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