mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
ModeParser: remove fakederef.
This commit is contained in:
parent
e862582e7e
commit
7ba7290bf0
@ -535,7 +535,7 @@ class CoreExport ModeWatcher : public classbase
|
||||
* parses client to server MODE strings for user and channel modes, and performs
|
||||
* processing for the 004 mode list numeric, amongst other things.
|
||||
*/
|
||||
class CoreExport ModeParser : public fakederef<ModeParser>
|
||||
class CoreExport ModeParser
|
||||
{
|
||||
public:
|
||||
static const ModeHandler::Id MODEID_MAX = 64;
|
||||
|
@ -131,7 +131,7 @@ void Channel::SetDefaultModes()
|
||||
|
||||
for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n)
|
||||
{
|
||||
ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
|
||||
ModeHandler* mode = ServerInstance->Modes.FindMode(*n, MODETYPE_CHANNEL);
|
||||
if (mode)
|
||||
{
|
||||
if (mode->IsPrefixMode())
|
||||
@ -272,7 +272,7 @@ Membership* Channel::ForceJoin(User* user, const std::string* privs, bool bursti
|
||||
// remote user and his own server set the modes), then set them internally now
|
||||
for (std::string::const_iterator i = privs->begin(); i != privs->end(); ++i)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(*i);
|
||||
if (mh)
|
||||
{
|
||||
std::string nick = user->nick;
|
||||
@ -415,7 +415,7 @@ void Channel::Write(ClientProtocol::Event& protoev, char status, const CUList& e
|
||||
unsigned int minrank = 0;
|
||||
if (status)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefix(status);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefix(status);
|
||||
if (mh)
|
||||
minrank = mh->GetPrefixRank();
|
||||
}
|
||||
@ -443,7 +443,7 @@ const char* Channel::ChanModes(bool showsecret)
|
||||
/* This was still iterating up to 190, Channel::modes is only 64 elements -- Om */
|
||||
for(int n = 0; n < 64; n++)
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(n + 65, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(n + 65, MODETYPE_CHANNEL);
|
||||
if (mh && IsModeSet(mh))
|
||||
{
|
||||
scratch.push_back(n + 65);
|
||||
@ -485,7 +485,7 @@ char Membership::GetPrefixChar() const
|
||||
|
||||
for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(*i);
|
||||
if (mh && mh->GetPrefixRank() > bestrank && mh->GetPrefix())
|
||||
{
|
||||
bestrank = mh->GetPrefixRank();
|
||||
@ -501,7 +501,7 @@ unsigned int Membership::getRank()
|
||||
unsigned int rv = 0;
|
||||
if (mchar)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(mchar);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(mchar);
|
||||
if (mh)
|
||||
rv = mh->GetPrefixRank();
|
||||
}
|
||||
@ -513,7 +513,7 @@ std::string Membership::GetAllPrefixChars() const
|
||||
std::string ret;
|
||||
for (std::string::const_iterator i = modes.begin(); i != modes.end(); ++i)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(*i);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(*i);
|
||||
if (mh && mh->GetPrefix())
|
||||
ret.push_back(mh->GetPrefix());
|
||||
}
|
||||
@ -535,7 +535,7 @@ bool Membership::SetPrefix(PrefixMode* delta_mh, bool adding)
|
||||
for (unsigned int i = 0; i < modes.length(); i++)
|
||||
{
|
||||
char mchar = modes[i];
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(mchar);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(mchar);
|
||||
if (mh && mh->GetPrefixRank() <= delta_mh->GetPrefixRank())
|
||||
{
|
||||
modes = modes.substr(0,i) +
|
||||
|
@ -114,7 +114,7 @@ CmdResult CommandInvite::Handle(User* user, const Params& parameters)
|
||||
if (rank < HALFOP_VALUE)
|
||||
{
|
||||
// Check whether halfop mode is available and phrase error message accordingly
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode('h', MODETYPE_CHANNEL);
|
||||
user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, InspIRCd::Format("You must be a channel %soperator",
|
||||
(mh && mh->name == "halfop" ? "half-" : "")));
|
||||
return CMD_FAILURE;
|
||||
@ -149,7 +149,7 @@ CmdResult CommandInvite::Handle(User* user, const Params& parameters)
|
||||
}
|
||||
case Invite::ANNOUNCE_DYNAMIC:
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode('h');
|
||||
if ((mh) && (mh->name == "halfop"))
|
||||
{
|
||||
prefix = mh->GetPrefix();
|
||||
|
@ -108,7 +108,7 @@ CmdResult CommandKick::Handle(User* user, const Params& parameters)
|
||||
unsigned int req = HALFOP_VALUE;
|
||||
for (std::string::size_type i = 0; i < memb->modes.length(); i++)
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(memb->modes[i], MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(memb->modes[i], MODETYPE_CHANNEL);
|
||||
if (mh && mh->GetLevelRequired(true) > req)
|
||||
req = mh->GetLevelRequired(true);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
|
||||
|
||||
// Build a map of limits to their mode character.
|
||||
insp::flat_map<int, std::string> limits;
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes.GetListModes();
|
||||
for (ModeParser::ListModeList::const_iterator iter = listmodes.begin(); iter != listmodes.end(); ++iter)
|
||||
{
|
||||
const unsigned int limit = (*iter)->GetLowerLimit();
|
||||
@ -344,7 +344,7 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
|
||||
unsigned int mypfx = chan->GetPrefixValue(user);
|
||||
char minmode = exemptions[restriction];
|
||||
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode(minmode);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode(minmode);
|
||||
if (mh && mypfx >= mh->GetPrefixRank())
|
||||
return MOD_RES_ALLOW;
|
||||
if (mh || minmode == '*')
|
||||
|
@ -177,7 +177,7 @@ CmdResult MessageCommandBase::HandleMessage(User* user, const Params& parameters
|
||||
char status = 0;
|
||||
const char* target = parameters[0].c_str();
|
||||
|
||||
if (ServerInstance->Modes->FindPrefix(*target))
|
||||
if (ServerInstance->Modes.FindPrefix(*target))
|
||||
{
|
||||
status = *target;
|
||||
target++;
|
||||
|
@ -488,7 +488,7 @@ void DataKeeper::RestoreMemberData(Channel* chan, const std::vector<ChanData::Me
|
||||
|
||||
void DataKeeper::CreateModeList(ModeType modetype)
|
||||
{
|
||||
const ModeParser::ModeHandlerMap& modes = ServerInstance->Modes->GetModes(modetype);
|
||||
const ModeParser::ModeHandlerMap& modes = ServerInstance->Modes.GetModes(modetype);
|
||||
for (ModeParser::ModeHandlerMap::const_iterator i = modes.begin(); i != modes.end(); ++i)
|
||||
{
|
||||
ModeHandler* mh = i->second;
|
||||
@ -535,7 +535,7 @@ void DataKeeper::LinkModes(ModeType modetype)
|
||||
for (std::vector<ProviderInfo>::iterator i = list.begin(); i != list.end(); ++i)
|
||||
{
|
||||
ProviderInfo& item = *i;
|
||||
item.mh = ServerInstance->Modes->FindMode(item.itemname, modetype);
|
||||
item.mh = ServerInstance->Modes.FindMode(item.itemname, modetype);
|
||||
VerifyServiceProvider(item, (modetype == MODETYPE_USER ? "User mode" : "Channel mode"));
|
||||
}
|
||||
}
|
||||
|
@ -338,10 +338,10 @@ void CommandStats::DoStats(Stats::Context& stats)
|
||||
std::string cmodes;
|
||||
for(char c='A'; c <= 'z'; c++)
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(c, MODETYPE_USER);
|
||||
if (mh && mh->NeedsOper() && tag->AllowedUserModes[c - 'A'])
|
||||
umodes.push_back(c);
|
||||
mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL);
|
||||
mh = ServerInstance->Modes.FindMode(c, MODETYPE_CHANNEL);
|
||||
if (mh && mh->NeedsOper() && tag->AllowedChanModes[c - 'A'])
|
||||
cmodes.push_back(c);
|
||||
}
|
||||
|
@ -88,9 +88,9 @@ CmdResult CommandMode::Handle(User* user, const Params& parameters)
|
||||
flags |= ModeParser::MODE_LOCALONLY;
|
||||
|
||||
if (IS_LOCAL(user))
|
||||
ServerInstance->Modes->ProcessSingle(user, targetchannel, targetuser, changelist, flags);
|
||||
ServerInstance->Modes.ProcessSingle(user, targetchannel, targetuser, changelist, flags);
|
||||
else
|
||||
ServerInstance->Modes->Process(user, targetchannel, targetuser, changelist, flags);
|
||||
ServerInstance->Modes.Process(user, targetchannel, targetuser, changelist, flags);
|
||||
|
||||
if ((ServerInstance->Modes.GetLastChangeList().empty()) && (targetchannel) && (parameters.size() == 2))
|
||||
{
|
||||
@ -118,7 +118,7 @@ void CommandMode::DisplayListModes(User* user, Channel* chan, const std::string&
|
||||
if (mletter == '+')
|
||||
continue;
|
||||
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(mletter, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(mletter, MODETYPE_CHANNEL);
|
||||
if (!mh || !mh->IsListMode())
|
||||
return;
|
||||
|
||||
@ -157,7 +157,7 @@ namespace
|
||||
for (unsigned char chr = 65; chr < 123; ++chr)
|
||||
{
|
||||
// Check that the mode exists and is set.
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(chr, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(chr, MODETYPE_CHANNEL);
|
||||
if (!mh || !chan->IsModeSet(mh))
|
||||
continue;
|
||||
|
||||
|
@ -42,7 +42,7 @@ ModeHandler::ModeHandler(Module* Creator, const std::string& Name, char modelett
|
||||
CullResult ModeHandler::cull()
|
||||
{
|
||||
if (ServerInstance)
|
||||
ServerInstance->Modes->DelMode(this);
|
||||
ServerInstance->Modes.DelMode(this);
|
||||
return classbase::cull();
|
||||
}
|
||||
|
||||
@ -147,12 +147,12 @@ ModeAction SimpleChannelModeHandler::OnModeChange(User* source, User* dest, Chan
|
||||
ModeWatcher::ModeWatcher(Module* Creator, const std::string& modename, ModeType type)
|
||||
: mode(modename), m_type(type), creator(Creator)
|
||||
{
|
||||
ServerInstance->Modes->AddModeWatcher(this);
|
||||
ServerInstance->Modes.AddModeWatcher(this);
|
||||
}
|
||||
|
||||
ModeWatcher::~ModeWatcher()
|
||||
{
|
||||
ServerInstance->Modes->DelModeWatcher(this);
|
||||
ServerInstance->Modes.DelModeWatcher(this);
|
||||
}
|
||||
|
||||
bool ModeWatcher::BeforeMode(User*, User*, Channel*, std::string&, bool)
|
||||
@ -834,7 +834,7 @@ void ModeHandler::RemoveMode(User* user)
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_remove(this);
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, NULL, user, changelist, ModeParser::MODE_LOCALONLY);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, NULL, user, changelist, ModeParser::MODE_LOCALONLY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ void ModuleManager::DelService(ServiceProvider& item)
|
||||
switch (item.service)
|
||||
{
|
||||
case SERVICE_MODE:
|
||||
if (!ServerInstance->Modes->DelMode(static_cast<ModeHandler*>(&item)))
|
||||
if (!ServerInstance->Modes.DelMode(static_cast<ModeHandler*>(&item)))
|
||||
throw ModuleException("Mode "+std::string(item.name)+" does not exist.");
|
||||
// Fall through
|
||||
case SERVICE_DATA:
|
||||
|
@ -167,8 +167,8 @@ class ModuleAntiCaps : public Module
|
||||
banmask.append(user->GetDisplayedHost());
|
||||
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), banmask);
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, channel, NULL, changelist);
|
||||
changelist.push_add(ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL), banmask);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, NULL, changelist);
|
||||
}
|
||||
|
||||
void InformUser(Channel* channel, User* user, const std::string& message)
|
||||
|
@ -36,9 +36,9 @@ class AutoOpList : public ListModeBase
|
||||
PrefixMode* FindMode(const std::string& mid)
|
||||
{
|
||||
if (mid.length() == 1)
|
||||
return ServerInstance->Modes->FindPrefixMode(mid[0]);
|
||||
return ServerInstance->Modes.FindPrefixMode(mid[0]);
|
||||
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(mid, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(mid, MODETYPE_CHANNEL);
|
||||
return mh ? mh->IsPrefixMode() : NULL;
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ class ModuleAutoOp : public Module
|
||||
changelist.push_add(given, memb->user->nick);
|
||||
}
|
||||
}
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, memb->chan, NULL, changelist);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, memb->chan, NULL, changelist);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ class ModuleBanRedirect : public Module
|
||||
|
||||
if(redirects)
|
||||
{
|
||||
ModeHandler* ban = ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL);
|
||||
ModeHandler* ban = ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL);
|
||||
Modes::ChangeList changelist;
|
||||
|
||||
for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++)
|
||||
@ -272,7 +272,7 @@ class ModuleBanRedirect : public Module
|
||||
for(BanRedirectList::iterator i = redirects->begin(); i != redirects->end(); i++)
|
||||
changelist.push_add(ban, i->banmask);
|
||||
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist, ModeParser::MODE_LOCALONLY);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, changelist, ModeParser::MODE_LOCALONLY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class ModuleChannelNames : public Module
|
||||
{
|
||||
removepermchan.clear();
|
||||
removepermchan.push_remove(*permchannelmode);
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, c, NULL, removepermchan);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, removepermchan);
|
||||
}
|
||||
|
||||
Channel::MemberMap& users = c->userlist;
|
||||
|
@ -34,7 +34,7 @@ class ModuleBadChannelExtban : public Module
|
||||
{
|
||||
std::string rm(mask, 2);
|
||||
char status = 0;
|
||||
const PrefixMode* const mh = ServerInstance->Modes->FindPrefix(rm[0]);
|
||||
const PrefixMode* const mh = ServerInstance->Modes.FindPrefix(rm[0]);
|
||||
if (mh)
|
||||
{
|
||||
rm.assign(mask, 3, std::string::npos);
|
||||
|
@ -269,7 +269,7 @@ class CommandCheck : public Command
|
||||
i->first->GetRealName().c_str()));
|
||||
}
|
||||
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes.GetListModes();
|
||||
for (ModeParser::ListModeList::const_iterator i = listmodes.begin(); i != listmodes.end(); ++i)
|
||||
context.DumpListMode(*i, targchan);
|
||||
|
||||
|
@ -56,7 +56,7 @@ class ModuleCustomPrefix : public Module
|
||||
|
||||
if (tag->getBool("change"))
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(name, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(name, MODETYPE_CHANNEL);
|
||||
if (!mh)
|
||||
throw ModuleException("<customprefix:change> specified for a non-existent mode at " + tag->getTagLocation());
|
||||
|
||||
|
@ -53,7 +53,7 @@ class ModuleDisable : public Module
|
||||
chr, field.c_str(), tag->getTagLocation().c_str()));
|
||||
|
||||
// Check that the mode actually exists.
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(chr, type);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(chr, type);
|
||||
if (!chr)
|
||||
throw ModuleException(InspIRCd::Format("Non-existent mode '%c' was specified in <disabled:%s> at %s",
|
||||
chr, field.c_str(), tag->getTagLocation().c_str()));
|
||||
|
@ -47,7 +47,7 @@ class ExemptChanOps : public ListModeBase
|
||||
if (p != std::string::npos)
|
||||
restriction.erase(p);
|
||||
|
||||
if (!ServerInstance->Modes->FindMode(restriction, MODETYPE_CHANNEL))
|
||||
if (!ServerInstance->Modes.FindMode(restriction, MODETYPE_CHANNEL))
|
||||
{
|
||||
user->WriteNumeric(Numerics::InvalidModeParameter(chan, this, word, "Unknown restriction"));
|
||||
return false;
|
||||
@ -70,9 +70,9 @@ class ExemptHandler : public CheckExemption::EventListener
|
||||
PrefixMode* FindMode(const std::string& mid)
|
||||
{
|
||||
if (mid.length() == 1)
|
||||
return ServerInstance->Modes->FindPrefixMode(mid[0]);
|
||||
return ServerInstance->Modes.FindPrefixMode(mid[0]);
|
||||
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(mid, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(mid, MODETYPE_CHANNEL);
|
||||
return mh ? mh->IsPrefixMode() : NULL;
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,8 @@ class ModuleMsgFlood : public Module
|
||||
if (f->ban)
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, dest, NULL, changelist);
|
||||
changelist.push_add(ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, dest, NULL, changelist);
|
||||
}
|
||||
|
||||
const std::string kickMessage = "Channel flood triggered (trigger is " + ConvToStr(f->lines) +
|
||||
|
@ -31,7 +31,7 @@ static void DisplayList(LocalUser* user, Channel* channel)
|
||||
Numeric::ParamBuilder<1> numeric(user, RPL_PROPLIST);
|
||||
numeric.AddStatic(channel->name);
|
||||
|
||||
const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
|
||||
const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes.GetModes(MODETYPE_CHANNEL);
|
||||
for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i)
|
||||
{
|
||||
ModeHandler* mh = i->second;
|
||||
@ -84,7 +84,7 @@ class CommandProp : public SplitCommand
|
||||
if (prop[0] == '+' || prop[0] == '-')
|
||||
prop.erase(prop.begin());
|
||||
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(prop, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(prop, MODETYPE_CHANNEL);
|
||||
if (mh)
|
||||
{
|
||||
if (mh->NeedsParam(plus))
|
||||
@ -96,7 +96,7 @@ class CommandProp : public SplitCommand
|
||||
modes.push(mh, plus);
|
||||
}
|
||||
}
|
||||
ServerInstance->Modes->ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS);
|
||||
ServerInstance->Modes.ProcessSingle(src, chan, NULL, modes, ModeParser::MODE_CHECKACCESS);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
};
|
||||
@ -159,7 +159,7 @@ class ModuleNamedModes : public Module
|
||||
name.erase(eq);
|
||||
}
|
||||
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(name, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(name, MODETYPE_CHANNEL);
|
||||
if (!mh)
|
||||
{
|
||||
// Mode handler not found
|
||||
|
@ -74,8 +74,8 @@ class CommandOjoin : public SplitCommand
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_add(npmh, user->nick);
|
||||
if (op)
|
||||
changelist.push_add(ServerInstance->Modes->FindMode('o', MODETYPE_CHANNEL), user->nick);
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, channel, NULL, changelist);
|
||||
changelist.push_add(ServerInstance->Modes.FindMode('o', MODETYPE_CHANNEL), user->nick);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, channel, NULL, changelist);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class ModuleOperPrefixMode : public Module
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push(&opm, add, user->nick);
|
||||
for (User::ChanList::iterator v = user->chans.begin(); v != user->chans.end(); v++)
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, (*v)->chan, NULL, changelist);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, (*v)->chan, NULL, changelist);
|
||||
}
|
||||
|
||||
void OnPostOper(User* user, const std::string& opername, const std::string& opertype) override
|
||||
|
@ -87,7 +87,7 @@ static bool WriteDatabase(PermChannel& permchanmode, Module* mod, bool save_list
|
||||
std::string modes;
|
||||
std::string params;
|
||||
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes.GetListModes();
|
||||
for (ModeParser::ListModeList::const_iterator j = listmodes.begin(); j != listmodes.end(); ++j)
|
||||
{
|
||||
ListModeBase* lm = *j;
|
||||
@ -233,7 +233,7 @@ public:
|
||||
// XXX bleh, should we pass this to the mode parser instead? ugly. --w00t
|
||||
for (std::string::iterator n = modeseq.begin(); n != modeseq.end(); ++n)
|
||||
{
|
||||
ModeHandler* mode = ServerInstance->Modes->FindMode(*n, MODETYPE_CHANNEL);
|
||||
ModeHandler* mode = ServerInstance->Modes.FindMode(*n, MODETYPE_CHANNEL);
|
||||
if (mode)
|
||||
{
|
||||
if (mode->NeedsParam(true))
|
||||
|
@ -395,8 +395,8 @@ class RepeatModule : public Module
|
||||
if (settings->Action == ChannelSettings::ACT_BAN)
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, chan, NULL, changelist);
|
||||
changelist.push_add(ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, chan, NULL, changelist);
|
||||
}
|
||||
|
||||
memb->chan->KickUser(ServerInstance->FakeClient, user, "Repeat flood");
|
||||
|
@ -43,7 +43,7 @@ class CommandRMode : public Command
|
||||
return CMD_FAILURE;
|
||||
}
|
||||
|
||||
mh = ServerInstance->Modes->FindMode(modeletter, MODETYPE_CHANNEL);
|
||||
mh = ServerInstance->Modes.FindMode(modeletter, MODETYPE_CHANNEL);
|
||||
if (mh == NULL || parameters[1].size() > 1)
|
||||
{
|
||||
user->WriteNotice(parameters[1] + " is not a valid channel mode.");
|
||||
@ -89,7 +89,7 @@ class CommandRMode : public Command
|
||||
changelist.push_remove(mh);
|
||||
}
|
||||
|
||||
ServerInstance->Modes->Process(user, chan, NULL, changelist);
|
||||
ServerInstance->Modes.Process(user, chan, NULL, changelist);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
@ -55,7 +55,7 @@ class CommandSamode : public Command
|
||||
|
||||
// XXX: Make ModeParser clear LastParse
|
||||
Modes::ChangeList emptychangelist;
|
||||
ServerInstance->Modes->ProcessSingle(ServerInstance->FakeClient, NULL, ServerInstance->FakeClient, emptychangelist);
|
||||
ServerInstance->Modes.ProcessSingle(ServerInstance->FakeClient, NULL, ServerInstance->FakeClient, emptychangelist);
|
||||
|
||||
logged = false;
|
||||
this->active = true;
|
||||
|
@ -181,9 +181,9 @@ void TreeSocket::SendCapabilities(int phase)
|
||||
{
|
||||
extra.append(" PROTOCOL="+ConvToStr(ProtocolVersion))
|
||||
.append(" MAXGECOS="+ConvToStr(ServerInstance->Config->Limits.MaxReal))
|
||||
.append(" CHANMODES="+ServerInstance->Modes->GiveModeList(MODETYPE_CHANNEL))
|
||||
.append(" USERMODES="+ServerInstance->Modes->GiveModeList(MODETYPE_USER))
|
||||
.append(" PREFIX="+ ServerInstance->Modes->BuildPrefixes());
|
||||
.append(" CHANMODES="+ServerInstance->Modes.GiveModeList(MODETYPE_CHANNEL))
|
||||
.append(" USERMODES="+ServerInstance->Modes.GiveModeList(MODETYPE_USER))
|
||||
.append(" PREFIX="+ ServerInstance->Modes.BuildPrefixes());
|
||||
}
|
||||
|
||||
this->WriteLine("CAPAB CAPABILITIES " /* Preprocessor does this one. */
|
||||
@ -335,13 +335,13 @@ bool TreeSocket::Capab(const CommandBase::Params& params)
|
||||
{
|
||||
if (this->capab->CapKeys.find("CHANMODES") != this->capab->CapKeys.end())
|
||||
{
|
||||
if (this->capab->CapKeys.find("CHANMODES")->second != ServerInstance->Modes->GiveModeList(MODETYPE_CHANNEL))
|
||||
if (this->capab->CapKeys.find("CHANMODES")->second != ServerInstance->Modes.GiveModeList(MODETYPE_CHANNEL))
|
||||
reason = "One or more of the channel modes on the remote server are invalid on this server.";
|
||||
}
|
||||
|
||||
else if (this->capab->CapKeys.find("PREFIX") != this->capab->CapKeys.end())
|
||||
{
|
||||
if (this->capab->CapKeys.find("PREFIX")->second != ServerInstance->Modes->BuildPrefixes())
|
||||
if (this->capab->CapKeys.find("PREFIX")->second != ServerInstance->Modes.BuildPrefixes())
|
||||
reason = "One or more of the prefixes on the remote server are invalid on this server.";
|
||||
}
|
||||
}
|
||||
@ -370,7 +370,7 @@ bool TreeSocket::Capab(const CommandBase::Params& params)
|
||||
}
|
||||
else if (proto_version == 1202 && this->capab->CapKeys.find("USERMODES") != this->capab->CapKeys.end())
|
||||
{
|
||||
if (this->capab->CapKeys.find("USERMODES")->second != ServerInstance->Modes->GiveModeList(MODETYPE_USER))
|
||||
if (this->capab->CapKeys.find("USERMODES")->second != ServerInstance->Modes.GiveModeList(MODETYPE_USER))
|
||||
reason = "One or more of the user modes on the remote server are invalid on this server.";
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
|
||||
if (apply_other_sides_modes)
|
||||
{
|
||||
ServerInstance->Modes.ModeParamsToChangeList(srcuser, MODETYPE_CHANNEL, params, modechangelist, 2, params.size() - 1);
|
||||
ServerInstance->Modes->Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
|
||||
ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY | ModeParser::MODE_MERGE);
|
||||
// Reuse for prefix modes
|
||||
modechangelist.clear();
|
||||
}
|
||||
@ -192,7 +192,7 @@ CmdResult CommandFJoin::Handle(User* srcuser, Params& params)
|
||||
|
||||
// Set prefix modes on their users if we lost the FJOIN or had equal TS
|
||||
if (apply_other_sides_modes)
|
||||
ServerInstance->Modes->Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY);
|
||||
ServerInstance->Modes.Process(srcuser, chan, NULL, modechangelist, ModeParser::MODE_LOCALONLY);
|
||||
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -227,7 +227,7 @@ void CommandFJoin::ProcessModeUUIDPair(const std::string& item, TreeServer* sour
|
||||
/* Iterate through the modes and see if they are valid here, if so, apply */
|
||||
for (std::string::const_iterator i = item.begin(); i != modeendit; ++i)
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(*i, MODETYPE_CHANNEL);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(*i, MODETYPE_CHANNEL);
|
||||
if (!mh)
|
||||
throw ProtocolException("Unrecognised mode '" + std::string(1, *i) + "'");
|
||||
|
||||
@ -261,7 +261,7 @@ void CommandFJoin::RemoveStatus(Channel* c)
|
||||
{
|
||||
Modes::ChangeList changelist;
|
||||
|
||||
const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes->GetModes(MODETYPE_CHANNEL);
|
||||
const ModeParser::ModeHandlerMap& mhs = ServerInstance->Modes.GetModes(MODETYPE_CHANNEL);
|
||||
for (ModeParser::ModeHandlerMap::const_iterator i = mhs.begin(); i != mhs.end(); ++i)
|
||||
{
|
||||
ModeHandler* mh = i->second;
|
||||
@ -270,7 +270,7 @@ void CommandFJoin::RemoveStatus(Channel* c)
|
||||
mh->RemoveMode(c, changelist);
|
||||
}
|
||||
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, c, NULL, changelist, ModeParser::MODE_LOCALONLY);
|
||||
}
|
||||
|
||||
void CommandFJoin::LowerTS(Channel* chan, time_t TS, const std::string& newname)
|
||||
|
@ -50,6 +50,6 @@ CmdResult CommandFMode::Handle(User* who, Params& params)
|
||||
if ((TS == ourTS) && IS_SERVER(who))
|
||||
flags |= ModeParser::MODE_MERGE;
|
||||
|
||||
ServerInstance->Modes->Process(who, chan, NULL, changelist, flags);
|
||||
ServerInstance->Modes.Process(who, chan, NULL, changelist, flags);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void TreeSocket::SendXLines()
|
||||
void TreeSocket::SendListModes(Channel* chan)
|
||||
{
|
||||
FModeBuilder fmode(chan);
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
|
||||
const ModeParser::ListModeList& listmodes = ServerInstance->Modes.GetListModes();
|
||||
for (ModeParser::ListModeList::const_iterator i = listmodes.begin(); i != listmodes.end(); ++i)
|
||||
{
|
||||
ListModeBase* mh = *i;
|
||||
|
@ -32,7 +32,7 @@ CmdResult CommandOpertype::HandleRemote(RemoteUser* u, CommandBase::Params& para
|
||||
if (!u->IsOper())
|
||||
ServerInstance->Users->all_opers.push_back(u);
|
||||
|
||||
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
|
||||
ModeHandler* opermh = ServerInstance->Modes.FindMode('o', MODETYPE_USER);
|
||||
if (opermh)
|
||||
u->SetMode(opermh, true);
|
||||
|
||||
|
@ -89,7 +89,7 @@ void SpanningTreeUtilities::RouteCommand(TreeServer* origin, CommandBase* thiscm
|
||||
{
|
||||
char pfx = 0;
|
||||
std::string dest = routing.serverdest;
|
||||
if (ServerInstance->Modes->FindPrefix(dest[0]))
|
||||
if (ServerInstance->Modes.FindPrefix(dest[0]))
|
||||
{
|
||||
pfx = dest[0];
|
||||
dest.erase(dest.begin());
|
||||
|
@ -90,7 +90,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, CommandBase::Params
|
||||
continue;
|
||||
|
||||
/* For each mode thats set, find the mode handler and set it on the new user */
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(*v, MODETYPE_USER);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(*v, MODETYPE_USER);
|
||||
if (!mh)
|
||||
throw ProtocolException("Unrecognised mode '" + std::string(1, *v) + "'");
|
||||
|
||||
|
@ -140,7 +140,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeSocketSet
|
||||
unsigned int minrank = 0;
|
||||
if (status)
|
||||
{
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefix(status);
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefix(status);
|
||||
if (mh)
|
||||
minrank = mh->GetPrefixRank();
|
||||
}
|
||||
|
@ -103,11 +103,11 @@ class CommandTban : public Command
|
||||
}
|
||||
|
||||
Modes::ChangeList setban;
|
||||
setban.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask);
|
||||
setban.push_add(ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL), mask);
|
||||
// Pass the user (instead of ServerInstance->FakeClient) to ModeHandler::Process() to
|
||||
// make it so that the user sets the mode themselves
|
||||
ServerInstance->Modes->Process(user, channel, NULL, setban);
|
||||
if (ServerInstance->Modes->GetLastChangeList().empty())
|
||||
ServerInstance->Modes.Process(user, channel, NULL, setban);
|
||||
if (ServerInstance->Modes.GetLastChangeList().empty())
|
||||
{
|
||||
user->WriteNotice("Invalid ban mask");
|
||||
return CMD_FAILURE;
|
||||
@ -120,7 +120,7 @@ class CommandTban : public Command
|
||||
|
||||
const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds.";
|
||||
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode('h');
|
||||
char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
|
||||
|
||||
ClientProtocol::Messages::Privmsg notice(ServerInstance->FakeClient, channel, addban, MSG_NOTICE);
|
||||
@ -212,7 +212,7 @@ class ModuleTimedBans : public Module
|
||||
{
|
||||
const std::string expiry = "*** Timed ban on " + cr->name + " expired.";
|
||||
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
|
||||
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
|
||||
PrefixMode* mh = ServerInstance->Modes.FindPrefixMode('h');
|
||||
char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';
|
||||
|
||||
ClientProtocol::Messages::Privmsg notice(ClientProtocol::Messages::Privmsg::nocopy, ServerInstance->FakeClient, cr, expiry, MSG_NOTICE);
|
||||
@ -220,8 +220,8 @@ class ModuleTimedBans : public Module
|
||||
ServerInstance->PI->SendChannelNotice(cr, pfxchar, expiry);
|
||||
|
||||
Modes::ChangeList setban;
|
||||
setban.push_remove(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask);
|
||||
ServerInstance->Modes->Process(ServerInstance->FakeClient, cr, NULL, setban);
|
||||
setban.push_remove(ServerInstance->Modes.FindMode('b', MODETYPE_CHANNEL), mask);
|
||||
ServerInstance->Modes.Process(ServerInstance->FakeClient, cr, NULL, setban);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ void ISupportManager::Build()
|
||||
|
||||
tokens["AWAYLEN"] = ConvToStr(ServerInstance->Config->Limits.MaxAway);
|
||||
tokens["CASEMAPPING"] = ServerInstance->Config->CaseMapping;
|
||||
tokens["CHANMODES"] = ServerInstance->Modes->GiveModeList(MODETYPE_CHANNEL);
|
||||
tokens["CHANMODES"] = ServerInstance->Modes.GiveModeList(MODETYPE_CHANNEL);
|
||||
tokens["CHANNELLEN"] = ConvToStr(ServerInstance->Config->Limits.ChanMax);
|
||||
tokens["CHANTYPES"] = "#";
|
||||
tokens["HOSTLEN"] = ConvToStr(ServerInstance->Config->Limits.MaxHost);
|
||||
@ -196,8 +196,8 @@ void ISupportManager::Build()
|
||||
tokens["MODES"] = ConvToStr(ServerInstance->Config->Limits.MaxModes);
|
||||
tokens["NETWORK"] = ServerInstance->Config->Network;
|
||||
tokens["NICKLEN"] = ConvToStr(ServerInstance->Config->Limits.NickMax);
|
||||
tokens["PREFIX"] = ServerInstance->Modes->BuildPrefixes();
|
||||
tokens["STATUSMSG"] = ServerInstance->Modes->BuildPrefixes(false);
|
||||
tokens["PREFIX"] = ServerInstance->Modes.BuildPrefixes();
|
||||
tokens["STATUSMSG"] = ServerInstance->Modes.BuildPrefixes(false);
|
||||
tokens["TOPICLEN"] = ConvToStr(ServerInstance->Config->Limits.MaxTopic);
|
||||
tokens["USERLEN"] = ConvToStr(ServerInstance->Config->Limits.IdentMax);
|
||||
tokens["VBANLIST"];
|
||||
|
@ -37,7 +37,7 @@ bool User::IsNoticeMaskSet(unsigned char sm)
|
||||
|
||||
bool User::IsModeSet(unsigned char m) const
|
||||
{
|
||||
ModeHandler* mh = ServerInstance->Modes->FindMode(m, MODETYPE_USER);
|
||||
ModeHandler* mh = ServerInstance->Modes.FindMode(m, MODETYPE_USER);
|
||||
return (mh && modes[mh->GetId()]);
|
||||
}
|
||||
|
||||
@ -353,7 +353,7 @@ CullResult FakeUser::cull()
|
||||
|
||||
void User::Oper(OperInfo* info)
|
||||
{
|
||||
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
|
||||
ModeHandler* opermh = ServerInstance->Modes.FindMode('o', MODETYPE_USER);
|
||||
if (opermh)
|
||||
{
|
||||
if (this->IsModeSet(opermh))
|
||||
@ -459,7 +459,7 @@ void User::UnOper()
|
||||
|
||||
/* Remove all oper only modes from the user when the deoper - Bug #466*/
|
||||
Modes::ChangeList changelist;
|
||||
const ModeParser::ModeHandlerMap& usermodes = ServerInstance->Modes->GetModes(MODETYPE_USER);
|
||||
const ModeParser::ModeHandlerMap& usermodes = ServerInstance->Modes.GetModes(MODETYPE_USER);
|
||||
for (ModeParser::ModeHandlerMap::const_iterator i = usermodes.begin(); i != usermodes.end(); ++i)
|
||||
{
|
||||
ModeHandler* mh = i->second;
|
||||
@ -467,12 +467,12 @@ void User::UnOper()
|
||||
changelist.push_remove(mh);
|
||||
}
|
||||
|
||||
ServerInstance->Modes->Process(this, NULL, this, changelist);
|
||||
ServerInstance->Modes.Process(this, NULL, this, changelist);
|
||||
|
||||
// Remove the user from the oper list
|
||||
stdalgo::vector::swaperase(ServerInstance->Users->all_opers, this);
|
||||
|
||||
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
|
||||
ModeHandler* opermh = ServerInstance->Modes.FindMode('o', MODETYPE_USER);
|
||||
if (opermh)
|
||||
this->SetMode(opermh, false);
|
||||
FOREACH_MOD(OnPostDeoper, (this));
|
||||
|
Loading…
x
Reference in New Issue
Block a user