summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-07-27 18:37:39 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-07-27 18:37:39 +0200
commitfe609b6bd81b6c16a9263aee586ce6824a994301 (patch)
treed577cb44becc360fdad150ca5fb43798b925aede
parenta3f0ce79d0b9674bfc0c3359f8c87e528ce74fed (diff)
m_spanningtree Add TreeSocket::WriteLineNoCompat() to send a line without doing any translation for old protocol servers
-rw-r--r--src/modules/m_spanningtree/compat.cpp15
-rw-r--r--src/modules/m_spanningtree/treesocket.h5
2 files changed, 14 insertions, 6 deletions
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;