diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/cmd_modules.cpp | 2 | ||||
-rw-r--r-- | src/cmd_notice.cpp | 2 | ||||
-rw-r--r-- | src/cmd_privmsg.cpp | 2 | ||||
-rw-r--r-- | src/cmd_stats.cpp | 4 | ||||
-rw-r--r-- | src/cmd_trace.cpp | 2 | ||||
-rw-r--r-- | src/cmd_userhost.cpp | 4 | ||||
-rw-r--r-- | src/cmd_who.cpp | 10 | ||||
-rw-r--r-- | src/cmd_whois.cpp | 6 | ||||
-rw-r--r-- | src/cmd_whowas.cpp | 4 | ||||
-rw-r--r-- | src/command_parse.cpp | 2 | ||||
-rw-r--r-- | src/mode.cpp | 6 | ||||
-rw-r--r-- | src/users.cpp | 12 |
13 files changed, 30 insertions, 28 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index e4b58a1a4..2793843c7 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -307,7 +307,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo { return chanrec::ForceChan(Instance, Ptr, user, privs); } - else if (*user->oper) + else if (IS_OPER(user)) { /* Oper allows extension up to the OperMaxchans value */ if (user->chans.size() < Instance->Config->OperMaxChans) diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp index 6f7633cc9..916f480fd 100644 --- a/src/cmd_modules.cpp +++ b/src/cmd_modules.cpp @@ -60,7 +60,7 @@ CmdResult cmd_modules::Handle (const char** parameters, int pcnt, userrec *user) if (!flagstate[0]) strcpy(flagstate," <no flags>"); strlcpy(modulename,ServerInstance->Config->module_names[i].c_str(),256); - if (*user->oper) + if (IS_OPER(user)) { user->WriteServ("900 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,ServerInstance->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2); } diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp index b4e4dd7c4..d2834d2ff 100644 --- a/src/cmd_notice.cpp +++ b/src/cmd_notice.cpp @@ -35,7 +35,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) return CMD_SUCCESS; - if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server)))) + if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server))) { int MOD_RESULT = 0; std::string temp = parameters[1]; diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index b0662cfec..1614a62dc 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -37,7 +37,7 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) return CMD_SUCCESS; - if ((parameters[0][0] == '$') && ((*user->oper) || (ServerInstance->ULine(user->server)))) + if ((parameters[0][0] == '$') && (IS_OPER(user) || ServerInstance->ULine(user->server))) { int MOD_RESULT = 0; std::string temp = parameters[1]; diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 7a232e033..24fa7e7ec 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -43,7 +43,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis { std::string sn = ServerInstance->Config->ServerName; - if ((*ServerInstance->Config->UserStats) && (!*user->oper) && (!strchr(ServerInstance->Config->UserStats,statschar))) + if ((*ServerInstance->Config->UserStats) && !IS_OPER(user) && !strchr(ServerInstance->Config->UserStats,statschar)) { results.push_back(sn+std::string(" 481 ")+user->nick+" :Permission denied - STATS "+statschar+" is oper-only"); return; @@ -125,7 +125,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis int idx = 0; for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++) { - if ((*i->second->oper) && (!ServerInstance->ULine(i->second->server))) + if (IS_OPER(i->second) && !ServerInstance->ULine(i->second->server)) { results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+ (IS_LOCAL(i->second) ? ConvToStr(ServerInstance->Time() - i->second->idle_lastmsg) + " secs" : "unavailable")); diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp index 1c968c8a8..158238579 100644 --- a/src/cmd_trace.cpp +++ b/src/cmd_trace.cpp @@ -30,7 +30,7 @@ CmdResult cmd_trace::Handle (const char** parameters, int pcnt, userrec *user) { if (i->second->registered == REG_ALL) { - if (*i->second->oper) + if (IS_OPER(i->second)) { user->WriteServ("205 %s :Oper 0 %s",user->nick,i->second->nick); } diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp index 363ba611c..6f31ad6a7 100644 --- a/src/cmd_userhost.cpp +++ b/src/cmd_userhost.cpp @@ -35,7 +35,7 @@ CmdResult cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user { retbuf = retbuf + " "; - if (*u->oper) + if (IS_OPER(u)) { retbuf = retbuf + "*=+"; } @@ -46,7 +46,7 @@ CmdResult cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user retbuf = retbuf + u->ident + "@"; - if (*user->oper) + if (IS_OPER(user)) { retbuf = retbuf + u->host; } diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index df209991a..bdbca597e 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -123,7 +123,7 @@ bool cmd_who::CanView(chanrec* chan, userrec* user) /* Execute items in fastest-to-execute first order */ /* Opers see all */ - if (*user->oper) + if (IS_OPER(user)) return true; else if (!chan->IsModeSet('s') && !chan->IsModeSet('p')) return true; @@ -143,7 +143,7 @@ void cmd_who::SendWhoLine(userrec* user, const std::string &initial, chanrec* ch return; std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " + - ((*ServerInstance->Config->HideWhoisServer && !*user->oper) ? ServerInstance->Config->HideWhoisServer : u->server) + + ((*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) ? ServerInstance->Config->HideWhoisServer : u->server) + " " + u->nick + " "; /* away? */ @@ -157,7 +157,7 @@ void cmd_who::SendWhoLine(userrec* user, const std::string &initial, chanrec* ch } /* oper? */ - if (*u->oper) + if (IS_OPER(u)) { wholine.append("*"); } @@ -212,11 +212,11 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) opt_viewopersonly = true; break; case 'h': - if (*user->oper) + if (IS_OPER(user)) opt_showrealhost = true; break; case 'u': - if (*user->oper) + if (IS_OPER(user)) opt_unlimit = true; break; case 'r': diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index 7164bbb98..43b39108b 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -30,7 +30,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo if (dest->registered == REG_ALL) { ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); - if ((user == dest) || (*user->oper)) + if (user == dest || IS_OPER(user)) { ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick, dest->nick, dest->ident, dest->host, dest->GetIPString()); } @@ -48,7 +48,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo ServerInstance->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick, dest->nick, cl.c_str()); } } - if (*ServerInstance->Config->HideWhoisServer && !(*user->oper)) + if (*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) { ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick, dest->nick, ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network); } @@ -62,7 +62,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick, dest->nick, dest->awaymsg); } - if (*dest->oper) + if (IS_OPER(dest)) { ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),irc::Spacify(dest->oper), ServerInstance->Config->Network); } diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp index 46228f0dc..4886c9800 100644 --- a/src/cmd_whowas.cpp +++ b/src/cmd_whowas.cpp @@ -65,10 +65,10 @@ CmdResult cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user) user->WriteServ("314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos); - if(*user->oper) + if (IS_OPER(user)) user->WriteServ("379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host); - if(*ServerInstance->Config->HideWhoisServer && !(*user->oper)) + if (*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], ServerInstance->Config->HideWhoisServer, b); else user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], u->server, b); diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 6fdf1800c..ae580c6a7 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -332,7 +332,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) return; } } - if ((user->registered == REG_ALL) && (!*user->oper) && (cm->second->IsDisabled())) + if ((user->registered == REG_ALL) && (!IS_OPER(user)) && (cm->second->IsDisabled())) { /* command is disabled! */ user->WriteServ("421 %s %s :This command has been disabled.",user->nick,command.c_str()); diff --git a/src/mode.cpp b/src/mode.cpp index b98316597..2c817e685 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -252,11 +252,11 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec return; } - if ((targetuser == user) || (*user->oper)) + if ((targetuser == user) || (IS_OPER(user))) { /* Display user's current mode string */ user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes()); - if (*targetuser->oper) + if (IS_OPER(targetuser)) user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); return; } @@ -532,7 +532,7 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool /* It's an oper only mode, check if theyre an oper. If they arent, * eat any parameter that came with the mode, and continue to next */ - if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!*user->oper)) + if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!IS_OPER(user))) { user->WriteServ("481 %s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick, adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", diff --git a/src/users.cpp b/src/users.cpp index e9b61f67f..e404d9107 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -553,7 +553,7 @@ bool userrec::HasPermission(const std::string &command) return true; // are they even an oper at all? - if (*this->oper) + if (IS_OPER(this)) { opertype_t::iterator iter_opertype = ServerInstance->Config->opertypes.find(this->oper); if (iter_opertype != ServerInstance->Config->opertypes.end()) @@ -800,10 +800,13 @@ void userrec::UnOper() { try { - if (*this->oper) + if (IS_OPER(this)) { + // unset their oper type (what IS_OPER checks), and remove +o *this->oper = 0; this->modes[UM_OPERATOR] = 0; + + // remove them from the opers list. for (std::vector<userrec*>::iterator a = ServerInstance->all_opers.begin(); a < ServerInstance->all_opers.end(); a++) { if (*a == this) @@ -1579,8 +1582,7 @@ void userrec::WriteCommonExcept(const std::string &text) void userrec::WriteWallOps(const std::string &text) { - /* Does nothing if theyre not opered */ - if ((!*this->oper) && (IS_LOCAL(this))) + if (!IS_OPER(this) && IS_LOCAL(this)) return; std::string wallop = "WALLOPS :"; @@ -1757,7 +1759,7 @@ std::string userrec::ChannelList(userrec* source) * If the channel is NOT private/secret OR the user shares a common channel * If the user is an oper, and the <options:operspywhois> option is set. */ - if ((source == this) || (*source->oper && ServerInstance->Config->OperSpyWhois) || (((!i->first->modes[CM_PRIVATE]) && (!i->first->modes[CM_SECRET])) || (i->first->HasUser(source)))) + if ((source == this) || (IS_OPER(source) && ServerInstance->Config->OperSpyWhois) || (((!i->first->modes[CM_PRIVATE]) && (!i->first->modes[CM_SECRET])) || (i->first->HasUser(source)))) { list.append(i->first->GetPrefixChar(this)).append(i->first->name).append(" "); } |