Fix IRC colors not being applied correctly to NOTICE messages (#3383)
* Normalize NOTICE message parsing for IRC Fixes #1782 * Add changelog entry Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
- Bugfix: Fixed IRC ACTION messages (/me) not being colorized properly. (#3341)
|
- Bugfix: Fixed IRC ACTION messages (/me) not being colorized properly. (#3341)
|
||||||
- Bugfix: Fixed splits losing filters when closing and reopening them (#3351)
|
- Bugfix: Fixed splits losing filters when closing and reopening them (#3351)
|
||||||
- Bugfix: Fixed the first usercard being broken in `/mods` and `/vips` (#3349)
|
- Bugfix: Fixed the first usercard being broken in `/mods` and `/vips` (#3349)
|
||||||
|
- Bugfix: Fixed IRC colors not being applied correctly to NOTICE messages. (#3383)
|
||||||
- Bugfix: Fixed Chatterino attempting to send empty messages (#3355)
|
- Bugfix: Fixed Chatterino attempting to send empty messages (#3355)
|
||||||
- Bugfix: Fixed IRC highlights not triggering sounds or alerts properly. (#3368)
|
- Bugfix: Fixed IRC highlights not triggering sounds or alerts properly. (#3368)
|
||||||
- Bugfix: Fixed IRC /kick command crashing if parameters were malformed. (#3382)
|
- Bugfix: Fixed IRC /kick command crashing if parameters were malformed. (#3382)
|
||||||
|
|||||||
@@ -42,6 +42,13 @@ IrcMessageBuilder::IrcMessageBuilder(Channel *_channel,
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IrcMessageBuilder::IrcMessageBuilder(
|
||||||
|
const Communi::IrcNoticeMessage *_ircMessage, const MessageParseArgs &_args)
|
||||||
|
: SharedMessageBuilder(Channel::getEmpty().get(), _ircMessage, _args,
|
||||||
|
_ircMessage->content(), false)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
MessagePtr IrcMessageBuilder::build()
|
MessagePtr IrcMessageBuilder::build()
|
||||||
{
|
{
|
||||||
// PARSE
|
// PARSE
|
||||||
@@ -203,14 +210,30 @@ void IrcMessageBuilder::appendUsername()
|
|||||||
// The full string that will be rendered in the chat widget
|
// The full string that will be rendered in the chat widget
|
||||||
QString usernameText = username;
|
QString usernameText = username;
|
||||||
|
|
||||||
if (!this->action_)
|
if (this->args.isReceivedWhisper)
|
||||||
{
|
{
|
||||||
usernameText += ":";
|
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
|
||||||
}
|
this->usernameColor_,
|
||||||
|
FontStyle::ChatMediumBold)
|
||||||
|
->setLink({Link::UserWhisper, this->message().displayName});
|
||||||
|
|
||||||
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
|
// Separator
|
||||||
this->usernameColor_, FontStyle::ChatMediumBold)
|
this->emplace<TextElement>("->", MessageElementFlag::Username,
|
||||||
->setLink({Link::UserInfo, this->message().loginName});
|
MessageColor::System, FontStyle::ChatMedium);
|
||||||
|
|
||||||
|
this->emplace<TextElement>("you:", MessageElementFlag::Username);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!this->action_)
|
||||||
|
{
|
||||||
|
usernameText += ":";
|
||||||
|
}
|
||||||
|
this->emplace<TextElement>(usernameText, MessageElementFlag::Username,
|
||||||
|
this->usernameColor_,
|
||||||
|
FontStyle::ChatMediumBold)
|
||||||
|
->setLink({Link::UserInfo, this->message().loginName});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|||||||
@@ -30,6 +30,12 @@ public:
|
|||||||
const MessageParseArgs &_args, QString content,
|
const MessageParseArgs &_args, QString content,
|
||||||
bool isAction);
|
bool isAction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief used for global notice messages (i.e. notice messages without a channel as its target)
|
||||||
|
**/
|
||||||
|
explicit IrcMessageBuilder(const Communi::IrcNoticeMessage *_ircMessage,
|
||||||
|
const MessageParseArgs &_args);
|
||||||
|
|
||||||
MessagePtr build() override;
|
MessagePtr build() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -90,23 +90,20 @@ void IrcServer::initializeConnectionSignals(IrcConnection *connection,
|
|||||||
|
|
||||||
QObject::connect(connection, &Communi::IrcConnection::noticeMessageReceived,
|
QObject::connect(connection, &Communi::IrcConnection::noticeMessageReceived,
|
||||||
this, [this](Communi::IrcNoticeMessage *message) {
|
this, [this](Communi::IrcNoticeMessage *message) {
|
||||||
// XD PAJLADA
|
MessageParseArgs args;
|
||||||
MessageBuilder builder;
|
args.isReceivedWhisper = true;
|
||||||
|
|
||||||
builder.emplace<TimestampElement>(
|
IrcMessageBuilder builder(message, args);
|
||||||
calculateMessageTimestamp(message));
|
|
||||||
builder.emplace<TextElement>(
|
|
||||||
message->nick(), MessageElementFlag::Username);
|
|
||||||
builder.emplace<TextElement>(
|
|
||||||
"-> you:", MessageElementFlag::Username);
|
|
||||||
builder.emplace<TextElement>(message->content(),
|
|
||||||
MessageElementFlag::Text);
|
|
||||||
|
|
||||||
auto msg = builder.release();
|
auto msg = builder.build();
|
||||||
|
|
||||||
for (auto &&weak : this->channels)
|
for (auto &&weak : this->channels)
|
||||||
|
{
|
||||||
if (auto shared = weak.lock())
|
if (auto shared = weak.lock())
|
||||||
|
{
|
||||||
shared->addMessage(msg);
|
shared->addMessage(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user