X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommand_parse.cpp;h=0f93e6f53d83e0ad9978d4b215f8f0ff11018a05;hb=ffc039651676e0f679726b15fac4bf133e7e5bc2;hp=5b8b5b7f95e2992161916c80348d8394e198a914;hpb=61185fc62b7d3d05e33a116fca26aa9dc72ab691;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 5b8b5b7f9..0f93e6f53 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -11,10 +11,9 @@ * --------------------------------------------------- */ -/* $Core: libIRCDcommand_parse */ +/* $Core */ #include "inspircd.h" -#include "wildcard.h" #include "xline.h" #include "socketengine.h" #include "socket.h" @@ -291,7 +290,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) { if (user->registered == REG_ALL) { - user->WriteNumeric(421, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); } ServerInstance->stats->statsUnknown++; return true; @@ -315,33 +314,42 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) { if (!user->IsModeSet(cm->second->flags_needed)) { - user->WriteNumeric(481, "%s :Permission Denied - You do not have the required operator privileges",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - You do not have the required operator privileges",user->nick.c_str()); return do_more; } if (!user->HasPermission(command)) { - user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to command %s",user->nick.c_str(),user->oper.c_str(),command.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to command %s",user->nick.c_str(),user->oper.c_str(),command.c_str()); return do_more; } } if ((user->registered == REG_ALL) && (!IS_OPER(user)) && (cm->second->IsDisabled())) { /* command is disabled! */ - user->WriteNumeric(421, "%s %s :This command has been disabled.",user->nick.c_str(),command.c_str()); + if (ServerInstance->Config->DisabledDontExist) + { + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); + } + else + { + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :This command has been disabled.", + user->nick.c_str(), command.c_str()); + } + ServerInstance->SNO->WriteToSnoMask('d', "%s denied for %s (%s@%s)", command.c_str(), user->nick.c_str(), user->ident.c_str(), user->host.c_str()); return do_more; } if (command_p.size() < cm->second->min_params) { - user->WriteNumeric(461, "%s %s :Not enough parameters.", user->nick.c_str(), command.c_str()); + user->WriteNumeric(ERR_NEEDMOREPARAMS, "%s %s :Not enough parameters.", user->nick.c_str(), command.c_str()); if ((ServerInstance->Config->SyntaxHints) && (user->registered == REG_ALL) && (cm->second->syntax.length())) - user->WriteNumeric(304, "%s :SYNTAX %s %s", user->nick.c_str(), cm->second->command.c_str(), cm->second->syntax.c_str()); + user->WriteNumeric(RPL_SYNTAX, "%s :SYNTAX %s %s", user->nick.c_str(), cm->second->command.c_str(), cm->second->syntax.c_str()); return do_more; } if ((user->registered != REG_ALL) && (!cm->second->WorksBeforeReg())) { - user->WriteNumeric(451, "%s :You have not registered",command.c_str()); + user->WriteNumeric(ERR_NOTREGISTERED, "%s :You have not registered",command.c_str()); return do_more; } else @@ -545,7 +553,7 @@ void CommandParser::SetupCommandTable(User* user) dirent* entry = NULL; while (0 != (entry = readdir(library))) { - if (match(entry->d_name, "cmd_*.so")) + if (InspIRCd::Match(entry->d_name, "cmd_*.so")) { if (!user) {