From: Attila Molnar Date: Sun, 27 Jul 2014 16:37:39 +0000 (+0200) Subject: m_spanningtree Add TreeSocket::WriteLineNoCompat() to send a line without doing any... X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=fe609b6bd81b6c16a9263aee586ce6824a994301;hp=a3f0ce79d0b9674bfc0c3359f8c87e528ce74fed;p=user%2Fhenk%2Fcode%2Finspircd.git m_spanningtree Add TreeSocket::WriteLineNoCompat() to send a line without doing any translation for old protocol servers --- diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 9cd081e1e..83ad77414 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -24,6 +24,13 @@ static std::string newline("\n"); +void TreeSocket::WriteLineNoCompat(const std::string& line) +{ + ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); + this->WriteData(line); + this->WriteData(newline); +} + void TreeSocket::WriteLine(const std::string& original_line) { if (LinkState == CONNECTED) @@ -275,16 +282,12 @@ void TreeSocket::WriteLine(const std::string& original_line) line.insert(c, " * 0"); } } - ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str()); - this->WriteData(line); - this->WriteData(newline); + WriteLineNoCompat(line); return; } } - ServerInstance->Logs->Log(MODNAME, LOG_RAWIO, "S[%d] O %s", this->GetFd(), original_line.c_str()); - this->WriteData(original_line); - this->WriteData(newline); + WriteLineNoCompat(original_line); } namespace diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index bee8b3069..2a47da39b 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -148,6 +148,11 @@ class TreeSocket : public BufferedSocket */ Link* AuthRemote(const parameterlist& params); + /** Write a line on this socket with a new line character appended, skipping all translation for old protocols + * @param line Line to write without a new line character at the end + */ + void WriteLineNoCompat(const std::string& line); + public: const time_t age;