- if (source->GetExt("nick_locked"))
- {
- WriteServ(user->fd,"946 %s %s :This user's nickname is already locked.",user->nick,source->nick);
- return;
- }
- if (Srv->IsNick(std::string(parameters[1])))
+ return CMD_FAILURE;
+ }
+
+ // check if user is locked
+ if (target->GetExt("nick_locked", dummy))
+ {
+ user->WriteNumeric(946, "%s %s :This user's nickname is already locked.",user->nick.c_str(),target->nick.c_str());
+ return CMD_FAILURE;
+ }
+
+ // check nick is valid
+ if (IS_LOCAL(user) && !ServerInstance->IsNick(parameters[1].c_str(), ServerInstance->Config->Limits.NickMax))
+ {
+ return CMD_FAILURE;
+ }
+
+ // let others know
+ ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKLOCK to change and hold "+parameters[0]+" to "+parameters[1]);
+
+ if (!target->ForceNickChange(parameters[1].c_str()))
+ {
+ // ugh, nickchange failed for some reason -- possibly existing nick?
+ if (!target->ForceNickChange(target->uuid.c_str()))