+ ModResult OnUserPreNick(User* user, const std::string &newnick)
+ {
+ if (!IS_LOCAL(user))
+ return MOD_RES_PASSTHRU;
+
+ if (isdigit(newnick[0])) /* Allow a switch to a UID */
+ return MOD_RES_PASSTHRU;
+
+ if (User::NICKForced.get(user)) /* Allow forced nick changes */
+ return MOD_RES_PASSTHRU;
+
+ if (locked.get(user))
+ {
+ user->WriteNumeric(447, "%s :You cannot change your nickname (your nick is locked)",user->nick.c_str());
+ return MOD_RES_DENY;
+ }
+ return MOD_RES_PASSTHRU;
+ }
+
+ void Prioritize()
+ {
+ Module *nflood = ServerInstance->Modules->Find("m_nickflood.so");
+ ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_BEFORE, &nflood);
+ }
+};