diff options
author | Kim Alvefur <zash@zash.se> | 2023-12-17 18:55:14 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-12-17 18:55:14 +0100 |
commit | 4ca636bb7ea175908c46b97de1002028fb7a79f7 (patch) | |
tree | 9818e74ab13a42bf5a8a4bc4d3d0745d110397cc | |
parent | 674b91b82b0ea6e3462aa5b26a424925a08fade8 (diff) | |
download | prosody-4ca636bb7ea175908c46b97de1002028fb7a79f7.tar.gz prosody-4ca636bb7ea175908c46b97de1002028fb7a79f7.zip |
mod_disco: Advertise disco#info and #items on bare JIDs to fix #1664
Having to add these in *there* places seems less than ideal.
I would also think that advertising disco#info is a bit redundant, since
it is a requirement for everything in XMPP and if it was missing you
would get an error back.
-rw-r--r-- | plugins/mod_disco.lua | 4 | ||||
-rw-r--r-- | spec/scansion/disco_self.scs | 26 |
2 files changed, 30 insertions, 0 deletions
diff --git a/plugins/mod_disco.lua b/plugins/mod_disco.lua index 79249c52..9d2991bf 100644 --- a/plugins/mod_disco.lua +++ b/plugins/mod_disco.lua @@ -172,6 +172,8 @@ module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function( if not stanza.attr.to or (expose_admins and is_admin) or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then if node and node ~= "" then local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; local ret = module:fire_event("account-disco-info-node", node_event); @@ -192,6 +194,8 @@ module:hook("iq-get/bare/http://jabber.org/protocol/disco#info:query", function( else reply:tag('identity', {category='account', type='registered'}):up(); end + reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); + reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); module:fire_event("account-disco-info", { origin = origin, reply = reply }); origin.send(reply); return true; diff --git a/spec/scansion/disco_self.scs b/spec/scansion/disco_self.scs new file mode 100644 index 00000000..6782e884 --- /dev/null +++ b/spec/scansion/disco_self.scs @@ -0,0 +1,26 @@ +# Basic login and initial presence + +[Client] Romeo + jid: discoverer@localhost + password: password + +--------- + +Romeo connects + +Romeo sends: + <iq type="get" id="info1"> + <query xmlns="http://jabber.org/protocol/disco#info"/> + </iq> + +Romeo receives: + <iq type="result" id="info1"> + <query xmlns="http://jabber.org/protocol/disco#info" scansion:strict="false"> + <identity xmlns="http://jabber.org/protocol/disco#info" category="account" type="registered"/> + <feature var="http://jabber.org/protocol/disco#info"/> + <feature var="http://jabber.org/protocol/disco#items"/> + </query> + </iq> + +Romeo disconnects + |