summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-01 03:35:08 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-01 03:35:08 +0000
commit18aae91d9336b204ac252ad83008bfd0e78595e4 (patch)
tree2b6cab3e64a06099000bb1d4a260e0bf465f3fcf
parent8f80dd4a40bf35718009ca32bf30e44a67b289b4 (diff)
ENCAP removal for supported protocol 1201 commands
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11788 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_spanningtree/compat.cpp36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp
index 94c797bfd..3724319b7 100644
--- a/src/modules/m_spanningtree/compat.cpp
+++ b/src/modules/m_spanningtree/compat.cpp
@@ -54,15 +54,15 @@ void TreeSocket::WriteLine(std::string line)
}
if (proto_version != ProtocolVersion)
{
- std::string::size_type a = line.find(' ') + 1;
- std::string::size_type b = line.find(' ', a);
- std::string command = line.substr(a, b-a);
+ std::string::size_type a = line.find(' ');
+ std::string::size_type b = line.find(' ', a + 1);
+ std::string command = line.substr(a + 1, b-a-1);
// now try to find a translation entry
// TODO a more efficient lookup method will be needed later
if (proto_version < 1202 && command == "FIDENT")
{
ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Rewriting FIDENT for 1201-protocol server");
- line = ":" + ServerInstance->Config->GetSID() + " CHGIDENT " + line.substr(1,a-2) + line.substr(b);
+ line = ":" + ServerInstance->Config->GetSID() + " CHGIDENT " + line.substr(1,a-1) + line.substr(b);
}
else if (proto_version < 1202 && command == "SAVE")
{
@@ -75,10 +75,35 @@ void TreeSocket::WriteLine(std::string line)
{
if (b != std::string::npos)
{
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Stripping AWAY timestamp for 1201-protocol server");
std::string::size_type c = line.find(' ', b + 1);
line.erase(b,c-b);
}
}
+ else if (proto_version < 1202 && command == "ENCAP")
+ {
+ // :src ENCAP target command [args...]
+ // A B C D
+ // Therefore B and C cannot be npos in a valid command
+ if (b == std::string::npos)
+ return;
+ std::string::size_type c = line.find(' ', b + 1);
+ if (c == std::string::npos)
+ return;
+ std::string::size_type d = line.find(' ', c + 1);
+ std::string subcmd = line.substr(c, d - c);
+ Command* thiscmd = ServerInstance->Parser->GetHandler(subcmd);
+ if (thiscmd)
+ {
+ Version ver = thiscmd->creator->GetVersion();
+ if (ver.Flags & VF_OPTCOMMON)
+ {
+ ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Removing ENCAP on '%s' for 1201-protocol server",
+ subcmd.c_str());
+ line.erase(a, c-a);
+ }
+ }
+ }
}
}
@@ -86,6 +111,3 @@ void TreeSocket::WriteLine(std::string line)
this->WriteData(line);
this->WriteData(wide_newline);
}
-
-
-