Software /
code /
prosody-modules
Diff
mod_muc_bot/mod_muc_bot.lua @ 4564:d25f0fea270f
mod_muc_bot: Reduce hackyness of occupant construction
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 10 Apr 2021 19:20:03 +0200 |
parent | 4563:30f2d7c3f946 |
child | 4565:3b2ae854842c |
line wrap: on
line diff
--- 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);