summaryrefslogtreecommitdiff
path: root/xmpp
diff options
context:
space:
mode:
authorrebecca <ubq323@ubq323.website>2026-09-24 17:20:42 +0100
committerrebecca <ubq323@ubq323.website>2026-09-24 18:55:05 +0100
commit71cee0014368f5d83fe94989526a4ffb2824f50c (patch)
treecd87a5c7d859d98f48866ff769ef89d60a28d5d5 /xmpp
parentdff5363f96029aba6d0f222d3e31ab3888d7111f (diff)
change fields on Message to include author
Diffstat (limited to 'xmpp')
-rw-r--r--xmpp/pylon.lua17
1 files changed, 8 insertions, 9 deletions
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}}))