From fd25fe3c4fd24faa6270c8805462cb2d50d8834a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 27 Feb 2024 14:37:40 +0000 Subject: Send the real username as the second parameter to FIDENT. --- src/modules/m_spanningtree/compat.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/modules/m_spanningtree/compat.cpp') diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index d193d5e5a..35aa8e6b6 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -71,6 +71,20 @@ void TreeSocket::WriteLine(const std::string& original_line) // FRHOST was introduced in PROTO_INSPIRCD_4; drop it. return; } + else if (irc::equals(command, "FIDENT")) + { + // FIDENT has two parameters in v4; drop the real username. + // : FIDENT + size_t displayend = NextToken(line, cmdend); + if (displayend != std::string::npos) + { + if ((displayend - cmdend) == 2 && line[displayend - 1] == '*') + return; // FIDENT is only changing the real username; drop. + + // Trim the rest of the line. + line.erase(displayend); + } + } else if (irc::equals(command, "METADATA")) { // : METADATA : @@ -112,7 +126,12 @@ void TreeSocket::WriteLine(const std::string& original_line) bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, CommandBase::Params& params) { - if (irc::equals(cmd, "SVSJOIN") || irc::equals(cmd, "SVSNICK") || irc::equals(cmd, "SVSPART")) + if (irc::equals(cmd, "FIDENT")) + { + 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. -- cgit v1.3.1-10-gc9f91