From bf84fc09b216bd4669d9a0ed9bba30209f0cb7a8 Mon Sep 17 00:00:00 2001 From: Digital Date: Sat, 30 Jun 2018 22:26:40 +0200 Subject: Add option to disable typing notifications (#63) --- ui/commands.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ui/commands.go') diff --git a/ui/commands.go b/ui/commands.go index bbe082d..60ab1f1 100644 --- a/ui/commands.go +++ b/ui/commands.go @@ -18,10 +18,10 @@ package ui import ( "encoding/json" - "maunium.net/go/gomuks/debug" - "strings" "fmt" "github.com/lucasb-eyer/go-colorful" + "maunium.net/go/gomuks/debug" + "strings" "unicode" ) @@ -74,7 +74,7 @@ func cmdRainbow(cmd *Command) { html.WriteRune(char) continue } - color := rainbow.GetInterpolatedColorFor(float64(i)/float64(len(text))).Hex() + color := rainbow.GetInterpolatedColorFor(float64(i) / float64(len(text))).Hex() fmt.Fprintf(&html, "%c", color, char) } tempMessage := cmd.Room.NewTempMessage("m.text", html.String()) @@ -182,9 +182,9 @@ func cmdSetState(cmd *Command) { } } -func cmdUIToggle(cmd *Command) { +func cmdToggle(cmd *Command) { if len(cmd.Args) == 0 { - cmd.Reply("Usage: /uitoggle ") + cmd.Reply("Usage: /toggle ") return } switch cmd.Args[0] { @@ -196,11 +196,14 @@ func cmdUIToggle(cmd *Command) { cmd.Config.Preferences.BareMessageView = !cmd.Config.Preferences.BareMessageView case "images": cmd.Config.Preferences.DisableImages = !cmd.Config.Preferences.DisableImages + case "typingnotif": + cmd.Config.Preferences.DisableTypingNotifs = !cmd.Config.Preferences.DisableTypingNotifs default: - cmd.Reply("Usage: /uitoggle ") + cmd.Reply("Usage: /toggle ") return } - cmd.UI.Render() + // is there a reason this is called twice? + // cmd.UI.Render() cmd.UI.Render() go cmd.Matrix.SendPreferencesToMatrix() } -- cgit v1.2.3