Software /
code /
prosody
Comparison
plugins/mod_websocket.lua @ 7938:3629f03817f8
mod_websocket: Make open_stream method behave like the one from util.xmppstream
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Mar 2017 03:03:25 +0100 |
parent | 7937:5b03a8003659 |
child | 8052:f83a2d4826fb |
comparison
equal
deleted
inserted
replaced
7937:5b03a8003659 | 7938:3629f03817f8 |
---|---|
49 module:depends("c2s") | 49 module:depends("c2s") |
50 local sessions = module:shared("c2s/sessions"); | 50 local sessions = module:shared("c2s/sessions"); |
51 local c2s_listener = portmanager.get_service("c2s").listener; | 51 local c2s_listener = portmanager.get_service("c2s").listener; |
52 | 52 |
53 --- Session methods | 53 --- Session methods |
54 local function session_open_stream(session) | 54 local function session_open_stream(session, from, to) |
55 local attr = { | 55 local attr = { |
56 xmlns = xmlns_framing, | 56 xmlns = xmlns_framing, |
57 ["xml:lang"] = "en", | 57 ["xml:lang"] = "en", |
58 version = "1.0", | 58 version = "1.0", |
59 id = session.streamid or "", | 59 id = session.streamid or "", |
60 from = session.host | 60 from = from or session.host, to = to, |
61 }; | 61 }; |
62 if session.stream_attrs then | |
63 session:stream_attrs(from, to, attr) | |
64 end | |
62 session.send(st.stanza("open", attr)); | 65 session.send(st.stanza("open", attr)); |
63 end | 66 end |
64 | 67 |
65 local function session_close(session, reason) | 68 local function session_close(session, reason) |
66 local log = session.log or log; | 69 local log = session.log or log; |