mirror of
https://salsa.debian.org/mdosch/go-sendxmpp
synced 2024-11-15 00:15:10 +00:00
Allow localpart as username
If username is not a JID assume it is the local part and append an @ and the server domain.
This commit is contained in:
parent
76a747efb4
commit
ce11b65376
@ -136,6 +136,19 @@ func parseConfig(configPath string) (configuration, error) {
|
|||||||
}
|
}
|
||||||
file.Close()
|
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
|
return output, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user