From ee838279b64e7b9fd3187c29f6fd79a342641c57 Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Sat, 23 Oct 2021 18:35:00 +0200 Subject: Add support for the INVITE message --- app.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'app.go') 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 -- cgit v1.2.3