From d91719b31e01ac752dabb9809a7f9e714ca56453 Mon Sep 17 00:00:00 2001 From: Nerixyz Date: Fri, 1 Nov 2024 18:18:15 +0100 Subject: [PATCH] review --- src/common/Channel.hpp | 1 + src/messages/MessageSink.hpp | 1 + src/providers/twitch/IrcMessageHandler.cpp | 14 ++++++++------ src/providers/twitch/IrcMessageHandler.hpp | 4 ++-- src/providers/twitch/TwitchChannel.cpp | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/common/Channel.hpp b/src/common/Channel.hpp index 86037e6c8..009e99897 100644 --- a/src/common/Channel.hpp +++ b/src/common/Channel.hpp @@ -98,6 +98,7 @@ public: /// Removes all messages from this channel and invokes #messagesCleared void clearMessages(); + [[deprecated("Use findMessageByID instead")]] MessagePtr findMessage(QString messageID); MessagePtr findMessageByID(QStringView messageID) final; diff --git a/src/messages/MessageSink.hpp b/src/messages/MessageSink.hpp index b44690ead..e720a1867 100644 --- a/src/messages/MessageSink.hpp +++ b/src/messages/MessageSink.hpp @@ -5,6 +5,7 @@ #include "messages/MessageFlag.hpp" #include +#include class QStringView; class QTime; diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 9a230bf9b..d38d534ac 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -369,8 +369,8 @@ void IrcMessageHandler::parsePrivMessageInto( } addMessage(message, sink, channel, - unescapeZeroWidthJoiner(message->content()), false, - message->isAction()); + unescapeZeroWidthJoiner(message->content()), + *getApp()->getTwitch(), false, message->isAction()); if (message->tags().contains(u"pinned-chat-paid-amount"_s)) { @@ -675,7 +675,8 @@ void IrcMessageHandler::parseUserNoticeMessageInto(Communi::IrcMessage *message, // Messages are not required, so they might be empty if (!content.isEmpty()) { - addMessage(message, sink, channel, content, true, false); + addMessage(message, sink, channel, content, *getApp()->getTwitch(), + true, false); } } @@ -956,7 +957,8 @@ void IrcMessageHandler::handlePartMessage(Communi::IrcMessage *message) void IrcMessageHandler::addMessage(Communi::IrcMessage *message, MessageSink &sink, TwitchChannel *channel, - const QString &originalContent, bool isSub, + const QString &originalContent, + ITwitchIrcServer &twitch, bool isSub, bool isAction) { assert(channel); @@ -1101,8 +1103,8 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message, if (highlighted && showInMentions && sink.sinkTraits().has(MessageSinkTrait::AddMentionsToGlobalChannel)) { - getApp()->getTwitch()->getMentionsChannel()->addMessage( - msg, MessageContext::Original); + twitch.getMentionsChannel()->addMessage(msg, + MessageContext::Original); } sink.addMessage(msg, MessageContext::Original); diff --git a/src/providers/twitch/IrcMessageHandler.hpp b/src/providers/twitch/IrcMessageHandler.hpp index 73d81e022..97a11285d 100644 --- a/src/providers/twitch/IrcMessageHandler.hpp +++ b/src/providers/twitch/IrcMessageHandler.hpp @@ -61,8 +61,8 @@ public: static void addMessage(Communi::IrcMessage *message, MessageSink &sink, TwitchChannel *channel, - const QString &originalContent, bool isSub, - bool isAction); + const QString &originalContent, + ITwitchIrcServer &twitch, bool isSub, bool isAction); private: static float similarity(const MessagePtr &msg, diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index 00bd8c117..7c7cc1304 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -453,7 +453,7 @@ void TwitchChannel::addChannelPointReward(const ChannelPointReward &reward) { IrcMessageHandler::instance().addMessage( msg.message.get(), *this, this, msg.originalContent, - false, false); + *server, false, false); return true; } return false;