diff options
| author | 2024-08-24 16:26:58 +0100 | |
|---|---|---|
| committer | 2024-08-24 16:26:58 +0100 | |
| commit | cf01291da809290781aa2c5ae657bf86d87ac5e7 (patch) | |
| tree | 809b5e3326b4c31b458180729d504046779abd47 /src/modules/m_spanningtree/compat.cpp | |
| parent | Close loggers and notify opers if they throw any exceptions. (diff) | |
Fix broadcasting server information to remote v3 servers.
Diffstat (limited to 'src/modules/m_spanningtree/compat.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/compat.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp index 145d3667e..679159352 100644 --- a/src/modules/m_spanningtree/compat.cpp +++ b/src/modules/m_spanningtree/compat.cpp @@ -51,8 +51,10 @@ 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++; @@ -109,6 +111,37 @@ void TreeSocket::WriteLine(const std::string& original_line) } } } + else if (irc::equals(command, "SINFO")) + { + // :<sid> SINFO <key> :<value> + auto keyend = NextToken(line, cmdend); + if (keyend != std::string::npos && sidstart != std::string::npos) + { + auto skey = line.substr(cmdend + 1, keyend - cmdend - 1); + if (irc::equals(skey, "customversion")) + return; + else if (irc::equals(skey, "rawbranch")) + { + // InspIRCd-4. testnet.inspircd.org :Test + auto* sid = Utils->FindServerID(line.substr(sidstart, cmdstart - sidstart - 1)); + if (sid) + { + line.replace(cmdend + 1, keyend - cmdend - 1, "version"); + line.append(INSP_FORMAT(". {} :{}", sid->GetPublicName(), sid->GetDesc())); + } + } + else if (irc::equals(skey, "rawversion")) + { + // InspIRCd-4.0.0-a10. sadie.testnet.inspircd.org :[597] Test + auto* sid = Utils->FindServerID(line.substr(sidstart, cmdstart - sidstart - 1)); + if (sid) + { + line.replace(cmdend + 1, keyend - cmdend - 1, "fullversion"); + line.append(INSP_FORMAT(". {} :[{}] {}", sid->GetName(), sid->GetId(), sid->GetDesc())); + } + } + } + } else if (irc::equals(command, "SQUERY")) { // SQUERY was introduced in PROTO_INSPIRCD_4; convert to PRIVMSG. |
