mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Constify variables within loops.
This commit is contained in:
parent
1dac868077
commit
ef24ec632d
@ -400,7 +400,7 @@ void ParseStack::DoInclude(std::shared_ptr<ConfigTag> tag, int flags)
|
|||||||
const std::string includedir = ServerInstance->Config->Paths.PrependConfig(name);
|
const std::string includedir = ServerInstance->Config->Paths.PrependConfig(name);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (auto& entry : std::filesystem::directory_iterator(includedir))
|
for (const auto& entry : std::filesystem::directory_iterator(includedir))
|
||||||
{
|
{
|
||||||
if (!entry.is_regular_file() || !InspIRCd::Match(entry.path().filename(), "*.conf"))
|
if (!entry.is_regular_file() || !InspIRCd::Match(entry.path().filename(), "*.conf"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -74,7 +74,7 @@ static void ReadXLine(ServerConfig* conf, const std::string& tag, const std::str
|
|||||||
{
|
{
|
||||||
insp::flat_set<std::string> configlines;
|
insp::flat_set<std::string> configlines;
|
||||||
|
|
||||||
for (auto& [_, ctag] : conf->ConfTags(tag))
|
for (const auto& [_, ctag] : conf->ConfTags(tag))
|
||||||
{
|
{
|
||||||
const std::string mask = ctag->getString(key);
|
const std::string mask = ctag->getString(key);
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
@ -98,7 +98,7 @@ typedef std::map<std::string, std::shared_ptr<ConfigTag>> LocalIndex;
|
|||||||
void ServerConfig::CrossCheckOperClassType()
|
void ServerConfig::CrossCheckOperClassType()
|
||||||
{
|
{
|
||||||
LocalIndex operclass;
|
LocalIndex operclass;
|
||||||
for (auto& [_, tag] : ConfTags("class"))
|
for (const auto& [_, tag] : ConfTags("class"))
|
||||||
{
|
{
|
||||||
std::string name = tag->getString("name");
|
std::string name = tag->getString("name");
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
@ -108,7 +108,7 @@ void ServerConfig::CrossCheckOperClassType()
|
|||||||
operclass[name] = tag;
|
operclass[name] = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [_, tag] : ConfTags("type"))
|
for (const auto& [_, tag] : ConfTags("type"))
|
||||||
{
|
{
|
||||||
std::string name = tag->getString("name");
|
std::string name = tag->getString("name");
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
@ -131,7 +131,7 @@ void ServerConfig::CrossCheckOperClassType()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [_, tag] : ConfTags("oper"))
|
for (const auto& [_, tag] : ConfTags("oper"))
|
||||||
{
|
{
|
||||||
std::string name = tag->getString("name");
|
std::string name = tag->getString("name");
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
@ -158,7 +158,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
|
|||||||
ClassMap oldBlocksByMask;
|
ClassMap oldBlocksByMask;
|
||||||
if (current)
|
if (current)
|
||||||
{
|
{
|
||||||
for (auto& c : current->Classes)
|
for (const auto& c : current->Classes)
|
||||||
{
|
{
|
||||||
switch (c->type)
|
switch (c->type)
|
||||||
{
|
{
|
||||||
@ -192,7 +192,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
|
|||||||
{
|
{
|
||||||
try_again = false;
|
try_again = false;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (auto& [_, tag] : ConfTags("connect"))
|
for (const auto& [_, tag] : ConfTags("connect"))
|
||||||
{
|
{
|
||||||
if (Classes[i])
|
if (Classes[i])
|
||||||
{
|
{
|
||||||
@ -441,7 +441,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
|
|||||||
if (!dietags.empty())
|
if (!dietags.empty())
|
||||||
{
|
{
|
||||||
errstr << "Your configuration has not been edited correctly!" << std::endl;
|
errstr << "Your configuration has not been edited correctly!" << std::endl;
|
||||||
for (auto& [_, tag] : dietags)
|
for (const auto& [_, tag] : dietags)
|
||||||
{
|
{
|
||||||
const std::string reason = tag->getString("reason", "You left a <die> tag in your config", 1);
|
const std::string reason = tag->getString("reason", "You left a <die> tag in your config", 1);
|
||||||
errstr << reason << " (at " << tag->source.str() << ")" << std::endl;
|
errstr << reason << " (at " << tag->source.str() << ")" << std::endl;
|
||||||
@ -543,7 +543,7 @@ void ServerConfig::ApplyModules(User* user)
|
|||||||
std::vector<std::string> added_modules;
|
std::vector<std::string> added_modules;
|
||||||
ModuleManager::ModuleMap removed_modules = ServerInstance->Modules.GetModules();
|
ModuleManager::ModuleMap removed_modules = ServerInstance->Modules.GetModules();
|
||||||
|
|
||||||
for (auto& [_, tag] : ConfTags("module"))
|
for (const auto& [_, tag] : ConfTags("module"))
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
if (tag->readString("name", name))
|
if (tag->readString("name", name))
|
||||||
|
@ -63,7 +63,7 @@ CmdResult CommandModules::Handle(User* user, const Params& parameters)
|
|||||||
|
|
||||||
bool has_priv = IS_LOCAL(user) && user->HasPrivPermission("servers/auspex");
|
bool has_priv = IS_LOCAL(user) && user->HasPrivPermission("servers/auspex");
|
||||||
const ModuleManager::ModuleMap& mods = ServerInstance->Modules.GetModules();
|
const ModuleManager::ModuleMap& mods = ServerInstance->Modules.GetModules();
|
||||||
for (auto& [modname, mod] : mods)
|
for (const auto& [modname, mod] : mods)
|
||||||
{
|
{
|
||||||
const char* version = has_priv ? mod->ModuleDLLManager->GetVersion() : "*";
|
const char* version = has_priv ? mod->ModuleDLLManager->GetVersion() : "*";
|
||||||
const std::string props = has_priv ? mod->GetPropertyString() : "*";
|
const std::string props = has_priv ? mod->GetPropertyString() : "*";
|
||||||
|
@ -39,7 +39,7 @@ CmdResult CommandServList::HandleLocal(LocalUser* user, const Params& parameters
|
|||||||
{
|
{
|
||||||
const std::string& mask = parameters.empty() ? "*" : parameters[0];
|
const std::string& mask = parameters.empty() ? "*" : parameters[0];
|
||||||
const bool has_type = parameters.size() > 1;
|
const bool has_type = parameters.size() > 1;
|
||||||
for (auto* serviceuser : ServerInstance->Users.all_services)
|
for (const auto* serviceuser : ServerInstance->Users.all_services)
|
||||||
{
|
{
|
||||||
if (serviceuser->IsModeSet(invisiblemode) || !InspIRCd::Match(serviceuser->nick, mask))
|
if (serviceuser->IsModeSet(invisiblemode) || !InspIRCd::Match(serviceuser->nick, mask))
|
||||||
continue;
|
continue;
|
||||||
|
@ -26,7 +26,7 @@ namespace
|
|||||||
{
|
{
|
||||||
std::map<std::string, std::pair<std::optional<std::string>, std::optional<std::string>>, irc::insensitive_swo> changedtokens;
|
std::map<std::string, std::pair<std::optional<std::string>, std::optional<std::string>>, irc::insensitive_swo> changedtokens;
|
||||||
stdalgo::map::difference(oldtokens, newtokens, changedtokens);
|
stdalgo::map::difference(oldtokens, newtokens, changedtokens);
|
||||||
for (auto& [name, values] : changedtokens)
|
for (const auto& [name, values] : changedtokens)
|
||||||
{
|
{
|
||||||
if (values.first && !values.second)
|
if (values.first && !values.second)
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ void ISupportManager::Build()
|
|||||||
{
|
{
|
||||||
if (user->registered & REG_ALL)
|
if (user->registered & REG_ALL)
|
||||||
{
|
{
|
||||||
for (auto&& diffnumeric : diffnumerics)
|
for (const auto& diffnumeric : diffnumerics)
|
||||||
user->WriteNumeric(diffnumeric);
|
user->WriteNumeric(diffnumeric);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,6 +139,6 @@ void ISupportManager::BuildNumerics(ISupport::TokenMap& tokens, std::vector<Nume
|
|||||||
|
|
||||||
void ISupportManager::SendTo(LocalUser* user)
|
void ISupportManager::SendTo(LocalUser* user)
|
||||||
{
|
{
|
||||||
for (auto&& cachednumeric : cachednumerics)
|
for (const auto& cachednumeric : cachednumerics)
|
||||||
user->WriteNumeric(cachednumeric);
|
user->WriteNumeric(cachednumeric);
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ void CommandStats::DoStats(Stats::Context& stats)
|
|||||||
/* stats o */
|
/* stats o */
|
||||||
case 'o':
|
case 'o':
|
||||||
{
|
{
|
||||||
for (auto& [_, ifo] : ServerInstance->Config->oper_blocks)
|
for (const auto& [_, ifo] : ServerInstance->Config->oper_blocks)
|
||||||
{
|
{
|
||||||
std::shared_ptr<ConfigTag> tag = ifo->oper_block;
|
std::shared_ptr<ConfigTag> tag = ifo->oper_block;
|
||||||
stats.AddRow(243, 'O', tag->getString("host"), '*', tag->getString("name"), tag->getString("type"), '0');
|
stats.AddRow(243, 'O', tag->getString("host"), '*', tag->getString("name"), tag->getString("type"), '0');
|
||||||
@ -345,7 +345,7 @@ void CommandStats::DoStats(Stats::Context& stats)
|
|||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
{
|
{
|
||||||
for (auto& [_, tag] : ServerInstance->Config->OperTypes)
|
for (const auto& [_, tag] : ServerInstance->Config->OperTypes)
|
||||||
{
|
{
|
||||||
tag->init();
|
tag->init();
|
||||||
std::string umodes;
|
std::string umodes;
|
||||||
|
@ -68,7 +68,7 @@ void ListModeBase::DoRehash()
|
|||||||
limitlist newlimits;
|
limitlist newlimits;
|
||||||
bool seen_default = false;
|
bool seen_default = false;
|
||||||
|
|
||||||
for (auto& [_, c] : ServerInstance->Config->ConfTags("maxlist"))
|
for (const auto& [_, c] : ServerInstance->Config->ConfTags("maxlist"))
|
||||||
{
|
{
|
||||||
const std::string mname = c->getString("mode");
|
const std::string mname = c->getString("mode");
|
||||||
if (!mname.empty() && !stdalgo::string::equalsci(mname, name) && !(mname.length() == 1 && GetModeChar() == mname[0]))
|
if (!mname.empty() && !stdalgo::string::equalsci(mname, name) && !(mname.length() == 1 && GetModeChar() == mname[0]))
|
||||||
|
@ -70,7 +70,7 @@ void LogManager::OpenFileLogs()
|
|||||||
return;
|
return;
|
||||||
std::map<std::string, FileWriter*> logmap;
|
std::map<std::string, FileWriter*> logmap;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("log"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("log"))
|
||||||
{
|
{
|
||||||
std::string method = tag->getString("method");
|
std::string method = tag->getString("method");
|
||||||
if (!stdalgo::string::equalsci(method, "file"))
|
if (!stdalgo::string::equalsci(method, "file"))
|
||||||
|
@ -129,7 +129,7 @@ void ModuleManager::LoadCoreModules(std::map<std::string, ServiceList>& servicem
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (auto& entry : std::filesystem::directory_iterator(ServerInstance->Config->Paths.Module))
|
for (const auto& entry : std::filesystem::directory_iterator(ServerInstance->Config->Paths.Module))
|
||||||
{
|
{
|
||||||
const std::string name = entry.path().filename();
|
const std::string name = entry.path().filename();
|
||||||
if (!entry.is_regular_file() || !InspIRCd::Match(name, "core_*" DLL_EXTENSION))
|
if (!entry.is_regular_file() || !InspIRCd::Match(name, "core_*" DLL_EXTENSION))
|
||||||
|
@ -488,7 +488,7 @@ void ModuleManager::LoadAll()
|
|||||||
LoadCoreModules(servicemap);
|
LoadCoreModules(servicemap);
|
||||||
|
|
||||||
// Step 1: load all of the modules.
|
// Step 1: load all of the modules.
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("module"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("module"))
|
||||||
{
|
{
|
||||||
const std::string shortname = tag->getString("name");
|
const std::string shortname = tag->getString("name");
|
||||||
if (shortname.empty())
|
if (shortname.empty())
|
||||||
|
@ -545,7 +545,7 @@ class ModuleLDAP : public Module
|
|||||||
{
|
{
|
||||||
ServiceMap conns;
|
ServiceMap conns;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("module"), "ldap"))
|
if (!stdalgo::string::equalsci(tag->getString("module"), "ldap"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -467,7 +467,7 @@ void ModuleSQL::ReadConfig(ConfigStatus& status)
|
|||||||
{
|
{
|
||||||
ConnMap conns;
|
ConnMap conns;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("module"), "mysql"))
|
if (!stdalgo::string::equalsci(tag->getString("module"), "mysql"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -547,7 +547,7 @@ class ModulePgSQL : public Module
|
|||||||
{
|
{
|
||||||
ConnMap conns;
|
ConnMap conns;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("module"), "pgsql"))
|
if (!stdalgo::string::equalsci(tag->getString("module"), "pgsql"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -257,7 +257,7 @@ class ModuleSQLite3 : public Module
|
|||||||
{
|
{
|
||||||
ClearConns();
|
ClearConns();
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("database"))
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("module"), "sqlite"))
|
if (!stdalgo::string::equalsci(tag->getString("module"), "sqlite"))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1129,7 +1129,7 @@ class ModuleSSLGnuTLS : public Module
|
|||||||
if (tags.empty())
|
if (tags.empty())
|
||||||
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
||||||
|
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
|
if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
|
||||||
{
|
{
|
||||||
|
@ -862,7 +862,7 @@ class ModuleSSLmbedTLS : public Module
|
|||||||
if (tags.empty())
|
if (tags.empty())
|
||||||
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
||||||
|
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
|
if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
|
||||||
{
|
{
|
||||||
|
@ -906,7 +906,7 @@ class ModuleSSLOpenSSL : public Module
|
|||||||
if (tags.empty())
|
if (tags.empty())
|
||||||
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
throw ModuleException("You have not specified any <sslprofile> tags that are usable by this module!");
|
||||||
|
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
|
if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,7 @@ class ModuleAlias : public Module
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
AliasMap newAliases;
|
AliasMap newAliases;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("alias"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("alias"))
|
||||||
{
|
{
|
||||||
Alias a;
|
Alias a;
|
||||||
a.AliasedCommand = tag->getString("text");
|
a.AliasedCommand = tag->getString("text");
|
||||||
|
@ -108,7 +108,7 @@ class ModuleCensor : public Module
|
|||||||
*/
|
*/
|
||||||
censor_t newcensors;
|
censor_t newcensors;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("badword"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("badword"))
|
||||||
{
|
{
|
||||||
const std::string text = tag->getString("text");
|
const std::string text = tag->getString("text");
|
||||||
if (text.empty())
|
if (text.empty())
|
||||||
|
@ -338,7 +338,7 @@ class ModuleCgiIRC
|
|||||||
std::vector<IdentHost> identhosts;
|
std::vector<IdentHost> identhosts;
|
||||||
std::vector<WebIRCHost> webirchosts;
|
std::vector<WebIRCHost> webirchosts;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("cgihost"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cgihost"))
|
||||||
{
|
{
|
||||||
MaskList masks;
|
MaskList masks;
|
||||||
irc::spacesepstream maskstream(tag->getString("mask"));
|
irc::spacesepstream maskstream(tag->getString("mask"));
|
||||||
|
@ -44,7 +44,7 @@ class ModuleChanLog : public Module
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
ChanLogTargets newlogs;
|
ChanLogTargets newlogs;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("chanlog"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("chanlog"))
|
||||||
{
|
{
|
||||||
std::string channel = tag->getString("channel");
|
std::string channel = tag->getString("channel");
|
||||||
std::string snomasks = tag->getString("snomasks");
|
std::string snomasks = tag->getString("snomasks");
|
||||||
|
@ -445,7 +445,7 @@ class ModuleCloaking : public Module
|
|||||||
|
|
||||||
bool firstcloak = true;
|
bool firstcloak = true;
|
||||||
std::vector<CloakInfo> newcloaks;
|
std::vector<CloakInfo> newcloaks;
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
// Ensure that we have the <cloak:key> parameter.
|
// Ensure that we have the <cloak:key> parameter.
|
||||||
const std::string key = tag->getString("key");
|
const std::string key = tag->getString("key");
|
||||||
|
@ -144,7 +144,7 @@ class ModuleCodepage
|
|||||||
AllowedChars newallowedchars;
|
AllowedChars newallowedchars;
|
||||||
AllowedChars newallowedfrontchars;
|
AllowedChars newallowedfrontchars;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpchars"))
|
||||||
{
|
{
|
||||||
unsigned char begin = tag->getUInt("begin", tag->getUInt("index", 0), 1, UCHAR_MAX);
|
unsigned char begin = tag->getUInt("begin", tag->getUInt("index", 0), 1, UCHAR_MAX);
|
||||||
if (!begin)
|
if (!begin)
|
||||||
@ -180,7 +180,7 @@ class ModuleCodepage
|
|||||||
for (size_t i = 0; i < UCHAR_MAX; ++i)
|
for (size_t i = 0; i < UCHAR_MAX; ++i)
|
||||||
newcasemap[i] = i;
|
newcasemap[i] = i;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("cpcase"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cpcase"))
|
||||||
{
|
{
|
||||||
unsigned char lower = tag->getUInt("lower", 0, 1, UCHAR_MAX);
|
unsigned char lower = tag->getUInt("lower", 0, 1, UCHAR_MAX);
|
||||||
if (!lower)
|
if (!lower)
|
||||||
|
@ -55,7 +55,7 @@ class ModuleCustomPrefix : public Module
|
|||||||
|
|
||||||
void init() override
|
void init() override
|
||||||
{
|
{
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("customprefix"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("customprefix"))
|
||||||
{
|
{
|
||||||
const std::string name = tag->getString("name");
|
const std::string name = tag->getString("name");
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
@ -121,7 +121,7 @@ class ModuleCustomTitle : public Module, public Whois::LineEventListener
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
CustomVhostMap newtitles;
|
CustomVhostMap newtitles;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("title"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("title"))
|
||||||
{
|
{
|
||||||
std::string name = tag->getString("name", "", 1);
|
std::string name = tag->getString("name", "", 1);
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
@ -590,7 +590,7 @@ class ModuleDCCAllow : public Module
|
|||||||
{
|
{
|
||||||
bannedfilelist newbfl;
|
bannedfilelist newbfl;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("banfile"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("banfile"))
|
||||||
{
|
{
|
||||||
BannedFileList bf;
|
BannedFileList bf;
|
||||||
bf.filemask = tag->getString("pattern");
|
bf.filemask = tag->getString("pattern");
|
||||||
|
@ -72,7 +72,7 @@ class ModuleDenyChannels : public Module
|
|||||||
{
|
{
|
||||||
GoodChannels goodchans;
|
GoodChannels goodchans;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("goodchan"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("goodchan"))
|
||||||
{
|
{
|
||||||
// Ensure that we have the <goodchan:name> parameter.
|
// Ensure that we have the <goodchan:name> parameter.
|
||||||
const std::string name = tag->getString("name");
|
const std::string name = tag->getString("name");
|
||||||
@ -83,7 +83,7 @@ class ModuleDenyChannels : public Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
BadChannels badchans;
|
BadChannels badchans;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("badchan"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("badchan"))
|
||||||
{
|
{
|
||||||
// Ensure that we have the <badchan:name> parameter.
|
// Ensure that we have the <badchan:name> parameter.
|
||||||
const std::string name = tag->getString("name");
|
const std::string name = tag->getString("name");
|
||||||
|
@ -328,7 +328,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener
|
|||||||
{
|
{
|
||||||
DNSBLConfList newentries;
|
DNSBLConfList newentries;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("dnsbl"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("dnsbl"))
|
||||||
{
|
{
|
||||||
auto e = std::make_shared<DNSBLConfEntry>();
|
auto e = std::make_shared<DNSBLConfEntry>();
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status)
|
|||||||
exemptedchans.clear();
|
exemptedchans.clear();
|
||||||
exemptednicks.clear();
|
exemptednicks.clear();
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("exemptfromfilter"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("exemptfromfilter"))
|
||||||
{
|
{
|
||||||
const std::string target = tag->getString("target");
|
const std::string target = tag->getString("target");
|
||||||
if (!target.empty())
|
if (!target.empty())
|
||||||
@ -865,7 +865,7 @@ void ModuleFilter::ReadFilters()
|
|||||||
filter++;
|
filter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("keyword"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("keyword"))
|
||||||
{
|
{
|
||||||
std::string pattern = tag->getString("pattern");
|
std::string pattern = tag->getString("pattern");
|
||||||
std::string reason = tag->getString("reason");
|
std::string reason = tag->getString("reason");
|
||||||
|
@ -119,7 +119,7 @@ class ModuleHelpop
|
|||||||
if (tags.empty())
|
if (tags.empty())
|
||||||
throw ModuleException("You have loaded the helpop module but not configured any help topics!");
|
throw ModuleException("You have loaded the helpop module but not configured any help topics!");
|
||||||
|
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
// Attempt to read the help key.
|
// Attempt to read the help key.
|
||||||
const std::string key = tag->getString("key");
|
const std::string key = tag->getString("key");
|
||||||
|
@ -63,7 +63,7 @@ class ModuleHideList : public Module
|
|||||||
typedef std::vector<std::pair<std::string, unsigned int> > NewConfigs;
|
typedef std::vector<std::pair<std::string, unsigned int> > NewConfigs;
|
||||||
NewConfigs newconfigs;
|
NewConfigs newconfigs;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("hidelist"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("hidelist"))
|
||||||
{
|
{
|
||||||
std::string modename = tag->getString("mode");
|
std::string modename = tag->getString("mode");
|
||||||
if (modename.empty())
|
if (modename.empty())
|
||||||
|
@ -42,7 +42,7 @@ class Settings
|
|||||||
{
|
{
|
||||||
RanksToSeeMap newranks;
|
RanksToSeeMap newranks;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("hidemode"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("hidemode"))
|
||||||
{
|
{
|
||||||
const std::string modename = tag->getString("mode");
|
const std::string modename = tag->getString("mode");
|
||||||
if (modename.empty())
|
if (modename.empty())
|
||||||
|
@ -133,7 +133,7 @@ private:
|
|||||||
{
|
{
|
||||||
HostRules rules;
|
HostRules rules;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("hostchange"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("hostchange"))
|
||||||
{
|
{
|
||||||
// Ensure that we have the <hostchange:mask> parameter.
|
// Ensure that we have the <hostchange:mask> parameter.
|
||||||
const std::string mask = tag->getString("mask");
|
const std::string mask = tag->getString("mask");
|
||||||
|
@ -58,7 +58,7 @@ class ModuleHTTPAccessList : public Module, public HTTPACLEventListener
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
std::vector<HTTPACL> new_acls;
|
std::vector<HTTPACL> new_acls;
|
||||||
for (auto& [_, c] : ServerInstance->Config->ConfTags("httpdacl"))
|
for (const auto& [_, c] : ServerInstance->Config->ConfTags("httpdacl"))
|
||||||
{
|
{
|
||||||
std::string path = c->getString("path");
|
std::string path = c->getString("path");
|
||||||
std::string types = c->getString("types");
|
std::string types = c->getString("types");
|
||||||
|
@ -46,7 +46,7 @@ class ModuleHttpConfig : public Module, public HTTPRequestEventListener
|
|||||||
ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", request.GetPath().c_str());
|
ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Handling HTTP request for %s", request.GetPath().c_str());
|
||||||
|
|
||||||
std::stringstream buffer;
|
std::stringstream buffer;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->config_data)
|
for (const auto& [_, tag] : ServerInstance->Config->config_data)
|
||||||
{
|
{
|
||||||
// Show the location of the tag in a comment.
|
// Show the location of the tag in a comment.
|
||||||
buffer << "# " << tag->source.str() << std::endl
|
buffer << "# " << tag->source.str() << std::endl
|
||||||
@ -55,7 +55,7 @@ class ModuleHttpConfig : public Module, public HTTPRequestEventListener
|
|||||||
// Print out the tag with all keys aligned vertically.
|
// Print out the tag with all keys aligned vertically.
|
||||||
const std::string indent(tag->name.length() + 2, ' ');
|
const std::string indent(tag->name.length() + 2, ' ');
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (auto& [key, value] : tag->GetItems())
|
for (const auto& [key, value] : tag->GetItems())
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
buffer << std::endl << indent;
|
buffer << std::endl << indent;
|
||||||
|
@ -338,7 +338,7 @@ public:
|
|||||||
|
|
||||||
LDAP.SetProvider("LDAP/" + tag->getString("dbid"));
|
LDAP.SetProvider("LDAP/" + tag->getString("dbid"));
|
||||||
|
|
||||||
for (auto& [_, wtag] : ServerInstance->Config->ConfTags("ldapwhitelist"))
|
for (const auto& [_, wtag] : ServerInstance->Config->ConfTags("ldapwhitelist"))
|
||||||
{
|
{
|
||||||
std::string cidr = wtag->getString("cidr");
|
std::string cidr = wtag->getString("cidr");
|
||||||
if (!cidr.empty()) {
|
if (!cidr.empty()) {
|
||||||
@ -346,7 +346,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [_, rtag] : ServerInstance->Config->ConfTags("ldaprequire"))
|
for (const auto& [_, rtag] : ServerInstance->Config->ConfTags("ldaprequire"))
|
||||||
{
|
{
|
||||||
const std::string attr = rtag->getString("attribute");
|
const std::string attr = rtag->getString("attribute");
|
||||||
const std::string val = rtag->getString("value");
|
const std::string val = rtag->getString("value");
|
||||||
|
@ -186,7 +186,7 @@ class ModulePBKDF2 : public Module
|
|||||||
|
|
||||||
// Then the specific values
|
// Then the specific values
|
||||||
ProviderConfigMap newconfigs;
|
ProviderConfigMap newconfigs;
|
||||||
for (auto& [_, ptag] : ServerInstance->Config->ConfTags("pbkdf2prov"))
|
for (const auto& [_, ptag] : ServerInstance->Config->ConfTags("pbkdf2prov"))
|
||||||
{
|
{
|
||||||
std::string hash_name = "hash/" + ptag->getString("hash");
|
std::string hash_name = "hash/" + ptag->getString("hash");
|
||||||
ProviderConfig& config = newconfigs[hash_name];
|
ProviderConfig& config = newconfigs[hash_name];
|
||||||
|
@ -200,7 +200,7 @@ public:
|
|||||||
* Process config-defined list of permanent channels.
|
* Process config-defined list of permanent channels.
|
||||||
* -- w00t
|
* -- w00t
|
||||||
*/
|
*/
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("permchannels"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("permchannels"))
|
||||||
{
|
{
|
||||||
std::string channel = tag->getString("channel");
|
std::string channel = tag->getString("channel");
|
||||||
std::string modes = tag->getString("modes");
|
std::string modes = tag->getString("modes");
|
||||||
|
@ -61,7 +61,7 @@ class ModuleRestrictChans : public Module
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
AllowChans newallows;
|
AllowChans newallows;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("allowchannel"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("allowchannel"))
|
||||||
{
|
{
|
||||||
const std::string name = tag->getString("name");
|
const std::string name = tag->getString("name");
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
|
@ -53,7 +53,7 @@ class ModuleSecureList final
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
AllowList newallows;
|
AllowList newallows;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("securehost"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("securehost"))
|
||||||
{
|
{
|
||||||
const std::string host = tag->getString("exception");
|
const std::string host = tag->getString("exception");
|
||||||
if (host.empty())
|
if (host.empty())
|
||||||
|
@ -150,7 +150,7 @@ class ModuleShowFile : public Module
|
|||||||
{
|
{
|
||||||
std::vector<CommandShowFile*> newcmds;
|
std::vector<CommandShowFile*> newcmds;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("showfile"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("showfile"))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ namespace
|
|||||||
stdalgo::map::difference(mymodules, remote.value(), modulediff);
|
stdalgo::map::difference(mymodules, remote.value(), modulediff);
|
||||||
|
|
||||||
std::ostringstream diffconfig, localmissing, remotemissing;
|
std::ostringstream diffconfig, localmissing, remotemissing;
|
||||||
for (auto& [module, values] : modulediff)
|
for (const auto& [module, values] : modulediff)
|
||||||
{
|
{
|
||||||
if (values.first && values.second)
|
if (values.first && values.second)
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ ModResult ModuleSpanningTree::OnStats(Stats::Context& stats)
|
|||||||
}
|
}
|
||||||
else if (stats.GetSymbol() == 'U')
|
else if (stats.GetSymbol() == 'U')
|
||||||
{
|
{
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("service", ServerInstance->Config->ConfTags("uline")))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("service", ServerInstance->Config->ConfTags("uline")))
|
||||||
{
|
{
|
||||||
std::string name = tag->getString("server");
|
std::string name = tag->getString("server");
|
||||||
if (!name.empty())
|
if (!name.empty())
|
||||||
|
@ -242,7 +242,7 @@ void TreeServer::CheckService()
|
|||||||
{
|
{
|
||||||
service = silentservice = false;
|
service = silentservice = false;
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("service", ServerInstance->Config->ConfTags("uline")))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("service", ServerInstance->Config->ConfTags("uline")))
|
||||||
{
|
{
|
||||||
std::string server = tag->getString("server");
|
std::string server = tag->getString("server");
|
||||||
if (irc::equals(server, GetName()))
|
if (irc::equals(server, GetName()))
|
||||||
|
@ -254,7 +254,7 @@ void SpanningTreeUtilities::ReadConfiguration()
|
|||||||
AutoconnectBlocks.clear();
|
AutoconnectBlocks.clear();
|
||||||
LinkBlocks.clear();
|
LinkBlocks.clear();
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("link"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("link"))
|
||||||
{
|
{
|
||||||
auto L = std::make_shared<Link>(tag);
|
auto L = std::make_shared<Link>(tag);
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ void SpanningTreeUtilities::ReadConfiguration()
|
|||||||
LinkBlocks.push_back(L);
|
LinkBlocks.push_back(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("autoconnect"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("autoconnect"))
|
||||||
{
|
{
|
||||||
auto A = std::make_shared<Autoconnect>(tag);
|
auto A = std::make_shared<Autoconnect>(tag);
|
||||||
A->Period = tag->getDuration("period", 60, 1);
|
A->Period = tag->getDuration("period", 60, 1);
|
||||||
|
@ -365,7 +365,7 @@ class ModuleSSLInfo
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Find an auto-oper block for this user
|
// Find an auto-oper block for this user
|
||||||
for (auto& [_, ifo] : ServerInstance->Config->oper_blocks)
|
for (const auto& [_, ifo] : ServerInstance->Config->oper_blocks)
|
||||||
{
|
{
|
||||||
std::string fp = ifo->oper_block->getString("fingerprint");
|
std::string fp = ifo->oper_block->getString("fingerprint");
|
||||||
if (MatchFP(cert, fp) && ifo->oper_block->getBool("autologin"))
|
if (MatchFP(cert, fp) && ifo->oper_block->getBool("autologin"))
|
||||||
|
@ -94,7 +94,7 @@ class ModuleVHost : public Module
|
|||||||
void ReadConfig(ConfigStatus& status) override
|
void ReadConfig(ConfigStatus& status) override
|
||||||
{
|
{
|
||||||
CustomVhostMap newhosts;
|
CustomVhostMap newhosts;
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("vhost"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("vhost"))
|
||||||
{
|
{
|
||||||
std::string mask = tag->getString("host");
|
std::string mask = tag->getString("host");
|
||||||
if (mask.empty())
|
if (mask.empty())
|
||||||
|
@ -519,7 +519,7 @@ class ModuleWebSocket : public Module
|
|||||||
throw ModuleException("You have loaded the websocket module but not configured any allowed origins!");
|
throw ModuleException("You have loaded the websocket module but not configured any allowed origins!");
|
||||||
|
|
||||||
WebSocketConfig config;
|
WebSocketConfig config;
|
||||||
for (auto& [_, tag] : tags)
|
for (const auto& [_, tag] : tags)
|
||||||
{
|
{
|
||||||
// Ensure that we have the <wsorigin:allow> parameter.
|
// Ensure that we have the <wsorigin:allow> parameter.
|
||||||
const std::string allow = tag->getString("allow");
|
const std::string allow = tag->getString("allow");
|
||||||
|
@ -65,7 +65,7 @@ size_t InspIRCd::BindPorts(FailedPortList& failed_ports)
|
|||||||
size_t bound = 0;
|
size_t bound = 0;
|
||||||
std::vector<ListenSocket*> old_ports(ports.begin(), ports.end());
|
std::vector<ListenSocket*> old_ports(ports.begin(), ports.end());
|
||||||
|
|
||||||
for (auto& [_, tag] : ServerInstance->Config->ConfTags("bind"))
|
for (const auto& [_, tag] : ServerInstance->Config->ConfTags("bind"))
|
||||||
{
|
{
|
||||||
// Are we creating a TCP/IP listener?
|
// Are we creating a TCP/IP listener?
|
||||||
const std::string address = tag->getString("address");
|
const std::string address = tag->getString("address");
|
||||||
|
@ -440,7 +440,7 @@ void OperInfo::init()
|
|||||||
AllowedSnomasks.reset();
|
AllowedSnomasks.reset();
|
||||||
AllowedUserModes['o' - 'A'] = true; // Call me paranoid if you want.
|
AllowedUserModes['o' - 'A'] = true; // Call me paranoid if you want.
|
||||||
|
|
||||||
for (auto& tag : class_blocks)
|
for (const auto& tag : class_blocks)
|
||||||
{
|
{
|
||||||
AllowedOperCommands.AddList(tag->getString("commands"));
|
AllowedOperCommands.AddList(tag->getString("commands"));
|
||||||
AllowedPrivs.AddList(tag->getString("privs"));
|
AllowedPrivs.AddList(tag->getString("privs"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user