mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Compare commits
5 commits
2552d7f5b7
...
d2dc8db0c2
Author | SHA1 | Date | |
---|---|---|---|
d2dc8db0c2 | |||
a92b5ee5c9 | |||
61f77a1beb | |||
c6204743a6 | |||
afe3487bd9 |
|
@ -512,18 +512,6 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
|||
}
|
||||
}
|
||||
|
||||
auto buildAndEmplaceMessage = [&builtMessages,
|
||||
mirrored](MessageBuilder &builder) {
|
||||
builder->flags.set(MessageFlag::Subscription);
|
||||
if (mirrored)
|
||||
{
|
||||
builder->flags.set(MessageFlag::SharedMessage);
|
||||
}
|
||||
|
||||
auto newMessage = builder.release();
|
||||
builtMessages.emplace_back(newMessage);
|
||||
};
|
||||
|
||||
auto it = tags.find("system-msg");
|
||||
|
||||
if (it != tags.end())
|
||||
|
@ -545,24 +533,30 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
|||
}
|
||||
else if (msgType == "raid")
|
||||
{
|
||||
auto loginTag = tags.find("login");
|
||||
auto displayNameTag = tags.find("msg-param-displayName");
|
||||
if (loginTag != tags.end() && displayNameTag != tags.end())
|
||||
auto login = tags.value("login").toString();
|
||||
auto displayName = tags.value("msg-param-displayName").toString();
|
||||
|
||||
if (!login.isEmpty() && !displayName.isEmpty())
|
||||
{
|
||||
auto login = loginTag.value().toString();
|
||||
MessageColor color = MessageColor::System;
|
||||
if (auto colorTag = tags.find("color"); colorTag != tags.end())
|
||||
if (auto colorTag = tags.value("color").value<QColor>();
|
||||
colorTag.isValid())
|
||||
{
|
||||
// Blindly trust that it's a valid hex code
|
||||
color = MessageColor(QColor{colorTag.value().toString()});
|
||||
color = MessageColor(colorTag);
|
||||
}
|
||||
|
||||
auto displayName = displayNameTag.value().toString();
|
||||
auto b = MessageBuilder(
|
||||
raidEntryMessage, parseTagString(messageText), login,
|
||||
displayName, color, calculateMessageTime(message).time());
|
||||
|
||||
buildAndEmplaceMessage(b);
|
||||
b->flags.set(MessageFlag::Subscription);
|
||||
if (mirrored)
|
||||
{
|
||||
b->flags.set(MessageFlag::SharedMessage);
|
||||
}
|
||||
|
||||
auto newMessage = b.release();
|
||||
builtMessages.emplace_back(newMessage);
|
||||
return builtMessages;
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +629,14 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
|||
|
||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||
calculateMessageTime(message).time());
|
||||
buildAndEmplaceMessage(b);
|
||||
b->flags.set(MessageFlag::Subscription);
|
||||
if (mirrored)
|
||||
{
|
||||
b->flags.set(MessageFlag::SharedMessage);
|
||||
}
|
||||
|
||||
auto newMessage = b.release();
|
||||
builtMessages.emplace_back(newMessage);
|
||||
}
|
||||
|
||||
return builtMessages;
|
||||
|
|
Loading…
Reference in a new issue