Diff

core/sessionmanager.lua @ 2141:f544729f9228

sessionmanager: Added function send_to_interested_resources().
author Waqas Hussain <waqas20@gmail.com>
date Sun, 22 Nov 2009 21:41:09 +0500
parent 2140:94b7ba39787d
child 2144:8e59d37a0e68
child 2816:59dfb99831ae
line wrap: on
line diff
--- a/core/sessionmanager.lua	Sun Nov 22 21:40:01 2009 +0500
+++ b/core/sessionmanager.lua	Sun Nov 22 21:41:09 2009 +0500
@@ -215,4 +215,19 @@
 	return count;
 end
 
+function send_to_interested_resources(user, host, stanza)
+	local jid = user.."@"..host;
+	local count = 0;
+	local user = bare_sessions[jid];
+	if user then
+		for k, session in pairs(user.sessions) do
+			if session.interested then
+				session.send(stanza);
+				count = count + 1;
+			end
+		end
+	end
+	return count;
+end
+
 return _M;