Software /
code /
prosody
Comparison
util/xmppstream.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 | 6054:7a5ddbaf758d |
child | 6084:3c02a9ed399e |
comparison
equal
deleted
inserted
replaced
6062:6cc6b4d407df | 6063:e626ee2fe106 |
---|---|
239 | 239 |
240 local handlers, meta = new_sax_handlers(session, stream_callbacks, handle_progress); | 240 local handlers, meta = new_sax_handlers(session, stream_callbacks, handle_progress); |
241 local parser = new_parser(handlers, ns_separator, false); | 241 local parser = new_parser(handlers, ns_separator, false); |
242 local parse = parser.parse; | 242 local parse = parser.parse; |
243 | 243 |
244 function session.open_stream(session, from, to) | |
245 local send = session.sends2s or session.send; | |
246 | |
247 local attr = { | |
248 ["xmlns:stream"] = "http://etherx.jabber.org/streams", | |
249 ["xml:lang"] = "en", | |
250 xmlns = stream_callbacks.default_ns, | |
251 version = session.version and (session.version > 0 and "1.0" or nil), | |
252 id = session.streamid or "", | |
253 from = from or session.host, to = to, | |
254 }; | |
255 send("<?xml version='1.0'?>"); | |
256 send(st.stanza("stream:stream", attr):top_tag()); | |
257 return true; | |
258 end | |
259 | |
244 return { | 260 return { |
245 reset = function () | 261 reset = function () |
246 parser = new_parser(handlers, ns_separator, false); | 262 parser = new_parser(handlers, ns_separator, false); |
247 parse = parser.parse; | 263 parse = parser.parse; |
248 n_outstanding_bytes = 0; | 264 n_outstanding_bytes = 0; |