From ab2ea4780357b08c5725ac456fd1c8fc8e394ba2 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 17 Jun 2026 14:58:35 +0100 Subject: Add a getter for the numeric to ClientProtocol::Messages::Numeric. --- include/clientprotocolmsg.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'include/clientprotocolmsg.h') 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. -- cgit v1.3.1-10-gc9f91