]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nicklock.cpp
Remove m_testcommand too
[user/henk/code/inspircd.git] / src / modules / m_nicklock.cpp
index a16d651e97672725d2777dbf84cb45890f10762a..fe669fdcb41a5f068f5e277d851a852b73e88e97 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -58,17 +58,20 @@ class CommandNicklock : public Command
                                user->WriteServ("NOTICE %s :*** Invalid nickname '%s'", user->nick.c_str(), parameters[1].c_str());
                                return CMD_FAILURE;
                        }
+
+                       user->WriteServ("947 %s %s :Nickname now locked.", user->nick.c_str(), parameters[1].c_str());
                }
 
                /* If we made it this far, extend the user */
                if (target)
                {
+                       // This has to be done *here*, because this metadata must be stored netwide.
                        target->Extend("nick_locked", "ON");
-                       ServerInstance->SNO->WriteToSnoMask('A', user->nick+" used NICKLOCK to change and hold "+target->nick+" to "+parameters[1]);
 
                        /* Only send out nick from local server */
                        if (IS_LOCAL(target))
                        {
+                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used NICKLOCK to change and hold "+target->nick+" to "+parameters[1]);
                                std::string oldnick = user->nick;
                                std::string newnick = target->nick;
                                if (!target->ForceNickChange(parameters[1].c_str()))
@@ -77,7 +80,7 @@ class CommandNicklock : public Command
                                         * tell everybody. Note user is still nick locked on their old
                                         * nick instead.
                                         */
-                                       ServerInstance->SNO->WriteToSnoMask('A', oldnick+" failed nickchange on NICKLOCK (from "+newnick+" to "+parameters[1]+") Locked to "+newnick+" instead");
+                                       ServerInstance->SNO->WriteToSnoMask('a', oldnick+" failed nickchange on NICKLOCK (from "+newnick+" to "+parameters[1]+") Locked to "+newnick+" instead");
                                        ServerInstance->PI->SendSNONotice("A", oldnick+" failed nickchange on NICKLOCK (from "+newnick+" to "+parameters[1]+") Locked to "+newnick+" instead");
                                }
                        }
@@ -125,12 +128,11 @@ class CommandNickunlock : public Command
                        }
                }
 
-               /* If we made it this far, the command is going out on the wire so send local snotice */
-               ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]);
-
                if (target)
                {
                        target->Shrink("nick_locked");
+                       if (IS_LOCAL(target))
+                               ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]);
                        if (IS_LOCAL(user))
                                user->WriteNumeric(945, "%s %s :Nickname now unlocked.",user->nick.c_str(),target->nick.c_str());
                }
@@ -196,7 +198,7 @@ class ModuleNickLock : public Module
        void Prioritize()
        {
                Module *nflood = ServerInstance->Modules->Find("m_nickflood.so");
-               ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIO_BEFORE, &nflood);
+               ServerInstance->Modules->SetPriority(this, I_OnUserPreJoin, PRIORITY_BEFORE, &nflood);
        }
 
        virtual void OnCleanup(int target_type, void* item)