From f0544fce3892368a633b01e2c9f4f41c9ece3d5137e0e431e55ee5434fef2b72 Mon Sep 17 00:00:00 2001
From: Sergey Matveev <stargrave@stargrave.org>
Date: Wed, 15 May 2024 12:17:35 +0300
Subject: [PATCH] Print alert/bell character at important events
---
cmd/client/gui.go | 4 ++++
cmd/client/main.go | 3 +++
2 files changed, 7 insertions(+)
diff --git a/cmd/client/gui.go b/cmd/client/gui.go
index 4e9eeab..3245f5e 100644
--- a/cmd/client/gui.go
+++ b/cmd/client/gui.go
@@ -32,6 +32,10 @@ var (
CurrentView = 0
)
+func printBell() {
+ fmt.Print("\a")
+}
+
func tabHandle(gui *gocui.Gui, v *gocui.View) error {
sids := make([]int, 0, len(Streams)+1)
sids = append(sids, -1)
diff --git a/cmd/client/main.go b/cmd/client/main.go
index 881f574..e4288b9 100644
--- a/cmd/client/main.go
+++ b/cmd/client/main.go
@@ -418,6 +418,7 @@ Magenta "S" means that peer is locally muted.`)
case vors.CmdAdd:
sidRaw, name, key := args[1], args[2], args[3]
sid := sidRaw[0]
+ printBell()
log.Println("add", string(name), "sid:", sid)
keyCiph, keyMAC := key[:chacha20.KeySize], key[chacha20.KeySize:]
stream := &Stream{
@@ -568,6 +569,7 @@ Magenta "S" means that peer is locally muted.`)
log.Println("unknown sid:", sid)
continue
}
+ printBell()
log.Println("del", s.name, "sid:", sid)
StreamsM.Lock()
delete(Streams, sid)
@@ -597,6 +599,7 @@ Magenta "S" means that peer is locally muted.`)
log.Println("unknown sid:", sid)
continue
}
+ printBell()
log.Println(s.name, ":", string(args[2]))
default:
log.Fatal("unexpected cmd:", cmd)
--
2.52.0