]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_noctcp.cpp
Add comments
[user/henk/code/inspircd.git] / src / modules / m_noctcp.cpp
index cb11dd5ad291aaca860dcffb660a2e228b663825..5407ffb9d254bd9daa6c41de2f32a825fdee2dbd 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
@@ -55,14 +55,12 @@ class ModuleNoCTCP : public Module
        {
                
                nc = new NoCTCP(ServerInstance);
-               if (!ServerInstance->AddMode(nc, 'C'))
+               if (!ServerInstance->Modes->AddMode(nc))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice };
+               ServerInstance->Modules->Attach(eventlist, this, 2);
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
-       }
 
        virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
@@ -74,6 +72,12 @@ class ModuleNoCTCP : public Module
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
                        Channel* c = (Channel*)dest;
+                       
+                       if (CHANOPS_EXEMPT(ServerInstance, 'C') && c->GetStatus(user) == STATUS_OP)
+                       {
+                               return 0;
+                       }
+                       
                        if (c->IsModeSet('C'))
                        {
                                if ((text.length()) && (text[0] == '\1'))