From 6713c3cc833906802acf3ef89e5ac3dd7f69e128 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 20 May 2023 19:19:19 +0200 Subject: Add persistence for last used JID --- limox.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'limox.go') diff --git a/limox.go b/limox.go index 672396e..0e8c056 100644 --- a/limox.go +++ b/limox.go @@ -34,7 +34,7 @@ type Limox struct { } func NewLimox() Limox { - return Limox{ + l := Limox{ Window: app.NewWindow( app.Title("LimoX"), app.Size(unit.Dp(400), unit.Dp(600)), @@ -44,6 +44,10 @@ func NewLimox() Limox { XmppConn: make(chan xmpp.Event), State: Disconnected, } + + l.JidEditor.SetText(getLastJid()) + + return l } func (l *Limox) run() error { @@ -77,7 +81,9 @@ func (l *Limox) buttonCallback() { switch l.State { case Disconnected: log.Println("Starting connection establishment ...") - go xmpp.Run(l.XmppConn, l.JidEditor.Text(), l.PwdEditor.Text()) + jid := l.JidEditor.Text() + setLastJid(jid) + go xmpp.Run(l.XmppConn, jid, l.PwdEditor.Text()) l.State = Connecting case Connecting: log.Println("Aborted connection establishment") -- cgit v1.2.3-70-g09d2