aboutsummaryrefslogtreecommitdiffstats
path: root/core/sessionmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-10-26 13:19:09 +0000
committerMatthew Wild <mwild1@gmail.com>2008-10-26 13:19:09 +0000
commit4d5a2486b5e283a4d464fd19b74c2500903a009c (patch)
tree6a4bedaa461bcac7f7c4921d752fd49fb2efa1b8 /core/sessionmanager.lua
parent08940b23081e7328f25099816f54e8bcd9d280ae (diff)
parent1746f7eea0135b89a4f871d11c71cded04c4c0c3 (diff)
downloadprosody-4d5a2486b5e283a4d464fd19b74c2500903a009c.tar.gz
prosody-4d5a2486b5e283a4d464fd19b74c2500903a009c.zip
Merge presence/subscription support from waqas
Diffstat (limited to 'core/sessionmanager.lua')
-rw-r--r--core/sessionmanager.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/sessionmanager.lua b/core/sessionmanager.lua
index a7858d9e..82a001c1 100644
--- a/core/sessionmanager.lua
+++ b/core/sessionmanager.lua
@@ -115,4 +115,24 @@ function streamopened(session, attr)
session.notopen = nil;
end
+function send_to_available_resources(user, host, stanza)
+ local count = 0;
+ 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);
+ count = count + 1;
+ end
+ end
+ end
+ end
+ stanza.attr.to = to;
+ return count;
+end
+
return _M; \ No newline at end of file