aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-06-02 20:07:22 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-06-02 20:07:22 +0500
commit6f05311d94df5373de96264015bcf16cc32a55e7 (patch)
tree36de64a1a000ef2242881f5538b5e4692525f683 /plugins
parent39a5e9a883252d47c603355d6edd7a8a380f2cb6 (diff)
downloadprosody-6f05311d94df5373de96264015bcf16cc32a55e7.tar.gz
prosody-6f05311d94df5373de96264015bcf16cc32a55e7.zip
mod_presence: Check for nil 'to' attribute in all cases for incoming stanzas
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_presence.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index fa070b7f..1587790d 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -302,14 +302,14 @@ module:hook("presence/bare", function(data)
-- 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 @@ module:hook("presence/bare", function(data)
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;