summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.go6
-rw-r--r--irc/events.go7
-rw-r--r--irc/states.go6
3 files changed, 19 insertions, 0 deletions
diff --git a/app.go b/app.go
index f9088ae..c63565f 100644
--- a/app.go
+++ b/app.go
@@ -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)