Software /
code /
prosody
Changeset
1285:0a6e2d6ae459
mod_presence: Check for nil 'to' attribute in all cases for incoming stanzas
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Tue, 02 Jun 2009 20:07:22 +0500 |
parents | 1284:c0fb8379696e |
children | 1286:a9b1675ad16e |
files | plugins/mod_presence.lua |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_presence.lua Tue Jun 02 16:22:37 2009 +0500 +++ b/plugins/mod_presence.lua Tue Jun 02 20:07:22 2009 +0500 @@ -302,14 +302,14 @@ -- inbound presence to bare JID recieved local origin, stanza = data.origin, data.stanza; - local t = stanza.attr.type; - if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes sent to bare JID - handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza); - return true; - end - local to = stanza.attr.to; if to then + local t = stanza.attr.type; + if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes sent to bare JID + handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza); + return true; + end + local user = bare_sessions[to]; if user then for _, session in pairs(user.sessions) do @@ -318,7 +318,7 @@ end end end -- no resources not online, discard - else + elseif not t or t == "unavailable" then handle_normal_presence(origin, stanza, core_route_stanza); end return true;