X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommand_parse.cpp;h=c273e0859cef1cb4dfcc7ca3871279613f8a72ef;hb=f087d825a88760d251b8f80b5d50bc98b40fa2ae;hp=4bc09b3f4c80f2259d19ae7c83c494ff78a4398c;hpb=036f62f864411dd5018ec718ec58a9c787cbbcfd;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 4bc09b3f4..c273e0859 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -217,12 +217,15 @@ bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, use { if ((pcnt>=n->second->min_params) && (n->second->source != "")) { - if ((!n->second->flags_needed) || (user->IsModeSet(n->second->flags_needed))) + if (IS_LOCAL(user) && n->second->flags_needed) { - if (n->second->flags_needed) + if (user->IsModeSet(n->second->flags_needed)) { - return ((user->HasPermission(commandname)) || (ServerInstance->ULine(user->server))); + return (user->HasPermission(commandname)); } + } + else + { return true; } } @@ -249,20 +252,29 @@ CmdResult CommandParser::CallHandler(const std::string &commandname,const char** { if (pcnt >= n->second->min_params) { - if ((!n->second->flags_needed) || (user->IsModeSet(n->second->flags_needed))) + bool bOkay = false; + + if (IS_LOCAL(user) && n->second->flags_needed) { - if (n->second->flags_needed) - { - if ((user->HasPermission(commandname)) || (!IS_LOCAL(user))) - { - return n->second->Handle(parameters,pcnt,user); - } - } - else + /* if user is local, and flags are needed .. */ + + if (user->IsModeSet(n->second->flags_needed)) { - return n->second->Handle(parameters,pcnt,user); + /* if user has the flags, and now has the permissions, go ahead */ + if (user->HasPermission(commandname)) + bOkay = true; } } + else + { + /* remote or no flags required anyway */ + bOkay = true; + } + + if (bOkay) + { + return n->second->Handle(parameters,pcnt,user); + } } } return CMD_INVALID; @@ -346,8 +358,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) return; /* - * WARNING: nothing should come after this, as the user may be on a cull list to - * be nuked next loop iteration. be sensible. + * WARNING: be careful, the user may be deleted soon */ CmdResult result = cm->second->Handle(command_p,items,user); @@ -414,7 +425,7 @@ void CommandParser::ProcessBuffer(std::string &buffer,userrec *user) { if (!user->muted) { - ServerInstance->Log(DEBUG,"C[%d] -> :%s %s",user->GetFd(), user->nick, buffer.c_str()); + ServerInstance->Log(DEBUG,"C[%d] I :%s %s",user->GetFd(), user->nick, buffer.c_str()); this->ProcessCommand(user,buffer); } } @@ -598,16 +609,25 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st { userrec* user = NULL; std::string item; + int translations = 0; switch (to) { case TR_NICK: /* Translate single nickname */ + ServerInstance->Log(DEBUG,"TR_NICK"); user = ServerInstance->FindNick(source); if (user) + { + ServerInstance->Log(DEBUG,"Managed UUID"); dest = user->uuid; + translations++; + } else + { + ServerInstance->Log(DEBUG,"Had to use source.. (%s)", source.c_str()); dest = source; + } break; case TR_NICKLIST: { @@ -617,7 +637,10 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st { user = ServerInstance->FindNick(item); if (user) + { dest.append(user->uuid); + translations++; + } else dest.append(source); dest.append(","); @@ -634,7 +657,10 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st { user = ServerInstance->FindNick(item); if (user) + { dest.append(user->uuid); + translations++; + } else dest.append(source); dest.append(" "); @@ -650,5 +676,7 @@ int CommandParser::TranslateUIDs(TranslateType to, const std::string &source, st dest = source; break; } + + return translations; }