]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/command_parse.cpp
Tweaks to closed socket detection
[user/henk/code/inspircd.git] / src / command_parse.cpp
index e5fc8fd7d9b34575b699f6d6cb92ed0de468bf37..18915b8194d9edd5ac0fdc4c9e0ad477277b25a2 100644 (file)
@@ -304,6 +304,11 @@ void CommandParser::CallHandler(std::string &commandname,char **parameters, int
                                        {
                                                n->second->Handle(parameters,pcnt,user);
                                        }
+                                       else
+                                       {
+                                               if (!IS_LOCAL(user))
+                                                       WriteOpers("*** \2WARNING\2: Command '%s' not allowed for oper '%s', dropped.",commandname.c_str(),user->nick);
+                                       }
                                }
                                else
                                {
@@ -582,6 +587,8 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
                        {
                                log(DEBUG,"permission denied: %s %s",user->nick,command);
                                WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command);
+                               if (!IS_LOCAL(user))
+                                       WriteOpers("*** \2WARNING\2: Command '%s' not allowed for oper '%s', dropped.",command,user->nick);
                                cmd_found = 1;
                                return;
                        }
@@ -596,14 +603,12 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd)
                                        return;
                                }
                        }
-                       if ((user->registered == 7) && (!strchr(user->modes,'o')))
+                       if ((user->registered == 7) && (!*user->oper) && (*Config->DisabledCommands))
                        {
                                std::stringstream dcmds(Config->DisabledCommands);
-                               while (!dcmds.eof())
+                               std::string thiscmd;
+                               while (dcmds >> thiscmd)
                                {
-                                       std::string thiscmd;
-                                       dcmds >> thiscmd;
-
                                        if (!strcasecmp(thiscmd.c_str(),command))
                                        {
                                                // command is disabled!
@@ -744,9 +749,13 @@ void CommandParser::ProcessBuffer(const char* cmdbuf,userrec *user)
 bool CommandParser::CreateCommand(command_t *f)
 {
        /* create the command and push it onto the table */
-       cmdlist[f->command] = f;
-       log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params);
-       return true;
+       if (cmdlist.find(f->command) == cmdlist.end())
+       {
+               cmdlist[f->command] = f;
+               log(DEBUG,"Added command %s (%lu parameters)",f->command.c_str(),(unsigned long)f->min_params);
+               return true;
+       }
+       else return false;
 }
 
 CommandParser::CommandParser()