Mercurial > libervia-backend
changeset 2821:3d735e0ab2fa
plugin OTR: ignore messages from sender without resource or from own jid
| author | Goffi <goffi@goffi.org> |
|---|---|
| date | Fri, 01 Mar 2019 12:13:55 +0100 |
| parents | 7ab8684784c6 |
| children | 5284be4c601b |
| files | sat/plugins/plugin_sec_otr.py |
| diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_sec_otr.py Fri Mar 01 12:12:50 2019 +0100 +++ b/sat/plugins/plugin_sec_otr.py Fri Mar 01 12:13:55 2019 +0100 @@ -733,6 +733,10 @@ 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:
