From ec2106579c77a98dfdb209864a1e1b5ae1f07e7f Mon Sep 17 00:00:00 2001 From: w00t Date: Sat, 12 May 2007 20:49:13 +0000 Subject: The commit that should have been r7000: src/modules now uses IS_OPER instead of not so tidy char equivilant git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7001 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_alias.cpp | 2 +- src/modules/m_check.cpp | 2 +- src/modules/m_hidechans.cpp | 2 +- src/modules/m_hideoper.cpp | 2 +- src/modules/m_nonicks.cpp | 2 +- src/modules/m_operchans.cpp | 2 +- src/modules/m_operlog.cpp | 2 +- src/modules/m_override.cpp | 6 +++--- src/modules/m_restrictchans.cpp | 2 +- src/modules/m_restrictmsg.cpp | 13 +++++++------ src/modules/m_securelist.cpp | 2 +- src/modules/m_userip.cpp | 2 +- 12 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 3893ad5bf..a901ab165 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -168,7 +168,7 @@ class ModuleAlias : public Module continue; } - if ((Aliases[i].operonly) && (!*user->oper)) + if ((Aliases[i].operonly) && (!IS_OPER(user))) return 0; if (Aliases[i].requires != "") diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 23b641294..4b38c9fcb 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -69,7 +69,7 @@ class cmd_check : public command_t /* user is away */ user->WriteServ(checkstr + " awaymsg " + targuser->awaymsg); } - if (targuser->oper[0] != 0) + if (IS_OPER(targuser)) { /* user is an oper of type ____ */ user->WriteServ(checkstr + " opertype " + irc::Spacify(targuser->oper)); diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index d7438d877..a2bc4aa54 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -87,7 +87,7 @@ class ModuleHideChans : public Module /* Dont display channels if they have +I set and the * person doing the WHOIS is not an oper */ - return ((user != dest) && (!*user->oper) && (numeric == 319) && dest->IsModeSet('I')); + return ((user != dest) && (!IS_OPER(user)) && (numeric == 319) && dest->IsModeSet('I')); } }; diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 0785fd185..ce627f448 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -86,7 +86,7 @@ class ModuleHideOper : public Module /* Dont display numeric 313 (RPL_WHOISOPER) if they have +H set and the * person doing the WHOIS is not an oper */ - return ((!*user->oper) && (numeric == 313) && dest->IsModeSet('H')); + return ((!IS_OPER(user)) && (numeric == 313) && dest->IsModeSet('H')); } }; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 0532519a2..9bba77d6c 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -85,7 +85,7 @@ class ModuleNoNickChange : public Module for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++) { chanrec* curr = i->first; - if ((curr->IsModeSet('N')) && (!*user->oper)) + if ((curr->IsModeSet('N')) && (!IS_OPER(user))) { // 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 6852bc608..6b89332be 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -68,7 +68,7 @@ class ModuleOperChans : public Module virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { - if (!*user->oper) + if (!IS_OPER(user)) { if (chan) { diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 4968a8925..195415340 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -49,7 +49,7 @@ class ModuleOperLog : public Module if (!validated) return 0; - if ((*user->oper) && (IS_LOCAL(user)) && (user->HasPermission(command))) + if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command))) { command_t* thiscommand = ServerInstance->Parser->GetHandler(command); if ((thiscommand) && (thiscommand->flags_needed = 'o')) diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index e68d3f760..31b52e853 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -107,7 +107,7 @@ class ModuleOverride : public Module virtual int OnUserPreKick(userrec* source, userrec* user, chanrec* chan, const std::string &reason) { - if ((*source->oper) && (CanOverride(source,"KICK"))) + if (IS_OPER(source) && CanOverride(source,"KICK")) { if (((chan->GetStatus(source) == STATUS_HOP) && (chan->GetStatus(user) == STATUS_OP)) || (chan->GetStatus(source) < STATUS_VOICE)) { @@ -121,7 +121,7 @@ class ModuleOverride : public Module virtual int OnAccessCheck(userrec* source,userrec* dest,chanrec* channel,int access_type) { - if (*source->oper) + if (IS_OPER(source)) { if (source && channel) { @@ -232,7 +232,7 @@ class ModuleOverride : public Module virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs) { - if (*user->oper) + if (IS_OPER(user)) { if (chan) { diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index fc83d2e59..68fb73577 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -63,7 +63,7 @@ class ModuleRestrictChans : public Module { irc::string x = cname; // user is not an oper and its not in the allow list - if ((!*user->oper) && (allowchans.find(x) == allowchans.end())) + if ((!IS_OPER(user)) && (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 4f611653b..ce62296ac 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -44,18 +44,19 @@ class ModuleRestrictMsg : public Module if ((target_type == TYPE_USER) && (IS_LOCAL(user))) { userrec* u = (userrec*)dest; - if (*u->oper || *user->oper) + + // message allowed if: + // (1) the sender is opered + // (2) the recipient is opered + // anything else, blocked. + if (IS_OPER(u) || IS_OPER(user)) { - // message allowed if: - // (1) the sender is opered - // (2) the recipient is opered - // (3) both are opered - // anything else, blocked. return 0; } user->WriteServ("531 %s %s :You are not permitted to send private messages to this user",user->nick,u->nick); return 1; } + // however, we must allow channel messages... return 0; } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 81aae1375..8be50dffe 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -65,7 +65,7 @@ class ModuleSecureList : public Module if (!validated) return 0; - if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!*user->oper)) + if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!IS_OPER(user))) { /* Normally wouldnt be allowed here, are they exempt? */ for (std::vector::iterator x = allowlist.begin(); x != allowlist.end(); x++) diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 86b3cd02e..9c0aa12a8 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -40,7 +40,7 @@ class cmd_userip : public command_t userrec *u = ServerInstance->FindNick(parameters[i]); if ((u) && (u->registered == REG_ALL)) { - snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,*u->oper ? "*" : "",u->ident,u->GetIPString()); + snprintf(junk,MAXBUF,"%s%s=+%s@%s ",u->nick,IS_OPER(u) ? "*" : "",u->ident,u->GetIPString()); strlcat(Return,junk,MAXBUF); } } -- cgit v1.2.3