Mercurial > prosody-hg
comparison plugins/mod_iq.lua @ 1268:dc1f95b37024
mod_iq: Correctly handle the lack of 'to' on IQs
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Mon, 01 Jun 2009 11:16:48 +0500 |
| parents | 1bf897de6c24 |
| children | d2dc0954ebfd |
comparison
equal
deleted
inserted
replaced
| 1267:1bf897de6c24 | 1268:dc1f95b37024 |
|---|---|
| 24 | 24 |
| 25 module:hook("iq/bare", function(data) | 25 module:hook("iq/bare", function(data) |
| 26 -- IQ to bare JID recieved | 26 -- IQ to bare JID recieved |
| 27 local origin, stanza = data.origin, data.stanza; | 27 local origin, stanza = data.origin, data.stanza; |
| 28 | 28 |
| 29 if not bare_sessions[stanza.attr.to] then -- quick check for account existance | 29 local to = stanza.attr.to; |
| 30 local node, host = jid_split(stanza.attr.to); | 30 if to and not bare_sessions[to] then -- quick check for account existance |
| 31 local node, host = jid_split(to); | |
| 31 if not user_exists(node, host) then -- full check for account existance | 32 if not user_exists(node, host) then -- full check for account existance |
| 32 if stanza.attr.type == "get" or stanza.attr.type == "set" then | 33 if stanza.attr.type == "get" or stanza.attr.type == "set" then |
| 33 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); | 34 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); |
| 34 end | 35 end |
| 35 return true; | 36 return true; |
