From 6b0847d6aa2471df2004b9f795f586abf28af139 Mon Sep 17 00:00:00 2001 From: Goffi Date: Fri, 1 Mar 2019 12:13:55 +0100 Subject: [PATCH] plugin OTR: ignore messages from sender without resource or from own jid --- sat/plugins/plugin_sec_otr.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sat/plugins/plugin_sec_otr.py b/sat/plugins/plugin_sec_otr.py index 5c99d25c..2db01c0b 100644 --- a/sat/plugins/plugin_sec_otr.py +++ b/sat/plugins/plugin_sec_otr.py @@ -733,6 +733,10 @@ class OTR(object): if message_elt.getAttribute("type") == C.MESS_TYPE_GROUPCHAT: # OTR is not possible in group chats return True + from_jid = jid.JID(message_elt['from']) + if not from_jid.resource or from_jid.userhostJID() == client.jid.userhostJID(): + # OTR is only usable when resources are present + return True if client.profile in self.skipped_profiles: post_treat.addCallback(self._receivedTreatmentForSkippedProfiles) else: