From 30d99c706e3a75948c49289fc6b0317258957819 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 3 Jun 2023 20:20:30 +0200 Subject: Implement dummy session Minimal step towards session-based XMPP architecture. --- limox.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'limox.go') diff --git a/limox.go b/limox.go index 6c8afa3..320765f 100644 --- a/limox.go +++ b/limox.go @@ -26,6 +26,7 @@ type Limox struct { JidEditor widget.Editor PwdEditor widget.Editor MainButton widget.Clickable + session *xmpp.Session XmppConn chan xmpp.Event State LimoxState Window *app.Window @@ -85,13 +86,15 @@ func (l *Limox) buttonCallback() { pwd := l.PwdEditor.Text() setLastJid(jid) setLastPwd(pwd) - c := xmpp.NewConn(l.XmppConn, jid, pwd) - go c.Run() + l.session = xmpp.NewSession(jid, pwd) + l.XmppConn = l.session.Out + go l.session.Run() l.State = Connecting case Connecting: + l.session.Close() l.State = Disconnected case Connected: - l.XmppConn <- xmpp.ShouldDisconnectEvent + l.session.Close() l.State = Disconnected } } -- cgit v1.2.3-70-g09d2