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