Changeset

1044:41a0c76127f4

mod_presence: Fix for local presence subscriptions and probes
author Waqas Hussain <waqas20@gmail.com>
date Thu, 23 Apr 2009 02:48:22 +0500
parents 1043:ad87f555b484
children 1050:9552c08241af
files plugins/mod_presence.lua
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_presence.lua	Wed Apr 22 21:33:44 2009 +0100
+++ b/plugins/mod_presence.lua	Thu Apr 23 02:48:22 2009 +0500
@@ -25,6 +25,20 @@
 local sessionmanager = require "core.sessionmanager";
 local offlinemanager = require "core.offlinemanager";
 
+local _core_route_stanza = core_route_stanza;
+local core_route_stanza;
+function core_route_stanza(origin, stanza)
+	if stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" and stanza.attr.type ~= "error" then
+		local node, host = jid_split(stanza.attr.to);
+		host = hosts[host];
+		if host and host.type == "local" then
+			handle_inbound_presence_subscriptions_and_probes(origin, stanza, jid_bare(stanza.attr.from), jid_bare(stanza.attr.to), core_route_stanza);
+			return;
+		end
+	end
+	_core_route_stanza(origin, stanza);
+end
+
 function handle_presence(origin, stanza, from_bare, to_bare, core_route_stanza, inbound)
 	local type = stanza.attr.type;
 	if type and type ~= "unavailable" and type ~= "error" then