Simplify connection code.

errwrp
Martin Dosch 1 year ago
parent 56b8d38de9
commit 28521a16aa
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -25,22 +25,16 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
// Use StartTLS
options.NoTLS = true
options.StartTLS = true
options.Host = net.JoinHostPort(adr.Target, fmt.Sprint(adr.Port))
// Connect to server
client, err := options.NewClient()
if err == nil {
return client, nil
}
} else if adr.Type == "xmpps-client" {
// Use direct TLS
options.NoTLS = false
options.StartTLS = false
options.Host = net.JoinHostPort(adr.Target, fmt.Sprint(adr.Port))
// Connect to server
client, err := options.NewClient()
if err == nil {
return client, nil
}
}
options.Host = net.JoinHostPort(adr.Target, fmt.Sprint(adr.Port))
// Connect to server
client, err := options.NewClient()
if err == nil {
return client, nil
}
}
}

Loading…
Cancel
Save