本文整理汇总了C++中ConfigTag::getUInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfigTag::getUInt方法的具体用法?C++ ConfigTag::getUInt怎么用?C++ ConfigTag::getUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigTag
的用法示例。
在下文中一共展示了ConfigTag::getUInt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void init() override
{
ConfigTagList tags = ServerInstance->Config->ConfTags("customprefix");
for (ConfigIter iter = tags.first; iter != tags.second; ++iter)
{
ConfigTag* tag = iter->second;
const std::string name = tag->getString("name");
if (name.empty())
throw ModuleException("<customprefix:name> must be specified at " + tag->getTagLocation());
if (tag->getBool("change"))
{
ModeHandler* mh = ServerInstance->Modes.FindMode(name, MODETYPE_CHANNEL);
if (!mh)
throw ModuleException("<customprefix:change> specified for a non-existent mode at " + tag->getTagLocation());
PrefixMode* pm = mh->IsPrefixMode();
if (!pm)
throw ModuleException("<customprefix:change> specified for a non-prefix mode at " + tag->getTagLocation());
unsigned long rank = tag->getUInt("rank", pm->GetPrefixRank(), 0, UINT_MAX);
unsigned long setrank = tag->getUInt("ranktoset", pm->GetLevelRequired(true), rank, UINT_MAX);
unsigned long unsetrank = tag->getUInt("ranktounset", pm->GetLevelRequired(false), setrank, UINT_MAX);
bool depriv = tag->getBool("depriv", pm->CanSelfRemove());
pm->Update(rank, setrank, unsetrank, depriv);
ServerInstance->Logs.Log(MODNAME, LOG_DEBUG, "Changed the %s prefix: depriv=%u rank=%u ranktoset=%u ranktounset=%u",
pm->name.c_str(), pm->CanSelfRemove(), pm->GetPrefixRank(), pm->GetLevelRequired(true), pm->GetLevelRequired(false));
continue;
}
const std::string letter = tag->getString("letter");
if (letter.length() != 1)
throw ModuleException("<customprefix:letter> must be set to a mode character at " + tag->getTagLocation());
const std::string prefix = tag->getString("prefix");
if (prefix.length() != 1)
throw ModuleException("<customprefix:prefix> must be set to a mode prefix at " + tag->getTagLocation());
try
{
CustomPrefixMode* mh = new CustomPrefixMode(this, name, letter[0], prefix[0], tag);
modes.push_back(mh);
ServerInstance->Modules.AddService(*mh);
}
catch (ModuleException& e)
{
throw ModuleException(e.GetReason() + " (while creating mode from " + tag->getTagLocation() + ")");
}
}
}
示例2: ReadConfig
void ReadConfig()
{
ConfigTag* conf = ServerInstance->Config->ConfValue("repeat");
ms.MaxLines = conf->getUInt("maxlines", 20);
ms.MaxBacklog = conf->getUInt("maxbacklog", 20);
ms.MaxSecs = conf->getDuration("maxtime", 0);
ms.MaxDiff = conf->getUInt("maxdistance", 50);
if (ms.MaxDiff > 100)
ms.MaxDiff = 100;
unsigned int newsize = conf->getUInt("size", 512);
if (newsize > ServerInstance->Config->Limits.MaxLine)
newsize = ServerInstance->Config->Limits.MaxLine;
Resize(newsize);
}
示例3: ReadConfig
void ReadConfig(ConfigStatus& status) override
{
// TODO: Multiple SNI profiles
ConfigTag* tag = ServerInstance->Config->ConfValue("sts");
if (tag == ServerInstance->Config->EmptyTag)
throw ModuleException("You must define a STS policy!");
const std::string host = tag->getString("host");
if (host.empty())
throw ModuleException("<sts:host> must contain a hostname, at " + tag->getTagLocation());
unsigned int port = tag->getUInt("port", 0, 0, UINT16_MAX);
if (!HasValidSSLPort(port))
throw ModuleException("<sts:port> must be a TLS port, at " + tag->getTagLocation());
unsigned long duration = tag->getDuration("duration", 60*60*24*30*2);
bool preload = tag->getBool("preload");
cap.SetPolicy(host, duration, port, preload);
}
示例4: Fill
void ServerConfig::Fill()
{
ConfigTag* options = ConfValue("options");
ConfigTag* security = ConfValue("security");
ConfigTag* server = ConfValue("server");
if (sid.empty())
{
ServerName = server->getString("name", "irc.example.com", InspIRCd::IsHost);
sid = server->getString("id");
if (!sid.empty() && !InspIRCd::IsSID(sid))
throw CoreException(sid + " is not a valid server ID. A server ID must be 3 characters long, with the first character a digit and the next two characters a digit or letter.");
}
else
{
std::string name = server->getString("name");
if (!name.empty() && name != ServerName)
throw CoreException("You must restart to change the server name");
std::string nsid = server->getString("id");
if (!nsid.empty() && nsid != sid)
throw CoreException("You must restart to change the server id");
}
SoftLimit = ConfValue("performance")->getUInt("softlimit", (SocketEngine::GetMaxFds() > 0 ? SocketEngine::GetMaxFds() : LONG_MAX), 10);
CCOnConnect = ConfValue("performance")->getBool("clonesonconnect", true);
MaxConn = ConfValue("performance")->getUInt("somaxconn", SOMAXCONN);
TimeSkipWarn = ConfValue("performance")->getDuration("timeskipwarn", 2, 0, 30);
XLineMessage = options->getString("xlinemessage", "You're banned!");
ServerDesc = server->getString("description", "Configure Me");
Network = server->getString("network", "Network");
NetBufferSize = ConfValue("performance")->getInt("netbuffersize", 10240, 1024, 65534);
CustomVersion = security->getString("customversion");
HideBans = security->getBool("hidebans");
HideServer = security->getString("hideserver");
SyntaxHints = options->getBool("syntaxhints");
FullHostInTopic = options->getBool("hostintopic");
MaxTargets = security->getUInt("maxtargets", 20, 1, 31);
DefaultModes = options->getString("defaultmodes", "not");
PID = ConfValue("pid")->getString("file");
c_ipv4_range = ConfValue("cidr")->getUInt("ipv4clone", 32, 1, 32);
c_ipv6_range = ConfValue("cidr")->getUInt("ipv6clone", 128, 1, 128);
Limits = ServerLimits(ConfValue("limits"));
Paths = ServerPaths(ConfValue("path"));
NoSnoticeStack = options->getBool("nosnoticestack", false);
std::string defbind = options->getString("defaultbind");
if (stdalgo::string::equalsci(defbind, "ipv4"))
{
WildcardIPv6 = false;
}
else if (stdalgo::string::equalsci(defbind, "ipv6"))
{
WildcardIPv6 = true;
}
else
{
WildcardIPv6 = true;
int socktest = socket(AF_INET6, SOCK_STREAM, 0);
if (socktest < 0)
WildcardIPv6 = false;
else
SocketEngine::Close(socktest);
}
ServerInstance->XLines->ClearConfigLines();
ReadXLine(this, "badip", "ipmask", ServerInstance->XLines->GetFactory("Z"));
ReadXLine(this, "badnick", "nick", ServerInstance->XLines->GetFactory("Q"));
ReadXLine(this, "badhost", "host", ServerInstance->XLines->GetFactory("K"));
ReadXLine(this, "exception", "host", ServerInstance->XLines->GetFactory("E"));
const std::string restrictbannedusers = options->getString("restrictbannedusers", "yes");
if (stdalgo::string::equalsci(restrictbannedusers, "no"))
RestrictBannedUsers = ServerConfig::BUT_NORMAL;
else if (stdalgo::string::equalsci(restrictbannedusers, "silent"))
RestrictBannedUsers = ServerConfig::BUT_RESTRICT_SILENT;
else if (stdalgo::string::equalsci(restrictbannedusers, "yes"))
RestrictBannedUsers = ServerConfig::BUT_RESTRICT_NOTIFY;
else
throw CoreException(restrictbannedusers + " is an invalid <options:restrictbannedusers> value, at " + options->getTagLocation());
}
示例5: CrossCheckConnectBlocks
//.........这里部分代码省略.........
try_again = true;
// couldn't find parent this time. If it's the last time, we'll never find it.
if (tries >= blk_count)
throw CoreException("Could not find parent connect class \"" + parentName + "\" for connect block at " + tag->getTagLocation());
continue;
}
parent = Classes[parentIter->second];
}
std::string name = tag->getString("name");
std::string mask, typeMask;
char type;
if (tag->readString("allow", mask, false))
{
type = CC_ALLOW;
typeMask = 'a' + mask;
}
else if (tag->readString("deny", mask, false))
{
type = CC_DENY;
typeMask = 'd' + mask;
}
else if (!name.empty())
{
type = CC_NAMED;
mask = name;
typeMask = 'n' + mask;
}
else
{
throw CoreException("Connect class must have allow, deny, or name specified at " + tag->getTagLocation());
}
if (name.empty())
{
name = "unnamed-" + ConvToStr(i);
}
else
{
typeMask = 'n' + name;
}
if (names.find(name) != names.end())
throw CoreException("Two connect classes with name \"" + name + "\" defined!");
names[name] = i;
ConnectClass* me = parent ?
new ConnectClass(tag, type, mask, *parent) :
new ConnectClass(tag, type, mask);
me->name = name;
me->registration_timeout = tag->getDuration("timeout", me->registration_timeout);
me->pingtime = tag->getDuration("pingfreq", me->pingtime);
std::string sendq;
if (tag->readString("sendq", sendq))
{
// attempt to guess a good hard/soft sendq from a single value
unsigned long value = strtoul(sendq.c_str(), NULL, 10);
if (value > 16384)
me->softsendqmax = value / 16;
else
me->softsendqmax = value;
me->hardsendqmax = value * 8;
}
me->softsendqmax = tag->getUInt("softsendq", me->softsendqmax);
me->hardsendqmax = tag->getUInt("hardsendq", me->hardsendqmax);
me->recvqmax = tag->getUInt("recvq", me->recvqmax);
me->penaltythreshold = tag->getUInt("threshold", me->penaltythreshold);
me->commandrate = tag->getUInt("commandrate", me->commandrate);
me->fakelag = tag->getBool("fakelag", me->fakelag);
me->maxlocal = tag->getUInt("localmax", me->maxlocal);
me->maxglobal = tag->getUInt("globalmax", me->maxglobal);
me->maxchans = tag->getUInt("maxchans", me->maxchans);
me->maxconnwarn = tag->getBool("maxconnwarn", me->maxconnwarn);
me->limit = tag->getUInt("limit", me->limit);
me->resolvehostnames = tag->getBool("resolvehostnames", me->resolvehostnames);
std::string ports = tag->getString("port");
if (!ports.empty())
{
irc::portparser portrange(ports, false);
while (int port = portrange.GetToken())
me->ports.insert(port);
}
ClassMap::iterator oldMask = oldBlocksByMask.find(typeMask);
if (oldMask != oldBlocksByMask.end())
{
ConnectClass* old = oldMask->second;
oldBlocksByMask.erase(oldMask);
old->Update(me);
delete me;
me = old;
}
Classes[i] = me;
}
}
}
示例6: ReadConfig
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("watch");
cmd.maxwatch = tag->getUInt("maxwatch", 30, 1);
}
示例7: ReadConfig
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("monitor");
cmd.maxmonitor = tag->getUInt("maxentries", 30, 1);
}
示例8: ReadConfig
void ReadConfig(ConfigStatus& status) override
{
ConfigTag* tag = ServerInstance->Config->ConfValue("remove");
supportnokicks = tag->getBool("supportnokicks");
cmd1.protectedrank = cmd2.protectedrank = tag->getUInt("protectedrank", 50000);
}