# HG changeset patch # User Goffi # Date 1582045998 -3600 # Node ID d073d82d9044590e45533c306fbf8a7eb96fc396 # Parent 39d7327583e1460c37706e1ee6a0c133b1791c3f core (memory/encryption): new "isEncrypted" method to check if encrypted flag is set in message data diff -r 39d7327583e1 -r d073d82d9044 sat/memory/encryption.py --- a/sat/memory/encryption.py Tue Feb 18 18:13:17 2020 +0100 +++ b/sat/memory/encryption.py Tue Feb 18 18:13:18 2020 +0100 @@ -430,17 +430,26 @@ def markAsEncrypted(self, mess_data): """Helper method to mark a message as having been e2e encrypted. - This should be used in the post_treat workflow of MessageReceived trigger of + This should be used in the post_treat workflow of messageReceived trigger of the plugin @param mess_data(dict): message data as used in post treat workflow """ mess_data[C.MESS_KEY_ENCRYPTED] = True return mess_data + def isEncrypted(self, mess_data): + """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) + + def markAsTrusted(self, mess_data): """Helper methor to mark a message as sent from a trusted entity. - This should be used in the post_treat workflow of MessageReceived trigger of + This should be used in the post_treat workflow of messageReceived trigger of the plugin @param mess_data(dict): message data as used in post treat workflow """ @@ -450,7 +459,7 @@ def markAsUntrusted(self, mess_data): """Helper methor to mark a message as sent from an untrusted entity. - This should be used in the post_treat workflow of MessageReceived trigger of + This should be used in the post_treat workflow of messageReceived trigger of the plugin @param mess_data(dict): message data as used in post treat workflow """