core (memory/encryption): new "isEncrypted" method to check if encrypted flag is set in message data

This commit is contained in:
Goffi 2020-02-18 18:13:18 +01:00
commit 8fa4cd0f86

View file

@ -430,17 +430,26 @@ class EncryptionHandler(object):
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 @@ class EncryptionHandler(object):
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
"""