diff options
-rw-r--r-- | app.go | 6 | ||||
-rw-r--r-- | irc/events.go | 7 | ||||
-rw-r--r-- | irc/states.go | 6 |
3 files changed, 19 insertions, 0 deletions
@@ -196,6 +196,12 @@ func (app *App) handleIRCEvent(ev irc.Event) { Mergeable: true, }) } + case irc.TopicChangeEvent: + app.win.AddLine(ev.Channel, false, ui.Line{ + At: ev.Time, + Head: "--", + Body: fmt.Sprintf("\x0314Topic changed to: %s\x03", ev.Topic), + }) case irc.MessageEvent: buffer, line, hlNotification := app.formatMessage(ev) app.win.AddLine(buffer, hlNotification, line) diff --git a/irc/events.go b/irc/events.go index 62622b4..9bb4c79 100644 --- a/irc/events.go +++ b/irc/events.go @@ -51,6 +51,13 @@ type UserQuitEvent struct { Time time.Time } +type TopicChangeEvent struct { + User *Prefix + Channel string + Topic string + Time time.Time +} + type MessageEvent struct { User *Prefix Target string diff --git a/irc/states.go b/irc/states.go index e560bdf..5502dd0 100644 --- a/irc/states.go +++ b/irc/states.go @@ -780,6 +780,12 @@ func (s *Session) handle(msg Message) (err error) { c.TopicWho = msg.Prefix.Copy() c.TopicTime = msg.TimeOrNow() s.channels[channelCf] = c + s.evts <- TopicChangeEvent{ + User: msg.Prefix.Copy(), + Channel: c.Name, + Topic: c.Topic, + Time: c.TopicTime, + } } case "PRIVMSG", "NOTICE": s.evts <- s.privmsgToEvent(msg) |