#include <string>
#include <sstream>
#include <vector>
-#include <sched.h>
-#ifdef THREADED_DNS
-#include <pthread.h>
-#endif
+#include <algorithm>
#include "users.h"
#include "globals.h"
#include "modules.h"
#include "commands.h"
#include "xline.h"
#include "inspstring.h"
-#include "dnsqueue.h"
#include "helperfuncs.h"
#include "hashcomp.h"
#include "socketengine.h"
while (((para[items] = tokens.GetToken()) != "") && (items < 127))
command_p[items] = para[items++].c_str();
- for (std::string::iterator makeupper = command.begin(); makeupper != command.end(); makeupper++)
- *makeupper = toupper(*makeupper);
+ std::transform(command.begin(), command.end(), command.begin(), ::toupper);
int MOD_RESULT = 0;
FOREACH_RESULT(I_OnPreCommand,OnPreCommand(command,command_p,items,user,false));
{
/* activity resets the ping pending timer */
user->nping = TIME + user->pingmax;
- if (items < cm->second->min_params)
- {
- log(DEBUG,"not enough parameters: %s %s",user->nick,command.c_str());
- WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command.c_str());
- return;
- }
if (cm->second->flags_needed)
{
if (!user->IsModeSet(cm->second->flags_needed))
{
- log(DEBUG,"permission denied: %s %s",user->nick,command.c_str());
WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
return;
}
+ if (!user->HasPermission(command))
+ {
+ WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str());
+ return;
+ }
}
- if ((cm->second->flags_needed) && (!user->HasPermission(command)))
+ if ((user->registered == REG_ALL) && (!*user->oper) && (cm->second->IsDisabled()))
{
- log(DEBUG,"permission denied: %s %s",user->nick,command.c_str());
- WriteServ(user->fd,"481 %s :Permission Denied- Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str());
+ /* command is disabled! */
+ WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command.c_str());
return;
}
- if ((user->registered == 7) && (!*user->oper) && (cm->second->IsDisabled()))
+ if (items < cm->second->min_params)
{
- /* command is disabled! */
- WriteServ(user->fd,"421 %s %s :This command has been disabled.",user->nick,command.c_str());
+ WriteServ(user->fd,"461 %s %s :Not enough parameters.", user->nick, command.c_str());
+ /* If syntax is given, display this as the 461 reply */
+ if ((Config->SyntaxHints) && (cm->second->syntax.length()))
+ WriteServ(user->fd,"304 %s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str());
return;
}
- if ((user->registered == 7) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass))
+ if ((user->registered == REG_ALL) || (cm->second == command_user) || (cm->second == command_nick) || (cm->second == command_pass))
{
/* ikky /stats counters */
cm->second->use_count++;