Changeset

10809:86ea811ee25b

mod_s2s: Improve signaling of stream open events Makes it clearer, cleaner and easier to extend.
author Kim Alvefur <zash@zash.se>
date Fri, 08 May 2020 23:54:17 +0200
parents 10808:0d365c0ee9fe
children 10810:8a0a923e1ced
files plugins/mod_s2s/mod_s2s.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/mod_s2s.lua	Thu May 07 23:02:47 2020 +0200
+++ b/plugins/mod_s2s/mod_s2s.lua	Fri May 08 23:54:17 2020 +0200
@@ -322,7 +322,7 @@
 
 function stream_callbacks.streamopened(session, attr)
 	-- run _streamopened in async context
-	session.thread:run({ attr = attr });
+	session.thread:run({ stream = "opened", attr = attr });
 end
 
 function stream_callbacks._streamopened(session, attr)
@@ -564,10 +564,10 @@
 	local stream = new_xmpp_stream(session, stream_callbacks);
 
 	session.thread = runner(function (stanza)
-		if stanza.name == nil then
+		if st.is_stanza(stanza) then
+			core_process_stanza(session, stanza);
+		elseif stanza.stream == "opened" then
 			stream_callbacks._streamopened(session, stanza.attr);
-		else
-			core_process_stanza(session, stanza);
 		end
 	end, runner_callbacks, session);