From 71cee0014368f5d83fe94989526a4ffb2824f50c Mon Sep 17 00:00:00 2001 From: rebecca Date: Thu, 24 Sep 2026 17:20:42 +0100 Subject: change fields on Message to include author --- xmpp/pylon.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'xmpp') diff --git a/xmpp/pylon.lua b/xmpp/pylon.lua index 0e6094c..7fd7a1a 100644 --- a/xmpp/pylon.lua +++ b/xmpp/pylon.lua @@ -56,10 +56,8 @@ function Xmpp.add_channel(self, channel) 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, msg_sender, source_pylon) +function Xmpp.ensure_and_get_user(self, muc_jid, nick, source_pylon) local muc = assert(self.mucs[muc_jid]) - local nick = msg_sender - if source_pylon then nick = nick.."["..source_pylon.shortname.."]" end local user = muc.nick_to_user[nick] if user then local user_jid = user..'@'..self.component @@ -117,10 +115,11 @@ function Xmpp.recving(self) and from_nick and not muc.nick_to_user[from_nick] then self.log:proto('<',from_bare_jid,from_nick,body) - self.wilson:deliver({ - source_channel = Thing(self, from_bare_jid), + self.wilson:deliver(Message { + pylon = self, + channel = Thing(self, from_bare_jid), + author = Thing(self, x.xarg.from, from_nick), body = body, - sender = from_nick, }) end end @@ -131,9 +130,9 @@ end function Xmpp.sending(self) for dest_channel, message in self.inbox:iter() do - self.log:proto('>',dest_channel,message.sender,message.body) - local user, nick, user_jid, nick_jid - = self:ensure_and_get_user(dest_channel.id, message.sender, message.source_channel.pylon) + self.log:proto('>',dest_channel,message.author,message.body) + local user, nick, user_jid, nick_jid = self:ensure_and_get_user( + dest_channel.id, message.author:name_with_shortname(), message.pylon) self.sock:write(xmlify( X.message{to=dest_channel.id, type='groupchat', from=user_jid, X.body{message.body}})) -- cgit v1.2.3