summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-08-22 17:02:34 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-08-22 17:02:34 +0200
commitfea425704f1ab72dc7dbadb556958e71144c3765 (patch)
tree32a67275d089691727d1f9823475ec40788003c6
parent4e0b32e67e27235162f41b362ac62b86c9e0af18 (diff)
m_spanningtree Change type of Link::Name to std::string
Switch to stdalgo::string::equalsci()
-rw-r--r--src/modules/m_spanningtree/link.h2
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/server.cpp3
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp2
-rw-r--r--src/modules/m_spanningtree/utils.cpp16
5 files changed, 13 insertions, 14 deletions
diff --git a/src/modules/m_spanningtree/link.h b/src/modules/m_spanningtree/link.h
index 21213fb3e..632982623 100644
--- a/src/modules/m_spanningtree/link.h
+++ b/src/modules/m_spanningtree/link.h
@@ -24,7 +24,7 @@ class Link : public refcountbase
{
public:
reference<ConfigTag> tag;
- irc::string Name;
+ std::string Name;
std::string IPAddr;
int Port;
std::string SendPass;
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 81543b0da..67c1afdac 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -194,7 +194,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y)
{
bool ipvalid = true;
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map))
{
ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself.");
return;
@@ -320,7 +320,7 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector<std::string>& para
Link* x = *i;
if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map))
{
- if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map))
+ if (InspIRCd::Match(ServerInstance->Config->ServerName, x->Name, rfc_case_insensitive_map))
{
user->WriteRemoteNotice(InspIRCd::Format("*** CONNECT: Server \002%s\002 is ME, not connecting.", x->Name.c_str()));
return MOD_RES_DENY;
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp
index 3000dd391..50f63e117 100644
--- a/src/modules/m_spanningtree/server.cpp
+++ b/src/modules/m_spanningtree/server.cpp
@@ -98,7 +98,6 @@ Link* TreeSocket::AuthRemote(const parameterlist& params)
return NULL;
}
- irc::string servername = params[0].c_str();
const std::string& sname = params[0];
const std::string& password = params[1];
const std::string& sid = params[3];
@@ -115,7 +114,7 @@ Link* TreeSocket::AuthRemote(const parameterlist& params)
for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++)
{
Link* x = *i;
- if (x->Name != servername && x->Name != "*") // open link allowance
+ if ((!stdalgo::string::equalsci(x->Name, sname)) && (x->Name != "*")) // open link allowance
continue;
if (!ComparePass(*x, password))
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index e1642a086..a96c4a90c 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -37,7 +37,7 @@
* and only do minor initialization tasks ourselves.
*/
TreeSocket::TreeSocket(Link* link, Autoconnect* myac, const std::string& ipaddr)
- : linkID(assign(link->Name)), LinkState(CONNECTING), MyRoot(NULL), proto_version(0)
+ : linkID(link->Name), LinkState(CONNECTING), MyRoot(NULL), proto_version(0)
, burstsent(false), age(ServerInstance->Time())
{
capab = new CapabData;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 6de47de94..7ef20d202 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -267,31 +267,31 @@ void SpanningTreeUtilities::ReadConfiguration()
throw ModuleException("Invalid configuration, found a link tag without a name!" + (!L->IPAddr.empty() ? " IP address: "+L->IPAddr : ""));
if (L->Name.find('.') == std::string::npos)
- throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it must contain at least one '.' character");
+ throw ModuleException("The link name '"+L->Name+"' is invalid as it must contain at least one '.' character");
if (L->Name.length() > ServerInstance->Config->Limits.MaxHost)
- throw ModuleException("The link name '"+assign(L->Name)+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters");
+ throw ModuleException("The link name '"+L->Name+"' is invalid as it is longer than " + ConvToStr(ServerInstance->Config->Limits.MaxHost) + " characters");
if (L->RecvPass.empty())
- throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', recvpass not defined");
+ throw ModuleException("Invalid configuration for server '"+L->Name+"', recvpass not defined");
if (L->SendPass.empty())
- throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', sendpass not defined");
+ throw ModuleException("Invalid configuration for server '"+L->Name+"', sendpass not defined");
if ((L->SendPass.find(' ') != std::string::npos) || (L->RecvPass.find(' ') != std::string::npos))
- throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that contains a space character which is invalid");
+ throw ModuleException("Link block '" + L->Name + "' has a password set that contains a space character which is invalid");
if ((L->SendPass[0] == ':') || (L->RecvPass[0] == ':'))
- throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that begins with a colon (:) which is invalid");
+ throw ModuleException("Link block '" + L->Name + "' has a password set that begins with a colon (:) which is invalid");
if (L->IPAddr.empty())
{
L->IPAddr = "*";
- ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + assign(L->Name) + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want.");
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no IP defined! This will allow any IP to connect as this server, and MAY not be what you want.");
}
if (!L->Port)
- ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + assign(L->Name) + "' has no port defined, you will not be able to /connect it.");
+ ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Configuration warning: Link block '" + L->Name + "' has no port defined, you will not be able to /connect it.");
L->Fingerprint.erase(std::remove(L->Fingerprint.begin(), L->Fingerprint.end(), ':'), L->Fingerprint.end());
LinkBlocks.push_back(L);