Changeset

2141:f544729f9228

sessionmanager: Added function send_to_interested_resources().
author Waqas Hussain <waqas20@gmail.com>
date Sun, 22 Nov 2009 21:41:09 +0500
parents 2140:94b7ba39787d
children 2142:4b339020607f
files core/sessionmanager.lua
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
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;