From a3f0ce79d0b9674bfc0c3359f8c87e528ce74fed Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 27 Jul 2014 18:36:12 +0200 Subject: m_spanningtree Translate the new SERVER message for 1202 protocol servers --- src/modules/m_spanningtree/compat.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/modules/m_spanningtree/compat.cpp') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 0f55793f1..9cd081e1e 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -258,6 +258,22 @@ void TreeSocket::WriteLine(const std::string& original_line) line = line.substr(0, 5) + "VERSION" + line.substr(c); } + else if (command == "SERVER") + { + // :001 SERVER inspircd.test 002 [ ...] :gecos + // A B C + std::string::size_type c = line.find(' ', b + 1); + if (c == std::string::npos) + return; + + std::string::size_type d = c + 4; + std::string::size_type spcolon = line.find(" :", d); + if (spcolon == std::string::npos) + return; + + line.erase(d, spcolon-d); + line.insert(c, " * 0"); + } } ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); this->WriteData(line); @@ -432,6 +448,16 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std: params.erase(params.begin()+1); } } + else if ((cmd == "SERVER") && (params.size() > 4)) + { + // This does not affect the initial SERVER line as it is sent before the link state is CONNECTED + // :20D SERVER * 0 + // change to + // :20D SERVER + + params[1].swap(params[3]); + params.erase(params.begin()+2, params.begin()+4); + } return true; // Passthru } -- cgit v1.2.3