Comparison

plugins/mod_c2s.lua @ 6063:e626ee2fe106

mod_c2s, mod_s2s, mod_component, util.xmppstream: Move all session:open_stream() functions to util.xmppstream
author Kim Alvefur <zash@zash.se>
date Thu, 10 Apr 2014 13:13:07 +0200
parent 6005:98b768a41c9d
child 6284:b49540983320
comparison
equal deleted inserted replaced
6062:6cc6b4d407df 6063:e626ee2fe106
172 conn:close(); 172 conn:close();
173 end 173 end
174 end 174 end
175 end 175 end
176 176
177 local function session_open_stream(session)
178 local attr = {
179 ["xmlns:stream"] = 'http://etherx.jabber.org/streams',
180 xmlns = stream_callbacks.default_ns,
181 version = "1.0",
182 ["xml:lang"] = 'en',
183 id = session.streamid or "",
184 from = session.host
185 };
186 session.send("<?xml version='1.0'?>");
187 session.send(st.stanza("stream:stream", attr):top_tag());
188 end
189
190 module:hook_global("user-deleted", function(event) 177 module:hook_global("user-deleted", function(event)
191 local username, host = event.username, event.host; 178 local username, host = event.username, event.host;
192 local user = hosts[host].sessions[username]; 179 local user = hosts[host].sessions[username];
193 if user and user.sessions then 180 if user and user.sessions then
194 for jid, session in pairs(user.sessions) do 181 for jid, session in pairs(user.sessions) do
232 219
233 if opt_keepalives then 220 if opt_keepalives then
234 conn:setoption("keepalive", opt_keepalives); 221 conn:setoption("keepalive", opt_keepalives);
235 end 222 end
236 223
237 session.open_stream = session_open_stream;
238 session.close = session_close; 224 session.close = session_close;
239 225
240 local stream = new_xmpp_stream(session, stream_callbacks); 226 local stream = new_xmpp_stream(session, stream_callbacks);
241 session.stream = stream; 227 session.stream = stream;
242 session.notopen = true; 228 session.notopen = true;