summaryrefslogtreecommitdiff
path: root/limox.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-07-09 17:23:28 +0200
committerxengineering <me@xengineering.eu>2023-07-09 17:23:28 +0200
commit3f5e695e6d772f46ef3596f83c9d2c26ebcbab35 (patch)
tree13c0c6f4fb5f491f516157d35a1bf9ffccd45fb2 /limox.go
parent4152d6e7bfe3d0fd7d099d36311c4a57f4858964 (diff)
downloadlimox-3f5e695e6d772f46ef3596f83c9d2c26ebcbab35.tar
limox-3f5e695e6d772f46ef3596f83c9d2c26ebcbab35.tar.zst
limox-3f5e695e6d772f46ef3596f83c9d2c26ebcbab35.zip
Pass roster result to limox struct
This is needed to display the roster in the context of GUI.
Diffstat (limited to 'limox.go')
-rw-r--r--limox.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/limox.go b/limox.go
index d1cbd79..040eef2 100644
--- a/limox.go
+++ b/limox.go
@@ -27,6 +27,7 @@ type Limox struct {
PwdEditor widget.Editor
ConnectButton widget.Clickable
DisconnectButton widget.Clickable
+ Roster []xmpp.RosterItem
sessionIn chan<- any
sessionOut chan any
State LimoxState
@@ -70,11 +71,14 @@ func (l *Limox) run() error {
l.draw(e)
}
case data := <-l.sessionOut:
- switch data.(type) {
+ switch d := data.(type) {
case xmpp.SessionDisconnect:
l.State = Disconnected
+ l.Roster = make([]xmpp.RosterItem, 0)
case xmpp.SessionConnect:
l.State = Connected
+ case []xmpp.RosterItem:
+ l.Roster = d
default:
log.Printf("Unknown XMPP data '%d'\n", data)
}