aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-06-02 07:26:40 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-06-02 07:26:40 +0500
commit2b3431a779d6c4140492d1d3988645f8a0e9ade9 (patch)
tree7507a31d3c1c0365e9293efaf4e6ea191f155f2a /plugins/mod_presence.lua
parent7ff04a760ef33520658d505bd5d2e3cc6c8111ca (diff)
downloadprosody-2b3431a779d6c4140492d1d3988645f8a0e9ade9.tar.gz
prosody-2b3431a779d6c4140492d1d3988645f8a0e9ade9.zip
mod_presence: A little cleanup
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index f30a1b84..ea6a61fc 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -273,19 +273,20 @@ module.unload = function()
end
module:hook("pre-presence/full", function(data)
- -- presence to full JID recieved
+ -- outbound presence to full JID recieved
local origin, stanza = data.origin, data.stanza;
- if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then
+ local t = stanza.attr.type;
+ if t ~= nil and t ~= "unavailable" and t ~= "error" then -- check for subscriptions and probes sent to full JID
handle_outbound_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;
local to_bare = jid_bare(to);
if not(origin.roster[to_bare] and (origin.roster[to_bare].subscription == "both" or origin.roster[to_bare].subscription == "from")) then -- directed presence
origin.directed = origin.directed or {};
- if stanza.attr.type then -- removing from directed presence list on sending an error or unavailable
+ if t then -- removing from directed presence list on sending an error or unavailable
origin.directed[to] = nil; -- FIXME does it make more sense to add to_bare rather than to?
else
origin.directed[to] = true; -- FIXME does it make more sense to add to_bare rather than to?