diff options
author | Kim Alvefur <zash@zash.se> | 2014-04-10 13:13:07 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2014-04-10 13:13:07 +0200 |
commit | e06966ee436e4d461b03aaf8691fe76dcd6d588b (patch) | |
tree | ffb8caf4394478800b0d8014bd89fbccc6233a40 /util | |
parent | 5d027d7f71fb0410b9c1a4ad46d94aaebb87c645 (diff) | |
download | prosody-e06966ee436e4d461b03aaf8691fe76dcd6d588b.tar.gz prosody-e06966ee436e4d461b03aaf8691fe76dcd6d588b.zip |
mod_c2s, mod_s2s, mod_component, util.xmppstream: Move all session:open_stream() functions to util.xmppstream
Diffstat (limited to 'util')
-rw-r--r-- | util/xmppstream.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/util/xmppstream.lua b/util/xmppstream.lua index 586ad5f9..1e65919b 100644 --- a/util/xmppstream.lua +++ b/util/xmppstream.lua @@ -241,6 +241,22 @@ function new(session, stream_callbacks, stanza_size_limit) local parser = new_parser(handlers, ns_separator, false); local parse = parser.parse; + function session.open_stream(session, from, to) + local send = session.sends2s or session.send; + + local attr = { + ["xmlns:stream"] = "http://etherx.jabber.org/streams", + ["xml:lang"] = "en", + xmlns = stream_callbacks.default_ns, + version = session.version and (session.version > 0 and "1.0" or nil), + id = session.streamid or "", + from = from or session.host, to = to, + }; + send("<?xml version='1.0'?>"); + send(st.stanza("stream:stream", attr):top_tag()); + return true; + end + return { reset = function () parser = new_parser(handlers, ns_separator, false); |