changeset 583:4c6c61696ba0

plugin sec_otr: improvement when sending a message to a MUC
author souliane <souliane@mailoo.org>
date Wed, 22 Oct 2014 14:19:25 +0200
parents c6380dd30602
children 0a06cf833f5a
files src/browser/sat_browser/plugin_sec_otr.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/plugin_sec_otr.py	Wed Oct 22 14:17:17 2014 +0200
+++ b/src/browser/sat_browser/plugin_sec_otr.py	Wed Oct 22 14:19:25 2014 +0200
@@ -464,7 +464,7 @@
     def sendMessageTrigger(self, to_jid, msg, msg_type, extra):
         def cb(jid):
             otrctx = self.context_manager.getContextForUser(jid, start=False)
-            if otrctx is not None and msg_type != 'groupchat' and otrctx.state != otr.context.STATE_PLAINTEXT:
+            if otrctx is not None and otrctx.state != otr.context.STATE_PLAINTEXT:
                 if otrctx.state == otr.context.STATE_ENCRYPTED:
                     log.debug(u"encrypting message")
                     otrctx.sendMessage(msg)
@@ -476,10 +476,9 @@
                 log.debug(u"sending message unencrypted")
                 self.host.bridge.call('sendMessage', (None, self.host.sendError), to_jid.full(), msg, '', msg_type, extra)
 
-        if msg_type != 'groupchat':
-            self.fixResource(to_jid, cb)
-        else:
-            cb(to_jid)
+        if msg_type == 'groupchat':
+            return True
+        self.fixResource(to_jid, cb)
         return False  # interrupt the main process
 
     def presenceReceivedTrigger(self, entity, show, priority, statuses):