changeset 4565:3b2ae854842c

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.
author Kim Alvefur <zash@zash.se>
date Sat, 10 Apr 2021 19:23:25 +0200
parents d25f0fea270f
children 174c7a3c819b
files mod_muc_bot/mod_muc_bot.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;