]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Add options:maxtargets that was somehow omitted, fixes bug #400 (Reported by DarkStorm)
[user/henk/code/inspircd.git] / src / command_parse.cpp
index 4e374d622eac7316664c4709022b3eab1d2d13e2..8a6149a2c809352a82d9623d78663025fc180df2 100644 (file)
@@ -134,14 +134,15 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
         */
        irc::commasepstream items1(parameters[splithere]);
        irc::commasepstream items2(parameters[extra]);
-       std::string item("*");
+       std::string extrastuff;
+       std::string item;
        unsigned int max = 0;
 
        /* Attempt to iterate these lists and call the command objech
         * which called us, for every parameter pair until there are
         * no more left to parse.
         */
-       while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets))
+       while (items1.GetToken(item) && (max++ < ServerInstance->Config->MaxTargets))
        {
                if (dupes.find(item.c_str()) == dupes.end())
                {
@@ -150,7 +151,8 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
                        for (int t = 0; (t < pcnt) && (t < MAXPARAMETERS); t++)
                                new_parameters[t] = parameters[t];
 
-                       std::string extrastuff = items2.GetToken();
+                       if (!items2.GetToken(extrastuff))
+                               extrastuff = "";
 
                        new_parameters[splithere] = item.c_str();
                        new_parameters[extra] = extrastuff.c_str();
@@ -175,14 +177,14 @@ int CommandParser::LoopCall(userrec* user, command_t* CommandObj, const char** p
 
        /* Only one commasepstream here */
        irc::commasepstream items1(parameters[splithere]);
-       std::string item("*");
+       std::string item;
        unsigned int max = 0;
 
        /* Parse the commasepstream until there are no tokens remaining.
         * Each token we parse out, call the command handler that called us
         * with it
         */
-       while (((item = items1.GetToken()) != "") && (max++ < ServerInstance->Config->MaxTargets))
+       while (items1.GetToken(item) && (max++ < ServerInstance->Config->MaxTargets))
        {
                if (dupes.find(item.c_str()) == dupes.end())
                {
@@ -325,6 +327,8 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
                        {
                                /* command is disabled! */
                                user->WriteServ("421 %s %s :This command has been disabled.",user->nick,command.c_str());
+                               ServerInstance->SNO->WriteToSnoMask('d', "%s denied for %s (%s@%s)",
+                                               command.c_str(), user->nick, user->ident, user->host);
                                return;
                        }
                        if (items < cm->second->min_params)
@@ -445,7 +449,6 @@ bool CommandParser::CreateCommand(command_t *f, void* so_handle)
 CommandParser::CommandParser(InspIRCd* Instance) : ServerInstance(Instance)
 {
        para.resize(128);
-       this->SetupCommandTable(NULL);
 }
 
 bool CommandParser::FindSym(void** v, void* h)
@@ -525,7 +528,10 @@ const char* CommandParser::LoadCommand(const char* name)
 
        /* Command already exists? Succeed silently - this is needed for REHASH */
        if (RFCCommands.find(name) != RFCCommands.end())
+       {
+               ServerInstance->Log(DEBUG,"Not reloading command %s/%s, it already exists", LIBRARYDIR, name);
                return NULL;
+       }
 
        snprintf(filename, MAXBUF, "%s/%s", LIBRARYDIR, name);
        h = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
@@ -573,7 +579,7 @@ void CommandParser::SetupCommandTable(userrec* user)
                                {
                                        if (user)
                                        {
-                                               user->WriteServ("NOTICE %s :*** Failed to load core command %s: %s", entry->d_name, err);
+                                               user->WriteServ("NOTICE %s :*** Failed to load core command %s: %s", user->nick, entry->d_name, err);
                                        }
                                        else
                                        {