diff options
| author | 2013-04-12 17:01:02 +0200 | |
|---|---|---|
| committer | 2013-04-13 17:09:18 +0200 | |
| commit | b9a2b9868d7bd94882e8b1c7a99b967e581240c8 (patch) | |
| tree | b29e22e624c3b32c897b41b1c5802005680b620a /src/modules/m_spanningtree/compat.cpp | |
| parent | m_spanningtree Introduce IJOIN and RESYNC (diff) | |
m_spanningtree Add channel timestamp to channel METADATA
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index bfc2d1560..c14115bed 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -90,6 +90,28 @@ void TreeSocket::WriteLine(std::string line) } else if (command == "RESYNC") return; + else if (command == "METADATA") + { + // Drop TS for channel METADATA + // :sid METADATA #target TS extname ... + // A B C D + if (b == std::string::npos) + return; + + std::string::size_type c = line.find(' ', b + 1); + if (c == 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); + } + } } } } @@ -98,3 +120,28 @@ void TreeSocket::WriteLine(std::string line) this->WriteData(line); this->WriteData(newline); } + +namespace +{ + bool InsertCurrentChannelTS(std::vector<std::string>& params) + { + Channel* chan = ServerInstance->FindChan(params[0]); + if (!chan) + return false; + + // Insert the current TS of the channel between the first and the second parameters + params.insert(params.begin()+1, ConvToStr(chan->age)); + return true; + } +} + +bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std::vector<std::string>& params) +{ + if ((cmd == "METADATA") && (params.size() >= 3)) + { + // :20D METADATA #channel extname :extdata + return InsertCurrentChannelTS(params); + } + + return true; // Passthru +} |
