]> git.r.bdr.sh - rbdr/mobius/blobdiff - hotline/ui.go
patch: v0.10.16
[rbdr/mobius] / hotline / ui.go
index 6eba01175121534c57808122518445d6d16ec7c1..8b0a8c5607759b198d7e94549b43eddf3ee9a0aa 100644 (file)
@@ -145,6 +145,7 @@ func (ui *UI) renderSettingsForm() *tview.Flex {
                return err == nil
        }, nil)
        settingsForm.AddInputField("Tracker", ui.HLClient.pref.Tracker, 0, nil, nil)
+       settingsForm.AddCheckbox("Enable Terminal Bell", ui.HLClient.pref.EnableBell, nil)
        settingsForm.AddButton("Save", func() {
                usernameInput := settingsForm.GetFormItem(0).(*tview.InputField).GetText()
                if len(usernameInput) == 0 {
@@ -154,6 +155,7 @@ func (ui *UI) renderSettingsForm() *tview.Flex {
                iconStr = settingsForm.GetFormItem(1).(*tview.InputField).GetText()
                ui.HLClient.pref.IconID, _ = strconv.Atoi(iconStr)
                ui.HLClient.pref.Tracker = settingsForm.GetFormItem(2).(*tview.InputField).GetText()
+               ui.HLClient.pref.EnableBell = settingsForm.GetFormItem(3).(*tview.Checkbox).IsChecked()
 
                out, err := yaml.Marshal(&ui.HLClient.pref)
                if err != nil {
@@ -208,11 +210,12 @@ func (ui *UI) joinServer(addr, login, password string) error {
                        buf := make([]byte, len(scanner.Bytes()))
                        copy(buf, scanner.Bytes())
 
-                       t, _, err := ReadTransaction(buf)
+                       var t Transaction
+                       _, err := t.Write(buf)
                        if err != nil {
                                break
                        }
-                       if err := ui.HLClient.HandleTransaction(t); err != nil {
+                       if err := ui.HLClient.HandleTransaction(&t); err != nil {
                                ui.HLClient.Logger.Errorw("Error handling transaction", "err", err)
                        }
                }