Mercurial > libervia-web
comparison src/browser/sat_browser/plugin_sec_otr.py @ 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 | b07f0fe2763a |
children | 0a06cf833f5a |
comparison
equal
deleted
inserted
replaced
582:c6380dd30602 | 583:4c6c61696ba0 |
---|---|
462 return False # interrupt the main process | 462 return False # interrupt the main process |
463 | 463 |
464 def sendMessageTrigger(self, to_jid, msg, msg_type, extra): | 464 def sendMessageTrigger(self, to_jid, msg, msg_type, extra): |
465 def cb(jid): | 465 def cb(jid): |
466 otrctx = self.context_manager.getContextForUser(jid, start=False) | 466 otrctx = self.context_manager.getContextForUser(jid, start=False) |
467 if otrctx is not None and msg_type != 'groupchat' and otrctx.state != otr.context.STATE_PLAINTEXT: | 467 if otrctx is not None and otrctx.state != otr.context.STATE_PLAINTEXT: |
468 if otrctx.state == otr.context.STATE_ENCRYPTED: | 468 if otrctx.state == otr.context.STATE_ENCRYPTED: |
469 log.debug(u"encrypting message") | 469 log.debug(u"encrypting message") |
470 otrctx.sendMessage(msg) | 470 otrctx.sendMessage(msg) |
471 self.host.newMessageCb(self.host.whoami, msg, msg_type, jid, extra) | 471 self.host.newMessageCb(self.host.whoami, msg, msg_type, jid, extra) |
472 else: | 472 else: |
474 dialog.InfoDialog(FINISHED_CONTEXT_TITLE.format(jid=to_jid.full()), feedback, AddStyleName="maxWidthLimit").show() | 474 dialog.InfoDialog(FINISHED_CONTEXT_TITLE.format(jid=to_jid.full()), feedback, AddStyleName="maxWidthLimit").show() |
475 else: | 475 else: |
476 log.debug(u"sending message unencrypted") | 476 log.debug(u"sending message unencrypted") |
477 self.host.bridge.call('sendMessage', (None, self.host.sendError), to_jid.full(), msg, '', msg_type, extra) | 477 self.host.bridge.call('sendMessage', (None, self.host.sendError), to_jid.full(), msg, '', msg_type, extra) |
478 | 478 |
479 if msg_type != 'groupchat': | 479 if msg_type == 'groupchat': |
480 self.fixResource(to_jid, cb) | 480 return True |
481 else: | 481 self.fixResource(to_jid, cb) |
482 cb(to_jid) | |
483 return False # interrupt the main process | 482 return False # interrupt the main process |
484 | 483 |
485 def presenceReceivedTrigger(self, entity, show, priority, statuses): | 484 def presenceReceivedTrigger(self, entity, show, priority, statuses): |
486 if show == "unavailable": | 485 if show == "unavailable": |
487 self.endSession(entity, finish=True) | 486 self.endSession(entity, finish=True) |