summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h18
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/commands/cmd_map.cpp2
-rw-r--r--src/commands/cmd_privmsg.cpp2
-rw-r--r--src/commands/cmd_stats.cpp2
-rw-r--r--src/commands/cmd_userhost.cpp4
-rw-r--r--src/commands/cmd_version.cpp2
-rw-r--r--src/commands/cmd_who.cpp6
-rw-r--r--src/commands/cmd_whois.cpp4
-rw-r--r--src/mode.cpp6
-rw-r--r--src/modes/umode_o.cpp2
-rw-r--r--src/modules/m_alias.cpp2
-rw-r--r--src/modules/m_callerid.cpp2
-rw-r--r--src/modules/m_check.cpp4
-rw-r--r--src/modules/m_commonchans.cpp2
-rw-r--r--src/modules/m_denychans.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_httpd_stats.cpp4
-rw-r--r--src/modules/m_ircv3.cpp4
-rw-r--r--src/modules/m_jumpserver.cpp2
-rw-r--r--src/modules/m_maphide.cpp2
-rw-r--r--src/modules/m_nonicks.cpp2
-rw-r--r--src/modules/m_operchans.cpp4
-rw-r--r--src/modules/m_operjoin.cpp2
-rw-r--r--src/modules/m_operlevels.cpp2
-rw-r--r--src/modules/m_operlog.cpp2
-rw-r--r--src/modules/m_operprefix.cpp2
-rw-r--r--src/modules/m_override.cpp8
-rw-r--r--src/modules/m_redirect.cpp2
-rw-r--r--src/modules/m_regonlycreate.cpp2
-rw-r--r--src/modules/m_restrictchans.cpp2
-rw-r--r--src/modules/m_restrictmsg.cpp2
-rw-r--r--src/modules/m_securelist.cpp2
-rw-r--r--src/modules/m_showwhois.cpp2
-rw-r--r--src/modules/m_shun.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp12
-rw-r--r--src/modules/m_spanningtree/netburst.cpp4
-rw-r--r--src/modules/m_spanningtree/opertype.cpp2
-rw-r--r--src/modules/m_spanningtree/override_map.cpp8
-rw-r--r--src/modules/m_sslinfo.cpp4
-rw-r--r--src/modules/m_userip.cpp4
-rw-r--r--src/modules/m_watch.cpp4
-rw-r--r--src/users.cpp12
43 files changed, 85 insertions, 77 deletions
diff --git a/include/users.h b/include/users.h
index 2cebc749d..4d3013ae8 100644
--- a/include/users.h
+++ b/include/users.h
@@ -329,7 +329,7 @@ class CoreExport User : public Extensible
std::string awaymsg;
/** Time the user last went away.
- * This is ONLY RELIABLE if user IS_AWAY()!
+ * This is ONLY RELIABLE if user IsAway()!
*/
time_t awaytime;
@@ -411,6 +411,18 @@ class CoreExport User : public Extensible
*/
std::string ProcessNoticeMasks(const char *sm);
+ /** Returns whether this user is currently away or not. If true,
+ * further information can be found in User::awaymsg and User::awaytime
+ * @return True if the user is away, false otherwise
+ */
+ bool IsAway() const { return (!awaymsg.empty()); }
+
+ /** Returns whether this user is an oper or not. If true,
+ * oper information can be obtained from User::oper
+ * @return True if the user is an oper, false otherwise
+ */
+ bool IsOper() const { return (oper != NULL); }
+
/** Returns true if a notice mask is set
* @param sm A notice mask character to check
* @return True if the notice mask is set
@@ -908,10 +920,6 @@ inline FakeUser* IS_SERVER(User* u)
{
return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL;
}
-/** Is an oper */
-#define IS_OPER(x) (x->oper)
-/** Is away */
-#define IS_AWAY(x) (!x->awaymsg.empty())
/** Derived from Resolver, and performs user forward/reverse lookups.
*/
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 0bf8e0e0a..809d8067b 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -300,7 +300,7 @@ bool CommandParser::ProcessCommand(LocalUser *user, std::string &cmd)
return do_more;
}
}
- if ((user->registered == REG_ALL) && (!IS_OPER(user)) && (cm->second->IsDisabled()))
+ if ((user->registered == REG_ALL) && (!user->IsOper()) && (cm->second->IsDisabled()))
{
/* command is disabled! */
if (ServerInstance->Config->DisabledDontExist)
diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp
index 385a2c752..0698134b5 100644
--- a/src/commands/cmd_map.cpp
+++ b/src/commands/cmd_map.cpp
@@ -43,7 +43,7 @@ CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user)
// module to override its behaviour and display something
// better.
- if (IS_OPER(user))
+ if (user->IsOper())
{
user->WriteNumeric(006, "%s :%s [%s]", user->nick.c_str(), ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->GetSID().c_str());
user->WriteNumeric(007, "%s :End of /MAP", user->nick.c_str());
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 09314e8a9..49845162c 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -202,7 +202,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
return CMD_FAILURE;
}
- if (IS_AWAY(dest))
+ if (dest->IsAway())
{
/* auto respond with aweh msg */
user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp
index 86512417c..ccf753956 100644
--- a/src/commands/cmd_stats.cpp
+++ b/src/commands/cmd_stats.cpp
@@ -59,7 +59,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results)
std::string sn(ServerInstance->Config->ServerName);
bool isPublic = ServerInstance->Config->UserStats.find(statschar) != std::string::npos;
- bool isRemoteOper = IS_REMOTE(user) && IS_OPER(user);
+ bool isRemoteOper = IS_REMOTE(user) && (user->IsOper());
bool isLocalOperWithPrivs = IS_LOCAL(user) && user->HasPrivPermission("servers/auspex");
if (!isPublic && !isRemoteOper && !isLocalOperWithPrivs)
diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp
index 399de0b1a..933cbca04 100644
--- a/src/commands/cmd_userhost.cpp
+++ b/src/commands/cmd_userhost.cpp
@@ -54,12 +54,12 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
{
retbuf = retbuf + u->nick;
- if (IS_OPER(u))
+ if (u->IsOper())
retbuf = retbuf + "*";
retbuf = retbuf + "=";
- if (IS_AWAY(u))
+ if (u->IsAway())
retbuf += "-";
else
retbuf += "+";
diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp
index 7620197fd..24442d9e1 100644
--- a/src/commands/cmd_version.cpp
+++ b/src/commands/cmd_version.cpp
@@ -42,7 +42,7 @@ class CommandVersion : public Command
CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user)
{
- std::string version = ServerInstance->GetVersionString(IS_OPER(user));
+ std::string version = ServerInstance->GetVersionString((user->IsOper()));
user->WriteNumeric(RPL_VERSION, "%s :%s", user->nick.c_str(), version.c_str());
ServerInstance->Config->Send005(user);
return CMD_SUCCESS;
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index a15fde68e..5a5c27dcf 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -201,7 +201,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms,
wholine.append(" " + u->nick + " ");
/* away? */
- if (IS_AWAY(u))
+ if (u->IsAway())
{
wholine.append("G");
}
@@ -211,7 +211,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms,
}
/* oper? */
- if (IS_OPER(u))
+ if (u->IsOper())
{
wholine.push_back('*');
}
@@ -342,7 +342,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
if (user != i->first)
{
/* opers only, please */
- if (opt_viewopersonly && !IS_OPER(i->first))
+ if (opt_viewopersonly && !i->first->IsOper())
continue;
/* If we're not inside the channel, hide +i users */
diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp
index 072e04769..b4483d8bb 100644
--- a/src/commands/cmd_whois.cpp
+++ b/src/commands/cmd_whois.cpp
@@ -135,12 +135,12 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne
ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->server.c_str(), serverdesc.c_str());
}
- if (IS_AWAY(dest))
+ if (dest->IsAway())
{
ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str());
}
- if (IS_OPER(dest))
+ if (dest->IsOper())
{
if (ServerInstance->Config->GenericOper)
ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is an IRC operator",user->nick.c_str(), dest->nick.c_str());
diff --git a/src/mode.cpp b/src/mode.cpp
index 417707ee9..768623bd5 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -215,7 +215,7 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ
{
/* Display user's current mode string */
user->WriteNumeric(RPL_UMODEIS, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes());
- if (IS_OPER(targetuser))
+ if ((targetuser->IsOper()))
user->WriteNumeric(RPL_SNOMASKIS, "%s +%s :Server notice mask", targetuser->nick.c_str(), targetuser->FormatNoticeMasks());
return;
}
@@ -296,7 +296,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool
return MODEACTION_DENY;
}
- if (IS_LOCAL(user) && !IS_OPER(user))
+ if (IS_LOCAL(user) && !user->IsOper())
{
char* disabled = (type == MODETYPE_CHANNEL) ? ServerInstance->Config->DisabledCModes : ServerInstance->Config->DisabledUModes;
if (disabled[modechar - 'A'])
@@ -310,7 +310,7 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool
if (adding && IS_LOCAL(user) && mh->NeedsOper() && !user->HasModePermission(modechar, type))
{
/* It's an oper only mode, and they don't have access to it. */
- if (IS_OPER(user))
+ if (user->IsOper())
{
user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c",
user->nick.c_str(), user->oper->NameStr(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar);
diff --git a/src/modes/umode_o.cpp b/src/modes/umode_o.cpp
index 1e33a0260..de00d7f73 100644
--- a/src/modes/umode_o.cpp
+++ b/src/modes/umode_o.cpp
@@ -32,7 +32,7 @@ ModeUserOperator::ModeUserOperator() : ModeHandler(NULL, "oper", 'o', PARAM_NONE
ModeAction ModeUserOperator::OnModeChange(User* source, User* dest, Channel*, std::string&, bool adding)
{
/* Only opers can execute this class at all */
- if (!ServerInstance->ULine(source->nick.c_str()) && !ServerInstance->ULine(source->server) && !IS_OPER(source))
+ if (!ServerInstance->ULine(source->nick.c_str()) && !ServerInstance->ULine(source->server) && !source->IsOper())
return MODEACTION_DENY;
/* Not even opers can GIVE the +o mode, only take it away */
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp
index 88c5ff9ca..cd53c9f97 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -263,7 +263,7 @@ class ModuleAlias : public Module
}
}
- if ((a->OperOnly) && (!IS_OPER(user)))
+ if ((a->OperOnly) && (!user->IsOper()))
return 0;
if (!a->RequiredNick.empty())
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 330b1ec91..ee7b5e71a 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -357,7 +357,7 @@ public:
if (!dest->IsModeSet('g'))
return MOD_RES_PASSTHRU;
- if (operoverride && IS_OPER(user))
+ if (operoverride && user->IsOper())
return MOD_RES_PASSTHRU;
callerid_data* dat = cmd.extInfo.get(dest, true);
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index 662e512f9..69389000b 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -102,14 +102,14 @@ class CommandCheck : public Command
if (loctarg)
user->SendText(checkstr + " lastmsg " + timestring(loctarg->idle_lastmsg));
- if (IS_AWAY(targuser))
+ if (targuser->IsAway())
{
/* user is away */
user->SendText(checkstr + " awaytime " + timestring(targuser->awaytime));
user->SendText(checkstr + " awaymsg " + targuser->awaymsg);
}
- if (IS_OPER(targuser))
+ if (targuser->IsOper())
{
OperInfo* oper = targuser->oper;
/* user is an oper of type ____ */
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index b7aa683e2..fad0dceca 100644
--- a/src/modules/m_commonchans.cpp
+++ b/src/modules/m_commonchans.cpp
@@ -54,7 +54,7 @@ class ModulePrivacyMode : public Module
if (target_type == TYPE_USER)
{
User* t = (User*)dest;
- if (!IS_OPER(user) && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t))
+ if (!user->IsOper() && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t))
{
user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick.c_str(), t->nick.c_str());
return MOD_RES_DENY;
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 50c70999d..9d9296c25 100644
--- a/src/modules/m_denychans.cpp
+++ b/src/modules/m_denychans.cpp
@@ -90,7 +90,7 @@ class ModuleDenyChannels : public Module
{
if (InspIRCd::Match(cname, j->second->getString("name")))
{
- if (IS_OPER(user) && j->second->getBool("allowopers"))
+ if (user->IsOper() && j->second->getBool("allowopers"))
{
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 81457d40c..ffa94fea8 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -279,7 +279,7 @@ CmdResult CommandFilter::Handle(const std::vector<std::string> &parameters, User
bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags)
{
- if ((filter->flag_no_opers) && IS_OPER(user))
+ if ((filter->flag_no_opers) && user->IsOper())
return false;
if ((iflags & FLAG_PRIVMSG) && (!filter->flag_privmsg))
return false;
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index b3a13ada6..3af9ee754 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -187,9 +187,9 @@ class ModuleHttpStats : public Module
data << "<nickname>" << u->nick << "</nickname><uuid>" << u->uuid << "</uuid><realhost>"
<< u->host << "</realhost><displayhost>" << u->dhost << "</displayhost><gecos>"
<< Sanitize(u->fullname) << "</gecos><server>" << u->server << "</server>";
- if (IS_AWAY(u))
+ if (u->IsAway())
data << "<away>" << Sanitize(u->awaymsg) << "</away><awaytime>" << u->awaytime << "</awaytime>";
- if (IS_OPER(u))
+ if (u->IsOper())
data << "<opertype>" << Sanitize(u->oper->NameStr()) << "</opertype>";
data << "<modes>" << u->FormatModes() << "</modes><ident>" << Sanitize(u->ident) << "</ident>";
LocalUser* lu = IS_LOCAL(u);
diff --git a/src/modules/m_ircv3.cpp b/src/modules/m_ircv3.cpp
index b0e020c63..cc2e6c322 100644
--- a/src/modules/m_ircv3.cpp
+++ b/src/modules/m_ircv3.cpp
@@ -125,7 +125,7 @@ class ModuleIRCv3 : public Module
void OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts)
{
// Remember who is not going to see the JOIN because of other modules
- if ((awaynotify) && (IS_AWAY(memb->user)))
+ if ((awaynotify) && (memb->user->IsAway()))
last_excepts = excepts;
if (!extendedjoin)
@@ -212,7 +212,7 @@ class ModuleIRCv3 : public Module
void OnPostJoin(Membership *memb)
{
- if ((!awaynotify) || (!IS_AWAY(memb->user)))
+ if ((!awaynotify) || (!memb->user->IsAway()))
return;
std::string line = ":" + memb->user->GetFullHost() + " AWAY :" + memb->user->awaymsg;
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index 361a28c9f..b754b2960 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -102,7 +102,7 @@ class CommandJumpserver : public Command
for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
{
User* t = *i;
- if (!IS_OPER(t))
+ if (!t->IsOper())
{
t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", t->nick.c_str(), parameters[0].c_str(), parameters[1].c_str());
ServerInstance->Users->QuitUser(t, reason);
diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp
index ca48cf4e2..f0502d175 100644
--- a/src/modules/m_maphide.cpp
+++ b/src/modules/m_maphide.cpp
@@ -39,7 +39,7 @@ class ModuleMapHide : public Module
ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser *user, bool validated, const std::string &original_line)
{
- if (validated && !IS_OPER(user) && !url.empty() && (command == "MAP" || command == "LINKS"))
+ if (validated && !user->IsOper() && !url.empty() && (command == "MAP" || command == "LINKS"))
{
user->WriteServ("NOTICE %s :/%s has been disabled; visit %s", user->nick.c_str(), command.c_str(), url.c_str());
return MOD_RES_DENY;
diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp
index ba60afc80..c1eb63da9 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -74,7 +74,7 @@ class ModuleNoNickChange : public Module
if (res == MOD_RES_ALLOW)
continue;
- if (override && IS_OPER(user))
+ if (override && user->IsOper())
continue;
if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N')))
diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp
index 508b0ff0c..2ac98e90c 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -51,7 +51,7 @@ class ModuleOperChans : public Module
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
- if (chan && chan->IsModeSet('O') && !IS_OPER(user))
+ if (chan && chan->IsModeSet('O') && !user->IsOper())
{
user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s %s :Only IRC operators may join %s (+O is set)",
user->nick.c_str(), chan->name.c_str(), chan->name.c_str());
@@ -64,7 +64,7 @@ class ModuleOperChans : public Module
{
if ((mask.length() > 2) && (mask[0] == 'O') && (mask[1] == ':'))
{
- if (IS_OPER(user) && InspIRCd::Match(user->oper->name, mask.substr(2)))
+ if (user->IsOper() && InspIRCd::Match(user->oper->name, mask.substr(2)))
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp
index ea70e51dc..2f5dda0ff 100644
--- a/src/modules/m_operjoin.cpp
+++ b/src/modules/m_operjoin.cpp
@@ -85,7 +85,7 @@ class ModuleOperjoin : public Module
if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax))
Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time());
- std::string chanList = IS_OPER(user)->getConfig("autojoin");
+ std::string chanList = user->oper->getConfig("autojoin");
if (!chanList.empty())
{
std::vector<std::string> typechans;
diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp
index 793fa070a..7f94b8a0d 100644
--- a/src/modules/m_operlevels.cpp
+++ b/src/modules/m_operlevels.cpp
@@ -40,7 +40,7 @@ class ModuleOperLevels : public Module
virtual ModResult OnKill(User* source, User* dest, const std::string &reason)
{
// oper killing an oper?
- if (IS_OPER(dest) && IS_OPER(source))
+ if (dest->IsOper() && source->IsOper())
{
std::string level = dest->oper->getConfig("level");
long dest_level = atol(level.c_str());
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index 023ff9419..4c67ea32b 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -52,7 +52,7 @@ class ModuleOperLog : public Module
if (!validated)
return MOD_RES_PASSTHRU;
- if ((IS_OPER(user)) && (IS_LOCAL(user)) && (user->HasPermission(command)))
+ if ((user->IsOper()) && (IS_LOCAL(user)) && (user->HasPermission(command)))
{
Command* thiscommand = ServerInstance->Parser->GetHandler(command);
if ((thiscommand) && (thiscommand->flags_needed == 'o'))
diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp
index c7f8b8fe6..0df2ac6d8 100644
--- a/src/modules/m_operprefix.cpp
+++ b/src/modules/m_operprefix.cpp
@@ -104,7 +104,7 @@ class ModuleOperPrefixMode : public Module
* conditions (mw_added and the user being +H) together mean the user is a hidden oper.
*/
- if (IS_OPER(user) && (!mw_added || !user->IsModeSet('H')))
+ if (user->IsOper() && (!mw_added || !user->IsModeSet('H')))
privs.push_back('y');
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp
index 62fdfc8c9..81f4230eb 100644
--- a/src/modules/m_override.cpp
+++ b/src/modules/m_override.cpp
@@ -68,7 +68,7 @@ class ModuleOverride : public Module
ModResult OnPreTopicChange(User *source, Channel *channel, const std::string &topic)
{
- if (IS_LOCAL(source) && IS_OPER(source) && CanOverride(source, "TOPIC"))
+ if (IS_LOCAL(source) && source->IsOper() && CanOverride(source, "TOPIC"))
{
if (!channel->HasUser(source) || (channel->IsModeSet('t') && channel->GetPrefixValue(source) < HALFOP_VALUE))
{
@@ -84,7 +84,7 @@ class ModuleOverride : public Module
ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason)
{
- if (IS_OPER(source) && CanOverride(source,"KICK"))
+ if (source->IsOper() && CanOverride(source,"KICK"))
{
// If the kicker's status is less than the target's, or the kicker's status is less than or equal to voice
if ((memb->chan->GetPrefixValue(source) < memb->getRank()) || (memb->chan->GetPrefixValue(source) <= VOICE_VALUE))
@@ -100,7 +100,7 @@ class ModuleOverride : public Module
{
if (!source || !channel)
return MOD_RES_PASSTHRU;
- if (!IS_OPER(source) || !IS_LOCAL(source))
+ if (!source->IsOper() || !IS_LOCAL(source))
return MOD_RES_PASSTHRU;
unsigned int mode = channel->GetPrefixValue(source);
@@ -118,7 +118,7 @@ class ModuleOverride : public Module
ModResult OnUserPreJoin(User* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven)
{
- if (IS_LOCAL(user) && IS_OPER(user))
+ if (IS_LOCAL(user) && user->IsOper())
{
if (chan)
{
diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp
index 318d26d2e..e2acb6af1 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -47,7 +47,7 @@ class Redirect : public ModeHandler
}
}
- if (IS_LOCAL(source) && !IS_OPER(source))
+ if (IS_LOCAL(source) && !source->IsOper())
{
Channel* c = ServerInstance->FindChan(parameter);
if (!c)
diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp
index 22bf42a61..9d4cd5f60 100644
--- a/src/modules/m_regonlycreate.cpp
+++ b/src/modules/m_regonlycreate.cpp
@@ -39,7 +39,7 @@ class ModuleRegOnlyCreate : public Module
if (chan)
return MOD_RES_PASSTHRU;
- if (IS_OPER(user))
+ if (user->IsOper())
return MOD_RES_PASSTHRU;
if (user->IsModeSet('r'))
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index 09333bbc1..435738834 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -63,7 +63,7 @@ class ModuleRestrictChans : public Module
if (!chan)
{
// user is not an oper and its not in the allow list
- if ((!IS_OPER(user)) && (allowchans.find(x) == allowchans.end()))
+ if ((!user->IsOper()) && (allowchans.find(x) == allowchans.end()))
{
user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname.c_str());
return MOD_RES_DENY;
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index 33a7fb18a..c4eba1b2e 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -46,7 +46,7 @@ class ModuleRestrictMsg : public Module
// (1) the sender is opered
// (2) the recipient is opered
// anything else, blocked.
- if (IS_OPER(u) || IS_OPER(user))
+ if (u->IsOper() || user->IsOper())
{
return MOD_RES_PASSTHRU;
}
diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index 61e884314..fb841d81b 100644
--- a/src/modules/m_securelist.cpp
+++ b/src/modules/m_securelist.cpp
@@ -63,7 +63,7 @@ class ModuleSecureList : public Module
if (!validated)
return MOD_RES_PASSTHRU;
- if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!IS_OPER(user)))
+ if ((command == "LIST") && (ServerInstance->Time() < (user->signon+WaitTime)) && (!user->IsOper()))
{
/* Normally wouldnt be allowed here, are they exempt? */
for (std::vector<std::string>::iterator x = allowlist.begin(); x != allowlist.end(); x++)
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index 93c3a7e60..459e48664 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -108,7 +108,7 @@ class ModuleShowwhois : public Module
if (!dest->IsModeSet('W') || source == dest)
return;
- if (!ShowWhoisFromOpers && IS_OPER(source))
+ if (!ShowWhoisFromOpers && source->IsOper())
return;
if (IS_LOCAL(dest))
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index 0638cb92d..cbaa68409 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -244,7 +244,7 @@ class ModuleShun : public Module
return MOD_RES_PASSTHRU;
}
- if (!affectopers && IS_OPER(user))
+ if (!affectopers && user->IsOper())
{
/* Don't do anything if the user is an operator and affectopers isn't set */
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index e7892526e..97a57cc73 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -101,7 +101,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
{
if ((Current->GetChild(q)->Hidden) || ((Utils->HideULines) && (ServerInstance->ULine(Current->GetChild(q)->GetName()))))
{
- if (IS_OPER(user))
+ if (user->IsOper())
{
ShowLinks(Current->GetChild(q),user,hops+1);
}
@@ -112,16 +112,16 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
}
}
/* Don't display the line if its a uline, hide ulines is on, and the user isnt an oper */
- if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetName())) && (!IS_OPER(user)))
+ if ((Utils->HideULines) && (ServerInstance->ULine(Current->GetName())) && (!user->IsOper()))
return;
/* Or if the server is hidden and they're not an oper */
- else if ((Current->Hidden) && (!IS_OPER(user)))
+ else if ((Current->Hidden) && (!user->IsOper()))
return;
std::string servername = Current->GetName();
user->WriteNumeric(364, "%s %s %s :%d %s", user->nick.c_str(), servername.c_str(),
- (Utils->FlatLinks && (!IS_OPER(user))) ? ServerInstance->Config->ServerName.c_str() : Parent.c_str(),
- (Utils->FlatLinks && (!IS_OPER(user))) ? 0 : hops,
+ (Utils->FlatLinks && (!user->IsOper())) ? ServerInstance->Config->ServerName.c_str() : Parent.c_str(),
+ (Utils->FlatLinks && (!user->IsOper())) ? 0 : hops,
Current->GetDesc().c_str());
}
@@ -595,7 +595,7 @@ void ModuleSpanningTree::OnUserConnect(LocalUser* user)
params.push_back(":"+user->fullname);
Utils->DoOneToMany(ServerInstance->Config->GetSID(), "UID", params);
- if (IS_OPER(user))
+ if (user->IsOper())
{
params.clear();
params.push_back(user->oper->name);
diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp
index 978886be6..6f32bb33e 100644
--- a/src/modules/m_spanningtree/netburst.cpp
+++ b/src/modules/m_spanningtree/netburst.cpp
@@ -238,12 +238,12 @@ void TreeSocket::SendUsers()
u->second->FormatModes(true), /* 8...n: Modes and params */
u->second->fullname.c_str()); /* size-1: GECOS */
this->WriteLine(data);
- if (IS_OPER(u->second))
+ if (u->second->IsOper())
{
snprintf(data,MAXBUF,":%s OPERTYPE %s", u->second->uuid.c_str(), u->second->oper->name.c_str());
this->WriteLine(data);
}
- if (IS_AWAY(u->second))
+ if (u->second->IsAway())
{
snprintf(data,MAXBUF,":%s AWAY %ld :%s", u->second->uuid.c_str(), (long)u->second->awaytime, u->second->awaymsg.c_str());
this->WriteLine(data);
diff --git a/src/modules/m_spanningtree/opertype.cpp b/src/modules/m_spanningtree/opertype.cpp
index 97a4de8c2..27c4271b8 100644
--- a/src/modules/m_spanningtree/opertype.cpp
+++ b/src/modules/m_spanningtree/opertype.cpp
@@ -30,7 +30,7 @@ CmdResult CommandOpertype::Handle(const std::vector<std::string>& params, User *
{
SpanningTreeUtilities* Utils = ((ModuleSpanningTree*)(Module*)creator)->Utils;
std::string opertype = params[0];
- if (!IS_OPER(u))
+ if (!u->IsOper())
ServerInstance->Users->all_opers.push_back(u);
u->modes[UM_OPERATOR] = 1;
OperIndex::iterator iter = ServerInstance->Config->oper_blocks.find(" " + opertype);
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index 04fa4bcab..69f088f65 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -51,7 +51,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
percent = Current->GetUserCount() * 100.0 / ServerInstance->Users->clientlist->size();
}
- const std::string operdata = IS_OPER(user) ? MapOperInfo(Current) : "";
+ const std::string operdata = user->IsOper() ? MapOperInfo(Current) : "";
char* myname = names + 100 * line;
char* mystat = stats + 50 * line;
@@ -59,7 +59,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
int w = depth;
std::string servername = Current->GetName();
- if (IS_OPER(user))
+ if (user->IsOper())
{
w += snprintf(myname + depth, 99 - depth, "%s (%s)", servername.c_str(), Current->GetID().c_str());
}
@@ -74,12 +74,12 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, int
line++;
- if (IS_OPER(user) || !Utils->FlatLinks)
+ if (user->IsOper() || !Utils->FlatLinks)
depth = depth + 2;
for (unsigned int q = 0; q < Current->ChildCount(); q++)
{
TreeServer* child = Current->GetChild(q);
- if (!IS_OPER(user)) {
+ if (!user->IsOper()) {
if (child->Hidden)
continue;
if ((Utils->HideULines) && (ServerInstance->ULine(child->GetName())))
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index bb30b76b5..a04a643a0 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -97,7 +97,7 @@ class CommandSSLInfo : public Command
return CMD_FAILURE;
}
bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly");
- if (operonlyfp && !IS_OPER(user) && target != user)
+ if (operonlyfp && !user->IsOper() && target != user)
{
user->WriteServ("NOTICE %s :*** You cannot view SSL certificate information for other users", user->nick.c_str());
return CMD_FAILURE;
@@ -152,7 +152,7 @@ class ModuleSSLInfo : public Module
{
ServerInstance->SendWhoisLine(source, dest, 671, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str());
bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly");
- if ((!operonlyfp || source == dest || IS_OPER(source)) && !cert->fingerprint.empty())
+ if ((!operonlyfp || source == dest || source->IsOper()) && !cert->fingerprint.empty())
ServerInstance->SendWhoisLine(source, dest, 276, "%s %s :has client certificate fingerprint %s",
source->nick.c_str(), dest->nick.c_str(), cert->fingerprint.c_str());
}
diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp
index 57e6eaaad..0a91a1b6e 100644
--- a/src/modules/m_userip.cpp
+++ b/src/modules/m_userip.cpp
@@ -43,8 +43,8 @@ class CommandUserip : public Command
User *u = ServerInstance->FindNick(parameters[i]);
if ((u) && (u->registered == REG_ALL))
{
- retbuf = retbuf + u->nick + (IS_OPER(u) ? "*" : "") + "=";
- if (IS_AWAY(u))
+ retbuf = retbuf + u->nick + (u->IsOper() ? "*" : "") + "=";
+ if (u->IsAway())
retbuf += "-";
else
retbuf += "+";
diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp
index 66570ae94..615cdf191 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -242,7 +242,7 @@ class CommandWatch : public Command
{
(*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age));
user->WriteNumeric(604, "%s %s %s :is online",user->nick.c_str(), nick, (*wl)[nick].c_str());
- if (IS_AWAY(target))
+ if (target->IsAway())
{
user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick.c_str(), target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long) target->awaytime);
}
@@ -320,7 +320,7 @@ class CommandWatch : public Command
{
user->WriteNumeric(604, "%s %s %s :is online", user->nick.c_str(), q->first.c_str(), q->second.c_str());
User *targ = ServerInstance->FindNick(q->first.c_str());
- if (IS_AWAY(targ))
+ if (targ->IsAway())
{
user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick.c_str(), targ->nick.c_str(), targ->ident.c_str(), targ->dhost.c_str(), (unsigned long) targ->awaytime);
}
diff --git a/src/users.cpp b/src/users.cpp
index 42e905960..9419325da 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -380,7 +380,7 @@ bool User::HasModePermission(unsigned char, ModeType)
bool LocalUser::HasModePermission(unsigned char mode, ModeType type)
{
- if (!IS_OPER(this))
+ if (!this->IsOper())
return false;
if (mode < 'A' || mode > ('A' + 64)) return false;
@@ -403,7 +403,7 @@ bool User::HasPermission(const std::string&)
bool LocalUser::HasPermission(const std::string &command)
{
// are they even an oper at all?
- if (!IS_OPER(this))
+ if (!this->IsOper())
{
return false;
}
@@ -423,7 +423,7 @@ bool User::HasPrivPermission(const std::string &privstr, bool noisy)
bool LocalUser::HasPrivPermission(const std::string &privstr, bool noisy)
{
- if (!IS_OPER(this))
+ if (!this->IsOper())
{
if (noisy)
this->WriteServ("NOTICE %s :You are not an oper", this->nick.c_str());
@@ -653,7 +653,7 @@ void OperInfo::init()
void User::UnOper()
{
- if (!IS_OPER(this))
+ if (!this->IsOper())
return;
/*
@@ -1248,7 +1248,7 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op
{
u->already_sent = uniq_id;
if (i->second)
- u->Write(IS_OPER(u) ? out2 : out1);
+ u->Write(u->IsOper() ? out2 : out1);
}
}
for (UCListIter v = include_c.begin(); v != include_c.end(); ++v)
@@ -1260,7 +1260,7 @@ void User::WriteCommonQuit(const std::string &normal_text, const std::string &op
if (u && !u->quitting && (u->already_sent != uniq_id))
{
u->already_sent = uniq_id;
- u->Write(IS_OPER(u) ? out2 : out1);
+ u->Write(u->IsOper() ? out2 : out1);
}
}
}