Mercurial > prosody-hg
comparison plugins/mod_disco.lua @ 3572:fb7fc154a56a
mod_disco: Renamed the 'session' property of the account-disco-info and account-disco-items events to 'origin' for consistency.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 07 Nov 2010 20:53:08 +0500 |
| parents | a416d714a905 |
| children | c888328ae6b3 |
comparison
equal
deleted
inserted
replaced
| 3571:675d65036f31 | 3572:fb7fc154a56a |
|---|---|
| 124 if node and node ~= "" then return; end -- TODO fire event? | 124 if node and node ~= "" then return; end -- TODO fire event? |
| 125 local username = jid_split(stanza.attr.to) or origin.username; | 125 local username = jid_split(stanza.attr.to) or origin.username; |
| 126 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then | 126 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then |
| 127 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'}); | 127 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'}); |
| 128 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account | 128 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account |
| 129 module:fire_event("account-disco-info", { session = origin, stanza = reply }); | 129 module:fire_event("account-disco-info", { origin = origin, stanza = reply }); |
| 130 origin.send(reply); | 130 origin.send(reply); |
| 131 return true; | 131 return true; |
| 132 end | 132 end |
| 133 end); | 133 end); |
| 134 module:hook("iq/bare/http://jabber.org/protocol/disco#items:query", function(event) | 134 module:hook("iq/bare/http://jabber.org/protocol/disco#items:query", function(event) |
| 138 if node and node ~= "" then return; end -- TODO fire event? | 138 if node and node ~= "" then return; end -- TODO fire event? |
| 139 local username = jid_split(stanza.attr.to) or origin.username; | 139 local username = jid_split(stanza.attr.to) or origin.username; |
| 140 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then | 140 if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then |
| 141 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#items'}); | 141 local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#items'}); |
| 142 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account | 142 if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account |
| 143 module:fire_event("account-disco-items", { session = origin, stanza = reply }); | 143 module:fire_event("account-disco-items", { origin = origin, stanza = reply }); |
| 144 origin.send(reply); | 144 origin.send(reply); |
| 145 return true; | 145 return true; |
| 146 end | 146 end |
| 147 end); | 147 end); |
