summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-23 18:06:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-23 18:06:57 +0000
commit10ef0fde2e1832f0684ae142a582cb5f032bfe6a (patch)
tree11bb007b9d1aa0630641c000d59b3715c025f442
parent7b9d883eec813a828f2f5afc5d04148b933d643f (diff)
Tidyup a bunch of stuff that was using userrec::modes directly rather than userrec::IsModeSet. Same for chanrec.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7506 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/channels.cpp4
-rw-r--r--src/cmd_invite.cpp2
-rw-r--r--src/cmd_list.cpp5
-rw-r--r--src/cmd_names.cpp2
-rw-r--r--src/cmd_notice.cpp4
-rw-r--r--src/cmd_oper.cpp2
-rw-r--r--src/cmd_privmsg.cpp4
-rw-r--r--src/cmd_topic.cpp4
-rw-r--r--src/command_parse.cpp4
-rw-r--r--src/helperfuncs.cpp6
-rw-r--r--src/snomasks.cpp2
-rw-r--r--src/users.cpp4
12 files changed, 22 insertions, 21 deletions
diff --git a/src/channels.cpp b/src/channels.cpp
index edee36bf7..c0055bf1d 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -288,7 +288,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
}
}
}
- if (Ptr->modes[CM_INVITEONLY])
+ if (Ptr->IsModeSet('i'))
{
MOD_RESULT = 0;
FOREACH_RESULT_I(Instance,I_OnCheckInvite,OnCheckInvite(user, Ptr));
@@ -865,7 +865,7 @@ void chanrec::UserList(userrec *user, CUList *ulist)
for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
{
- if ((!has_user) && (i->first->modes[UM_INVISIBLE]))
+ if ((!has_user) && (i->first->IsModeSet('i')))
{
/*
* user is +i, and source not on the channel, does not show
diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp
index 0eb3a2354..f4368071a 100644
--- a/src/cmd_invite.cpp
+++ b/src/cmd_invite.cpp
@@ -47,7 +47,7 @@ CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
return CMD_FAILURE;
}
- if ((c->modes[CM_INVITEONLY]) && (IS_LOCAL(user)))
+ if ((c->IsModeSet('i')) && (IS_LOCAL(user)))
{
if (c->GetStatus(user) < STATUS_HOP)
{
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index ed956e7f1..1a5688293 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -64,14 +64,14 @@ CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
// if the channel is not private/secret, OR the user is on the channel anyway
bool n = i->second->HasUser(user);
- if ((i->second->modes[CM_PRIVATE]) && (!n))
+ if ((i->second->IsModeSet('p')) && (!n))
{
if (users)
user->WriteServ("322 %s *",user->nick,i->second->name);
}
else
{
- if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
+ if (((!(i->second->IsModeSet('p'))) && (!(i->second->IsModeSet('p')))) || (n))
{
long users = i->second->GetUserCounter();
if (users)
@@ -83,3 +83,4 @@ CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
return CMD_SUCCESS;
}
+
diff --git a/src/cmd_names.cpp b/src/cmd_names.cpp
index fe61c4dea..cc6566cca 100644
--- a/src/cmd_names.cpp
+++ b/src/cmd_names.cpp
@@ -38,7 +38,7 @@ CmdResult cmd_names::Handle (const char** parameters, int pcnt, userrec *user)
c = ServerInstance->FindChan(parameters[0]);
if (c)
{
- if ((c->modes[CM_SECRET]) && (!c->HasUser(user)))
+ if ((c->IsModeSet('s')) && (!c->HasUser(user)))
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, c->name);
return CMD_FAILURE;
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp
index a797fefab..5df5b8ace 100644
--- a/src/cmd_notice.cpp
+++ b/src/cmd_notice.cpp
@@ -67,12 +67,12 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
{
if (IS_LOCAL(user))
{
- if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
+ if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
return CMD_FAILURE;
}
- if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
+ if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
return CMD_FAILURE;
diff --git a/src/cmd_oper.cpp b/src/cmd_oper.cpp
index 686182876..331115e1d 100644
--- a/src/cmd_oper.cpp
+++ b/src/cmd_oper.cpp
@@ -104,7 +104,7 @@ CmdResult cmd_oper::Handle (const char** parameters, int pcnt, userrec *user)
/* correct oper credentials */
ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]);
user->WriteServ("381 %s :You are now an IRC operator of type %s",user->nick,irc::Spacify(OperType));
- if (!user->modes[UM_OPERATOR])
+ if (!user->IsModeSet('o'))
user->Oper(OperType);
}
else
diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp
index f3295df07..04f500951 100644
--- a/src/cmd_privmsg.cpp
+++ b/src/cmd_privmsg.cpp
@@ -67,12 +67,12 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
{
if (IS_LOCAL(user))
{
- if ((chan->modes[CM_NOEXTERNAL]) && (!chan->HasUser(user)))
+ if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
{
user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name);
return CMD_FAILURE;
}
- if ((chan->modes[CM_MODERATED]) && (chan->GetStatus(user) < STATUS_VOICE))
+ if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE))
{
user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name);
return CMD_FAILURE;
diff --git a/src/cmd_topic.cpp b/src/cmd_topic.cpp
index 741558282..33005cab2 100644
--- a/src/cmd_topic.cpp
+++ b/src/cmd_topic.cpp
@@ -32,7 +32,7 @@ CmdResult cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
Ptr = ServerInstance->FindChan(parameters[0]);
if (Ptr)
{
- if ((Ptr->modes[CM_SECRET]) && (!Ptr->HasUser(user)))
+ if ((Ptr->IsModeSet('s')) && (!Ptr->HasUser(user)))
{
user->WriteServ("401 %s %s :No such nick/channel",user->nick, Ptr->name);
return CMD_FAILURE;
@@ -66,7 +66,7 @@ CmdResult cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
user->WriteServ("442 %s %s :You're not on that channel!",user->nick, Ptr->name);
return CMD_FAILURE;
}
- if ((Ptr->modes[CM_TOPICLOCK]) && (Ptr->GetStatus(user) < STATUS_HOP))
+ if ((Ptr->IsModeSet('t')) && (Ptr->GetStatus(user) < STATUS_HOP))
{
user->WriteServ("482 %s %s :You must be at least a half-operator to change the topic on this channel", user->nick, Ptr->name);
return CMD_FAILURE;
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 52c58ef99..774936b8b 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -218,7 +218,7 @@ bool CommandParser::IsValidCommand(const std::string &commandname, int pcnt, use
{
if ((pcnt>=n->second->min_params) && (n->second->source != "<core>"))
{
- if ((!n->second->flags_needed) || (user->modes[n->second->flags_needed-65]))
+ if ((!n->second->flags_needed) || (user->IsModeSet(n->second->flags_needed)))
{
if (n->second->flags_needed)
{
@@ -250,7 +250,7 @@ CmdResult CommandParser::CallHandler(const std::string &commandname,const char**
{
if (pcnt >= n->second->min_params)
{
- if ((!n->second->flags_needed) || (user->modes[n->second->flags_needed-65]))
+ if ((!n->second->flags_needed) || (user->IsModeSet(n->second->flags_needed)))
{
if (n->second->flags_needed)
{
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index da3fa5e1b..3591a2d89 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -116,7 +116,7 @@ void InspIRCd::WriteOpers(const std::string &text)
for (std::vector<userrec*>::iterator i = this->all_opers.begin(); i != this->all_opers.end(); i++)
{
userrec* a = *i;
- if (IS_LOCAL(a) && a->modes[UM_SERVERNOTICE])
+ if (IS_LOCAL(a) && a->IsModeSet('s'))
{
// send server notices to all with +s
a->WriteServ("NOTICE %s :%s",a->nick,text.c_str());
@@ -192,7 +192,7 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
for (int n = 0; n < modelen; n++)
{
- if (!t->modes[modes[n]-65])
+ if (!t->IsModeSet(modes[n]))
{
send_to_user = false;
break;
@@ -212,7 +212,7 @@ void InspIRCd::WriteMode(const char* modes, int flags, const char* text, ...)
for (int n = 0; n < modelen; n++)
{
- if (t->modes[modes[n]-65])
+ if (t->IsModeSet(modes[n]))
{
send_to_user = true;
break;
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index ba6d3d7d5..962e5a638 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -58,7 +58,7 @@ void SnomaskManager::WriteToSnoMask(char letter, const std::string &text)
for (std::vector<userrec*>::iterator i = ServerInstance->all_opers.begin(); i != ServerInstance->all_opers.end(); i++)
{
userrec* a = *i;
- if (IS_LOCAL(a) && a->modes[UM_SERVERNOTICE] && a->modes[UM_SNOMASK] && a->IsNoticeMaskSet(n->first))
+ if (IS_LOCAL(a) && a->IsModeSet('s') && a->IsModeSet('n') && a->IsNoticeMaskSet(n->first))
{
/* send server notices to all with +ns */
a->WriteServ("NOTICE %s :*** %s: %s",a->nick, n->second.c_str(), text.c_str());
diff --git a/src/users.cpp b/src/users.cpp
index 8b9227083..063a31dee 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1631,7 +1631,7 @@ void userrec::WriteWallOps(const std::string &text)
for (std::vector<userrec*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++)
{
userrec* t = *i;
- if (t->modes[UM_WALLOPS])
+ if (t->IsModeSet('w'))
this->WriteTo(t,wallop);
}
}
@@ -1790,7 +1790,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) || (IS_OPER(source) && 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->IsModeSet('p')) && (!i->first->IsModeSet('s'))) || (i->first->HasUser(source))))
{
list.append(i->first->GetPrefixChar(this)).append(i->first->name).append(" ");
}