Mercurial > prosody-hg
comparison plugins/mod_disco.lua @ 13408:d7857ef7843a 0.12
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.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 17 Dec 2023 18:55:14 +0100 |
| parents | 50fcd3879482 |
| children | 95d8875c90dc |
comparison
equal
deleted
inserted
replaced
| 13378:db30ffbf2090 | 13408:d7857ef7843a |
|---|---|
| 170 local username = jid_split(stanza.attr.to) or origin.username; | 170 local username = jid_split(stanza.attr.to) or origin.username; |
| 171 local is_admin = um_is_admin(stanza.attr.to or origin.full_jid, module.host) | 171 local is_admin = um_is_admin(stanza.attr.to or origin.full_jid, module.host) |
| 172 if not stanza.attr.to or (expose_admins and is_admin) or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then | 172 if not stanza.attr.to or (expose_admins and is_admin) or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then |
| 173 if node and node ~= "" then | 173 if node and node ~= "" then |
| 174 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); | 174 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info', node=node}); |
| 175 reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); | |
| 176 reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); | |
| 175 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account | 177 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account |
| 176 local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; | 178 local node_event = { origin = origin, stanza = stanza, reply = reply, node = node, exists = false}; |
| 177 local ret = module:fire_event("account-disco-info-node", node_event); | 179 local ret = module:fire_event("account-disco-info-node", node_event); |
| 178 if ret ~= nil then return ret; end | 180 if ret ~= nil then return ret; end |
| 179 if node_event.exists then | 181 if node_event.exists then |
| 190 elseif prosody.hosts[module.host].users.name == "anonymous" then | 192 elseif prosody.hosts[module.host].users.name == "anonymous" then |
| 191 reply:tag('identity', {category='account', type='anonymous'}):up(); | 193 reply:tag('identity', {category='account', type='anonymous'}):up(); |
| 192 else | 194 else |
| 193 reply:tag('identity', {category='account', type='registered'}):up(); | 195 reply:tag('identity', {category='account', type='registered'}):up(); |
| 194 end | 196 end |
| 197 reply:tag("feature", { var = "http://jabber.org/protocol/disco#info" }):up(); | |
| 198 reply:tag("feature", { var = "http://jabber.org/protocol/disco#items" }):up(); | |
| 195 module:fire_event("account-disco-info", { origin = origin, reply = reply }); | 199 module:fire_event("account-disco-info", { origin = origin, reply = reply }); |
| 196 origin.send(reply); | 200 origin.send(reply); |
| 197 return true; | 201 return true; |
| 198 end | 202 end |
| 199 end); | 203 end); |
