aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-05-08 23:54:17 +0200
committerKim Alvefur <zash@zash.se>2020-05-08 23:54:17 +0200
commit289898e68f98fe5edfb31ae622c9c3f0d6e1e039 (patch)
treeb296a14a85754e994f5eb98a6b3497db3c22ad5b
parentb2baba11247243446e60bea10884d2d2193e9f48 (diff)
downloadprosody-289898e68f98fe5edfb31ae622c9c3f0d6e1e039.tar.gz
prosody-289898e68f98fe5edfb31ae622c9c3f0d6e1e039.zip
mod_s2s: Improve signaling of stream open events
Makes it clearer, cleaner and easier to extend.
-rw-r--r--plugins/mod_s2s/mod_s2s.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index 8feb6403..2dad864c 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -322,7 +322,7 @@ local xmlns_xmpp_streams = "urn:ietf:params:xml:ns:xmpp-streams";
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 function initialize_session(session)
local stream = new_xmpp_stream(session, stream_callbacks);
session.thread = runner(function (stanza)
- if stanza.name == nil then
- stream_callbacks._streamopened(session, stanza.attr);
- else
+ if st.is_stanza(stanza) then
core_process_stanza(session, stanza);
+ elseif stanza.stream == "opened" then
+ stream_callbacks._streamopened(session, stanza.attr);
end
end, runner_callbacks, session);