comparison sat/plugins/plugin_xep_0384.py @ 3231:e756e0eb1be4

core (memory/encryption): automatic start encryption if peer send encrypted message: If peer sends encrypted message and we have no encryption activated, we automatically start encryption to avoid sending plain text message when answering. markAsEncrypted now needs the encryption algorithm namespace as mandatory argument.
author Goffi <goffi@goffi.org>
date Mon, 23 Mar 2020 17:52:18 +0100
parents 806a7936a591
children 9477f3197981
comparison
equal deleted inserted replaced
3230:109d94c62b95 3231:e756e0eb1be4
1160 ) 1160 )
1161 1161
1162 message_elt.children.remove(encrypted_elt) 1162 message_elt.children.remove(encrypted_elt)
1163 if plaintext: 1163 if plaintext:
1164 message_elt.addElement("body", content=plaintext) 1164 message_elt.addElement("body", content=plaintext)
1165 post_treat.addCallback(client.encryption.markAsEncrypted) 1165 post_treat.addCallback(client.encryption.markAsEncrypted, namespace=NS_OMEMO)
1166 defer.returnValue(True) 1166 defer.returnValue(True)
1167 1167
1168 def getJIDsForRoom(self, client, room_jid): 1168 def getJIDsForRoom(self, client, room_jid):
1169 if self._m is None: 1169 if self._m is None:
1170 exceptions.InternalError("XEP-0045 plugin missing, can't encrypt for group chat") 1170 exceptions.InternalError("XEP-0045 plugin missing, can't encrypt for group chat")