Compare commits

..

5 commits

Author SHA1 Message Date
James Upjohn d2dc8db0c2
Merge a92b5ee5c9 into 85d34c8ff0 2024-10-19 07:59:27 +00:00
James Upjohn a92b5ee5c9
doc: remove TODO comment that I won't do 2024-10-19 20:59:19 +13:00
James Upjohn 61f77a1beb
ref: replace more QMap.find() rituals with .value("") 2024-10-19 20:44:44 +13:00
James Upjohn c6204743a6
ref: replace fluff to get username QColor with QVariant.value<QColor> 2024-10-19 20:40:00 +13:00
James Upjohn afe3487bd9
ref: inline lambda function into 2 call sites 2024-10-19 20:29:24 +13:00

View file

@ -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;