diff options
| author | rebecca <ubq323@ubq323.website> | 2026-09-25 16:41:52 +0100 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-09-25 16:49:36 +0100 |
| commit | 28a876fa341174e8d17640fc215854328ce65b42 (patch) | |
| tree | 64be5771e6dd48e0d45a3cdc65bcda1f62369277 /xmpp | |
| parent | 89c71b2939ce610b4251d0d9f22b9e0d2217a106 (diff) | |
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
Diffstat (limited to 'xmpp')
| -rw-r--r-- | xmpp/pylon.lua | 9 |
1 files changed, 4 insertions, 5 deletions
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 |
