diff options
| author | 2026-06-17 14:49:38 +0100 | |
|---|---|---|
| committer | 2026-06-17 15:01:26 +0100 | |
| commit | abcbe86dc597a7c3e3ea18dcb3339b8e8400257b (patch) | |
| tree | 860642444a756aba7017260f1742bbf178be1822 /src/users.cpp | |
| parent | Allow modules to send the ISupport list to clients. (diff) | |
Add a WriteNumeric overload that takes a vector of numerics.
Diffstat (limited to 'src/users.cpp')
| -rw-r--r-- | src/users.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
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<Numeric::Numeric>& 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<Numeric::Numeric>& 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) * |
