X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommand_parse.cpp;h=57a86b0cde18b1e0a42ffd0e87c08118aef2b9da;hb=dd36852a52e8541306b76c5b88bce8ab9b36654c;hp=5492e26b5d54717ca44799b40f4cb2d389ab47cd;hpb=393c1afdd7bfede2b7f489d7ceb000c909c0fccf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 5492e26b5..57a86b0cd 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * InspIRCd: (C) 2002-2008 InspIRCd Development Team * See: http://www.inspircd.org/wiki/index.php/Credits * * This program is free but copyrighted software; see @@ -27,10 +27,10 @@ #include #endif -int InspIRCd::OperPassCompare(const char* data,const char* input, int tagnumber) +int InspIRCd::PassCompare(Extensible* ex, const char* data,const char* input, const char* hashtype) { int MOD_RESULT = 0; - FOREACH_RESULT_I(this,I_OnOperCompare,OnOperCompare(data, input, tagnumber)) + FOREACH_RESULT_I(this,I_OnPassCompare,OnPassCompare(ex, data, input, hashtype)) if (MOD_RESULT == 1) return 0; if (MOD_RESULT == -1) @@ -48,7 +48,7 @@ int InspIRCd::OperPassCompare(const char* data,const char* input, int tagnumber) * The second version is much simpler and just has the one stream to read, and is used in NAMES, WHOIS, PRIVMSG etc. * Both will only parse until they reach ServerInstance->Config->MaxTargets number of targets, to stop abuse via spam. */ -int CommandParser::LoopCall(User* user, Command* CommandObj, const char** parameters, int pcnt, unsigned int splithere, unsigned int extra) +int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere, unsigned int extra) { /* First check if we have more than one item in the list, if we don't we return zero here and the handler * which called us just carries on as it was. @@ -97,7 +97,7 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char** parame return 1; } -int CommandParser::LoopCall(User* user, Command* CommandObj, const char** parameters, int pcnt, unsigned int splithere) +int CommandParser::LoopCall(User* user, Command* CommandObj, const char* const* parameters, int pcnt, unsigned int splithere) { /* First check if we have more than one item in the list, if we don't we return zero here and the handler * which called us just carries on as it was. @@ -127,8 +127,6 @@ int CommandParser::LoopCall(User* user, Command* CommandObj, const char** parame new_parameters[splithere] = item.c_str(); - parameters[splithere] = item.c_str(); - /* Execute the command handler over and over. If someone pulls our user * record out from under us (e.g. if we /kill a comma sep list, and we're * in that list ourselves) abort if we're gone. @@ -180,7 +178,7 @@ Command* CommandParser::GetHandler(const std::string &commandname) // calls a handler function for a command -CmdResult CommandParser::CallHandler(const std::string &commandname,const char** parameters, int pcnt, User *user) +CmdResult CommandParser::CallHandler(const std::string &commandname,const char* const* parameters, int pcnt, User *user) { Commandable::iterator n = cmdlist.find(commandname); @@ -292,8 +290,11 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) if (cm == cmdlist.end()) { + if (user->registered == REG_ALL) + { + user->WriteServ("421 %s %s :Unknown command",user->nick,command.c_str()); + } ServerInstance->stats->statsUnknown++; - user->WriteServ("421 %s %s :Unknown command",user->nick,command.c_str()); return true; } @@ -351,7 +352,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) cm->second->total_bytes += cmd.length(); /* module calls too */ - int MOD_RESULT = 0; + MOD_RESULT = 0; FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,true,cmd)); if (MOD_RESULT == 1) return do_more; @@ -410,12 +411,10 @@ bool CommandParser::ProcessBuffer(std::string &buffer,User *user) if (buffer.length()) { - if (!user->muted) - { - ServerInstance->Log(DEBUG,"C[%d] I :%s %s",user->GetFd(), user->nick, buffer.c_str()); - return this->ProcessCommand(user,buffer); - } + ServerInstance->Logs->Log("USERINPUT", DEBUG,"C[%d] I :%s %s",user->GetFd(), user->nick, buffer.c_str()); + return this->ProcessCommand(user,buffer); } + return true; } @@ -499,13 +498,13 @@ bool CommandParser::ReloadCommand(const char* cmd, User* user) return false; } -CmdResult cmd_reload::Handle(const char** parameters, int /* pcnt */, User *user) +CmdResult cmd_reload::Handle(const char* const* parameters, int /* pcnt */, User *user) { user->WriteServ("NOTICE %s :*** Reloading command '%s'",user->nick, parameters[0]); if (ServerInstance->Parser->ReloadCommand(parameters[0], user)) { user->WriteServ("NOTICE %s :*** Successfully reloaded command '%s'", user->nick, parameters[0]); - ServerInstance->WriteOpers("*** RELOAD: %s reloaded the '%s' command.", user->nick, parameters[0]); + ServerInstance->SNO->WriteToSnoMask('A', "RELOAD: %s reloaded the '%s' command.", user->nick, parameters[0]); return CMD_SUCCESS; } else