Only update realname if specified in "user udpate"

This will allow adding more flags.
This commit is contained in:
Simon Ser 2021-06-28 16:40:49 +02:00
parent a14f646135
commit f8e853fab1

View File

@ -788,15 +788,18 @@ func handleUserCreate(dc *downstreamConn, params []string) error {
}
func handleUserUpdate(dc *downstreamConn, params []string) error {
var realname *string
fs := newFlagSet()
realname := fs.String("realname", "", "")
fs.Var(stringPtrFlag{&realname}, "realname", "")
if err := fs.Parse(params); err != nil {
return err
}
if err := dc.user.updateRealname(*realname); err != nil {
return err
if realname != nil {
if err := dc.user.updateRealname(*realname); err != nil {
return err
}
}
sendServicePRIVMSG(dc, fmt.Sprintf("updated user %q", dc.user.Username))