diff options
author | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-01 18:03:26 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtzfr.eu> | 2020-08-01 18:03:26 +0200 |
commit | f6ed22854234c6d651433c034578c10a4486480a (patch) | |
tree | 8c0590708d5f4d8933955afba70663436d9d6248 /cmd | |
parent | Handle self-NICK (diff) |
Show messages from self when echo-message is disabled
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/irc/main.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/irc/main.go b/cmd/irc/main.go index 51a6b0a..6245793 100644 --- a/cmd/irc/main.go +++ b/cmd/irc/main.go @@ -188,7 +188,7 @@ func handleUIEvent(app *ui.UI, s *irc.Session, ev tcell.Event) { case tcell.KeyEnter: buffer := app.CurrentBuffer() input := app.InputEnter() - handleInput(s, buffer, input) + handleInput(app, s, buffer, input) case tcell.KeyRune: app.InputRune(ev.Rune()) if app.CurrentBuffer() != "home" && !strings.HasPrefix(app.Input(), "/") { @@ -219,7 +219,7 @@ func parseCommand(s string) (command, args string) { return } -func handleInput(s *irc.Session, buffer, content string) { +func handleInput(app *ui.UI, s *irc.Session, buffer, content string) { cmd, args := parseCommand(content) switch cmd { @@ -229,6 +229,10 @@ func handleInput(s *irc.Session, buffer, content string) { } s.PrivMsg(buffer, args) + if !s.HasCapability("echo-message") { + line := formatIRCMessage(s.Nick(), args) + app.AddLine(buffer, line, time.Now(), false) + } case "QUOTE": s.SendRaw(args) case "J", "JOIN": |