comparison sat/plugins/plugin_xep_0374.py @ 3935:80d29f55ba8b

plugin XEP-0374: exluce `openpgp` element from XEP-0373 on send trigger: the `openpgp` element is excluded to avoid useless double encryption. rel 380
author Goffi <goffi@goffi.org>
date Sat, 15 Oct 2022 20:37:00 +0200
parents cecf45416403
children 748094d5a74d
comparison
equal deleted inserted replaced
3934:e345d93fb6e5 3935:80d29f55ba8b
380 380
381 # Move elements from the stanza to the content element. 381 # Move elements from the stanza to the content element.
382 # TODO: There should probably be explicitly forbidden elements here too, just as 382 # TODO: There should probably be explicitly forbidden elements here too, just as
383 # for XEP-0420 383 # for XEP-0420
384 for child in list(stanza.elements()): 384 for child in list(stanza.elements()):
385 if child.name == "openpgp" and child.uri == NS_OX:
386 log.debug("not re-encrypting encrypted OX element")
387 continue
385 # Remove the child from the stanza 388 # Remove the child from the stanza
386 stanza.children.remove(child) 389 stanza.children.remove(child)
387 390
388 # A namespace of ``None`` can be used on domish elements to inherit the 391 # A namespace of ``None`` can be used on domish elements to inherit the
389 # namespace from the parent. When moving elements from the stanza root to 392 # namespace from the parent. When moving elements from the stanza root to