changeset 3cb049fa7edb in /home/hg/repos/gajim-plugins
author: Michal Schmidt <mschmidt(a)redhat.com>
branches:
details:gajim-plugins?cmd=changeset;node=3cb049fa7edb
description: Assume nbxmpp availability in all plugins
Trying to import non-existent common.xmpp would trigger an exception were it
not for a a side-effect of demandimport that Gajim uses. It's not nice to rely
on it in gotr and juick.
juick does not use nbxmpp for anything. Let's just drop the import.
whiteboard does a Gajim version check that no other plugin does.
nbxmpp has been required since Gajim 0.16. In all plugins let's just assume
it's available. Some plugins already do that.
diffstat:
gotr/otrmodule.py | 14 +++-----------
juick/plugin.py | 7 -------
whiteboard/plugin.py | 6 +-----
whiteboard/whiteboard_widget.py | 8 +-------
4 files changed, 5 insertions(+), 30 deletions(-)
diffs (94 lines):
diff -r 3019b29339f6 -r 3cb049fa7edb gotr/otrmodule.py
--- a/gotr/otrmodule.py Sun Oct 25 21:08:42 2015 +0100
+++ b/gotr/otrmodule.py Mon Nov 02 20:02:24 2015 +0100
@@ -68,7 +68,6 @@
from pprint import pformat
from distutils.version import StrictVersion
-import common.xmpp
from common import gajim
from common import ged
from common.connection_handlers_events import MessageOutgoingEvent
@@ -93,11 +92,7 @@
except ImportError:
HAS_CRYPTO = False
-nb_xmpp = False
-import common.xmpp
-if not dir(common.xmpp):
- import nbxmpp
- nb_xmpp = True
+import nbxmpp
HAS_POTR = True
try:
@@ -133,10 +128,7 @@
msg = unicode(msg)
account = self.user.accountname
- if not nb_xmpp:
- stanza = common.xmpp.Message(to=self.peer, body=msg, typ='chat')
- else:
- stanza = nbxmpp.Message(to=self.peer, body=msg, typ='chat')
+ stanza = nbxmpp.Message(to=self.peer, body=msg, typ='chat')
if appdata is not None:
session = appdata.get('session', None)
if session is not None:
@@ -741,4 +733,4 @@
def add_message_processing_hints(stanza):
stanza.addChild(name='private', namespace=nbxmpp.NS_CARBONS)
stanza.addChild(name='no-permanent-store', namespace=nbxmpp.NS_MSG_HINTS)
- stanza.addChild(name='no-copy', namespace=nbxmpp.NS_MSG_HINTS)
\ No newline at end of file
+ stanza.addChild(name='no-copy', namespace=nbxmpp.NS_MSG_HINTS)
diff -r 3019b29339f6 -r 3cb049fa7edb juick/plugin.py
--- a/juick/plugin.py Sun Oct 25 21:08:42 2015 +0100
+++ b/juick/plugin.py Mon Nov 02 20:02:24 2015 +0100
@@ -21,13 +21,6 @@
from conversation_textview import TextViewImage
import gtkgui_helpers
-nb_xmpp = False
-import common.xmpp
-if not dir(common.xmpp):
- import nbxmpp
- nb_xmpp = True
-
-
class JuickPlugin(GajimPlugin):
@log_calls('JuickPlugin')
def init(self):
diff -r 3019b29339f6 -r 3cb049fa7edb whiteboard/plugin.py
--- a/whiteboard/plugin.py Sun Oct 25 21:08:42 2015 +0100
+++ b/whiteboard/plugin.py Mon Nov 02 20:02:24 2015 +0100
@@ -34,11 +34,7 @@
from plugins.plugin import GajimPluginException
from plugins.helpers import log_calls, log
from common import gajim
-ver = list(gajim.config.get('version').split('.'))
-if ver < [0, 15, 3, 0]:
- from common.xmpp import Message
-else:
- from nbxmpp import Message
+from nbxmpp import Message
import gtk
import chat_control
from common import ged
diff -r 3019b29339f6 -r 3cb049fa7edb whiteboard/whiteboard_widget.py
--- a/whiteboard/whiteboard_widget.py Sun Oct 25 21:08:42 2015 +0100
+++ b/whiteboard/whiteboard_widget.py Mon Nov 02 20:02:24 2015 +0100
@@ -25,13 +25,7 @@
HAS_GOOCANVAS = True
except:
HAS_GOOCANVAS = False
-from common import gajim
-ver = list(gajim.config.get('version').split('.'))
-if ver < [0, 15, 3, 0]:
- from common.xmpp import Node
-else:
- from nbxmpp import Node
-
+from nbxmpp import Node
from dialogs import FileChooserDialog
'''