diff options
author | Hubert Hirtz <hubert.hirtz@laposte.net> | 2020-06-03 23:05:44 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert.hirtz@laposte.net> | 2020-06-03 23:05:44 +0200 |
commit | 31b8f90aa0c75f52d03db7ca9fba41bddb8429fa (patch) | |
tree | 1db2ad54aedfafe8a50fd0fff56fdfa5cab3933a /cmd | |
parent | Nick colors (diff) |
Show JOIN and PARTs
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/irc/main.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/cmd/irc/main.go b/cmd/irc/main.go index 5c2d436..9999e14 100644 --- a/cmd/irc/main.go +++ b/cmd/irc/main.go @@ -34,7 +34,7 @@ func main() { defer app.Close() addr := cfg.Addr - app.AddLine("home", fmt.Sprintf("Connecting to %s...", addr), time.Now()) + app.AddLine("home", fmt.Sprintf("Connecting to %s...", addr), time.Now(), false) conn, err := tls.Dial("tcp", addr, nil) if err != nil { @@ -57,14 +57,20 @@ func main() { case ev := <-s.Poll(): switch ev := ev.(type) { case irc.RegisteredEvent: - app.AddLine("home", "Connected to the server", time.Now()) + app.AddLine("home", "Connected to the server", time.Now(), false) case irc.SelfJoinEvent: app.AddBuffer(ev.Channel) + case irc.UserJoinEvent: + line := fmt.Sprintf("\x033+\x0314%s", ev.Nick) + app.AddLine(ev.Channel, line, ev.Time, true) case irc.SelfPartEvent: app.RemoveBuffer(ev.Channel) + case irc.UserPartEvent: + line := fmt.Sprintf("\x034-\x0314%s", ev.Nick) + app.AddLine(ev.Channel, line, ev.Time, true) case irc.ChannelMessageEvent: line := formatIRCMessage(ev.Nick, ev.Content) - app.AddLine(ev.Channel, line, ev.Time) + app.AddLine(ev.Channel, line, ev.Time, false) case error: log.Panicln(ev) } |