summaryrefslogtreecommitdiff
path: root/app.go
diff options
context:
space:
mode:
authorHubert Hirtz <hubert@hirtz.pm>2021-10-23 18:35:00 +0200
committerHubert Hirtz <hubert@hirtz.pm>2021-10-23 18:35:00 +0200
commitee838279b64e7b9fd3187c29f6fd79a342641c57 (patch)
treea9d48dd11c936422705de97ff05e29652782a816 /app.go
parentDon't expect the server to send correct IRC messages (diff)
Add support for the INVITE message
Diffstat (limited to 'app.go')
-rw-r--r--app.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/app.go b/app.go
index 2447175..8cadcc1 100644
--- a/app.go
+++ b/app.go
@@ -686,6 +686,30 @@ func (app *App) handleIRCEvent(ev interface{}) {
HeadColor: tcell.ColorGray,
Body: body.StyledString(),
})
+ case irc.InviteEvent:
+ var buffer string
+ var notify ui.NotifyType
+ var body string
+ if app.s.IsMe(ev.Invitee) {
+ buffer = Home
+ notify = ui.NotifyHighlight
+ body = fmt.Sprintf("%s invited you to join %s", ev.Inviter, ev.Channel)
+ } else if app.s.IsMe(ev.Inviter) {
+ buffer = ev.Channel
+ notify = ui.NotifyNone
+ body = fmt.Sprintf("You invited %s to join this channel", ev.Invitee)
+ } else {
+ buffer = ev.Channel
+ notify = ui.NotifyUnread
+ body = fmt.Sprintf("%s invited %s to join this channel", ev.Inviter, ev.Invitee)
+ }
+ app.win.AddLine(buffer, notify, ui.Line{
+ At: msg.TimeOrNow(),
+ Head: "--",
+ HeadColor: tcell.ColorGray,
+ Body: ui.Styled(body, tcell.StyleDefault.Foreground(tcell.ColorGray)),
+ Highlight: notify == ui.NotifyHighlight,
+ })
case irc.MessageEvent:
buffer, line, hlNotification := app.formatMessage(ev)
var notify ui.NotifyType