Changeset

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 (2017-03-02)
parents 7937:5b03a8003659
children 7940:e520dc0c3af4
files plugins/mod_websocket.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_websocket.lua	Thu Mar 02 03:03:04 2017 +0100
+++ b/plugins/mod_websocket.lua	Thu Mar 02 03:03:25 2017 +0100
@@ -51,14 +51,17 @@
 local c2s_listener = portmanager.get_service("c2s").listener;
 
 --- Session methods
-local function session_open_stream(session)
+local function session_open_stream(session, from, to)
 	local attr = {
 		xmlns = xmlns_framing,
 		["xml:lang"] = "en",
 		version = "1.0",
 		id = session.streamid or "",
-		from = session.host
+		from = from or session.host, to = to,
 	};
+	if session.stream_attrs then
+		session:stream_attrs(from, to, attr)
+	end
 	session.send(st.stanza("open", attr));
 end