Allow localpart as username

If username is not a JID assume it is the local part and append an @
and the server domain.
passwordmanager
Martin Dosch 4 years ago
parent 76a747efb4
commit ce11b65376

@ -136,6 +136,19 @@ func parseConfig(configPath string) (configuration, error) {
}
file.Close()
// Check if the username is a valid JID
output.username, err = MarshalJID(output.username)
if err != nil {
// Check whether only the local part was used by appending an @ and the
// server part.
output.username = output.username + "@" + output.jserver
// Check if the username is a valid JID now
output.username, err = MarshalJID(output.username)
if err != nil {
return output, errors.New("invalid username/JID: " + output.username)
}
}
return output, err
}

Loading…
Cancel
Save