]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanprotect.cpp
Same fixes to make this module scale much better. Dont connect on each query, keep...
[user/henk/code/inspircd.git] / src / modules / m_chanprotect.cpp
index 6df309cde100893f93373f4da10760e634f379da..82c4e6940c330e6f8022d2c06cf763a811825c56 100644 (file)
@@ -66,8 +66,8 @@ class FounderProtectBase
        {
                CUList* cl = channel->GetUsers();
                std::string item = extend + std::string(channel->name);
-               const char* mode_junk[MAXMODES+2];
-               mode_junk[0] = channel->name;
+               std::vector<std::string> mode_junk;
+               mode_junk.push_back(channel->name);
                irc::modestacker modestack(false);
                std::deque<std::string> stackresult;                            
 
@@ -89,9 +89,9 @@ class FounderProtectBase
                {
                        for (size_t j = 0; j < stackresult.size(); j++)
                        {
-                               mode_junk[j+1] = stackresult[j].c_str();
+                               mode_junk.push_back(stackresult[j]);
                        }
-                       MyInstance->SendMode(mode_junk, stackresult.size() + 1, MyInstance->FakeClient);
+                       MyInstance->SendMode(mode_junk, MyInstance->FakeClient);
                }
        }
 
@@ -354,13 +354,13 @@ class ModuleChanProtect : public Module
                APrefix = apre.empty() ? 0 : apre[0];
 
                if ((APrefix && QPrefix) && APrefix == QPrefix)
-                       throw CoreException("What the smeg, why are both your +q and +a prefixes the same character?");
+                       throw ModuleException("What the smeg, why are both your +q and +a prefixes the same character?");
 
                if (cp && ServerInstance->Modes->FindPrefix(APrefix) == cp)
-                       throw CoreException("Looks like the +a prefix you picked for m_chanprotect is already in use. Pick another.");
+                       throw ModuleException("Looks like the +a prefix you picked for m_chanprotect is already in use. Pick another.");
 
                if (cf && ServerInstance->Modes->FindPrefix(QPrefix) == cf)
-                       throw CoreException("Looks like the +q prefix you picked for m_chanprotect is already in use. Pick another.");
+                       throw ModuleException("Looks like the +q prefix you picked for m_chanprotect is already in use. Pick another.");
 
                DeprivSelf = Conf.ReadFlag("options","deprotectself",0);
                DeprivOthers = Conf.ReadFlag("options","deprotectothers",0);