aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-01-29 21:06:51 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-01-29 21:06:51 +0500
commit90a52d44b331710ce10e520e6d3aba7f49d0a137 (patch)
tree4860755c5d50190423ef58a1e42c0e0b048e9187
parentcfc96206804b117f4449c85fdb3fb324ac3c546a (diff)
downloadprosody-90a52d44b331710ce10e520e6d3aba7f49d0a137.tar.gz
prosody-90a52d44b331710ce10e520e6d3aba7f49d0a137.zip
mod_presence: Added handler for presence subscriptions and probes to local hosts.
-rw-r--r--plugins/mod_presence.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 31d2d7b4..ec983fc2 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -309,13 +309,6 @@ module:hook("presence/bare", function(data)
end
return true;
end);
-module:hook("presence/host", function (data)
- local stanza = data.stanza;
- local reply = st.reply(stanza);
- reply.attr.type = "unsubscribed";
- handle_inbound_presence_subscriptions_and_probes(data.origin, reply, jid_bare(stanza.attr.to), jid_bare(stanza.attr.from), core_route_stanza);
- return true;
-end);
module:hook("presence/full", function(data)
-- inbound presence to full JID recieved
local origin, stanza = data.origin, data.stanza;
@@ -333,6 +326,20 @@ module:hook("presence/full", function(data)
end -- resource not online, discard
return true;
end);
+module:hook("presence/host", function(data)
+ -- inbound presence to the host
+ local origin, stanza = data.origin, data.stanza;
+
+ local from_bare = jid_bare(stanza.attr.from);
+ local t = stanza.attr.type;
+ if t == "probe" then
+ core_route_stanza(hosts[module.host], st.presence({ from = module.host, to = from_bare, id = stanza.attr.id }));
+ elseif t == "subscribe" then
+ core_route_stanza(hosts[module.host], st.presence({ from = module.host, to = from_bare, id = stanza.attr.id, type = "subscribed" }));
+ core_route_stanza(hosts[module.host], st.presence({ from = module.host, to = from_bare, id = stanza.attr.id }));
+ end
+ return true;
+end);
module:hook("resource-unbind", function(event)
local session, err = event.session, event.error;