diff src/plugins/plugin_sec_otr.py @ 1135:3158f9e08760

plugin OTR: a warning is logged when Account is instancied with a bare jid.
author Goffi <goffi@goffi.org>
date Mon, 25 Aug 2014 21:32:23 +0200
parents 8def4a3f55c2
children ea2bbdf5b541
line wrap: on
line diff
--- a/src/plugins/plugin_sec_otr.py	Mon Aug 25 21:32:23 2014 +0200
+++ b/src/plugins/plugin_sec_otr.py	Mon Aug 25 21:32:23 2014 +0200
@@ -80,7 +80,7 @@
     def setState(self, state):
         old_state = self.state
         super(Context, self).setState(state)
-        log.debug(u"setState: %s (old_state=%s) " % (state, old_state))
+        log.debug(u"setState: %s (old_state=%s)" % (state, old_state))
 
         if state == potr.context.STATE_PLAINTEXT:
             feedback = _(u"/!\\ conversation with %(other_jid)s is now UNENCRYPTED") % {'other_jid': self.peer.full()}
@@ -116,7 +116,9 @@
 
     def __init__(self, host, client):
         log.debug(u"new account: %s" % client.jid)
-        super(Account, self).__init__(client.jid, "xmpp", 1024)
+        if not client.jid.resource:
+            log.warning("Account created without resource")
+        super(Account, self).__init__(unicode(client.jid), "xmpp", 1024)
         self.host = host
         self.client = client
 
@@ -147,6 +149,8 @@
 
     def getContextForUser(self, other):
         log.debug(u"getContextForUser [%s]" % other)
+        if not other.resource:
+            log.warning("getContextForUser called with a bare jid")
         return self.startContext(other)