mod_muc_bot: Save occupant to room
authorKim Alvefur <zash@zash.se>
Sat, 10 Apr 2021 19:23:25 +0200
changeset 4569 3b2ae854842c
parent 4568 d25f0fea270f
child 4570 174c7a3c819b
mod_muc_bot: Save occupant to room This has some side-effects: Firstly, the bot shows up in occupant list, which is nice. Secondly, the bot starts receiving messages from the room which might be wanted, but it would be better to join the room for real in this case.
mod_muc_bot/mod_muc_bot.lua
--- a/mod_muc_bot/mod_muc_bot.lua	Sat Apr 10 19:20:03 2021 +0200
+++ b/mod_muc_bot/mod_muc_bot.lua	Sat Apr 10 19:23:25 2021 +0200
@@ -28,6 +28,8 @@
 		local join = st.presence({from = event.from; to = virtual_occupant_jid});
 		local dest_x = st.stanza("x", {xmlns = "http://jabber.org/protocol/muc#user"});
 		occupant:set_session(event.from, join, true);
+		room:save_occupant(occupant);
+		room:publicise_occupant_status(occupant, dest_x);
 		-- Inject virtual occupant to trick all the other hooks on this event that
 		-- this is an actual legitimate participant.
 		event.occupant = occupant;