~delthas/senpai-dev

app: show who changed the topic when it changes v1 PROPOSED

Lauri Tirkkonen: 1
 app: show who changed the topic when it changes

 3 files changed, 5 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~delthas/senpai-dev/patches/48915/mbox | git am -3
Learn more about email & git

[PATCH] app: show who changed the topic when it changes Export this patch

---
 app.go         | 3 ++-
 irc/events.go  | 1 +
 irc/session.go | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/app.go b/app.go
index d4c58ef..0d5e8bd 100644
--- a/app.go
+++ b/app.go
@@ -1321,7 +1321,8 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
		}
	case irc.TopicChangeEvent:
		topic := ui.IRCString(ev.Topic).String()
		body := fmt.Sprintf("Topic changed to: %s", topic)
		who := ui.IRCString(ev.Who)
		body := fmt.Sprintf("%s changed topic to: %s", who, topic)
		return ui.Line{
			At:        ev.Time,
			Head:      "--",
diff --git a/irc/events.go b/irc/events.go
index aaf3953..9bb61ba 100644
--- a/irc/events.go
+++ b/irc/events.go
@@ -68,6 +68,7 @@ type TopicChangeEvent struct {
	Channel string
	Topic   string
	Time    time.Time
	Who	string
}

type ModeChangeEvent struct {
diff --git a/irc/session.go b/irc/session.go
index 8e644af..43c0869 100644
--- a/irc/session.go
+++ b/irc/session.go
@@ -1126,6 +1126,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
				Channel: channel,
				Topic:   topic,
				Time:    msg.TimeOrNow(),
				Who:     msg.Prefix.Name,
			}, nil
		}

@@ -1140,6 +1141,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
				Channel: c.Name,
				Topic:   c.Topic,
				Time:    msg.TimeOrNow(),
				Who:     msg.Prefix.Name,
			}, nil
		}
	case "MODE":
-- 
2.43.0


-- 
Lauri Tirkkonen | lotheac @ IRCnet
Pinging on this one as well. Is this desired? I think it's useful to
know who makes changes to channels, as that's sort of communication too.
Mode changes also don't show who made them at the moment, but if this
patch is accepted I could probably follow up with similar for mode
changes.