poezio/plugin_e2ee: Use encrypted_tags attribute to complete whitelist filtering on encryption

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-07-02 01:12:22 +02:00
parent a166fcb5a3
commit 12c5310e5b
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -251,8 +251,12 @@ class E2EEPlugin(BasePlugin):
# Filter stanza with the whitelist. Plugins doing stanza encryption
# will have to include these in their encrypted container beforehand.
whitelist = self.tag_whitelist
if self.encrypted_tags is not None:
whitelist += self.encrypted_tags
for elem in message.xml[:]:
if elem.tag not in self.tag_whitelist:
if elem.tag not in whitelist:
message.xml.remove(elem)
log.debug('Encrypted %s message: %r', self.encryption_name, message)