diff options
-rw-r--r-- | app.go | 12 | ||||
-rw-r--r-- | irc/events.go | 5 | ||||
-rw-r--r-- | irc/session.go | 8 |
3 files changed, 25 insertions, 0 deletions
@@ -648,6 +648,18 @@ func (app *App) handleIRCEvent(ev interface{}) { HeadColor: tcell.ColorGray, Body: body.StyledString(), }) + case irc.ModeChangeEvent: + var body ui.StyledStringBuilder + body.Grow(len(ev.Mode) + 13) + body.SetStyle(tcell.StyleDefault.Foreground(tcell.ColorGray)) + body.WriteString("Mode change: ") + body.WriteString(ev.Mode) + app.win.AddLine(ev.Channel, ui.NotifyUnread, ui.Line{ + At: msg.TimeOrNow(), + Head: "--", + HeadColor: tcell.ColorGray, + Body: body.StyledString(), + }) case irc.MessageEvent: buffer, line, hlNotification := app.formatMessage(ev) var notify ui.NotifyType diff --git a/irc/events.go b/irc/events.go index eeac8fb..ba6e38d 100644 --- a/irc/events.go +++ b/irc/events.go @@ -51,6 +51,11 @@ type TopicChangeEvent struct { Topic string } +type ModeChangeEvent struct { + Channel string + Mode string +} + type MessageEvent struct { User string Target string diff --git a/irc/session.go b/irc/session.go index f799f38..692daf4 100644 --- a/irc/session.go +++ b/irc/session.go @@ -741,6 +741,14 @@ func (s *Session) handleRegistered(msg Message) Event { Topic: c.Topic, } } + case "MODE": + channelCf := s.Casemap(msg.Params[0]) + if c, ok := s.channels[channelCf]; ok { + return ModeChangeEvent{ + Channel: c.Name, + Mode: strings.Join(msg.Params[1:], " "), + } + } case "PRIVMSG", "NOTICE": targetCf := s.casemap(msg.Params[0]) nickCf := s.casemap(msg.Prefix.Name) |