return NULL;
}
-/* A convenient wrapper that returns true if a server exists */
-bool SpanningTreeUtilities::IsServer(const std::string &ServerName)
-{
- return (FindServer(ServerName) != NULL);
-}
-
SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C)
{
ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str());
return;
}
-bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, const parameterlist ¶ms)
-{
- TreeServer* omitroute = this->BestRouteTo(omit);
- unsigned int items =this->TreeRoot->ChildCount();
- for (unsigned int x = 0; x < items; x++)
- {
- TreeServer* Route = this->TreeRoot->GetChild(x);
- if ((Route) && (Route->GetSocket()) && (Route->GetName() != omit) && (omitroute != Route))
- {
- TreeSocket* Sock = Route->GetSocket();
- if (Sock)
- Sock->WriteLine(data);
- }
- }
- return true;
-}
-
-bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string omit)
+bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& omit)
{
TreeServer* omitroute = this->BestRouteTo(omit);
std::string FullLine = ":" + prefix + " " + command;
return true;
}
-bool SpanningTreeUtilities::DoOneToMany(const char* prefix, const char* command, const parameterlist ¶ms)
-{
- std::string spfx = prefix;
- std::string scmd = command;
- return this->DoOneToMany(spfx, scmd, params);
-}
-
-bool SpanningTreeUtilities::DoOneToAllButSender(const char* prefix, const char* command, const parameterlist ¶ms, std::string omit)
-{
- std::string spfx = prefix;
- std::string scmd = command;
- return this->DoOneToAllButSender(spfx, scmd, params, omit);
-}
-
-bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string target)
+bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist ¶ms, const std::string& target)
{
TreeServer* Route = this->BestRouteTo(target);
if (Route)
{
try
{
- bool cached;
+ bool cached = false;
SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L->IPAddr, L, cached, DNS_QUERY_AAAA);
ServerInstance->AddResolver(sr, cached);
}
void SpanningTreeUtilities::ReadConfiguration()
{
- ConfigReader Conf;
-
- FlatLinks = Conf.ReadFlag("security","flatlinks",0);
- HideULines = Conf.ReadFlag("security","hideulines",0);
- AnnounceTSChange = Conf.ReadFlag("options","announcets",0);
- AllowOptCommon = Conf.ReadFlag("options", "allowmismatch", 0);
- ChallengeResponse = !Conf.ReadFlag("security", "disablehmac", 0);
- quiet_bursts = Conf.ReadFlag("performance", "quietbursts", 0);
- PingWarnTime = Conf.ReadInteger("options", "pingwarning", 0, true);
- PingFreq = Conf.ReadInteger("options", "serverpingfreq", 0, true);
+ ConfigTag* security = ServerInstance->Config->ConfValue("security");
+ ConfigTag* options = ServerInstance->Config->ConfValue("options");
+ FlatLinks = security->getBool("flatlinks");
+ HideULines = security->getBool("hideulines");
+ AnnounceTSChange = options->getBool("announcets");
+ AllowOptCommon = options->getBool("allowmismatch");
+ ChallengeResponse = !security->getBool("disablehmac");
+ quiet_bursts = ServerInstance->Config->ConfValue("performance")->getBool("quietbursts");
+ PingWarnTime = options->getInt("pingwarning");
+ PingFreq = options->getInt("serverpingfreq");
if (PingFreq == 0)
PingFreq = 60;
{
ConfigTag* tag = i->second;
reference<Link> L = new Link(tag);
- L->Name = tag->getString("name").c_str();
+ std::string linkname = tag->getString("name");
+ L->Name = linkname.c_str();
L->AllowMask = tag->getString("allowmask");
L->IPAddr = tag->getString("ipaddr");
L->Port = tag->getInt("port");
for (std::vector<reference<Link> >::iterator i = LinkBlocks.begin(); i != LinkBlocks.end(); ++i)
{
Link* x = *i;
- if (InspIRCd::Match(x->Name.c_str(), name.c_str()))
+ if (InspIRCd::Match(x->Name.c_str(), name.c_str(), rfc_case_insensitive_map))
{
return x;
}
}
return NULL;
}
+
+void SpanningTreeUtilities::Rehash()
+{
+ server_hash temp;
+ for (server_hash::const_iterator i = serverlist.begin(); i != serverlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ serverlist.swap(temp);
+ temp.clear();
+
+ for (server_hash::const_iterator i = sidlist.begin(); i != sidlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ sidlist.swap(temp);
+}