Commit ed47951f authored by Yann Leboulanger's avatar Yann Leboulanger

look in correct ftp folder according to gajim version

parent 9b229cd6
[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 <fominde@gmail.com>
Yann Leboulanger <asterix@lagaule.org>
......
......@@ -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')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment