core/sessionmanager.lua

changeset 175
5f71d290bb44
parent 156
884c43c7028a
child 176
e5cd2a03891d
--- a/core/sessionmanager.lua	Sat Oct 25 03:13:10 2008 +0500
+++ b/core/sessionmanager.lua	Sat Oct 25 06:49:48 2008 +0500
@@ -115,4 +115,21 @@
 						session.notopen = nil;
 end
 
+function send_to_available_resources(user, host, stanza)
+	local to = stanza.attr.to;
+	stanza.attr.to = nil;
+	local h = hosts[host];
+	if h and h.type == "local" then
+		local u = h.sessions[user];
+		if u then
+			for k, session in pairs(u.sessions) do
+				if session.presence then
+					session.send(stanza);
+				end
+			end
+		end
+	end
+	stanza.attr.to = to;
+end
+
 return _M;
\ No newline at end of file

mercurial