aboutsummaryrefslogtreecommitdiffstats
path: root/modules/spanningtree/reply.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-03-11 21:54:40 +0000
committerGravatar Sadie Powell2026-03-12 00:18:06 +0000
commitfcb3090055429a108b9837dbd4ba505d9c291129 (patch)
tree5c55fd77d3b24adeda54e250d91b2a44badc9c5d /modules/spanningtree/reply.cpp
parentMark 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/reply.cpp')
-rw-r--r--modules/spanningtree/reply.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/modules/spanningtree/reply.cpp b/modules/spanningtree/reply.cpp
index 095dc0eeb..2290c5c3a 100644
--- a/modules/spanningtree/reply.cpp
+++ b/modules/spanningtree/reply.cpp
@@ -52,19 +52,11 @@ RouteDescriptor CommandReply::GetRouting(User* user, const Params& params)
}
CommandReply::Builder::Builder(SpanningTree::RemoteUser* target, const Reply::Reply& reply)
- : CmdBuilder(Reply::CommandStrFromType(reply.GetType()))
+ : MessageBuilder(Reply::CommandStrFromType(reply.GetType()))
{
- push(reply.GetSource() ? reply.GetSource()->GetId() : Utils->TreeRoot->GetId());
- push(target->uuid);
- push(reply.GetCommand() ? reply.GetCommand()->service_name : "*");
- push(reply.GetCode());
-
- const auto& params = reply.GetParams();
- if (!params.empty())
- {
- for (auto it = params.begin(); it != params.end() - 1; ++it)
- push(*it);
- push_last(params.back());
- }
- push_tags(params.GetTags());
+ Push(reply.GetSource() ? reply.GetSource()->GetId() : Utils->TreeRoot->GetId());
+ Push(target->uuid);
+ Push(reply.GetCommand() ? reply.GetCommand()->service_name : "*");
+ Push(reply.GetCode());
+ PushParams(reply.GetParams());
}