summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 18:02:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-08-28 18:02:01 +0000
commitf83322c93800a528cf74811523ed90560092b715 (patch)
treeeb61cca00003f9a8f1a9f849ea1e3d7df75102df /src/modules
parent02b2c0ac2b45b130c36c8e1df4da654dfb2c482b (diff)
Tidy up duplicate code, provide GetSID() method on ServerConfig which returns the SID always 3 digits long
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7959 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp10
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp7
2 files changed, 3 insertions, 14 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index 91165824e..f2be6dd31 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -430,12 +430,6 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
}
else if (params[0] == "END")
{
- std::string OurSID;
-
- OurSID += (char)((Instance->Config->sid / 100) + 48);
- OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
- OurSID += (char)(Instance->Config->sid % 10 + 48);
-
std::string reason;
int ip6support = 0;
#ifdef SUPPORT_IP6LINKS
@@ -508,14 +502,14 @@ bool TreeSocket::Capab(const std::deque<std::string> &params)
if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
{
this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+
- OurSID+" :"+this->Instance->Config->ServerDesc);
+ Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc);
}
}
else
{
/* They didnt specify a challenge or we don't have m_sha256.so, we use plaintext */
if (this->LinkState == CONNECTING)
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+OutboundPass+" 0 "+Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc);
}
if (reason.length())
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index c671ebded..7f274ba13 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -910,17 +910,12 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> &params)
std::string password = params[1];
std::string sid = params[3];
std::string description = params[4];
- std::string OurSID;
int hops = atoi(params[2].c_str());
this->InboundServerName = sname;
this->InboundDescription = description;
this->InboundSID = sid;
- OurSID += (char)((Instance->Config->sid / 100) + 48);
- OurSID += (char)((Instance->Config->sid / 10) % 10 + 48);
- OurSID += (char)(Instance->Config->sid % 10 + 48);
-
if (!sentcapab)
this->SendCapabilities();
@@ -976,7 +971,7 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> &params)
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+OurSID+" :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass, this->GetTheirChallenge())+" 0 "+Instance->Config->GetSID()+" :"+this->Instance->Config->ServerDesc);
// move to the next state, we are now waiting for THEM.
this->LinkState = WAIT_AUTH_2;
return true;