MODS
This commit is contained in:
13
main.go
13
main.go
@@ -24,7 +24,6 @@ import (
|
||||
_ "embed"
|
||||
"encoding/xml"
|
||||
"github.com/kr/pretty"
|
||||
"math/rand/v2"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
@@ -104,18 +103,16 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Put 4 random characters at the end
|
||||
chars := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZλ"
|
||||
str := ""
|
||||
for range 4 {
|
||||
str = str + string(chars[rand.IntN(len(chars))])
|
||||
if loadedConfig.Resource == "" {
|
||||
fmt.Println("Config resource is empty! Generating a random one")
|
||||
loadedConfig.Resource = randomClientResource()
|
||||
}
|
||||
|
||||
config := xmpp.Config{
|
||||
TransportConfiguration: xmpp.TransportConfiguration{
|
||||
Address: loadedConfig.Server,
|
||||
},
|
||||
Jid: loadedConfig.Username + "/lambda." + str,
|
||||
Jid: loadedConfig.Username + "/" + loadedConfig.Resource,
|
||||
Credential: xmpp.Password(loadedConfig.Password),
|
||||
Insecure: loadedConfig.Insecure,
|
||||
// StreamLogger: os.Stdout,
|
||||
@@ -347,6 +344,7 @@ func main() {
|
||||
|
||||
c, err := xmpp.NewClient(&config, router, func(err error) {
|
||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
||||
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -447,6 +445,7 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
connectionStatus.SetText(fmt.Sprintf("Disconnected: %s", err.Error()))
|
||||
connectionIcon.SetFromPaintable(clientAssets["disconnect"])
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user