mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Handle ritual (new viewer announcement) messages (#2703)
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
115d198434
commit
b614ce1cd8
|
@ -10,6 +10,7 @@
|
||||||
- Bugfix: Added missing Copy/Open link context menu entries to emotes in Emote Picker. (#2670)
|
- Bugfix: Added missing Copy/Open link context menu entries to emotes in Emote Picker. (#2670)
|
||||||
- Bugfix: Fixed visual glitch with smooth scrolling. (#2084)
|
- Bugfix: Fixed visual glitch with smooth scrolling. (#2084)
|
||||||
- Bugfix: Clicking on split header focuses its split. (#2720)
|
- Bugfix: Clicking on split header focuses its split. (#2720)
|
||||||
|
- Bugfix: Handle new user messages ("rituals") properly. (#2703)
|
||||||
|
|
||||||
## 2.3.0
|
## 2.3.0
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,16 @@
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
using namespace chatterino;
|
using namespace chatterino;
|
||||||
|
|
||||||
|
// Message types below are the ones that might contain special user's message on USERNOTICE
|
||||||
|
static const QSet<QString> specialMessageTypes{
|
||||||
|
"sub", //
|
||||||
|
"subgift", //
|
||||||
|
"resub", // resub messages
|
||||||
|
"bitsbadgetier", // bits badge upgrade
|
||||||
|
"ritual", // new viewer ritual
|
||||||
|
};
|
||||||
|
|
||||||
MessagePtr generateBannedMessage(bool confirmedBan)
|
MessagePtr generateBannedMessage(bool confirmedBan)
|
||||||
{
|
{
|
||||||
const auto linkColor = MessageColor(MessageColor::Link);
|
const auto linkColor = MessageColor(MessageColor::Link);
|
||||||
|
@ -561,12 +571,9 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
|
||||||
{
|
{
|
||||||
std::vector<MessagePtr> builtMessages;
|
std::vector<MessagePtr> builtMessages;
|
||||||
|
|
||||||
auto data = message->toData();
|
|
||||||
|
|
||||||
auto tags = message->tags();
|
auto tags = message->tags();
|
||||||
auto parameters = message->parameters();
|
auto parameters = message->parameters();
|
||||||
|
|
||||||
auto target = parameters[0];
|
|
||||||
QString msgType = tags.value("msg-id", "").toString();
|
QString msgType = tags.value("msg-id", "").toString();
|
||||||
QString content;
|
QString content;
|
||||||
if (parameters.size() >= 2)
|
if (parameters.size() >= 2)
|
||||||
|
@ -574,11 +581,9 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
|
||||||
content = parameters[1];
|
content = parameters[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgType == "sub" || msgType == "resub" || msgType == "subgift" ||
|
if (specialMessageTypes.contains(msgType))
|
||||||
msgType == "bitsbadgetier")
|
|
||||||
{
|
{
|
||||||
// Sub-specific and bits badge upgrade specific message.
|
// Messages are not required, so they might be empty
|
||||||
// It's only allowed for "resub" messages.
|
|
||||||
if (!content.isEmpty())
|
if (!content.isEmpty())
|
||||||
{
|
{
|
||||||
MessageParseArgs args;
|
MessageParseArgs args;
|
||||||
|
@ -596,6 +601,7 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
|
||||||
|
|
||||||
if (it != tags.end())
|
if (it != tags.end())
|
||||||
{
|
{
|
||||||
|
// By default, we return value of system-msg tag
|
||||||
QString messageText = it.value().toString();
|
QString messageText = it.value().toString();
|
||||||
|
|
||||||
if (msgType == "bitsbadgetier")
|
if (msgType == "bitsbadgetier")
|
||||||
|
@ -620,8 +626,6 @@ std::vector<MessagePtr> IrcMessageHandler::parseUserNoticeMessage(
|
||||||
void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||||
TwitchIrcServer &server)
|
TwitchIrcServer &server)
|
||||||
{
|
{
|
||||||
auto data = message->toData();
|
|
||||||
|
|
||||||
auto tags = message->tags();
|
auto tags = message->tags();
|
||||||
auto parameters = message->parameters();
|
auto parameters = message->parameters();
|
||||||
|
|
||||||
|
@ -633,11 +637,9 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||||
content = parameters[1];
|
content = parameters[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgType == "sub" || msgType == "resub" || msgType == "subgift" ||
|
if (specialMessageTypes.contains(msgType))
|
||||||
msgType == "bitsbadgetier")
|
|
||||||
{
|
{
|
||||||
// Sub-specific and bits badge upgrade specific message.
|
// Messages are not required, so they might be empty
|
||||||
// It's only allowed for "resub" messages.
|
|
||||||
if (!content.isEmpty())
|
if (!content.isEmpty())
|
||||||
{
|
{
|
||||||
this->addMessage(message, target, content, server, true, false);
|
this->addMessage(message, target, content, server, true, false);
|
||||||
|
@ -648,6 +650,7 @@ void IrcMessageHandler::handleUserNoticeMessage(Communi::IrcMessage *message,
|
||||||
|
|
||||||
if (it != tags.end())
|
if (it != tags.end())
|
||||||
{
|
{
|
||||||
|
// By default, we return value of system-msg tag
|
||||||
QString messageText = it.value().toString();
|
QString messageText = it.value().toString();
|
||||||
|
|
||||||
if (msgType == "bitsbadgetier")
|
if (msgType == "bitsbadgetier")
|
||||||
|
|
Loading…
Reference in a new issue