[PATCH 1/1] Show mode change sender
Export this patch
This makes senpai show mode changes with the following format:
-- [<+/-><mode> <nick>] by <who>
For example:
-- [+o UntrustedUser] by TotallyTrustedPerson
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
Superseded by https://lists.sr.ht/~delthas/senpai-dev/patches/54214
Cheers.
---
app.go | 2 + -
irc/events.go | 1 +
irc/session.go | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/app.go b/app.go
index 61a7401..fb37d23 100644
--- a/app.go
+++ b/app.go
@@ -1693,7 +1693,7 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
Readable: true,
}
case irc.ModeChangeEvent:
- body := fmt.Sprintf("[%s]", ev.Mode)
+ body := fmt.Sprintf("[%s] by %s", ev.Mode, ev.Who)
// simple mode event: <+/-><mode> <nick>
mergeable := len(strings.Split(ev.Mode, " ")) == 2
return ui.Line{
diff --git a/irc/events.go b/irc/events.go
index 716a9c1..2fbafd5 100644
--- a/irc/events.go
+++ b/irc/events.go
@@ -77,6 +77,7 @@ type ModeChangeEvent struct {
Channel string
Mode string
Time time.Time
+ Who string
}
type InviteEvent struct {
diff --git a/irc/session.go b/irc/session.go
index 0101171..d985a5e 100644
--- a/irc/session.go
+++ b/irc/session.go
@@ -1195,6 +1195,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
Channel: channel,
Mode: mode,
Time: msg.TimeOrNow(),
+ Who: msg.Prefix.Name,
}, nil
}
@@ -1235,6 +1236,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
Channel: c.Name,
Mode: mode,
Time: msg.TimeOrNow(),
+ Who: msg.Prefix.Name,
}, nil
}
case "INVITE":
--
2.45.1
Hi,