This commit is contained in:
Nerixyz 2024-11-01 18:18:15 +01:00
parent e537fca186
commit d91719b31e
No known key found for this signature in database
GPG key ID: 946BA188C5609CCC
5 changed files with 13 additions and 9 deletions

View file

@ -98,6 +98,7 @@ public:
/// Removes all messages from this channel and invokes #messagesCleared /// Removes all messages from this channel and invokes #messagesCleared
void clearMessages(); void clearMessages();
[[deprecated("Use findMessageByID instead")]]
MessagePtr findMessage(QString messageID); MessagePtr findMessage(QString messageID);
MessagePtr findMessageByID(QStringView messageID) final; MessagePtr findMessageByID(QStringView messageID) final;

View file

@ -5,6 +5,7 @@
#include "messages/MessageFlag.hpp" #include "messages/MessageFlag.hpp"
#include <memory> #include <memory>
#include <optional>
class QStringView; class QStringView;
class QTime; class QTime;

View file

@ -369,8 +369,8 @@ void IrcMessageHandler::parsePrivMessageInto(
} }
addMessage(message, sink, channel, addMessage(message, sink, channel,
unescapeZeroWidthJoiner(message->content()), false, unescapeZeroWidthJoiner(message->content()),
message->isAction()); *getApp()->getTwitch(), false, message->isAction());
if (message->tags().contains(u"pinned-chat-paid-amount"_s)) 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 // Messages are not required, so they might be empty
if (!content.isEmpty()) 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, void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
MessageSink &sink, TwitchChannel *channel, MessageSink &sink, TwitchChannel *channel,
const QString &originalContent, bool isSub, const QString &originalContent,
ITwitchIrcServer &twitch, bool isSub,
bool isAction) bool isAction)
{ {
assert(channel); assert(channel);
@ -1101,8 +1103,8 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
if (highlighted && showInMentions && if (highlighted && showInMentions &&
sink.sinkTraits().has(MessageSinkTrait::AddMentionsToGlobalChannel)) sink.sinkTraits().has(MessageSinkTrait::AddMentionsToGlobalChannel))
{ {
getApp()->getTwitch()->getMentionsChannel()->addMessage( twitch.getMentionsChannel()->addMessage(msg,
msg, MessageContext::Original); MessageContext::Original);
} }
sink.addMessage(msg, MessageContext::Original); sink.addMessage(msg, MessageContext::Original);

View file

@ -61,8 +61,8 @@ public:
static void addMessage(Communi::IrcMessage *message, MessageSink &sink, static void addMessage(Communi::IrcMessage *message, MessageSink &sink,
TwitchChannel *channel, TwitchChannel *channel,
const QString &originalContent, bool isSub, const QString &originalContent,
bool isAction); ITwitchIrcServer &twitch, bool isSub, bool isAction);
private: private:
static float similarity(const MessagePtr &msg, static float similarity(const MessagePtr &msg,

View file

@ -453,7 +453,7 @@ void TwitchChannel::addChannelPointReward(const ChannelPointReward &reward)
{ {
IrcMessageHandler::instance().addMessage( IrcMessageHandler::instance().addMessage(
msg.message.get(), *this, this, msg.originalContent, msg.message.get(), *this, this, msg.originalContent,
false, false); *server, false, false);
return true; return true;
} }
return false; return false;