aboutsummaryrefslogtreecommitdiff
path: root/modules/spanningtree/metadata.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/metadata.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/metadata.cpp')
-rw-r--r--modules/spanningtree/metadata.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/modules/spanningtree/metadata.cpp b/modules/spanningtree/metadata.cpp
index 1b0814344..080768a63 100644
--- a/modules/spanningtree/metadata.cpp
+++ b/modules/spanningtree/metadata.cpp
@@ -112,44 +112,44 @@ CmdResult CommandMetadata::Handle(User* srcuser, Params& params)
}
CommandMetadata::Builder::Builder(const Extensible* ext, const std::string& key, const std::string& val)
- : CmdBuilder("METADATA")
+ : MessageBuilder("METADATA")
{
switch (ext->extype)
{
case ExtensionType::CHANNEL:
{
const Channel* chan = static_cast<const Channel*>(ext);
- push(chan->name);
- push_int(chan->age);
+ Push(chan->name);
+ Push(chan->age);
break;
}
case ExtensionType::MEMBERSHIP:
{
const Membership* memb = static_cast<const Membership*>(ext);
- push_raw("@");
- push(memb->user->uuid);
- push_raw(memb->chan->name);
- push_int(memb->chan->age);
- push_int(memb->id);
+ Push("@");
+ Push(memb->user->uuid);
+ Push(memb->chan->name);
+ Push(memb->chan->age);
+ Push(memb->id);
break;
}
case ExtensionType::USER:
{
const User* user = static_cast<const User*>(ext);
- push(user->uuid);
+ Push(user->uuid);
break;
}
}
- push(key);
- push_last(val);
+ Push(key);
+ Push(val);
}
CommandMetadata::Builder::Builder(const std::string& key, const std::string& val)
- : CmdBuilder("METADATA")
+ : MessageBuilder("METADATA")
{
- push("*");
- push(key);
- push_last(val);
+ Push("*");
+ Push(key);
+ Push(val);
}