# HG changeset patch # User Waqas Hussain # Date 1243955242 -18000 # Node ID 0a6e2d6ae4594481cb2e821269285957dc1a2c5d # Parent c0fb8379696eb9c81b2d12b8904f8bb2ab594410 mod_presence: Check for nil 'to' attribute in all cases for incoming stanzas diff -r c0fb8379696e -r 0a6e2d6ae459 plugins/mod_presence.lua --- 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;