mod_smacks: Initialize queue before sending <enable>
authorKim Alvefur <zash@zash.se>
Sun, 15 May 2022 16:12:34 +0200
changeset 12508 c589874fe348
parent 12507 ad49bb3a4780
child 12510 d04f6f014636
mod_smacks: Initialize queue before sending <enable> Setting the .smacks field enables code paths that expects the queue to be present. The queue is initialized in wrap_session_out(). With opportunistic writes enabled this happens immediately on .sends2s(), so the sending <enable> must happen before OR after these two lines, not in the middle.
plugins/mod_smacks.lua
--- a/plugins/mod_smacks.lua	Sun May 15 15:29:02 2022 +0200
+++ b/plugins/mod_smacks.lua	Sun May 15 16:12:34 2022 +0200
@@ -334,8 +334,8 @@
 	if not session.smacks_feature then return end
 
 	session.smacks = session.smacks_feature.attr.xmlns;
+	wrap_session_out(session, false);
 	session.sends2s(st.stanza("enable", { xmlns = session.smacks }));
-	wrap_session_out(session, false);
 end);
 
 function handle_enabled(session, stanza, xmlns_sm) -- luacheck: ignore 212/stanza