plugin XEP-0473: Don't try do load secrets if there is not encrypted elements:
The plugin was trying to decrypt all pubsub events, without checking if there is "encrypted" element first, resulting in warning for all clear events. This patch fixes it by detecting <encrypted> element and exiting early if none is found.
This commit is contained in:
parent
351b7e2140
commit
1c6ca838b5
1 changed files with 8 additions and 0 deletions
|
|
@ -757,6 +757,14 @@ class XEP_0473:
|
|||
f"Invalid event's items element, missing node: {items_elt.toXml()}"
|
||||
)
|
||||
return
|
||||
|
||||
has_encrypted = any(
|
||||
next(item_elt.elements(NS_OXPS, "encrypted"), None)
|
||||
for item_elt in items_elt.elements(pubsub.NS_PUBSUB_EVENT, "item")
|
||||
)
|
||||
if not has_encrypted:
|
||||
return
|
||||
|
||||
node_uri = uri.build_xmpp_uri("pubsub", path=pubsub_service.full(), node=node)
|
||||
shared_secrets = await self.load_secrets(client, node_uri)
|
||||
if shared_secrets is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue