diff options
author | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-24 12:23:46 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-24 15:20:20 +0200 |
commit | 9421ec8dad54e38b721dcc3c7a5219bf3fbeb65d (patch) | |
tree | 7ed586c14b6c8b5b696ea44bd1329b6f174d91cf | |
parent | Fix multiple SelfJoinEvent being sent (diff) |
Improve query display
- Print outgoing messages as "-> target" instead of self nick
- Don't highlight messages
-rw-r--r-- | app.go | 18 | ||||
-rw-r--r-- | irc/events.go | 1 | ||||
-rw-r--r-- | irc/states.go | 1 |
3 files changed, 16 insertions, 4 deletions
@@ -132,11 +132,20 @@ func (app *App) handleIRCEvent(ev irc.Event) { } case irc.QueryMessageEvent: if ev.Command == "PRIVMSG" { - l := ui.LineFromIRCMessage(ev.Time, ev.Nick, ev.Content, false, true) + isHighlight := true + head := ev.Nick + if app.s.NickCf() == strings.ToLower(ev.Nick) { + isHighlight = false + head = "\u2192 " + ev.Target + } else { + app.lastQuery = ev.Nick + } + l := ui.LineFromIRCMessage(ev.Time, head, ev.Content, false, false) app.win.AddLine(ui.Home, l) app.win.TypingStop(ui.Home, ev.Nick) - app.lastQuery = ev.Nick - app.notifyHighlight(ui.Home, ev.Nick, ev.Content) + if isHighlight { + app.notifyHighlight(ui.Home, ev.Nick, ev.Content) + } } else if ev.Command == "NOTICE" { l := ui.LineFromIRCMessage(ev.Time, ev.Nick, ev.Content, true, false) app.win.AddLine("", l) @@ -431,7 +440,8 @@ func (app *App) handleInput(buffer, content string) { app.s.PrivMsg(app.lastQuery, args) if !app.s.HasCapability("echo-message") { - line := ui.LineFromIRCMessage(time.Now(), app.s.Nick(), args, false, false) + head := "\u2192 " + app.lastQuery + line := ui.LineFromIRCMessage(time.Now(), head, args, false, false) app.win.AddLine(ui.Home, line) } } diff --git a/irc/events.go b/irc/events.go index e28c3e4..cd26369 100644 --- a/irc/events.go +++ b/irc/events.go @@ -48,6 +48,7 @@ type UserPartEvent struct { type QueryMessageEvent struct { Nick string + Target string Command string Content string Time time.Time diff --git a/irc/states.go b/irc/states.go index 365224e..61d06a4 100644 --- a/irc/states.go +++ b/irc/states.go @@ -847,6 +847,7 @@ func (s *Session) privmsgToEvent(msg Message) (ev Event) { // PRIVMSG to self ev = QueryMessageEvent{ Nick: nick, + Target: msg.Params[0], Command: msg.Command, Content: msg.Params[1], Time: t, |