From 2fc2872d8b0459d6bbe9c32f368bb92d3c86269b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 28 Oct 2025 14:44:43 +0000 Subject: Move message serialization into core_clients. --- src/users.cpp | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index a57704879..9f65e945d 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -590,28 +590,6 @@ void LocalUser::ChangeConnectClass(const std::shared_ptr& klass, b FOREACH_MOD(OnPostChangeConnectClass, (this, force)); } -void LocalUser::Write(const ClientProtocol::SerializedMessage& text) -{ - if (text.empty()) - return; - - if (ServerInstance->Config->RawLog) - { - std::string::size_type nlpos = text.find_first_of("\r\n", 0, 2); - if (nlpos == std::string::npos) - nlpos = text.length(); - - ServerInstance->Logs.RawIO("USEROUTPUT", "C[{}] O {}", uuid, std::string_view(text.c_str(), nlpos)); - } - - this->io->Write(text); - - const size_t bytessent = text.length() + 2; - ServerInstance->Stats.Sent += bytessent; - this->bytes_out += bytessent; - this->cmds_out++; -} - void LocalUser::Send(ClientProtocol::Event& protoev) { if (!serializer) @@ -646,8 +624,13 @@ void LocalUser::Send(ClientProtocol::Event& protoev, ClientProtocol::MessageList ClientProtocol::Message& curr = *msg; ModResult res; FIRST_MOD_RESULT(OnUserWrite, res, (this, curr)); - if (res != MOD_RES_DENY) - Write(serializer->SerializeForUser(this, curr)); + if (res == MOD_RES_DENY) + continue; + + const auto bytessent = this->io->Write(curr); + ServerInstance->Stats.Sent += bytessent; + this->bytes_out += bytessent; + this->cmds_out++; } } -- cgit v1.3.1-10-gc9f91