From 049329e1765b679ed99776364c878e95ad8ef429 Mon Sep 17 00:00:00 2001 From: fourtf Date: Thu, 7 Jun 2018 15:49:24 +0200 Subject: [PATCH] fixed /me action messages --- src/providers/twitch/ircmessagehandler.cpp | 14 ++++++++------ src/providers/twitch/ircmessagehandler.hpp | 2 +- src/providers/twitch/twitchmessagebuilder.cpp | 6 ++++-- src/providers/twitch/twitchmessagebuilder.hpp | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/providers/twitch/ircmessagehandler.cpp b/src/providers/twitch/ircmessagehandler.cpp index 09753caca..def8a9e8e 100644 --- a/src/providers/twitch/ircmessagehandler.cpp +++ b/src/providers/twitch/ircmessagehandler.cpp @@ -30,11 +30,13 @@ IrcMessageHandler &IrcMessageHandler::getInstance() void IrcMessageHandler::handlePrivMessage(Communi::IrcPrivateMessage *message, TwitchServer &server) { - this->addMessage(message, message->target(), message->content(), server, false); + this->addMessage(message, message->target(), message->content(), server, false, + message->isAction()); } -void IrcMessageHandler::addMessage(Communi::IrcMessage *message, const QString &target, - const QString &content, TwitchServer &server, bool isSub) +void IrcMessageHandler::addMessage(Communi::IrcMessage *_message, const QString &target, + const QString &content, TwitchServer &server, bool isSub, + bool isAction) { QString channelName; if (!trimChannelName(target, channelName)) { @@ -52,7 +54,7 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message, const QString & args.trimSubscriberUsername = true; } - TwitchMessageBuilder builder(chan.get(), message, content, args); + TwitchMessageBuilder builder(chan.get(), _message, args, content, isAction); if (isSub || !builder.isIgnored()) { messages::MessagePtr msg = builder.build(); @@ -203,7 +205,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) auto c = app->twitch.server->whispersChannel.get(); - twitch::TwitchMessageBuilder builder(c, message, message->parameter(1), args); + twitch::TwitchMessageBuilder builder(c, message, args, message->parameter(1), false); if (!builder.isIgnored()) { messages::MessagePtr _message = builder.build(); @@ -242,7 +244,7 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message, Tw if (msgType == "sub" || msgType == "resub" || msgType == "subgift") { // Sub-specific message. I think it's only allowed for "resub" messages atm if (!content.isEmpty()) { - this->addMessage(message, target, content, server, true); + this->addMessage(message, target, content, server, true, false); } } diff --git a/src/providers/twitch/ircmessagehandler.hpp b/src/providers/twitch/ircmessagehandler.hpp index dca4c16b8..274c677bd 100644 --- a/src/providers/twitch/ircmessagehandler.hpp +++ b/src/providers/twitch/ircmessagehandler.hpp @@ -31,7 +31,7 @@ public: private: void addMessage(Communi::IrcMessage *message, const QString &target, const QString &content, - TwitchServer &server, bool isResub); + TwitchServer &server, bool isResub, bool isAction); }; } // namespace twitch diff --git a/src/providers/twitch/twitchmessagebuilder.cpp b/src/providers/twitch/twitchmessagebuilder.cpp index 3ffa2dd84..10563ccb7 100644 --- a/src/providers/twitch/twitchmessagebuilder.cpp +++ b/src/providers/twitch/twitchmessagebuilder.cpp @@ -39,14 +39,16 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, } TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, - const Communi::IrcMessage *_ircMessage, QString content, - const messages::MessageParseArgs &_args) + const Communi::IrcMessage *_ircMessage, + const messages::MessageParseArgs &_args, QString content, + bool isAction) : channel(_channel) , twitchChannel(dynamic_cast(_channel)) , ircMessage(_ircMessage) , args(_args) , tags(this->ircMessage->tags()) , originalMessage(content) + , action(isAction) { auto app = getApp(); this->usernameColor = app->themes->messages.textColors.system; diff --git a/src/providers/twitch/twitchmessagebuilder.hpp b/src/providers/twitch/twitchmessagebuilder.hpp index 9441f45fe..a14a6028c 100644 --- a/src/providers/twitch/twitchmessagebuilder.hpp +++ b/src/providers/twitch/twitchmessagebuilder.hpp @@ -30,7 +30,8 @@ public: explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage, const messages::MessageParseArgs &_args); explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage, - QString content, const messages::MessageParseArgs &_args); + const messages::MessageParseArgs &_args, QString content, + bool isAction); Channel *channel; TwitchChannel *twitchChannel;