+
+ // 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,target->nick);
+ return CMD_FAILURE;
+ }
+
+ // check nick is valid
+ if (!ServerInstance->IsNick(parameters[1]))
+ {
+ 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]))
+ {
+ // ugh, nickchange failed for some reason -- possibly existing nick?
+ User::QuitUser(ServerInstance, target, "Nickname collision");
+ }
+
+ // give them a lock flag
+ target->Extend("nick_locked", "ON");
+
+ /* route */
+ return CMD_SUCCESS;