From 28a876fa341174e8d17640fc215854328ce65b42 Mon Sep 17 00:00:00 2001 From: rebecca Date: Fri, 25 Sep 2026 16:41:52 +0100 Subject: consistentize 'channels' maps in pylons for live reloading to work, wilson needs to know which channels each pylon currently cares about, so it knows which combination of add_channel and remove_channel to call on each one discord: rename channel_to_webhook --> channels xmpp: rename mucs --> channels quaddle: add channels map --- xmpp/pylon.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'xmpp/pylon.lua') diff --git a/xmpp/pylon.lua b/xmpp/pylon.lua index d00c41b..a3415dd 100644 --- a/xmpp/pylon.lua +++ b/xmpp/pylon.lua @@ -13,8 +13,7 @@ local Xmpp = class.extend(BasePylon) function Xmpp.init(self) self:_check_fields"server component component_secret" - - self.mucs = {} + self.channels = {} end -- only use on local connections! @@ -44,13 +43,13 @@ end function Xmpp.add_channel(self, channel) local muc = { nick_to_user={}, user_to_nick={} } - self.mucs[channel.id] = muc + self.channels[channel.id] = muc local bot = {} ; self.bot = bot bot.user, bot.nick, bot.user_jid, bot.nick_jid = self:ensure_and_get_user(channel.id, "wilson") end function Xmpp.ensure_and_get_user(self, muc_jid, nick, source_pylon) - local muc = assert(self.mucs[muc_jid]) + local muc = assert(self.channels[muc_jid]) local user = muc.nick_to_user[nick] if user then local user_jid = user..'@'..self.component @@ -101,7 +100,7 @@ function Xmpp.recving(self) if x.label == 'message' then local from_bare_jid, from_nick if x.xarg.from then from_bare_jid, from_nick = x.xarg.from:match"(.*)/(.*)" end - local muc = self.mucs[from_bare_jid] ; if muc then + local muc = self.channels[from_bare_jid] ; if muc then if x.xarg.to == 'wilson@'..self.component and body -- cgit v1.2.3