Comparison

core/sessionmanager.lua @ 176:e5cd2a03891d

Outbound presence subscription
author Waqas Hussain <waqas20@gmail.com>
date Sat, 25 Oct 2008 21:16:08 +0500
parent 175:5f71d290bb44
child 304:7b28fa8bbfe5
comparison
equal deleted inserted replaced
175:5f71d290bb44 176:e5cd2a03891d
114 log("info", "Stream opened successfully"); 114 log("info", "Stream opened successfully");
115 session.notopen = nil; 115 session.notopen = nil;
116 end 116 end
117 117
118 function send_to_available_resources(user, host, stanza) 118 function send_to_available_resources(user, host, stanza)
119 local count = 0;
119 local to = stanza.attr.to; 120 local to = stanza.attr.to;
120 stanza.attr.to = nil; 121 stanza.attr.to = nil;
121 local h = hosts[host]; 122 local h = hosts[host];
122 if h and h.type == "local" then 123 if h and h.type == "local" then
123 local u = h.sessions[user]; 124 local u = h.sessions[user];
124 if u then 125 if u then
125 for k, session in pairs(u.sessions) do 126 for k, session in pairs(u.sessions) do
126 if session.presence then 127 if session.presence then
127 session.send(stanza); 128 session.send(stanza);
129 count = count + 1;
128 end 130 end
129 end 131 end
130 end 132 end
131 end 133 end
132 stanza.attr.to = to; 134 stanza.attr.to = to;
135 return count;
133 end 136 end
134 137
135 return _M; 138 return _M;