* ---------------------------------------------------
*/
-using namespace std;
-
#include "inspircd_config.h"
#include "inspircd.h"
-#include "inspircd_io.h"
+#include "configreader.h"
#include <unistd.h>
#include <fcntl.h>
#include <sys/errno.h>
#include <sys/utsname.h>
#include <time.h>
#include <string>
-#ifdef GCC3
-#include <ext/hash_map>
-#else
-#include <hash_map>
-#endif
-#include <map>
#include <sstream>
#include <vector>
-#include <deque>
#include <sched.h>
#ifdef THREADED_DNS
#include <pthread.h>
return 1;
}
-bool CommandParser::IsValidCommand(std::string &commandname, int pcnt, userrec * user)
+bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, userrec * user)
{
nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
{
if ((pcnt>=n->second->min_params) && (n->second->source != "<core>"))
{
- if ((strchr(user->modes,n->second->flags_needed)) || (!n->second->flags_needed))
+ if ((!n->second->flags_needed) || (user->modes[n->second->flags_needed-65]))
{
if (n->second->flags_needed)
{
- return ((user->HasPermission(commandname)) || (is_uline(user->server)))
+ return ((user->HasPermission(commandname)) || (is_uline(user->server)));
}
return true;
}
// calls a handler function for a command
-bool CommandParser::CallHandler(std::string &commandname,char **parameters, int pcnt, userrec *user)
+bool CommandParser::CallHandler(const std::string &commandname,char **parameters, int pcnt, userrec *user)
{
nspace::hash_map<std::string,command_t*>::iterator n = cmdlist.find(commandname);
{
if (pcnt >= n->second->min_params)
{
- if ((strchr(user->modes,n->second->flags_needed)) || (!n->second->flags_needed))
+ if ((!n->second->flags_needed) || (user->modes[n->second->flags_needed-65]))
{
if (n->second->flags_needed)
{
WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command);
return;
}
- if ((!strchr(user->modes,cm->second->flags_needed)) && (cm->second->flags_needed))
+ if (cm->second->flags_needed)
{
- log(DEBUG,"permission denied: %s %s",user->nick,command);
- WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
- cmd_found = 1;
- return;
+ if (!user->modes[cm->second->flags_needed-65])
+ {
+ log(DEBUG,"permission denied: %s %s",user->nick,command);
+ WriteServ(user->fd,"481 %s :Permission Denied- You do not have the required operator privilages",user->nick);
+ cmd_found = 1;
+ return;
+ }
}
if ((cm->second->flags_needed) && (!user->HasPermission(xcommand)))
{
this->CreateCommand(new cmd_server);
this->CreateCommand(new cmd_commands);
}
-