fixed /me action messages

This commit is contained in:
fourtf 2018-06-07 15:49:24 +02:00
parent 578795fbc3
commit 049329e176
4 changed files with 15 additions and 10 deletions

View file

@ -30,11 +30,13 @@ IrcMessageHandler &IrcMessageHandler::getInstance()
void IrcMessageHandler::handlePrivMessage(Communi::IrcPrivateMessage *message, TwitchServer &server) 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, void IrcMessageHandler::addMessage(Communi::IrcMessage *_message, const QString &target,
const QString &content, TwitchServer &server, bool isSub) const QString &content, TwitchServer &server, bool isSub,
bool isAction)
{ {
QString channelName; QString channelName;
if (!trimChannelName(target, channelName)) { if (!trimChannelName(target, channelName)) {
@ -52,7 +54,7 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message, const QString &
args.trimSubscriberUsername = true; args.trimSubscriberUsername = true;
} }
TwitchMessageBuilder builder(chan.get(), message, content, args); TwitchMessageBuilder builder(chan.get(), _message, args, content, isAction);
if (isSub || !builder.isIgnored()) { if (isSub || !builder.isIgnored()) {
messages::MessagePtr msg = builder.build(); messages::MessagePtr msg = builder.build();
@ -203,7 +205,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
auto c = app->twitch.server->whispersChannel.get(); 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()) { if (!builder.isIgnored()) {
messages::MessagePtr _message = builder.build(); messages::MessagePtr _message = builder.build();
@ -242,7 +244,7 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message, Tw
if (msgType == "sub" || msgType == "resub" || msgType == "subgift") { if (msgType == "sub" || msgType == "resub" || msgType == "subgift") {
// Sub-specific message. I think it's only allowed for "resub" messages atm // Sub-specific message. I think it's only allowed for "resub" messages atm
if (!content.isEmpty()) { if (!content.isEmpty()) {
this->addMessage(message, target, content, server, true); this->addMessage(message, target, content, server, true, false);
} }
} }

View file

@ -31,7 +31,7 @@ public:
private: private:
void addMessage(Communi::IrcMessage *message, const QString &target, const QString &content, void addMessage(Communi::IrcMessage *message, const QString &target, const QString &content,
TwitchServer &server, bool isResub); TwitchServer &server, bool isResub, bool isAction);
}; };
} // namespace twitch } // namespace twitch

View file

@ -39,14 +39,16 @@ TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
} }
TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel, TwitchMessageBuilder::TwitchMessageBuilder(Channel *_channel,
const Communi::IrcMessage *_ircMessage, QString content, const Communi::IrcMessage *_ircMessage,
const messages::MessageParseArgs &_args) const messages::MessageParseArgs &_args, QString content,
bool isAction)
: channel(_channel) : channel(_channel)
, twitchChannel(dynamic_cast<TwitchChannel *>(_channel)) , twitchChannel(dynamic_cast<TwitchChannel *>(_channel))
, ircMessage(_ircMessage) , ircMessage(_ircMessage)
, args(_args) , args(_args)
, tags(this->ircMessage->tags()) , tags(this->ircMessage->tags())
, originalMessage(content) , originalMessage(content)
, action(isAction)
{ {
auto app = getApp(); auto app = getApp();
this->usernameColor = app->themes->messages.textColors.system; this->usernameColor = app->themes->messages.textColors.system;

View file

@ -30,7 +30,8 @@ public:
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage, explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage,
const messages::MessageParseArgs &_args); const messages::MessageParseArgs &_args);
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage, explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage,
QString content, const messages::MessageParseArgs &_args); const messages::MessageParseArgs &_args, QString content,
bool isAction);
Channel *channel; Channel *channel;
TwitchChannel *twitchChannel; TwitchChannel *twitchChannel;