summaryrefslogtreecommitdiff
path: root/limox.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-18 18:40:46 +0200
committerxengineering <me@xengineering.eu>2023-05-18 18:40:46 +0200
commit8fce634716a998721cc5fb4663a7c0379c6df633 (patch)
treef23ac38a9d1acb5d93d0eb0512f5741193e6bfa0 /limox.go
parent0f96bb37005dfda8c2fe20a638f670f6385d2e8b (diff)
downloadlimox-8fce634716a998721cc5fb4663a7c0379c6df633.tar
limox-8fce634716a998721cc5fb4663a7c0379c6df633.tar.zst
limox-8fce634716a998721cc5fb4663a7c0379c6df633.zip
Use only xmpp.Event for channel communication
Diffstat (limited to 'limox.go')
-rw-r--r--limox.go23
1 files changed, 7 insertions, 16 deletions
diff --git a/limox.go b/limox.go
index 6723745..672396e 100644
--- a/limox.go
+++ b/limox.go
@@ -2,7 +2,6 @@ package main
import (
"log"
- "reflect"
"gioui.org/app"
"gioui.org/font/gofont"
@@ -27,7 +26,7 @@ type Limox struct {
JidEditor widget.Editor
PwdEditor widget.Editor
MainButton widget.Clickable
- XmppConn chan any
+ XmppConn chan xmpp.Event
State LimoxState
Window *app.Window
Operations op.Ops
@@ -42,7 +41,7 @@ func NewLimox() Limox {
),
Operations: op.Ops{},
Theme: material.NewTheme(gofont.Collection()),
- XmppConn: make(chan any),
+ XmppConn: make(chan xmpp.Event),
State: Disconnected,
}
}
@@ -61,21 +60,13 @@ func (l *Limox) run() error {
l.draw(e)
}
case ev := <-l.XmppConn:
- switch ev.(type) {
- case error:
- log.Print(ev)
+ switch ev {
+ case xmpp.DisconnectEvent:
l.State = Disconnected
- case xmpp.Event:
- switch ev {
- case xmpp.DisconnectEvent:
- l.State = Disconnected
- case xmpp.ConnectEvent:
- l.State = Connected
- default:
- log.Printf("Unknown xmpp.Event '%d'\n", ev)
- }
+ case xmpp.ConnectEvent:
+ l.State = Connected
default:
- log.Printf("Unknown event type '%s'.\n", reflect.TypeOf(ev))
+ log.Printf("Unknown xmpp.Event '%d'\n", ev)
}
l.Window.Invalidate()
}