commit ed39a2a

Hubert Hirtz  ·  2020-08-19 19:56:04 +0000 UTC
parent cdb68f6
Fix highlight not following new nick on registration
1 files changed,  +3, -5
M app.go
M app.go
+3, -5
 1@@ -66,8 +66,6 @@ func NewApp(cfg Config) (app *App, err error) {
 2 		app.win.AddLine(ui.Home, ui.NewLineNow("ERROR --", "Registration failed"))
 3 	}
 4 
 5-	app.highlights = append(app.highlights, app.s.NickCf())
 6-
 7 	return
 8 }
 9 
10@@ -110,9 +108,6 @@ func (app *App) handleIRCEvent(ev irc.Event) {
11 			line += " as " + app.s.Nick()
12 		}
13 		app.win.AddLine(ui.Home, ui.NewLineNow("--", line))
14-		if app.cfg.Highlights == nil {
15-			app.highlights[0] = app.s.NickCf()
16-		}
17 	case irc.SelfNickEvent:
18 		line := fmt.Sprintf("\x0314%s\x03\u2192\x0314%s\x03", ev.FormerNick, ev.NewNick)
19 		app.win.AddLine(ui.Home, ui.NewLine(ev.Time, "--", line, true, true))
20@@ -253,6 +248,9 @@ func (app *App) isHighlight(nick, content string) bool {
21 		return false
22 	}
23 	contentCf := strings.ToLower(content)
24+	if app.highlights == nil {
25+		return strings.Contains(contentCf, app.s.NickCf())
26+	}
27 	for _, h := range app.highlights {
28 		if strings.Contains(contentCf, h) {
29 			return true