[kupfer] plugin.gajim: fix lp bug #489484: Doesn't work with Gajim 0.13



commit 14b5a111c05c33b309b6723927a8185c90f68ea4
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Sat Nov 28 13:42:02 2009 +0100

    plugin.gajim: fix lp bug #489484: Doesn't work with Gajim 0.13
    
    In Gajim 0.13 open_chat method was changed: new parameter "message".
    
    Changes in plugin:
    - add _check_gajim_version to get version of Gajim (via dbus)
    - in OpenChat action add checking of Gajim version

 kupfer/plugin/gajim.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/gajim.py b/kupfer/plugin/gajim.py
index d60127d..16fa803 100644
--- a/kupfer/plugin/gajim.py
+++ b/kupfer/plugin/gajim.py
@@ -51,6 +51,17 @@ def _create_dbus_connection(activate=False):
 	return interface
 
 
+def _check_gajim_version(conn):
+	''' get gajim version. return list lika [0.12.5] '''
+	prefs = conn.prefs_list()
+	version = prefs['version']
+	tversion = map(int, version.split('.'))
+	if len(tversion) == 2:
+		tversion += [0]
+	return tversion
+
+
+
 class GajimContact(Leaf):
 	""" Leaf represent single contact from Gajim """
 
@@ -92,7 +103,11 @@ class OpenChat(Action):
 		interface = _create_dbus_connection()
 		account, jid = leaf.object
 		if interface is not None:
-			interface.open_chat(jid, account)
+			vmaj,vmin,vbuild = _check_gajim_version(interface)
+			if vmaj == 0 and vmin < 13:
+				interface.open_chat(jid, account)
+			else:
+				interface.open_chat(jid, account, '')
 
 	def get_icon_name(self):
 		return 'gajim'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]