sessionmanager: Added function send_to_interested_resources().

Sun, 22 Nov 2009 21:41:09 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sun, 22 Nov 2009 21:41:09 +0500
changeset 2141
f544729f9228
parent 2140
94b7ba39787d
child 2142
4b339020607f

sessionmanager: Added function send_to_interested_resources().

core/sessionmanager.lua file | annotate | diff | comparison | revisions
--- 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;

mercurial