]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanfilter.cpp
The last commit never happened.
[user/henk/code/inspircd.git] / src / modules / m_chanfilter.cpp
index 51bc2092a151b65dbf0aeb6d19db9f862b54bf47..3c16b013d0550aba81666a84608b2fb70331df2a 100644 (file)
@@ -2,20 +2,15 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
 
-using namespace std;
-
 #include <stdio.h>
 #include <string>
 #include <vector>
@@ -75,7 +70,8 @@ class ModuleChanFilter : public Module
                : Module::Module(Me)
        {
                cf = new ChanFilter(ServerInstance);
-               ServerInstance->AddMode(cf, 'g');
+               if (!ServerInstance->AddMode(cf, 'g'))
+                       throw ModuleException("Could not add new modes!");
        }
 
        void Implements(char* List) 
@@ -89,13 +85,16 @@ class ModuleChanFilter : public Module
                cf->DoChannelDelete(chan);
        }
 
-       virtual void OnRehash(const std::string &parameter)
+       virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                cf->DoRehash();
        }
 
        virtual int ProcessMessages(userrec* user,chanrec* chan,std::string &text)
        {
+               if (!IS_LOCAL(user) || CHANOPS_EXEMPT(ServerInstance, 'g') && chan->GetStatus(user) == STATUS_OP)
+                       return 0;
+
                // Create a copy of the string in irc::string
                irc::string line = text.c_str();
 
@@ -113,6 +112,7 @@ class ModuleChanFilter : public Module
                                }
                        }
                }
+
                return 0;
        }