From e62516014fdbc13a0baf9b869b747300bfdccbc7 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:52:46 +0000 Subject: Add s2s backward compatability for protocol changes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11656 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/compat.cpp | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/modules/m_spanningtree/compat.cpp (limited to 'src/modules/m_spanningtree/compat.cpp') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp new file mode 100644 index 000000000..345215031 --- /dev/null +++ b/src/modules/m_spanningtree/compat.cpp @@ -0,0 +1,46 @@ +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ + +#include "inspircd.h" +#include "main.h" +#include "treesocket.h" + +void TreeSocket::WriteLine(std::string line) +{ + if (line[0] != ':' && LinkState == CONNECTED) + { + ServerInstance->Logs->Log("m_spanningtree", DEFAULT, "Sending line without server prefix!"); + line = ":" + ServerInstance->Config->GetSID() + " " + line; + } + if (proto_version != ProtocolVersion) + { + std::string::size_type a = line.find(' '); + std::string::size_type b = line.find(' ', a); + std::string command = line.substr(a,b); + // now try to find a translation entry + // TODO a more efficient lookup method will be needed later + if (proto_version < 1202 && command == "FIDENT") + { + // a more aggressive method would be to translate to CHGIDENT + ServerInstance->Logs->Log("m_spanningtree",DEBUG,"Dropping FIDENT to 1201-protocol server"); + return; + } + } + + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "S[%d] O %s", this->GetFd(), line.c_str()); + line.append("\r\n"); + this->Write(line); +} + + + -- cgit v1.3.1-10-gc9f91