]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_servprotect.cpp
YAY for LDAP oper blocks! :D
[user/henk/code/inspircd.git] / src / modules / m_servprotect.cpp
index d1ea08c7322a878c1c0770a853af6dac0d38e77f..e0ea6911c3cc258873953017e842e5bfc03a713b 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -28,7 +28,7 @@ class ServProtectMode : public ModeHandler
  public:
        ServProtectMode(InspIRCd* Instance) : ModeHandler(Instance, 'k', 0, 0, false, MODETYPE_USER, true) { }
 
-       ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
        {
                return MODEACTION_DENY;
        }
@@ -46,19 +46,17 @@ class ModuleServProtectMode : public Module
        {
                
                bm = new ServProtectMode(ServerInstance);
-               if (!ServerInstance->AddMode(bm, 'k'))
+               if (!ServerInstance->Modes->AddMode(bm))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnWhois, I_OnKill, I_OnWhoisLine };
+               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnWhois] = List[I_OnKill] = List[I_OnWhoisLine] = 1;
-       }
        
        virtual ~ModuleServProtectMode()
        {
                ServerInstance->Modes->DelMode(bm);
-               DELETE(bm);
+               delete bm;
        }
        
        virtual Version GetVersion()
@@ -66,7 +64,7 @@ class ModuleServProtectMode : public Module
                return Version(1,1,0,0,VF_COMMON,API_VERSION);
        }
 
-       virtual void OnWhois(userrec* src, userrec* dst)
+       virtual void OnWhois(User* src, User* dst)
        {
                if (dst->IsModeSet('k'))
                {
@@ -74,7 +72,7 @@ class ModuleServProtectMode : public Module
                }
        }
 
-       virtual int OnKill(userrec* src, userrec* dst, const std::string &reason)
+       virtual int OnKill(User* src, User* dst, const std::string &reason)
        {
                if (src == NULL)
                        return 0;
@@ -82,13 +80,13 @@ class ModuleServProtectMode : public Module
                if (dst->IsModeSet('k'))
                {
                        src->WriteServ("485 %s :You are not allowed to kill %s Services!", src->nick, ServerInstance->Config->Network);
-                       ServerInstance->WriteOpers("*** "+std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")");
+                       ServerInstance->SNO->WriteToSnoMask('A', std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")");
                        return 1;
                }
                return 0;
        }
 
-       virtual int OnWhoisLine(userrec* src, userrec* dst, int &numeric, std::string &text)
+       virtual int OnWhoisLine(User* src, User* dst, int &numeric, std::string &text)
        {
                return ((src != dst) && (numeric == 319) && dst->IsModeSet('k'));
        }