diff options
| author | 2025-12-28 00:12:57 +0000 | |
|---|---|---|
| committer | 2025-12-28 00:12:57 +0000 | |
| commit | 695975cdb3371d3cd297e97ea2ec2d6b36405716 (patch) | |
| tree | 9ab98303b7ec37d5de4b27c6e82e769adb7bc74f /modules/spanningtree/compat.cpp | |
| parent | Fix some issues with the previous merge. (diff) | |
Add join time to the membership identifier.
Diffstat (limited to 'modules/spanningtree/compat.cpp')
| -rw-r--r-- | modules/spanningtree/compat.cpp | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/modules/spanningtree/compat.cpp b/modules/spanningtree/compat.cpp index 585241ea0..e6c93483d 100644 --- a/modules/spanningtree/compat.cpp +++ b/modules/spanningtree/compat.cpp @@ -20,7 +20,6 @@ #include "inspircd.h" #include "main.h" -#if 0 namespace { size_t NextToken(const std::string& line, size_t start) @@ -31,7 +30,6 @@ namespace return line.find(' ', start + 1); } } -#endif void TreeSocket::WriteLine(const std::string& original_line) { @@ -44,7 +42,6 @@ void TreeSocket::WriteLine(const std::string& original_line) } std::string line = original_line; -#if 0 size_t cmdstart = 0; if (line[0] == '@') // Skip the tags. @@ -54,10 +51,8 @@ void TreeSocket::WriteLine(const std::string& original_line) cmdstart++; } - size_t sidstart = std::string::npos; if (line[cmdstart] == ':') // Skip the prefix. { - sidstart = cmdstart + 1; cmdstart = NextToken(line, cmdstart); if (cmdstart != std::string::npos) cmdstart++; @@ -71,38 +66,50 @@ void TreeSocket::WriteLine(const std::string& original_line) std::string command(line, cmdstart, cmdend - cmdstart); if (proto_version == PROTO_INSPIRCD_4) { + if (irc::equals(command, "FJOIN")) + { + // :<sid> FJOIN <chan> <chants> <modes> :[<modes>],<uuid>:<membid>/<joined> [<modes>],<uuid>:<membid>/<joined> + // ^^^^^^^^^ New in 120 + const auto chanend = NextToken(line, cmdend); + const auto chantsend = NextToken(line, chanend); + const auto modesend = NextToken(line, chantsend); + if (modesend != std::string::npos) + { + auto pos = modesend; + while (pos != std::string::npos) + { + auto next = NextToken(line, pos); + auto slash = line.find('/', pos); + if (slash != std::string::npos) + line.erase(slash, next - slash); + pos = next; + } + } + } + else if (irc::equals(command, "IJOIN")) + { + // :<uuid> IJOIN <chan> <membid> <joints> [<chants> <modes>] + // ^^^^^^^^ New in 1207 + const auto chanend = NextToken(line, cmdend); + const auto membidend = NextToken(line, chanend); + const auto jointsend = NextToken(line, membidend); + if (jointsend != std::string::npos) + line.erase(membidend, jointsend - membidend); + } } -#endif WriteLineInternal(line); } bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, CommandBase::Params& params) { - if (irc::equals(cmd, "FHOST") || irc::equals(cmd, "FIDENT")) + if (irc::equals(cmd, "IJOIN")) { - if (params.size() < 2) - params.push_back("*"); - } - else if (irc::equals(cmd, "SVSJOIN") || irc::equals(cmd, "SVSNICK") || irc::equals(cmd, "SVSPART")) - { - if (params.empty()) - return false; // Malformed. - - auto* target = ServerInstance->Users.FindUUID(params[0]); - if (!target) - return false; // User gone. - - params.insert(params.begin(), { target->uuid.substr(0, 3), cmd }); - cmd = "ENCAP"; - } - else if (irc::equals(cmd, "UID")) - { - if (params.size() < 6) + if (params.size() < 3) return false; // Malformed. - // :<sid> UID <uuid> <nickchanged> <nick> <host> <dhost> <user> <duser> <ip.string> <signon> <modes> [<modepara>] :<real> - // ^^^^^^ New in 1206 - params.insert(params.begin() + 5, params[5]); + // :<uuid> IJOIN <chan> <membid> <joints> [<chants> <modes>] + // ^^^^^^^^ New in 1207 + params.insert(params.begin() + 2, "0"); } return true; } |
