diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index aabf80d9..76b82b2e 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -1183,8 +1183,8 @@ class SatMessageProtocol(xmppim.MessageProtocol): data["extra"]["delay_sender"] = data["delay_sender"] except KeyError: pass - if C.MESS_KEY_ENCRYPTION in data: - data["extra"]["encrypted"] = C.BOOL_TRUE + if self.client.encryption.isEncrypted(data): + data["extra"]["encrypted"] = True if data is not None: if self.parent.isMessagePrintable(data): self.host.bridge.messageNew( diff --git a/sat/memory/encryption.py b/sat/memory/encryption.py index 24b2ac0e..16852123 100644 --- a/sat/memory/encryption.py +++ b/sat/memory/encryption.py @@ -447,6 +447,7 @@ class EncryptionHandler: f"encryption flag must not be set for groupchat if encryption algorithm " f"({encryption['plugin'].name}) is directed!") mess_data[C.MESS_KEY_ENCRYPTION] = encryption + self.markAsEncrypted(mess_data) ## Misc ## @@ -457,7 +458,7 @@ class EncryptionHandler: the plugin @param mess_data(dict): message data as used in post treat workflow """ - mess_data[C.MESS_KEY_ENCRYPTED] = True + mess_data['extra'][C.MESS_KEY_ENCRYPTED] = True return mess_data def isEncryptionRequested(self, mess_data, namespace=None): @@ -478,12 +479,12 @@ class EncryptionHandler: return plugin.namespace == namespace def isEncrypted(self, mess_data): - """Helper method to check if an incoming message has the e2e encrypted flag + """Helper method to check if a message has the e2e encrypted flag @param mess_data(dict): message data @return (bool): True if the encrypted flag is present """ - return mess_data.get(C.MESS_KEY_ENCRYPTED, False) + return mess_data['extra'].get(C.MESS_KEY_ENCRYPTED, False) def markAsTrusted(self, mess_data):