aboutsummaryrefslogtreecommitdiffstats
path: root/include/clientprotocolmsg.h
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-06-17 14:58:35 +0100
committerGravatar Sadie Powell2026-06-17 15:01:26 +0100
commitab2ea4780357b08c5725ac456fd1c8fc8e394ba2 (patch)
treebbbaa6c3eb3576f6fded71e90369cd3a406f23df /include/clientprotocolmsg.h
parentAdd a WriteNumeric overload that takes a vector of numerics. (diff)
Add a getter for the numeric to ClientProtocol::Messages::Numeric.
Diffstat (limited to 'include/clientprotocolmsg.h')
-rw-r--r--include/clientprotocolmsg.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/clientprotocolmsg.h b/include/clientprotocolmsg.h
index 0f04b5dc3..23172c9bb 100644
--- a/include/clientprotocolmsg.h
+++ b/include/clientprotocolmsg.h
@@ -48,19 +48,22 @@ namespace ClientProtocol
class CoreExport ClientProtocol::Messages::Numeric
: public ClientProtocol::Message
{
+private:
+ unsigned int numeric;
char numericstr[4];
- void InitCommand(unsigned int number)
+ void InitCommand(unsigned int num)
{
- snprintf(numericstr, sizeof(numericstr), "%03u", number);
+ this->numeric = num;
+ snprintf(numericstr, sizeof(numericstr), "%03u", num);
SetCommand(numericstr);
}
- void InitFromNumeric(const ::Numeric::Numeric& numeric)
+ void InitFromNumeric(const ::Numeric::Numeric& num)
{
- AddTags(numeric.GetParams().GetTags());
- InitCommand(numeric.GetNumeric());
- for (const auto& param : numeric.GetParams())
+ AddTags(num.GetParams().GetTags());
+ InitCommand(num.GetNumeric());
+ for (const auto& param : num.GetParams())
PushParamRef(param);
}
@@ -99,6 +102,9 @@ public:
InitCommand(num);
PushParam("*");
}
+
+ /** Retrieves the underlying numeric for this message. */
+ auto GetNumeric() const { return this->numeric; }
};
/** JOIN message.