* @param value True if you want to set the mode or false if you want to remove it
*/
void SetMode(ModeHandler* mode, bool value);
- void SetMode(char mode,bool mode_on);
/** Sets or unsets a custom mode in the channels info
* @param mode The mode character to set or unset
*/
inline bool IsModeSet(char mode) { return modes[mode-'A']; }
inline bool IsModeSet(ModeHandler* mode) { return modes[mode->GetModeChar()-'A']; }
-
+ bool IsModeSet(ModeHandler& mode) { return IsModeSet(&mode); }
/** Returns the parameter for a custom mode on a channel.
* @param mode The mode character you wish to query
* @return True if the mode is set
*/
bool IsModeSet(unsigned char m);
+ bool IsModeSet(ModeHandler* mh);
+ bool IsModeSet(ModeHandler& mh) { return IsModeSet(&mh); }
/** Set a specific usermode to on or off
* @param m The user mode
* @param value On or off setting of the mode
*/
void SetMode(unsigned char m, bool value);
+ void SetMode(ModeHandler* mh, bool value);
+ void SetMode(ModeHandler& mh, bool value) { SetMode(&mh, value); }
/** Returns true or false for if a user can execute a privilaged oper command.
* This is done by looking up their oper type from User::oper, then referencing
return u->usertype == USERTYPE_SERVER ? static_cast<FakeUser*>(u) : NULL;
}
+inline bool User::IsModeSet(ModeHandler* mh)
+{
+ char m = mh->GetModeChar();
+ return (modes[m-65]);
+}
+
+inline void User::SetMode(ModeHandler* mh, bool value)
+{
+ char m = mh->GetModeChar();
+ modes[m-65] = value;
+}
modes.reset();
}
-void Channel::SetMode(char mode,bool mode_on)
-{
- modes[mode-65] = mode_on;
-}
-
void Channel::SetMode(ModeHandler* mh, bool on)
{
modes[mh->GetModeChar() - 65] = on;
{
/* We're either trying to add a mode we already have or
remove a mode we don't have, deny. */
- if (dest->IsModeSet(this->GetModeChar()) == adding)
+ if (dest->IsModeSet(this) == adding)
return MODEACTION_DENY;
/* adding will be either true or false, depending on if we
aren't removing a mode we don't have, we don't have to do any
other checks here to see if it's true or false, just add or
remove the mode */
- dest->SetMode(this->GetModeChar(), adding);
+ dest->SetMode(this, adding);
return MODEACTION_ALLOW;
}
{
/* We're either trying to add a mode we already have or
remove a mode we don't have, deny. */
- if (channel->IsModeSet(this->GetModeChar()) == adding)
+ if (channel->IsModeSet(this) == adding)
return MODEACTION_DENY;
/* adding will be either true or false, depending on if we
aren't removing a mode we don't have, we don't have to do any
other checks here to see if it's true or false, just add or
remove the mode */
- channel->SetMode(this->GetModeChar(), adding);
+ channel->SetMode(this, adding);
return MODEACTION_ALLOW;
}
/* Make sure the user isn't trying to slip in an invalid parameter */
if ((parameter.find(':') == 0) || (parameter.rfind(' ') != std::string::npos))
continue;
- if ((flags & MODE_MERGE) && targetchannel && targetchannel->IsModeSet(modechar) && !mh->IsListMode())
+ if ((flags & MODE_MERGE) && targetchannel && targetchannel->IsModeSet(mh) && !mh->IsListMode())
{
- std::string ours = targetchannel->GetModeParameter(modechar);
+ std::string ours = targetchannel->GetModeParameter(mh);
if (!mh->ResolveModeConflict(parameter, ours, targetchannel))
/* we won the mode merge, don't apply this mode */
continue;
{
RemovePrefixMode(channel, stack);
}
- else if (channel->IsModeSet(this->GetModeChar()))
+ else if (channel->IsModeSet(this))
{
if (this->GetNumParams(false))
// Removing this mode requires a parameter
- stack.Push(this->GetModeChar(), channel->GetModeParameter(this->GetModeChar()));
+ stack.Push(this->GetModeChar(), channel->GetModeParameter(this));
else
stack.Push(this->GetModeChar());
}
ModeAction ModeChannelKey::OnModeChange(User* source, User*, Channel* channel, std::string ¶meter, bool adding)
{
- bool exists = channel->IsModeSet('k');
+ bool exists = channel->IsModeSet(this);
if (IS_LOCAL(source))
{
if (exists == adding)
return MODEACTION_DENY;
- if (exists && (parameter != channel->GetModeParameter('k')))
+ if (exists && (parameter != channel->GetModeParameter(this)))
{
/* Key is currently set and the correct key wasnt given */
return MODEACTION_DENY;
}
} else {
- if (exists && adding && parameter == channel->GetModeParameter('k'))
+ if (exists && adding && parameter == channel->GetModeParameter(this))
{
/* no-op, don't show */
return MODEACTION_DENY;
if (adding)
{
/* Fix for bug #310 reported by Smartys */
- if (!dest->modes[UM_SNOMASK])
+ if (!dest->IsModeSet(this))
dest->snomasks.reset();
- dest->modes[UM_SNOMASK] = true;
+ dest->SetMode(this, true);
parameter = dest->ProcessNoticeMasks(parameter.c_str());
return MODEACTION_ALLOW;
}
else
{
- if (dest->modes[UM_SNOMASK] != false)
+ if (dest->IsModeSet(this))
{
- dest->modes[UM_SNOMASK] = false;
+ dest->SetMode(this, false);
return MODEACTION_ALLOW;
}
}
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You are banned from using INVITE", user->nick.c_str(), channel->name.c_str());
return res;
}
- if (channel->IsModeSet('A') || res == MOD_RES_ALLOW)
+ if (channel->IsModeSet(ni) || res == MOD_RES_ALLOW)
{
// Explicitly allow /invite
return MOD_RES_ALLOW;
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- if (!c->GetExtBanStatus(user, 'B').check(!c->IsModeSet('B')))
+ if (!c->GetExtBanStatus(user, 'B').check(!c->IsModeSet(bc)))
{
int caps = 0;
const char* actstr = "\1ACTION ";
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- if (!c->GetExtBanStatus(user, 'c').check(!c->IsModeSet('c')))
+ if (!c->GetExtBanStatus(user, 'c').check(!c->IsModeSet(bc)))
{
for (std::string::iterator i = text.begin(); i != text.end(); i++)
{
void OnWhois(User* src, User* dst) CXX11_OVERRIDE
{
- if (dst->IsModeSet('B'))
+ if (dst->IsModeSet(bm))
{
ServerInstance->SendWhoisLine(src, dst, 335, src->nick+" "+dst->nick+" :is a bot on "+ServerInstance->Config->Network);
}
ModResult PreText(User* user, User* dest, std::string& text)
{
- if (!dest->IsModeSet('g') || (user == dest))
+ if (!dest->IsModeSet(myumode) || (user == dest))
return MOD_RES_PASSTHRU;
if (operoverride && user->IsOper())
bool active = false;
if (target_type == TYPE_USER)
- active = ((User*)dest)->IsModeSet('G');
+ active = ((User*)dest)->IsModeSet(cu);
else if (target_type == TYPE_CHANNEL)
{
- active = ((Channel*)dest)->IsModeSet('G');
Channel* c = (Channel*)dest;
+ active = c->IsModeSet(cc);
ModResult res = ServerInstance->OnCheckExemption(user,c,"censor");
if (res == MOD_RES_ALLOW)
}
else
{
- if (!channel->IsModeSet('H'))
+ if (!channel->IsModeSet(this))
return MODEACTION_DENY;
ext.unset(channel);
}
*/
if (!user)
{
- dest->SetMode('x',adding);
+ dest->SetMode(this, adding);
return MODEACTION_ALLOW;
}
debounce_ts = ServerInstance->Time();
}
- if (adding == user->IsModeSet('x'))
+ if (adding == user->IsModeSet(this))
return MODEACTION_DENY;
/* don't allow this user to spam modechanges */
if (cloak)
{
user->ChangeDisplayedHost(cloak->c_str());
- user->SetMode('x',true);
+ user->SetMode(this, true);
return MODEACTION_ALLOW;
}
else
/* User is removing the mode, so restore their real host
* and make it match the displayed one.
*/
- user->SetMode('x',false);
+ user->SetMode(this, false);
user->ChangeDisplayedHost(user->host.c_str());
return MODEACTION_ALLOW;
}
// mode change, we will call SetMode back to true AFTER the host change is done.
void OnChangeHost(User* u, const std::string& host) CXX11_OVERRIDE
{
- if(u->IsModeSet('x'))
+ if (u->IsModeSet(cu))
{
- u->SetMode('x', false);
- u->WriteServ("MODE %s -x", u->nick.c_str());
+ u->SetMode(cu, false);
+ u->WriteServ("MODE %s -%c", u->nick.c_str(), cu.GetModeChar());
}
}
if (target_type == TYPE_USER)
{
User* t = (User*)dest;
- if (!user->IsOper() && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t))
+ if (!user->IsOper() && (t->IsModeSet(pm)) && (!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;
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
+ if (adding == dest->IsModeSet(this))
+ return MODEACTION_DENY;
+
if (adding)
- {
- if (!dest->IsModeSet('d'))
- {
- dest->WriteNotice("*** You have enabled usermode +d, deaf mode. This mode means you WILL NOT receive any messages from any channels you are in. If you did NOT mean to do this, use /mode " + dest->nick + " -d.");
- dest->SetMode('d',true);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
- if (dest->IsModeSet('d'))
- {
- dest->SetMode('d',false);
- return MODEACTION_ALLOW;
- }
- }
- return MODEACTION_DENY;
+ dest->WriteNotice("*** You have enabled usermode +d, deaf mode. This mode means you WILL NOT receive any messages from any channels you are in. If you did NOT mean to do this, use /mode " + dest->nick + " -d.");
+
+ dest->SetMode(this, adding);
+ return MODEACTION_ALLOW;
}
};
for (UserMembCIter i = ulist->begin(); i != ulist->end(); i++)
{
/* not +d ? */
- if (!i->first->IsModeSet('d'))
+ if (!i->first->IsModeSet(m1))
continue; /* deliver message */
/* matched both U-line only and regular bypasses */
if (is_bypasschar && is_bypasschar_uline)
ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
/* no change */
- if (channel->IsModeSet('D') == adding)
+ if (channel->IsModeSet(this) == adding)
return MODEACTION_DENY;
if (!adding)
for (UserMembCIter n = names->begin(); n != names->end(); ++n)
creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
}
- channel->SetMode('D', adding);
+ channel->SetMode(this, adding);
return MODEACTION_ALLOW;
}
void ModuleDelayJoin::OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
{
- if (memb->chan->IsModeSet('D'))
+ if (memb->chan->IsModeSet(djm))
{
unjoined.set(memb, 1);
populate(except, memb);
{
if (adding)
{
- if ((channel->IsModeSet('d')) && (channel->GetModeParameter('d') == parameter))
+ if ((channel->IsModeSet(this)) && (channel->GetModeParameter(this) == parameter))
return MODEACTION_DENY;
/* Setting a new limit, sanity check */
}
else
{
- if (!channel->IsModeSet('d'))
+ if (!channel->IsModeSet(this))
return MODEACTION_DENY;
/*
void ModuleDelayMsg::OnUserJoin(Membership* memb, bool sync, bool created, CUList&)
{
- if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet('d')))
+ if ((IS_LOCAL(memb->user)) && (memb->chan->IsModeSet(djm)))
{
djm.jointime.set(memb, ServerInstance->Time());
}
if (ts == 0)
return MOD_RES_PASSTHRU;
- std::string len = channel->GetModeParameter('d');
+ std::string len = channel->GetModeParameter(&djm);
if (ts + atoi(len.c_str()) > ServerInstance->Time())
{
void OnWhois(User* src, User* dst) CXX11_OVERRIDE
{
- if (dst->IsModeSet('h'))
+ if (dst->IsModeSet(ho))
{
ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is available for help.");
}
return MOD_RES_PASSTHRU;
/* don't touch if -I */
- if (!dest->IsModeSet('I'))
+ if (!dest->IsModeSet(hm))
return MOD_RES_PASSTHRU;
/* if it affects opers, we don't care if they are opered */
if (numeric != 313)
return MOD_RES_PASSTHRU;
- if (!dest->IsModeSet('H'))
+ if (!dest->IsModeSet(hm))
return MOD_RES_PASSTHRU;
if (!user->HasPrivPermission("users/auspex"))
void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) CXX11_OVERRIDE
{
- if (user->IsModeSet('H') && !source->HasPrivPermission("users/auspex"))
+ if (user->IsModeSet(hm) && !source->HasPrivPermission("users/auspex"))
{
// hide the "*" that marks the user as an oper from the /WHO line
std::string::size_type pos = line.find("*");
}
else
{
- if (!channel->IsModeSet('f'))
+ if (!channel->IsModeSet(this))
return MODEACTION_DENY;
ext.unset(channel);
ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
{
- if ((!IS_LOCAL(user)) || !dest->IsModeSet('f'))
+ if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
return MOD_RES_PASSTHRU;
if (ServerInstance->OnCheckExemption(user,dest,"flood") == MOD_RES_ALLOW)
ModeHandler* mh = ServerInstance->Modes->FindMode(letter, MODETYPE_CHANNEL);
if (!mh || mh->IsListMode())
continue;
- if (!channel->IsModeSet(letter))
+ if (!channel->IsModeSet(mh))
continue;
items << " +" << mh->name;
if (mh->GetNumParams(true))
- items << " " << channel->GetModeParameter(letter);
+ items << " " << channel->GetModeParameter(mh);
}
const std::string line = ":" + ServerInstance->Config->ServerName + " 961 " + user->nick + " " + channel->name;
user->SendText(line, items);
}
else
{
- if (!channel->IsModeSet('F'))
+ if (!channel->IsModeSet(this))
return MODEACTION_DENY;
ext.unset(channel);
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet('C')))
+ if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet(nc)))
{
user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str());
return MOD_RES_DENY;
ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) CXX11_OVERRIDE
{
- if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet('Q')))
+ if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet(nk)))
{
// Can't kick with Q in place, not even opers with override, and founders
source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), memb->chan->name.c_str(), memb->user->nick.c_str());
if (override && user->IsOper())
continue;
- if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N')))
+ if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn)))
{
user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)",
user->nick.c_str(), curr->name.c_str());
if ((msgtype == MSG_NOTICE) && (target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
{
Channel* c = (Channel*)dest;
- if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet('T')))
+ if (!c->GetExtBanStatus(user, 'T').check(!c->IsModeSet(nt)))
{
res = ServerInstance->OnCheckExemption(user,c,"nonotice");
if (res == MOD_RES_ALLOW)
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
- if (chan && chan->IsModeSet('O') && !user->IsOper())
+ if (chan && chan->IsModeSet(oc) && !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());
/* $ModDesc: Provides support for channel mode +P to provide permanent channels */
+
+/** Handles the +P channel mode
+ */
+class PermChannel : public ModeHandler
+{
+ public:
+ PermChannel(Module* Creator)
+ : ModeHandler(Creator, "permanent", 'P', PARAM_NONE, MODETYPE_CHANNEL)
+ {
+ oper = true;
+ }
+
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string& parameter, bool adding)
+ {
+ if (adding == channel->IsModeSet(this))
+ return MODEACTION_DENY;
+
+ channel->SetMode(this, adding);
+ if (!adding)
+ channel->CheckDestroy();
+
+ return MODEACTION_ALLOW;
+ }
+};
+
// Not in a class due to circular dependancy hell.
static std::string permchannelsconf;
-static bool WriteDatabase()
+static bool WriteDatabase(PermChannel& permchanmode)
{
/*
* We need to perform an atomic write so as not to fuck things up.
for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); i++)
{
Channel* chan = i->second;
- if (!chan->IsModeSet('P'))
+ if (!chan->IsModeSet(permchanmode))
continue;
stream << "<permchannels channel=\"" << ServerConfig::Escape(chan->name)
return true;
}
-
-/** Handles the +P channel mode
- */
-class PermChannel : public ModeHandler
-{
- public:
- PermChannel(Module* Creator) : ModeHandler(Creator, "permanent", 'P', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; }
-
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
- {
- if (adding)
- {
- if (!channel->IsModeSet('P'))
- {
- channel->SetMode('P',true);
- return MODEACTION_ALLOW;
- }
- }
- else
- {
- if (channel->IsModeSet('P'))
- {
- channel->SetMode(this,false);
- channel->CheckDestroy();
- return MODEACTION_ALLOW;
- }
- }
-
- return MODEACTION_DENY;
- }
-};
-
class ModulePermanentChannels : public Module
{
PermChannel p;
ModResult OnRawMode(User* user, Channel* chan, const char mode, const std::string ¶m, bool adding, int pcnt) CXX11_OVERRIDE
{
- if (chan && (chan->IsModeSet('P') || mode == 'P'))
+ if (chan && (chan->IsModeSet(p) || mode == p.GetModeChar()))
dirty = true;
return MOD_RES_PASSTHRU;
void OnPostTopicChange(User*, Channel *c, const std::string&) CXX11_OVERRIDE
{
- if (c->IsModeSet('P'))
+ if (c->IsModeSet(p))
dirty = true;
}
void OnBackgroundTimer(time_t) CXX11_OVERRIDE
{
if (dirty)
- WriteDatabase();
+ WriteDatabase(p);
dirty = false;
}
ModResult OnChannelPreDelete(Channel *c) CXX11_OVERRIDE
{
- if (c->IsModeSet('P'))
+ if (c->IsModeSet(p))
return MOD_RES_DENY;
return MOD_RES_PASSTHRU;
}
}
- if (channel->GetModeParameter('L') == parameter)
+ if (channel->GetModeParameter(this) == parameter)
return MODEACTION_DENY;
/*
* We used to do some checking for circular +L here, but there is no real need for this any more especially as we
}
else
{
- if (channel->IsModeSet('L'))
+ if (channel->IsModeSet(this))
{
return MODEACTION_ALLOW;
}
class ModuleRedirect : public Module
{
-
Redirect re;
AntiRedirect re_u;
bool UseUsermode;
public:
-
ModuleRedirect()
- : re(this), re_u(this)
+ : re(this)
+ , re_u(this)
{
}
{
if (chan)
{
- if (chan->IsModeSet('L') && chan->IsModeSet('l'))
+ if (chan->IsModeSet(re) && chan->IsModeSet('l'))
{
if (chan->GetUserCounter() >= ConvToInt(chan->GetModeParameter('l')))
{
- std::string channel = chan->GetModeParameter('L');
+ std::string channel = chan->GetModeParameter(&re);
/* sometimes broken ulines can make circular or chained +L, avoid this */
Channel* destchan = ServerInstance->FindChan(channel);
- if (destchan && destchan->IsModeSet('L'))
+ if (destchan && destchan->IsModeSet(re))
{
user->WriteNumeric(470, "%s %s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", user->nick.c_str(), cname.c_str());
return MOD_RES_DENY;
}
/* We check the bool value here to make sure we have it enabled, if we don't then
usermode +L might be assigned to something else. */
- if (UseUsermode && user->IsModeSet('L'))
+ if (UseUsermode && user->IsModeSet(re_u))
{
user->WriteNumeric(470, "%s %s %s :Force redirection stopped.", user->nick.c_str(), cname.c_str(), channel.c_str());
return MOD_RES_DENY;
if (!mh->IsListMode())
{
- if (chan->IsModeSet(modeletter))
+ if (chan->IsModeSet(mh))
modestack.Push(modeletter);
}
else if (((prefixrank = mh->GetPrefixRank()) && (prefixchar = mh->GetPrefix())))
if (!IS_LOCAL(source))
{
// Only change the mode if it's not redundant
- if ((adding != channel->IsModeSet('r')))
+ if ((adding != channel->IsModeSet(this)))
{
- channel->SetMode('r',adding);
+ channel->SetMode(this, adding);
return MODEACTION_ALLOW;
}
}
{
if (!IS_LOCAL(source))
{
- if ((adding != dest->IsModeSet('r')))
+ if ((adding != dest->IsModeSet(this)))
{
- dest->SetMode('r',adding);
+ dest->SetMode(this, adding);
return MODEACTION_ALLOW;
}
}
ServerInstance->SendWhoisLine(source, dest, 330, "%s %s %s :is logged in as", source->nick.c_str(), dest->nick.c_str(), account->c_str());
}
- if (dest->IsModeSet('r'))
+ if (dest->IsModeSet(m5))
{
/* user is registered */
ServerInstance->SendWhoisLine(source, dest, 307, "%s %s :is a registered nick", source->nick.c_str(), dest->nick.c_str());
void OnUserPostNick(User* user, const std::string &oldnick) CXX11_OVERRIDE
{
/* On nickchange, if they have +r, remove it */
- if (user->IsModeSet('r') && assign(user->nick) != oldnick)
+ if (user->IsModeSet(m5) && assign(user->nick) != oldnick)
{
std::vector<std::string> modechange;
modechange.push_back(user->nick);
Channel* c = (Channel*)dest;
ModResult res = ServerInstance->OnCheckExemption(user,c,"regmoderated");
- if (c->IsModeSet('M') && !is_registered && res != MOD_RES_ALLOW)
+ if (c->IsModeSet(m2) && !is_registered && res != MOD_RES_ALLOW)
{
// user messaging a +M channel and is not registered
user->WriteNumeric(477, user->nick+" "+c->name+" :You need to be identified to a registered account to message this channel");
{
User* u = (User*)dest;
- if (u->IsModeSet('R') && !is_registered)
+ if (u->IsModeSet(m3) && !is_registered)
{
// user messaging a +R user and is not registered
user->WriteNumeric(477, ""+ user->nick +" "+ u->nick +" :You need to be identified to a registered account to message this user");
if (chan)
{
- if (chan->IsModeSet('R'))
+ if (chan->IsModeSet(m1))
{
if (!is_registered)
{
void OnWhois(User* user, User* dest) CXX11_OVERRIDE
{
- if (dest->IsModeSet('k'))
+ if (dest->IsModeSet(bm))
{
ServerInstance->SendWhoisLine(user, dest, 310, user->nick+" "+dest->nick+" :is a Network Service on "+ServerInstance->Config->Network);
}
* This includes any prefix permission mode, even those registered in other modules, e.g. +qaohv. Using ::ModeString()
* here means that the number of modes is restricted to only modes the user has, limiting it to as short a loop as possible.
*/
- if (u->IsModeSet('k') && memb && memb->modes.find(mode) != std::string::npos)
+ if (u->IsModeSet(bm) && memb && memb->modes.find(mode) != std::string::npos)
{
/* BZZZT, Denied! */
user->WriteNumeric(482, "%s %s :You are not permitted to remove privileges from %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network.c_str());
if (src == NULL)
return MOD_RES_PASSTHRU;
- if (dst->IsModeSet('k'))
+ if (dst->IsModeSet(bm))
{
src->WriteNumeric(485, "%s :You are not permitted to kill %s services!", src->nick.c_str(), ServerInstance->Config->Network.c_str());
ServerInstance->SNO->WriteGlobalSno('a', src->nick+" tried to kill service "+dst->nick+" ("+reason+")");
ModResult OnUserPreKick(User *src, Membership* memb, const std::string &reason) CXX11_OVERRIDE
{
- if (memb->user->IsModeSet('k'))
+ if (memb->user->IsModeSet(bm))
{
src->WriteNumeric(484, "%s %s :You are not permitted to kick services",
src->nick.c_str(), memb->chan->name.c_str());
ModResult OnWhoisLine(User* src, User* dst, int &numeric, std::string &text) CXX11_OVERRIDE
{
- return ((src != dst) && (numeric == 319) && dst->IsModeSet('k')) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
+ return ((src != dst) && (numeric == 319) && dst->IsModeSet(bm)) ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
};
void OnWhois(User* source, User* dest) CXX11_OVERRIDE
{
- if (!dest->IsModeSet('W') || source == dest)
+ if (!dest->IsModeSet(*sw) || source == dest)
return;
if (!ShowWhoisFromOpers && source->IsOper())
}
else
mh->OnModeChange(_new, _new, NULL, empty, true);
- _new->SetMode(*v, true);
+ _new->SetMode(mh, true);
}
_new->SetClientIP(params[6].c_str());
{
if (adding)
{
- if (!channel->IsModeSet('z'))
+ if (!channel->IsModeSet(this))
{
if (IS_LOCAL(source))
{
}
}
}
- channel->SetMode('z',true);
+ channel->SetMode(this, true);
return MODEACTION_ALLOW;
}
else
}
else
{
- if (channel->IsModeSet('z'))
+ if (channel->IsModeSet(this))
{
- channel->SetMode('z',false);
+ channel->SetMode(this, false);
return MODEACTION_ALLOW;
}
ModResult OnUserPreJoin(LocalUser* user, Channel* chan, const std::string& cname, std::string& privs, const std::string& keygiven) CXX11_OVERRIDE
{
- if(chan && chan->IsModeSet('z'))
+ if(chan && chan->IsModeSet(sslm))
{
if (!sslm.API)
return MOD_RES_DENY;
if (target_type == TYPE_USER)
{
User* t = (User*)dest;
- active = t->IsModeSet('S');
+ active = t->IsModeSet(usc);
}
else if (target_type == TYPE_CHANNEL)
{
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
- active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet('S'));
+ active = !t->GetExtBanStatus(user, 'S').check(!t->IsModeSet(csc));
}
if (active)