From ed39a2adbf1553308a15db79eb111e79d86a0d05 Mon Sep 17 00:00:00 2001 From: Hubert Hirtz Date: Wed, 19 Aug 2020 21:56:04 +0200 Subject: Fix highlight not following new nick on registration --- app.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'app.go') diff --git a/app.go b/app.go index cb1eb3b..e718fc6 100644 --- a/app.go +++ b/app.go @@ -66,8 +66,6 @@ func NewApp(cfg Config) (app *App, err error) { app.win.AddLine(ui.Home, ui.NewLineNow("ERROR --", "Registration failed")) } - app.highlights = append(app.highlights, app.s.NickCf()) - return } @@ -110,9 +108,6 @@ func (app *App) handleIRCEvent(ev irc.Event) { line += " as " + app.s.Nick() } app.win.AddLine(ui.Home, ui.NewLineNow("--", line)) - if app.cfg.Highlights == nil { - app.highlights[0] = app.s.NickCf() - } case irc.SelfNickEvent: line := fmt.Sprintf("\x0314%s\x03\u2192\x0314%s\x03", ev.FormerNick, ev.NewNick) app.win.AddLine(ui.Home, ui.NewLine(ev.Time, "--", line, true, true)) @@ -253,6 +248,9 @@ func (app *App) isHighlight(nick, content string) bool { return false } contentCf := strings.ToLower(content) + if app.highlights == nil { + return strings.Contains(contentCf, app.s.NickCf()) + } for _, h := range app.highlights { if strings.Contains(contentCf, h) { return true -- cgit v1.2.3