diff options
| author | 2026-03-11 21:54:40 +0000 | |
|---|---|---|
| committer | 2026-03-12 00:18:06 +0000 | |
| commit | fcb3090055429a108b9837dbd4ba505d9c291129 (patch) | |
| tree | 5c55fd77d3b24adeda54e250d91b2a44badc9c5d /modules/spanningtree/treeserver.cpp | |
| parent | Mark all acting extbans as MATCH_REQUIRE_CHANNEL. (diff) | |
Rework sending server protocol messages.
- Replace CmdBuilder with MessageBuilder. This has a less footgun
API. All message building has to go through this now so we can
implement other message formats in the future.
- Replace the message parsing in WriteLine with an analogue to
PreProcessOldProtocolMessage. This should be much faster.
- Move parameter translation from the core to spanningtree.
- Change EncodeParameter to return the value instead of updating
in place.
- Replace the OnBuild*Message events with one OnServerMessage that
can now access all parts of the message and change them.
Diffstat (limited to 'modules/spanningtree/treeserver.cpp')
| -rw-r--r-- | modules/spanningtree/treeserver.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/spanningtree/treeserver.cpp b/modules/spanningtree/treeserver.cpp index e2624081d..78a712f6a 100644 --- a/modules/spanningtree/treeserver.cpp +++ b/modules/spanningtree/treeserver.cpp @@ -172,7 +172,9 @@ void TreeServer::SQuitChild(TreeServer* server, const std::string& reason, bool { // Server split from us, generate a SQUIT message and broadcast it ServerInstance->SNO.WriteGlobalSno('l', "Server \002" + server->GetName() + "\002 split: " + reason); - CmdBuilder("SQUIT").push(server->GetId()).push_last(reason).Broadcast(); + MessageBuilder("SQUIT") + .Push(server->GetId(), reason) + .Broadcast(); } else { @@ -296,8 +298,8 @@ void TreeServer::RemoveHash() void TreeServer::SendMetadata(const std::string& key, const std::string& data) const { - if (GetRoute() && GetRoute()->GetSocket()) - GetRoute()->GetSocket()->WriteLine(CommandMetadata::Builder(key, data)); + if (GetRoute()) + CommandMetadata::Builder(key, data).Unicast(GetRoute()); } void TreeServer::SendMetadata(const Extensible* ext, const std::string& key, const std::string& data) const @@ -305,6 +307,6 @@ void TreeServer::SendMetadata(const Extensible* ext, const std::string& key, con if (ext->extype == ExtensionType::USER && !static_cast<const User*>(ext)->IsFullyConnected()) return; - if (GetRoute() && GetRoute()->GetSocket()) - GetRoute()->GetSocket()->WriteLine(CommandMetadata::Builder(ext, key, data)); + if (GetRoute()) + CommandMetadata::Builder(ext, key, data).Unicast(GetRoute()); } |
