diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:54 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:54 +0000 |
commit | 8ca460a0e660f7ac6bae4dfdc88680876fd899f5 (patch) | |
tree | 063df543e7d38449300588b54d00e4612250580e /src/modules/m_spanningtree/capab.cpp | |
parent | e62516014fdbc13a0baf9b869b747300bfdccbc7 (diff) |
Add modules to the VF_COMMON list in backwards compatability link mode, translate FIDENT as CHGIDENT
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11657 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/capab.cpp')
-rw-r--r-- | src/modules/m_spanningtree/capab.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 5b68ab4f9..66d448e55 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -21,10 +21,13 @@ /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - std::string TreeSocket::MyModules(int filter) { std::vector<std::string> modlist = this->ServerInstance->Modules->GetAllModuleNames(filter); + + if (filter == VF_COMMON && proto_version != ProtocolVersion) + CompatAddModules(modlist); + std::string capabilities; sort(modlist.begin(),modlist.end()); for (unsigned int i = 0; i < modlist.size(); i++) @@ -36,16 +39,20 @@ std::string TreeSocket::MyModules(int filter) return capabilities; } -void TreeSocket::SendCapabilities() +void TreeSocket::SendCapabilities(int phase) { - if (sentcapab) + if (capab_phase >= phase) + return; + + if (capab_phase < 1 && phase >= 1) + WriteLine("CAPAB START " + ConvToStr(ProtocolVersion)); + + capab_phase = phase; + if (phase < 2) return; - sentcapab = true; irc::commasepstream modulelist(MyModules(VF_COMMON)); irc::commasepstream optmodulelist(MyModules(VF_OPTCOMMON)); - this->WriteLine("CAPAB START"); - /* Send module names, split at 509 length */ std::string item; std::string line = "CAPAB MODULES "; @@ -160,6 +167,9 @@ bool TreeSocket::Capab(const parameterlist ¶ms) ModuleList.clear(); OptModuleList.clear(); CapKeys.clear(); + if (params.size() > 1) + proto_version = atoi(params[1].c_str()); + SendCapabilities(2); } else if (params[0] == "END") { @@ -244,7 +254,7 @@ bool TreeSocket::Capab(const parameterlist ¶ms) this->SetTheirChallenge(n->second); if (!this->GetTheirChallenge().empty() && (this->LinkState == CONNECTING)) { - this->SendCapabilities(); + this->SendCapabilities(2); this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+this->MakePass(OutboundPass, this->GetTheirChallenge())+" 0 "+ ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); } @@ -254,7 +264,7 @@ bool TreeSocket::Capab(const parameterlist ¶ms) /* They didnt specify a challenge or we don't have m_sha256.so, we use plaintext */ if (this->LinkState == CONNECTING) { - this->SendCapabilities(); + this->SendCapabilities(2); this->WriteLine(std::string("SERVER ")+this->ServerInstance->Config->ServerName+" "+OutboundPass+" 0 "+ServerInstance->Config->GetSID()+" :"+this->ServerInstance->Config->ServerDesc); } } |