Software /
code /
prosody
Comparison
plugins/mod_disco.lua @ 8155:f0d847316723
mod_disco: Add an account/registered identity on subscribed accounts, fixes #826.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 27 May 2017 15:53:30 +0100 |
parent | 8002:57060d0cee4b |
child | 8156:745e0a783055 |
comparison
equal
deleted
inserted
replaced
8152:8e26672df704 | 8155:f0d847316723 |
---|---|
136 if node and node ~= "" then return; end -- TODO fire event? | 136 if node and node ~= "" then return; end -- TODO fire event? |
137 local username = jid_split(stanza.attr.to) or origin.username; | 137 local username = jid_split(stanza.attr.to) or origin.username; |
138 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then | 138 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then |
139 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'}); | 139 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'}); |
140 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account | 140 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account |
141 reply:tag('identity', {category='account', type='registered'}):up(); | |
141 module:fire_event("account-disco-info", { origin = origin, stanza = reply }); | 142 module:fire_event("account-disco-info", { origin = origin, stanza = reply }); |
142 origin.send(reply); | 143 origin.send(reply); |
143 return true; | 144 return true; |
144 end | 145 end |
145 end); | 146 end); |