comparison sat/plugins/plugin_sec_otr.py @ 3172:dcebc585c29f

core: renamed "MessageReceived" trigger to "messageReceived" for consistency.
author Goffi <goffi@goffi.org>
date Tue, 18 Feb 2020 18:13:19 +0100
parents 330a5f1d9eea
children 2f406b762788
comparison
equal deleted inserted replaced
3171:d073d82d9044 3172:dcebc585c29f
311 self.skipped_profiles = ( 311 self.skipped_profiles = (
312 set() 312 set()
313 ) #  FIXME: OTR should not be skipped per profile, this need to be refactored 313 ) #  FIXME: OTR should not be skipped per profile, this need to be refactored
314 self._p_hints = host.plugins["XEP-0334"] 314 self._p_hints = host.plugins["XEP-0334"]
315 self._p_carbons = host.plugins["XEP-0280"] 315 self._p_carbons = host.plugins["XEP-0280"]
316 host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100000) 316 host.trigger.add("messageReceived", self.messageReceivedTrigger, priority=100000)
317 host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100000) 317 host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100000)
318 host.trigger.add("sendMessageData", self._sendMessageDataTrigger) 318 host.trigger.add("sendMessageData", self._sendMessageDataTrigger)
319 host.bridge.addMethod( 319 host.bridge.addMethod(
320 "skipOTR", ".plugin", in_sign="s", out_sign="", method=self._skipOTR 320 "skipOTR", ".plugin", in_sign="s", out_sign="", method=self._skipOTR
321 ) # FIXME: must be removed, must be done on per-message basis 321 ) # FIXME: must be removed, must be done on per-message basis
728 # if they are used at the same time as Libervia. 728 # if they are used at the same time as Libervia.
729 # Hard to avoid with decryption on Libervia though. 729 # Hard to avoid with decryption on Libervia though.
730 data["history"] = C.HISTORY_SKIP 730 data["history"] = C.HISTORY_SKIP
731 return data 731 return data
732 732
733 def MessageReceivedTrigger(self, client, message_elt, post_treat): 733 def messageReceivedTrigger(self, client, message_elt, post_treat):
734 if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: 734 if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT:
735 # OTR is not possible in group chats 735 # OTR is not possible in group chats
736 return True 736 return True
737 from_jid = jid.JID(message_elt['from']) 737 from_jid = jid.JID(message_elt['from'])
738 if not from_jid.resource or from_jid.userhostJID() == client.jid.userhostJID(): 738 if not from_jid.resource or from_jid.userhostJID() == client.jid.userhostJID():