diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-02 16:21:20 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-02 16:21:20 +0500 |
commit | 71e6ba9a5ca7ba5f2305637698ae5d80fdc00089 (patch) | |
tree | 1c871454acdb8a40f1016f301d36352b4338c003 /plugins | |
parent | 78eea929eb0ad7b889a619c3ee4911ae37747a7b (diff) | |
download | prosody-71e6ba9a5ca7ba5f2305637698ae5d80fdc00089.tar.gz prosody-71e6ba9a5ca7ba5f2305637698ae5d80fdc00089.zip |
mod_presence: Handle non-subscription presence and routing
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_presence.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index 075c8f85..15d1b9c1 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -307,6 +307,20 @@ module:hook("presence/bare", function(data) 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 user = bare_sessions[to];
+ if user then
+ for _, session in pairs(user.sessions) do
+ if session.presence then -- only send to available resources
+ session.send(stanza);
+ end
+ end
+ end -- no resources not online, discard
+ else
+ handle_normal_presence(origin, stanza, core_route_stanza);
+ end
end);
module:hook("presence/full", function(data)
-- inbound presence to full JID recieved
@@ -317,4 +331,10 @@ module:hook("presence/full", function(data) 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 session = full_sessions[stanza.attr.to];
+ if session then
+ -- TODO fire post processing event
+ session.send(stanza);
+ end -- resource not online, discard
end);
|