diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:46 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:52:46 +0000 |
commit | e62516014fdbc13a0baf9b869b747300bfdccbc7 (patch) | |
tree | d16b926b9d7bd05f93c4ab90f9ea80cd2b78cc6e /src/modules/m_spanningtree/compat.cpp | |
parent | fe7ce903b838912a34de9e1530dd9ca45af5aed3 (diff) |
Add s2s backward compatability for protocol changes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11656 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
-rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
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); +} + + + |