]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcaps.cpp
Remove some debug (im on a crusade to make debug mode useful, but at the same time...
[user/henk/code/inspircd.git] / src / modules / m_blockcaps.cpp
index ecccf3534a98f275302bf28a1a1b19ab4ac1e2e2..058336fb37f1c3aeacbabb4a9b4ef2f3f1f3056c 100644 (file)
@@ -59,9 +59,10 @@ public:
        
        ModuleBlockCAPS(InspIRCd* Me) : Module::Module(Me)
        {
-               OnRehash("");
+               OnRehash(NULL,"");
                bc = new BlockCaps(ServerInstance);
-               ServerInstance->AddMode(bc, 'P');
+               if (!ServerInstance->AddMode(bc, 'P'))
+                       throw ModuleException("Could not add new modes!");
        }
 
        void Implements(char* List)
@@ -69,7 +70,7 @@ public:
                List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = List[I_OnRehash] = 1;
        }
 
-       virtual void OnRehash(const std::string &param)
+       virtual void OnRehash(userrec* user, const std::string &param)
        {
                ReadConf();
        }
@@ -86,13 +87,12 @@ public:
                        if (c->IsModeSet('P'))
                        {
                                int caps = 0;
-                               const char* i = text.c_str();
-                               for (; *i; i++)
+                               for (std::string::iterator i = text.begin(); i != text.end(); i++)
                                {
                                        if ( (*i >= 'A') && (*i <= 'Z'))
                                                caps++;
                                }
-                               if ( (caps * 100 / text.size()) > percent )
+                               if ( (caps * 100 / text.size()) >= percent )
                                {
                                        user->WriteServ( "404 %s %s :Can't send all-CAPS to channel (+P set)", user->nick, c->name);
                                        return 1;