]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nicklock.cpp
Remove an extern, partly because it's unused, partly because it then gets shadowed...
[user/henk/code/inspircd.git] / src / modules / m_nicklock.cpp
index 731704d6850c9ddeb25e46c83739dee503698a65..cd36f17475535c049d0fb001771ad290ba7929c6 100644 (file)
@@ -26,7 +26,7 @@ using namespace std;
 
 /* $ModDesc: Provides the NICKLOCK command, allows an oper to chage a users nick and lock them to it until they quit */
 
-Server *Srv;
+static Server *Srv;
 
 class cmd_nicklock : public command_t
 {
@@ -110,10 +110,10 @@ class ModuleNickLock : public Module
 
        void Implements(char* List)
        {
-               List[I_OnUserPreNick] = List[I_OnUserQuit] = 1;
+               List[I_OnUserPreNick] = List[I_OnUserQuit] = List[I_OnCleanup] = 1;
        }
 
-       virtual int OnUserPreNick(userrec* user, std::string newnick)
+       virtual int OnUserPreNick(userrec* user, const std::string &newnick)
        {
                if (user->GetExt("nick_locked"))
                {
@@ -123,11 +123,19 @@ class ModuleNickLock : public Module
                return 0;
        }
 
-        virtual void OnUserQuit(userrec* user, std::string reason)
-        {
-                user->Shrink("nick_locked");
-        }
+       virtual void OnUserQuit(userrec* user, const std::string &reason)
+       {
+               user->Shrink("nick_locked");
+       }
 
+       virtual void OnCleanup(int target_type, void* item)
+       {
+               if(target_type == TYPE_USER)
+               {
+                       userrec* user = (userrec*)item;
+                       user->Shrink("nick_locked");
+               }
+       }
 };
 
 // stuff down here is the module-factory stuff. For basic modules you can ignore this.