xep_0380: Add add_eme method

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-02-23 12:54:56 +00:00
parent e9f2f503b8
commit 88260cc240
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -55,6 +55,11 @@ class XEP_0380(BasePlugin):
def has_eme(self, msg):
return msg.xml.find('{%s}encryption' % Encryption.namespace) is not None
def add_eme(self, msg: Message, namespace: str) -> Message:
msg['eme']['name'] = self.mechanisms[namespace]
msg['eme']['namespace'] = namespace
return msg
def replace_body_with_eme(self, msg):
eme = msg['eme']
namespace = eme['namespace']