diff options
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index c41b8e45b..52d885a0e 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -20,6 +20,9 @@ #include "inspircd.h" #include "main.h" +// The maximum line length in the 1205 protocol +#define COMPAT_LINE_LEN 510 + namespace { size_t NextToken(const std::string& line, size_t start) @@ -129,6 +132,27 @@ void TreeSocket::WriteLine(const std::string& original_line) line.erase(displayend); } } + else if (irc::equals(command, "FJOIN")) + { + // FJOIN has no length limit in v4 + // :<sid> FJOIN <chan> <TS> <modes> :[<member> [<member> ...]] + const auto chanend = NextToken(line, cmdend); + const auto chantsend = NextToken(line, chanend); + const auto modesend = NextToken(line, chantsend); + if (modesend != std::string::npos) + { + const auto maxlinelen = cmdstart + COMPAT_LINE_LEN; + while (line.length() > maxlinelen) + { + auto lastpos = line.rfind(' ', maxlinelen); + if (lastpos != std::string::npos) + { + WriteLineInternal(line.substr(0, lastpos)); + line.erase(modesend, lastpos - modesend); + } + } + } + } else if (irc::equals(command, "LMODE")) { // LMODE is new in v4; downgrade to FMODE. |
