# HG changeset patch # User Kim Alvefur # Date 1618075203 -7200 # Node ID d25f0fea270f73d6743f316be08ca50a75d5eb03 # Parent 30f2d7c3f9460ff92239301460fd331c3823122b mod_muc_bot: Reduce hackyness of occupant construction diff -r 30f2d7c3f946 -r d25f0fea270f mod_muc_bot/mod_muc_bot.lua --- a/mod_muc_bot/mod_muc_bot.lua Thu Apr 01 13:15:05 2021 +0200 +++ b/mod_muc_bot/mod_muc_bot.lua Sat Apr 10 19:20:03 2021 +0200 @@ -24,14 +24,13 @@ return true; end + local occupant = room:new_occupant(module.host, virtual_occupant_jid); + 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); -- Inject virtual occupant to trick all the other hooks on this event that -- this is an actual legitimate participant. - -- XXX Hack! - event.occupant = { - nick = virtual_occupant_jid; - bare_jid = jid.bare(event.from); - role = "participant"; - }; + event.occupant = occupant; end end, 66);