aboutsummaryrefslogtreecommitdiffstats
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2026-06-17 15:37:26 +0100
committerGravatar Sadie Powell2026-06-17 15:39:58 +0100
commit33ab04fef638ab7fb6ec2eeea983b58c7e96c02f (patch)
tree6bd4da6a42df3deff3a7f955f56fa22c88f6a6f4 /src/users.cpp
parentMerge branch 'insp4' into master. (diff)
parentAllow an event hook for after messages are sent to a client. (diff)
Merge branch 'insp4' into master.
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/users.cpp b/src/users.cpp
index a2bbd7d1d..010601e31 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -641,6 +641,7 @@ void LocalUser::Send(ClientProtocol::Event& protoev, ClientProtocol::MessageList
this->bytes_out += bytessent;
this->cmds_out++;
}
+ protoev.PostSendMessagesToUser(this, msglist);
}
bool LocalUserIO::CheckMaxRecvQ() const
@@ -679,9 +680,7 @@ void User::WriteNumeric(const Numeric::Numeric& numeric)
return;
ModResult modres;
-
FIRST_MOD_RESULT(OnNumeric, modres, (this, numeric));
-
if (modres == MOD_RES_DENY)
return;
@@ -689,10 +688,35 @@ 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 = this->AsLocal();
+ 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);
+ insp::delete_all(messages);
+ }
+}
+
+
void User::WriteReply(const Reply::Reply& reply)
{
- auto* lthis = this->AsLocal();
- if (!this->IsLocal())
+ auto* const lthis = this->AsLocal();
+ if (!lthis)
return;
ClientProtocol::Messages::Reply replymsg(reply);
@@ -793,6 +817,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)
*