Fix for broadcasting presence of available resources to newly approved contact

Mon, 17 Nov 2008 10:24:47 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Mon, 17 Nov 2008 10:24:47 +0500
changeset 322
d370fea67264
parent 321
31fe15ce6fac
child 323
7c9d2cabd245

Fix for broadcasting presence of available resources to newly approved contact

core/presencemanager.lua file | annotate | diff | comparison | revisions
--- a/core/presencemanager.lua	Mon Nov 17 10:15:04 2008 +0500
+++ b/core/presencemanager.lua	Mon Nov 17 10:24:47 2008 +0500
@@ -13,7 +13,7 @@
 
 module "presencemanager"
 
-function send_presence_of_available_resources(user, host, jid, recipient_session)
+function send_presence_of_available_resources(user, host, jid, recipient_session, core_route_stanza)
 	local h = hosts[host];
 	local count = 0;
 	if h and h.type == "local" then
@@ -24,7 +24,7 @@
 				if pres then
 					pres.attr.to = jid;
 					pres.attr.from = session.full_jid;
-					recipient_session.send(pres);
+					core_route_stanza(recipient_session, pres);
 					pres.attr.to = nil;
 					pres.attr.from = nil;
 					count = count + 1;
@@ -61,7 +61,7 @@
 		if rostermanager.subscribed(node, host, to_bare) then
 			rostermanager.roster_push(node, host, to_bare);
 			core_route_stanza(origin, stanza);
-			send_presence_of_available_resources(node, host, to_bare, origin);
+			send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza);
 		end
 	elseif stanza.attr.type == "unsubscribed" then
 		-- 1. route stanza
@@ -81,7 +81,7 @@
 	log("debug", "inbound presence "..stanza.attr.type.." from "..from_bare.." for "..to_bare);
 	if stanza.attr.type == "probe" then
 		if rostermanager.is_contact_subscribed(node, host, from_bare) then
-			if 0 == send_presence_of_available_resources(node, host, from_bare, origin) then
+			if 0 == send_presence_of_available_resources(node, host, from_bare, origin, core_route_stanza) then
 				-- TODO send last recieved unavailable presence (or we MAY do nothing, which is fine too)
 			end
 		else

mercurial