]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/capab.cpp
Reset the already_sent IDs during slow garbage collection
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / capab.cpp
index ffd7eb80f7772d9d607c72db883b5b317ee20f9b..1e2fe710aa9d123e1fa1a2218772eaef78216284 100644 (file)
@@ -17,6 +17,7 @@
 #include "treesocket.h"
 #include "treeserver.h"
 #include "utils.h"
+#include "link.h"
 #include "main.h"
 
 std::string TreeSocket::MyModules(int filter)
@@ -49,22 +50,24 @@ std::string TreeSocket::MyModules(int filter)
 
 static std::string BuildModeList(ModeType type)
 {
-       std::string line;
+       std::vector<std::string> modes;
        for(char c='A'; c <= 'z'; c++)
        {
                ModeHandler* mh = ServerInstance->Modes->FindMode(c, type);
                if (mh)
                {
-                       if (!line.empty())
-                               line.push_back(' ');
-                       line.append(mh->name);
-                       line.push_back('=');
+                       std::string mdesc = mh->name;
+                       mdesc.push_back('=');
                        if (mh->GetPrefix())
-                               line.push_back(mh->GetPrefix());
-                       line.push_back(c);
+                               mdesc.push_back(mh->GetPrefix());
+                       if (mh->GetModeChar())
+                               mdesc.push_back(mh->GetModeChar());
+                       modes.push_back(mdesc);
                }
        }
-       return line;
+       sort(modes.begin(), modes.end());
+       irc::stringjoiner line(" ", modes, 0, modes.size() - 1);
+       return line.GetJoined();
 }
 
 void TreeSocket::SendCapabilities(int phase)
@@ -129,7 +132,7 @@ void TreeSocket::SendCapabilities(int phase)
        /* Do we have sha256 available? If so, we send a challenge */
        if (Utils->ChallengeResponse && (ServerInstance->Modules->Find("m_sha256.so")))
        {
-               this->SetOurChallenge(RandString(20));
+               SetOurChallenge(ServerInstance->GenRandomStr(20));
                extra = " CHALLENGE=" + this->GetOurChallenge();
        }
 
@@ -219,7 +222,7 @@ bool TreeSocket::Capab(const parameterlist &params)
                if (this->capab->OptModuleList != this->MyModules(VF_OPTCOMMON) && this->capab->OptModuleList.length())
                {
                        std::string diffIneed, diffUneed;
-                       ListDifference(this->capab->ModuleList, this->MyModules(VF_OPTCOMMON), ' ', diffIneed, diffUneed);
+                       ListDifference(this->capab->OptModuleList, this->MyModules(VF_OPTCOMMON), ' ', diffIneed, diffUneed);
                        if (diffIneed.length() || diffUneed.length())
                        {
                                if (Utils->AllowOptCommon)
@@ -313,8 +316,7 @@ bool TreeSocket::Capab(const parameterlist &params)
                        if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING))
                        {
                                this->SendCapabilities(2);
-                               this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+this->MakePass(capab->OutboundPass, this->GetTheirChallenge())+" 0 "+
-                                               ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
+                               this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+this->MakePass(capab->link->SendPass, capab->theirchallenge)+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
                        }
                }
                else
@@ -323,7 +325,7 @@ bool TreeSocket::Capab(const parameterlist &params)
                        if (this->LinkState == CONNECTING)
                        {
                                this->SendCapabilities(2);
-                               this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+capab->OutboundPass+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
+                               this->WriteLine(std::string("SERVER ")+ServerInstance->Config->ServerName+" "+capab->link->SendPass+" 0 "+ServerInstance->Config->GetSID()+" :"+ServerInstance->Config->ServerDesc);
                        }
                }