diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-15 19:23:01 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-02-15 19:23:01 +0000 |
commit | feaf72ecb48470114fbe3f3058b5f4b9622b88a5 (patch) | |
tree | 838377c1155b6fdb00460d6e52ffcb4bdf17f053 | |
parent | d715c1936e96ce05d9cc4eea2fd4afab3ad02539 (diff) |
Removed a whole lot of strchr's looking for mode +o where we can do if *user->oper
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3221 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/channels.cpp | 2 | ||||
-rw-r--r-- | src/cmd_modules.cpp | 2 | ||||
-rw-r--r-- | src/cmd_oper.cpp | 2 | ||||
-rw-r--r-- | src/cmd_stats.cpp | 2 | ||||
-rw-r--r-- | src/cmd_trace.cpp | 2 | ||||
-rw-r--r-- | src/cmd_who.cpp | 6 | ||||
-rw-r--r-- | src/command_parse.cpp | 2 | ||||
-rw-r--r-- | src/commands.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_nonicks.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_operchans.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_operlevels.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_override.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_restrictchans.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_restrictmsg.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_userip.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 2 |
16 files changed, 21 insertions, 28 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index ec1be82cd..8e5917d85 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -427,7 +427,7 @@ chanrec* add_channel(userrec *user, const char* cn, const char* key, bool overri user->chans.push_back(a); return c; } - else if (strchr(user->modes,'o')) + else if (*user->oper) { /* Oper allows extension up to the OPERMAXCHANS value */ if (user->chans.size() < OPERMAXCHANS) diff --git a/src/cmd_modules.cpp b/src/cmd_modules.cpp index 460290edc..0a7108267 100644 --- a/src/cmd_modules.cpp +++ b/src/cmd_modules.cpp @@ -96,7 +96,7 @@ void cmd_modules::Handle (char **parameters, int pcnt, userrec *user) if (!flagstate[0]) strcpy(flagstate," <no flags>"); strlcpy(modulename,Config->module_names[i].c_str(),256); - if (strchr(user->modes,'o')) + if (*user->oper) { if ((pcnt >= 2) && (!strcasecmp(parameters[0],"debug"))) { diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp index 8e57329d4..435e37e59 100644 --- a/src/cmd_oper.cpp +++ b/src/cmd_oper.cpp @@ -125,7 +125,7 @@ void cmd_oper::Handle (char **parameters, int pcnt, userrec *user) /* correct oper credentials */ WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s",user->nick,user->ident,user->host,OperType); WriteServ(user->fd,"381 %s :You are now an IRC operator of type %s",user->nick,OperType); - if (!strchr(user->modes,'o')) + if (!*user->oper) { strcat(user->modes,"o"); WriteServ(user->fd,"MODE %s :+o",user->nick); diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 98d3987e7..d784b02f6 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -136,7 +136,7 @@ void cmd_stats::Handle (char **parameters, int pcnt, userrec *user) int idx = 0; for (user_hash::iterator i = clientlist.begin(); i != clientlist.end(); i++) { - if (strchr(i->second->modes,'o')) + if (*i->second->oper) { WriteServ(user->fd,"249 %s :%s (%s@%s) Idle: %d",user->nick,i->second->nick,i->second->ident,i->second->dhost,(TIME - i->second->idle_lastmsg)); idx++; diff --git a/src/cmd_trace.cpp b/src/cmd_trace.cpp index 19b653842..242ff7586 100644 --- a/src/cmd_trace.cpp +++ b/src/cmd_trace.cpp @@ -70,7 +70,7 @@ void cmd_trace::Handle (char **parameters, int pcnt, userrec *user) { if (isnick(i->second->nick)) { - if (strchr(i->second->modes,'o')) + if (*i->second->oper) { WriteServ(user->fd,"205 %s :Oper 0 %s",user->nick,i->second->nick); } diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index 8292c0167..ecb52ea29 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -88,7 +88,7 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) } else { strlcat(tmp, "H", 9); } - if (strchr(i->second->modes,'o')) { strlcat(tmp, "*", 9); } + if (*i->second->oper) { strlcat(tmp, "*", 9); } WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, Ptr ? Ptr->name : "*", i->second->ident, i->second->dhost, i->second->server, i->second->nick, tmp, i->second->fullname); if (n_list++ > Config->MaxWhoResults) { @@ -125,7 +125,7 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) } else { strlcat(tmp, "H", 9); } - if (strchr(i->second->modes,'o')) { strlcat(tmp, "*", 9); } + if (*i->second->oper) { strlcat(tmp, "*", 9); } strlcat(tmp, cmode(i->second, Ptr),5); WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, Ptr->name, i->second->ident, i->second->dhost, i->second->server, i->second->nick, tmp, i->second->fullname); n_list++; @@ -156,7 +156,7 @@ void cmd_who::Handle (char **parameters, int pcnt, userrec *user) } else { strlcat(tmp, "H" ,9); } - if (strchr(u->modes,'o')) { strlcat(tmp, "*" ,9); } + if (*u->oper) { strlcat(tmp, "*" ,9); } WriteServ(user->fd,"352 %s %s %s %s %s %s %s :0 %s",user->nick, u->chans.size() && u->chans[0].channel ? u->chans[0].channel->name : "*", u->ident, u->dhost, u->server, u->nick, tmp, u->fullname); } diff --git a/src/command_parse.cpp b/src/command_parse.cpp index e5fc8fd7d..0c61fd8b1 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -596,7 +596,7 @@ void CommandParser::ProcessCommand(userrec *user, char* cmd) return; } } - if ((user->registered == 7) && (!strchr(user->modes,'o'))) + if ((user->registered == 7) && (!*user->oper)) { std::stringstream dcmds(Config->DisabledCommands); while (!dcmds.eof()) diff --git a/src/commands.cpp b/src/commands.cpp index 5cb5af2ad..00f44c74a 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -118,7 +118,7 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i if (dest->registered == 7) { WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); - if ((user == dest) || (strchr(user->modes,'o'))) + if ((user == dest) || (*user->oper)) { WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, (char*)inet_ntoa(dest->ip4)); } @@ -146,16 +146,9 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i { WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg); } - if (strchr(dest->modes,'o')) + if (*dest->oper) { - if (*dest->oper) - { - WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",dest->oper[0]) ? "an" : "a"),dest->oper, Config->Network); - } - else - { - WriteServ(user->fd,"313 %s %s :is an IRC operator",user->nick, dest->nick); - } + WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",*dest->oper) ? "an" : "a"),dest->oper, Config->Network); } if ((!signon) && (!idle)) { diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 7c13d678a..5f7be1580 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -71,7 +71,7 @@ class ModuleNoNickChange : public Module chanrec* curr = user->chans[i].channel; if (curr->IsCustomModeSet('N')) { - if (!strchr(user->modes,'o')) + if (!*user->oper) { // don't allow the nickchange, theyre on at least one channel with +N set // and theyre not an oper diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 1ec4b4fc7..fb181d1f5 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -49,7 +49,7 @@ class ModuleOperChans : public Module { chanrec* chan = (chanrec*)target; - if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server)) || (!*user->server) || (strchr(user->modes,'o'))) + if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server)) || (!*user->server) || (*user->oper)) { log(DEBUG,"Allowing mode +O"); return 1; @@ -75,7 +75,7 @@ class ModuleOperChans : public Module virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { - if (!strchr(user->modes,'o')) + if (!*user->oper) { if (chan) { diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index da3ab18b3..bf5596330 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -52,7 +52,7 @@ class ModuleOperLevels : public Module { long dest_level = 0,source_level = 0; // oper killing an oper? - if (strchr(dest->modes,'o')) + if (*dest->oper) { for (int j =0; j < conf->Enumerate("type"); j++) { diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index b6cafbc77..8dfc5dd6f 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -174,7 +174,7 @@ class ModuleOverride : public Module virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { - if (strchr(user->modes,'o')) + if (*user->oper) { if (chan) { diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 0ca0dd921..d4fbdfbb5 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -68,7 +68,7 @@ class ModuleRestrictChans : public Module { irc::string x = cname; // user is not an oper and its not in the allow list - if ((!strchr(user->modes,'o')) && (allowchans.find(x) == allowchans.end())) + if ((!*user->oper) && (allowchans.find(x) == allowchans.end())) { // channel does not yet exist (record is null, about to be created IF we were to allow it) if (!chan) diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index f960c65c8..c51ea4850 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -48,7 +48,7 @@ class ModuleRestrictMsg : public Module if (target_type == TYPE_USER) { userrec* u = (userrec*)dest; - if ((strchr(u->modes,'o')) || (strchr(user->modes,'o'))) + if (*u->oper || *user->oper) { // message allowed if: // (1) the sender is opered diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 48befe370..4ffeca3d5 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -44,7 +44,7 @@ class cmd_userip : public command_t userrec *u = Find(parameters[i]); if (u) { - snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,strchr(u->modes,'o') ? "*" : "",u->ident,(char*)inet_ntoa(u->ip4)); + snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,(char*)inet_ntoa(u->ip4)); strlcat(Return,junk,MAXBUF); } } diff --git a/src/users.cpp b/src/users.cpp index 8c3ad4969..15663a7d1 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -211,7 +211,7 @@ bool userrec::HasPermission(std::string &command) return true; // are they even an oper at all? - if (strchr(this->modes,'o')) + if (*this->oper) { for (int j =0; j < Config->ConfValueEnum("type",&Config->config_f); j++) { |