From ed47951f20092b1c38999ef4b50761ee4d5ca4fc Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 28 Aug 2013 13:16:43 +0200 Subject: [PATCH] look in correct ftp folder according to gajim version --- plugin_installer/manifest.ini | 2 +- plugin_installer/plugin_installer.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugin_installer/manifest.ini b/plugin_installer/manifest.ini index f7aa750..c50a27d 100644 --- a/plugin_installer/manifest.ini +++ b/plugin_installer/manifest.ini @@ -1,7 +1,7 @@ [info] name: Plugin Installer short_name: plugin_installer -version: 0.12 +version: 0.12.1 description: Install and upgrade plugins from ftp authors: Denis Fomin Yann Leboulanger diff --git a/plugin_installer/plugin_installer.py b/plugin_installer/plugin_installer.py index 9cef3e6..de703cc 100644 --- a/plugin_installer/plugin_installer.py +++ b/plugin_installer/plugin_installer.py @@ -78,6 +78,12 @@ class PluginInstaller(GajimPlugin): icon = Gtk.Image() self.def_icon = icon.render_icon(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU) + if gajim.version.startswith('0.15'): + self.server_folder = 'plugins_0.15' + elif gajim.version.startswith('0.16.10'): + self.server_folder = 'plugins_gtk3' + else: + self.server_folder = 'plugins_0.16' @log_calls('PluginInstallerPlugin') def activate(self): @@ -118,7 +124,7 @@ class PluginInstaller(GajimPlugin): try: to_update = [] con = self.ftp_connect() - con.cwd('plugins_gtk3') + con.cwd(self.server_folder) con.retrbinary('RETR manifests.zip', ftp.handleDownload) zip_file = zipfile.ZipFile(ftp.buffer_) manifest_list = zip_file.namelist() @@ -501,7 +507,7 @@ class Ftp(threading.Thread): GLib.idle_add(self.progressbar.set_text, _('Connecting to server')) self.ftp = self.plugin.ftp_connect() - self.ftp.cwd('plugins_gtk3') + self.ftp.cwd(self.plugin.server_folder) self.progressbar.set_show_text(True) if not self.remote_dirs: GLib.idle_add(self.progressbar.set_text, @@ -601,7 +607,7 @@ class Ftp(threading.Thread): else: files.append(i[1:]) dirs, files = [], [] - nlstr('/plugins_gtk3/' + remote_dir) + nlstr('/%s/%s' % (self.plugin.server_folder, remote_dir) base_dir, user_dir = gajim.PLUGINS_DIRS if not os.path.isdir(user_dir): @@ -625,7 +631,7 @@ class Ftp(threading.Thread): GLib.idle_add(self.progressbar.set_text, _('Downloading "%s"') % filename) full_filename = os.path.join(local_dir, filename.replace( - 'plugins_gtk3', 'plugins')) + self.plugin.server_folder, 'plugins')) try: file_ = open(full_filename, 'wb')