From c628bfb97cd3914ebfa0fd6f3440d00686bb79d6 Mon Sep 17 00:00:00 2001 From: FIGBERT Date: Tue, 8 Aug 2023 16:56:57 -0700 Subject: [PATCH] Configure MxID and homeserver in headless startup --- headless/headless.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/headless/headless.go b/headless/headless.go index 38452e8..6f2db6d 100644 --- a/headless/headless.go +++ b/headless/headless.go @@ -9,6 +9,7 @@ import ( "maunium.net/go/mautrix" "maunium.net/go/mautrix/crypto" "maunium.net/go/mautrix/crypto/ssss" + "maunium.net/go/mautrix/id" "maunium.net/go/gomuks/initialize" "maunium.net/go/gomuks/matrix" @@ -16,10 +17,8 @@ import ( ) type HeadlessConfig struct { - OutputDir, - MxID, MxPassword, - KeyPath, KeyPassword, - RecoveryPhrase string + OutputDir, MxPassword, KeyPath, KeyPassword, RecoveryPhrase string + MxID id.UserID } func HeadlessInit(conf HeadlessConfig) error { @@ -39,9 +38,15 @@ func HeadlessInit(conf HeadlessConfig) error { } // login section + _, hs, err := conf.MxID.Parse() + if err != nil { + return err + } + + gmx.Config().HS = hs if err := gmx.Matrix().InitClient(false); err != nil { return err - } else if err = gmx.Matrix().Login(conf.MxID, conf.MxPassword); err != nil { + } else if err = gmx.Matrix().Login(conf.MxID.String(), conf.MxPassword); err != nil { return err }