From e56f7136a93b926a82af5ce0d70506ae4f499b22 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 10 Mar 2024 14:00:52 +0100 Subject: [PATCH] fix: truncate outgoing IRC messages to ensure we don't send more than 512 bytes (#5246) --- CHANGELOG.md | 1 + src/providers/irc/AbstractIrcServer.hpp | 2 +- src/providers/irc/IrcServer.cpp | 5 +++++ src/providers/irc/IrcServer.hpp | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4ea7dbe..7183dd470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,6 +91,7 @@ - Bugfix: Fixed a crash that could occur when using certain features in a Reply popup after closing the split from which it was created. (#5036, #5051) - Bugfix: Fixed a bug on Wayland where tooltips would spawn as separate windows instead of behaving like tooltips. (#4998, #5040) - Bugfix: Fixes to section deletion in text input fields. (#5013) +- Bugfix: Truncated IRC messages to be at most 512 bytes. (#5246) - Bugfix: Show user text input within watch streak notices. (#5029) - Bugfix: Fixed avatar in usercard and moderation button triggering when releasing the mouse outside their area. (#5052) - Bugfix: Fixed moderator-only topics being subscribed to for non-moderators. (#5056) diff --git a/src/providers/irc/AbstractIrcServer.hpp b/src/providers/irc/AbstractIrcServer.hpp index cb8b17735..7a0e1ee63 100644 --- a/src/providers/irc/AbstractIrcServer.hpp +++ b/src/providers/irc/AbstractIrcServer.hpp @@ -37,7 +37,7 @@ public: void disconnect(); void sendMessage(const QString &channelName, const QString &message); - void sendRawMessage(const QString &rawMessage); + virtual void sendRawMessage(const QString &rawMessage); // channels ChannelPtr getOrAddChannel(const QString &dirtyChannelName); diff --git a/src/providers/irc/IrcServer.cpp b/src/providers/irc/IrcServer.cpp index 0ae9849f5..8d54d79f7 100644 --- a/src/providers/irc/IrcServer.cpp +++ b/src/providers/irc/IrcServer.cpp @@ -371,6 +371,11 @@ void IrcServer::sendWhisper(const QString &target, const QString &message) } } +void IrcServer::sendRawMessage(const QString &rawMessage) +{ + AbstractIrcServer::sendRawMessage(rawMessage.left(510)); +} + bool IrcServer::hasEcho() const { return this->hasEcho_; diff --git a/src/providers/irc/IrcServer.hpp b/src/providers/irc/IrcServer.hpp index a36049390..199a9340a 100644 --- a/src/providers/irc/IrcServer.hpp +++ b/src/providers/irc/IrcServer.hpp @@ -25,6 +25,8 @@ public: */ void sendWhisper(const QString &target, const QString &message); + void sendRawMessage(const QString &rawMessage) override; + // AbstractIrcServer interface protected: void initializeConnectionSignals(IrcConnection *connection,