summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/compat.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-07-27 18:36:12 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-07-27 18:36:12 +0200
commita3f0ce79d0b9674bfc0c3359f8c87e528ce74fed (patch)
treec19ff02da93248832cb190a558d4d35af6f691ad /src/modules/m_spanningtree/compat.cpp
parent9c934dcae25a60924fd2506126f86fcc86e73632 (diff)
m_spanningtree Translate the new SERVER message for 1202 protocol servers
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
-rw-r--r--src/modules/m_spanningtree/compat.cpp26
1 files changed, 26 insertions, 0 deletions
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 [<anything> ...] :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 <name> * 0 <sid> <desc>
+ // change to
+ // :20D SERVER <name> <sid> <desc>
+
+ params[1].swap(params[3]);
+ params.erase(params.begin()+2, params.begin()+4);
+ }
return true; // Passthru
}