mandatory_tag.clear();
}
- if (name == "include")
+ if (stdalgo::string::equalsci(name, "include"))
{
stack.DoInclude(tag, flags);
}
- else if (name == "files")
+ else if (stdalgo::string::equalsci(name, "files"))
{
for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, false);
}
}
- else if (name == "execfiles")
+ else if (stdalgo::string::equalsci(name, "execfiles"))
{
for(ConfigItems::iterator i = items->begin(); i != items->end(); i++)
{
stack.DoReadFile(i->first, i->second, flags, true);
}
}
- else if (name == "define")
+ else if (stdalgo::string::equalsci(name, "define"))
{
if (flags & FLAG_USE_COMPAT)
throw CoreException("<define> tags may only be used in XML-style config (add <config format=\"xml\">)");
throw CoreException("Variable definition must include variable name");
stack.vars[varname] = value;
}
- else if (name == "config")
+ else if (stdalgo::string::equalsci(name, "config"))
{
std::string format = tag->getString("format");
- if (format == "xml")
+ if (stdalgo::string::equalsci(format, "xml"))
flags &= ~FLAG_USE_COMPAT;
- else if (format == "compat")
+ else if (stdalgo::string::equalsci(format, "compat"))
flags |= FLAG_USE_COMPAT;
else if (!format.empty())
throw CoreException("Unknown configuration format " + format);
if (res == MOD_RES_PASSTHRU)
{
std::string type = bind_tag->getString("type", "clients");
- if (type == "clients")
+ if (stdalgo::string::equalsci(type, "clients"))
{
ServerInstance->Users->AddUser(incomingSockfd, this, &client, &server);
res = MOD_RES_ALLOW;
{
ConfigTag* tag = i->second;
std::string method = tag->getString("method");
- if (method != "file")
+ if (!stdalgo::string::equalsci(method, "file"))
{
continue;
}
std::string type = tag->getString("type");
std::string level = tag->getString("level");
LogLevel loglevel = LOG_DEFAULT;
- if (level == "rawio")
+ if (stdalgo::string::equalsci(level, "rawio"))
{
loglevel = LOG_RAWIO;
ServerInstance->Config->RawLog = true;
}
- else if (level == "debug")
+ else if (stdalgo::string::equalsci(level, "debug"))
{
loglevel = LOG_DEBUG;
}
- else if (level == "verbose")
+ else if (stdalgo::string::equalsci(level, "verbose"))
{
loglevel = LOG_VERBOSE;
}
- else if (level == "default")
+ else if (stdalgo::string::equalsci(level, "default"))
{
loglevel = LOG_DEFAULT;
}
- else if (level == "sparse")
+ else if (stdalgo::string::equalsci(level, "sparse"))
{
loglevel = LOG_SPARSE;
}
- else if (level == "none")
+ else if (stdalgo::string::equalsci(level, "none"))
{
loglevel = LOG_NONE;
}
, con(NULL), config(tag), last_connect(0)
{
std::string scope = config->getString("searchscope");
- if (scope == "base")
+ if (stdalgo::string::equalsci(scope, "base"))
searchscope = LDAP_SCOPE_BASE;
- else if (scope == "onelevel")
+ else if (stdalgo::string::equalsci(scope, "onelevel"))
searchscope = LDAP_SCOPE_ONELEVEL;
else
searchscope = LDAP_SCOPE_SUBTREE;
{
const reference<ConfigTag>& tag = i->second;
- if (tag->getString("module") != "ldap")
+ if (!stdalgo::string::equalsci(tag->getString("module"), "ldap"))
continue;
std::string id = tag->getString("id");
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "mysql") != "mysql")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "mysql"))
continue;
std::string id = i->second->getString("id");
ConnMap::iterator curr = connections.find(id);
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "pgsql") != "pgsql")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "pgsql"))
continue;
std::string id = i->second->getString("id");
ConnMap::iterator curr = connections.find(id);
ConfigTag* Conf = ServerInstance->Config->ConfValue("stdregex");
std::string regextype = Conf->getString("type", "ecmascript");
- if(regextype == "bre")
+ if (stdalgo::string::equalsci(regextype, "bre"))
ref.regextype = std::regex::basic;
- else if(regextype == "ere")
+ else if (stdalgo::string::equalsci(regextype, "ere"))
ref.regextype = std::regex::extended;
- else if(regextype == "awk")
+ else if (stdalgo::string::equalsci(regextype, "awk"))
ref.regextype = std::regex::awk;
- else if(regextype == "grep")
+ else if (stdalgo::string::equalsci(regextype, "grep"))
ref.regextype = std::regex::grep;
- else if(regextype == "egrep")
+ else if (stdalgo::string::equalsci(regextype, "egrep"))
ref.regextype = std::regex::egrep;
else
{
- if(regextype != "ecmascript")
+ if (!stdalgo::string::equalsci(regextype, "ecmascript"))
ServerInstance->SNO->WriteToSnoMask('a', "WARNING: Non-existent regex engine '%s' specified. Falling back to ECMAScript.", regextype.c_str());
ref.regextype = std::regex::ECMAScript;
}
ConfigTagList tags = ServerInstance->Config->ConfTags("database");
for(ConfigIter i = tags.first; i != tags.second; i++)
{
- if (i->second->getString("module", "sqlite") != "sqlite")
+ if (!stdalgo::string::equalsci(i->second->getString("provider"), "sqlite"))
continue;
SQLConn* conn = new SQLConn(this, i->second);
conns.insert(std::make_pair(i->second->getString("id"), conn));
throw Exception("Unknown hash type " + hashname);
gnutls_hash_deinit(is_digest, NULL);
#else
- if (hashname == "md5")
+ if (stdalgo::string::equalsci(hashname, "md5"))
hash = GNUTLS_DIG_MD5;
- else if (hashname == "sha1")
+ else if (stdalgo::string::equalsci(hashname, "sha1"))
hash = GNUTLS_DIG_SHA1;
#ifdef INSPIRCD_GNUTLS_ENABLE_SHA256_FINGERPRINT
- else if (hashname == "sha256")
+ else if (stdalgo::string::equalsci(hashname, "sha256"))
hash = GNUTLS_DIG_SHA256;
#endif
else
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "gnutls")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls"))
continue;
std::string name = tag->getString("name");
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "mbedtls")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "mbedtls"))
continue;
std::string name = tag->getString("name");
/* Set CRL mode */
unsigned long crlflags = X509_V_FLAG_CRL_CHECK;
- if (crlmode == "chain")
+ if (stdalgo::string::equalsci(crlmode, "chain"))
{
crlflags |= X509_V_FLAG_CRL_CHECK_ALL;
}
- else if (crlmode != "leaf")
+ else if (!stdalgo::string::equalsci(crlmode, "leaf"))
{
throw ModuleException("Unknown mode '" + crlmode + "'; expected either 'chain' (default) or 'leaf'");
}
for (ConfigIter i = tags.first; i != tags.second; ++i)
{
ConfigTag* tag = i->second;
- if (tag->getString("provider") != "openssl")
+ if (!stdalgo::string::equalsci(tag->getString("provider"), "openssl"))
continue;
std::string name = tag->getString("name");
ForgetDelay = tag->getDuration("delay", 3);
std::string act = tag->getString("action");
- if (act == "notice")
+ if (stdalgo::string::equalsci(act, "notice"))
action = IBLOCK_NOTICE;
- else if (act == "noticeopers")
+ else if (stdalgo::string::equalsci(act, "noticeopers"))
action = IBLOCK_NOTICEOPERS;
- else if (act == "silent")
+ else if (stdalgo::string::equalsci(act, "silent"))
action = IBLOCK_SILENT;
- else if (act == "kill")
+ else if (stdalgo::string::equalsci(act, "kill"))
action = IBLOCK_KILL;
else
action = IBLOCK_KILLOPERS;
suffix = tag->getString("suffix", ".IP");
std::string modestr = tag->getString("mode");
- if (modestr == "half")
+ if (stdalgo::string::equalsci(modestr, "half"))
{
mode = MODE_HALF_CLOAK;
domainparts = tag->getUInt("domainparts", 3, 1, 10);
}
- else if (modestr == "full")
+ else if (stdalgo::string::equalsci(modestr, "full"))
mode = MODE_OPAQUE;
else
throw ModuleException("Bad value for <cloak:mode>; must be half or full");
if (InspIRCd::Match(filename, bfl[i].filemask, ascii_case_insensitive_map))
{
/* We have a matching badfile entry, override whatever the default action is */
- if (bfl[i].action == "allow")
+ if (stdalgo::string::equalsci(bfl[i].action, "allow"))
return MOD_RES_PASSTHRU;
else
{
e->reason = tag->getString("reason");
e->domain = tag->getString("domain");
- if (tag->getString("type") == "bitmask")
+ if (stdalgo::string::equalsci(tag->getString("type"), "bitmask"))
{
e->type = DNSBLConfEntry::A_BITMASK;
e->bitmask = tag->getUInt("bitmask", 0, 0, UINT_MAX);
public:
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
- if (from->bind_tag->getString("type") != "flashpolicyd")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "flashpolicyd"))
return MOD_RES_PASSTHRU;
if (policy_reply.empty())
for (std::vector<ListenSocket*>::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i)
{
ListenSocket* ls = *i;
- if (ls->bind_tag->getString("type", "clients") != "clients" || ls->bind_tag->getString("ssl", "plaintext") != "plaintext")
+ if (!stdalgo::string::equalsci(ls->bind_tag->getString("type", "clients"), "clients") || !ls->bind_tag->getString("ssl").empty())
continue;
to_ports.append(ConvToStr(ls->bind_sa.port())).push_back(',');
ModResult OnAcceptConnection(int nfd, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
{
- if (from->bind_tag->getString("type") != "httpd")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "httpd"))
return MOD_RES_PASSTHRU;
sockets.push_front(new HttpServerSocket(nfd, client->addr(), from, client, server, timeoutsec));
while (sep.GetToken(type))
{
- if (type == "password")
+ if (stdalgo::string::equalsci(type, "password"))
{
username = c->getString("username");
password = c->getString("password");
}
- else if (type == "whitelist")
+ else if (stdalgo::string::equalsci(type, "whitelist"))
{
whitelist = c->getString("whitelist");
}
- else if (type == "blacklist")
+ else if (stdalgo::string::equalsci(type, "blacklist"))
{
blacklist = c->getString("blacklist");
}
ModResult ModuleSpanningTree::OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
{
- if (from->bind_tag->getString("type") != "servers")
+ if (!stdalgo::string::equalsci(from->bind_tag->getString("type"), "servers"))
return MOD_RES_PASSTHRU;
std::string incomingip = client->addr();
for (ConfigItems::const_iterator piter = parentkeys.begin(); piter != parentkeys.end(); ++piter)
{
// The class name and parent name are not inherited
- if (piter->first == "name" || piter->first == "parent")
+ if (stdalgo::string::equalsci(piter->first, "name") || stdalgo::string::equalsci(piter->first, "parent"))
continue;
// Store the item in the config tag. If this item also