199 session.send("</stream:stream>"); |
199 session.send("</stream:stream>"); |
200 session.notopen = true; |
200 session.notopen = true; |
201 end |
201 end |
202 |
202 |
203 function send_to_available_resources(user, host, stanza) |
203 function send_to_available_resources(user, host, stanza) |
|
204 local jid = user.."@"..host; |
204 local count = 0; |
205 local count = 0; |
205 local to = stanza.attr.to; |
206 local user = bare_sessions[jid]; |
206 stanza.attr.to = nil; |
207 if user then |
207 local h = hosts[host]; |
208 for k, session in pairs(user.sessions) do |
208 if h and h.type == "local" then |
209 if session.presence then |
209 local u = h.sessions[user]; |
210 session.send(stanza); |
210 if u then |
211 count = count + 1; |
211 for k, session in pairs(u.sessions) do |
212 end |
212 if session.presence then |
213 end |
213 session.send(stanza); |
214 end |
214 count = count + 1; |
|
215 end |
|
216 end |
|
217 end |
|
218 end |
|
219 stanza.attr.to = to; |
|
220 return count; |
215 return count; |
221 end |
216 end |
222 |
217 |
|
218 function send_to_interested_resources(user, host, stanza) |
|
219 local jid = user.."@"..host; |
|
220 local count = 0; |
|
221 local user = bare_sessions[jid]; |
|
222 if user then |
|
223 for k, session in pairs(user.sessions) do |
|
224 if session.interested then |
|
225 session.send(stanza); |
|
226 count = count + 1; |
|
227 end |
|
228 end |
|
229 end |
|
230 return count; |
|
231 end |
|
232 |
223 return _M; |
233 return _M; |