commit d6230f3

Lauri Tirkkonen  ·  2024-01-26 09:18:07 +0000 UTC
parent 328325b
app: show who changed the topic when it changes
3 files changed,  +5, -1
M app.go
M app.go
+2, -1
 1@@ -1390,7 +1390,8 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
 2 		}
 3 	case irc.TopicChangeEvent:
 4 		topic := ui.IRCString(ev.Topic).String()
 5-		body := fmt.Sprintf("Topic changed to: %s", topic)
 6+		who := ui.IRCString(ev.Who).String()
 7+		body := fmt.Sprintf("Topic changed by %s to: %s", who, topic)
 8 		return ui.Line{
 9 			At:        ev.Time,
10 			Head:      "--",
+1, -0
1@@ -68,6 +68,7 @@ type TopicChangeEvent struct {
2 	Channel string
3 	Topic   string
4 	Time    time.Time
5+	Who	string
6 }
7 
8 type ModeChangeEvent struct {
+2, -0
 1@@ -1140,6 +1140,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
 2 				Channel: channel,
 3 				Topic:   topic,
 4 				Time:    msg.TimeOrNow(),
 5+				Who:     msg.Prefix.Name,
 6 			}, nil
 7 		}
 8 
 9@@ -1154,6 +1155,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
10 				Channel: c.Name,
11 				Topic:   c.Topic,
12 				Time:    msg.TimeOrNow(),
13+				Who:     msg.Prefix.Name,
14 			}, nil
15 		}
16 	case "MODE":