diff --git a/go-sendxmpp.go b/go-sendxmpp.go index 1e11d63..bde8688 100644 --- a/go-sendxmpp.go +++ b/go-sendxmpp.go @@ -260,8 +260,8 @@ func main() { recipients[i] = validatedJid } - // Read configuration file if user, server or password is not specified. - if *flagUser == "" || *flagServer == "" || *flagPassword == "" { + // Read configuration file if user or password is not specified. + if *flagUser == "" || *flagPassword == "" { // Read configuration from file. config, err := parseConfig(*flagFile) if err != nil { @@ -286,6 +286,11 @@ func main() { server = *flagServer } + // Use the JIDs server part if no server is specified. + if server == "" { + server = strings.Split(user, "@")[1] + } + // Overwrite password if specified via command line flag. if *flagPassword != "" { password = *flagPassword