From fcb3090055429a108b9837dbd4ba505d9c291129 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 11 Mar 2026 21:54:40 +0000 Subject: 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. --- modules/spanningtree/ping.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'modules/spanningtree/ping.cpp') diff --git a/modules/spanningtree/ping.cpp b/modules/spanningtree/ping.cpp index 6b7f2d050..9597c1a09 100644 --- a/modules/spanningtree/ping.cpp +++ b/modules/spanningtree/ping.cpp @@ -32,13 +32,14 @@ CmdResult CommandPing::Handle(User* user, Params& params) if (params[0] == ServerInstance->Config->ServerId) { // PING for us, reply with a PONG - CmdBuilder reply("PONG"); - reply.push(user->uuid); + MessageBuilder msg("PONG"); + msg.Push(user->uuid); if (params.size() >= 2) + { // If there is a second parameter, append it - reply.push(params[1]); - - reply.Unicast(user); + msg.Push(params[1]); + } + msg.Unicast(user); } return CmdResult::SUCCESS; } -- cgit v1.3.1-10-gc9f91