diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-08-18 13:48:31 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-08-18 13:48:31 +0200 |
commit | b395c59997debe3827a39ec23cba54465d2aaf6a (patch) | |
tree | 728da998d74cfa1aa8988ae010224b27874718a4 /src/modules/m_spanningtree/compat.cpp | |
parent | 02267976f636e3c4fffc8732a949b4777a771ca2 (diff) |
m_spanningtree Propagate oper-only quit reason using METADATA, remove OPERQUIT
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
-rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 41cabbc93..0fc837beb 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -93,7 +93,7 @@ void TreeSocket::WriteLine(std::string line) return; else if (command == "METADATA") { - // Drop TS for channel METADATA + // Drop TS for channel METADATA, translate METADATA operquit into an OPERQUIT command // :sid METADATA #target TS extname ... // A B C D if (b == std::string::npos) @@ -103,15 +103,20 @@ void TreeSocket::WriteLine(std::string line) if (c == std::string::npos) return; + std::string::size_type d = line.find(' ', c + 1); + if (d == std::string::npos) + return; + if (line[b + 1] == '#') { // We're sending channel metadata - std::string::size_type d = line.find(' ', c + 1); - if (d == std::string::npos) - return; - line.erase(c, d-c); } + else if (line.substr(c, d-c) == " operquit") + { + // ":22D METADATA 22DAAAAAX operquit :message" -> ":22DAAAAAX OPERQUIT :message" + line = ":" + line.substr(b+1, c-b) + "OPERQUIT" + line.substr(d); + } } else if (command == "FTOPIC") { @@ -246,6 +251,17 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std: { cmd = "MODE"; } + else if (cmd == "OPERQUIT") + { + // Translate OPERQUIT into METADATA + if (params.empty()) + return false; + + cmd = "METADATA"; + params.insert(params.begin(), who->uuid); + params.insert(params.begin()+1, "operquit"); + who = MyRoot->ServerUser; + } return true; // Passthru } |