From abcbe86dc597a7c3e3ea18dcb3339b8e8400257b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 17 Jun 2026 14:49:38 +0100 Subject: Add a WriteNumeric overload that takes a vector of numerics. --- src/users.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index dbbbc8c13..b366ed951 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -773,9 +773,7 @@ void User::WriteNumeric(const Numeric::Numeric& numeric) return; ModResult modres; - FIRST_MOD_RESULT(OnNumeric, modres, (this, numeric)); - if (modres == MOD_RES_DENY) return; @@ -783,6 +781,31 @@ void User::WriteNumeric(const Numeric::Numeric& numeric) localuser->Send(ServerInstance->GetRFCEvents().numeric, numericmsg); } +void User::WriteNumeric(const std::vector& numerics) +{ + auto* const lthis = IS_LOCAL(this); + if (!lthis) + return; + + ClientProtocol::MessageList messages; + for (const auto& numeric : numerics) + { + ModResult modres; + FIRST_MOD_RESULT(OnNumeric, modres, (this, numeric)); + if (modres != MOD_RES_DENY) + messages.push_back(new ClientProtocol::Messages::Numeric(numeric, this)); + } + + if (!messages.empty()) + { + ClientProtocol::Event numericev(ServerInstance->GetRFCEvents().numeric); + numericev.SetMessageList(messages); + lthis->Send(numericev); + stdalgo::delete_all(messages); + } +} + + void User::WriteRemoteNotice(const std::string& text) { ServerInstance->PI->SendMessage(this, text, MessageType::NOTICE); @@ -877,6 +900,11 @@ void User::WriteRemoteNumeric(const Numeric::Numeric& numeric) WriteNumeric(numeric); } +void User::WriteRemoteNumeric(const std::vector& numerics) +{ + WriteNumeric(numerics); +} + /* return 0 or 1 depending if users u and u2 share one or more common channels * (used by QUIT, NICK etc which arent channel specific notices) * -- cgit v1.3.1-10-gc9f91