summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorHubert Hirtz <hubert.hirtz@laposte.net>2020-06-03 23:05:44 +0200
committerHubert Hirtz <hubert.hirtz@laposte.net>2020-06-03 23:05:44 +0200
commit31b8f90aa0c75f52d03db7ca9fba41bddb8429fa (patch)
tree1db2ad54aedfafe8a50fd0fff56fdfa5cab3933a /cmd
parentNick colors (diff)
Show JOIN and PARTs
Diffstat (limited to 'cmd')
-rw-r--r--cmd/irc/main.go12
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)
}