changeset 4011:74d4c9ff893d

plugin XEP-0277: when publisher is not found, check ancestor in both client and component namespaces
author Goffi <goffi@goffi.org>
date Thu, 16 Mar 2023 16:43:47 +0100
parents 818db4ca3717
children d538b07cddf3
files sat/core/constants.py sat/plugins/plugin_xep_0277.py
diffstat 2 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/constants.py	Thu Mar 16 16:43:08 2023 +0100
+++ b/sat/core/constants.py	Thu Mar 16 16:43:47 2023 +0100
@@ -158,6 +158,8 @@
     ## Common namespaces ##
     NS_XML = "http://www.w3.org/XML/1998/namespace"
     NS_CLIENT = "jabber:client"
+    NS_COMPONENT = "jabber:component:accept"
+    NS_STREAM = (NS_CLIENT, NS_COMPONENT)
     NS_FORWARD = "urn:xmpp:forward:0"
     NS_DELAY = "urn:xmpp:delay"
     NS_XHTML = "http://www.w3.org/1999/xhtml"
--- a/sat/plugins/plugin_xep_0277.py	Thu Mar 16 16:43:08 2023 +0100
+++ b/sat/plugins/plugin_xep_0277.py	Thu Mar 16 16:43:47 2023 +0100
@@ -575,7 +575,7 @@
                 microblog_data["author_jid"] = publisher
                 microblog_data["author_jid_verified"] = True
             else:
-                iq_elt = xml_tools.findAncestor(item_elt, "iq", C.NS_CLIENT)
+                iq_elt = xml_tools.findAncestor(item_elt, "iq", C.NS_STREAM)
                 microblog_data["author_jid"] = iq_elt["from"]
                 microblog_data["author_jid_verified"] = False