mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Compare commits
7 commits
2552d7f5b7
...
6c7fd02b5f
Author | SHA1 | Date | |
---|---|---|---|
6c7fd02b5f | |||
2f631356b2 | |||
f22f323bc0 | |||
8ff61c4860 | |||
fc12a3c630 | |||
8bfcd99be9 | |||
2cc492a26f |
|
@ -36,6 +36,7 @@
|
||||||
- Minor: Added `--login <username>` CLI argument to specify which account to start logged in as. (#5626)
|
- Minor: Added `--login <username>` CLI argument to specify which account to start logged in as. (#5626)
|
||||||
- Minor: Indicate when subscriptions and resubscriptions are for multiple months. (#5642)
|
- Minor: Indicate when subscriptions and resubscriptions are for multiple months. (#5642)
|
||||||
- Minor: Proxy URL information is now included in the `/debug-env` command. (#5648)
|
- Minor: Proxy URL information is now included in the `/debug-env` command. (#5648)
|
||||||
|
- Minor: Make raid entry message usernames clickable. (#5651)
|
||||||
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
- Bugfix: Fixed tab move animation occasionally failing to start after closing a tab. (#5426, #5612)
|
||||||
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
- Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378)
|
||||||
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
- Bugfix: Fixed restricted users usernames not being clickable. (#5405)
|
||||||
|
|
|
@ -461,6 +461,35 @@ MessageBuilder::MessageBuilder(SystemMessageTag, const QString &text,
|
||||||
this->message().searchText = text;
|
this->message().searchText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageBuilder::MessageBuilder(RaidEntryMessageTag, const QString &text,
|
||||||
|
const QString &loginName,
|
||||||
|
const QString &displayName,
|
||||||
|
const MessageColor &userColor, const QTime &time)
|
||||||
|
: MessageBuilder()
|
||||||
|
{
|
||||||
|
this->emplace<TimestampElement>(time);
|
||||||
|
|
||||||
|
const QStringList textFragments =
|
||||||
|
text.split(QRegularExpression("\\s"), Qt::SkipEmptyParts);
|
||||||
|
for (const auto &word : textFragments)
|
||||||
|
{
|
||||||
|
if (word == displayName)
|
||||||
|
{
|
||||||
|
this->emplace<MentionElement>(displayName, loginName,
|
||||||
|
MessageColor::System, userColor);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->emplace<TextElement>(word, MessageElementFlag::Text,
|
||||||
|
MessageColor::System);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->message().flags.set(MessageFlag::System);
|
||||||
|
this->message().flags.set(MessageFlag::DoNotTriggerNotification);
|
||||||
|
this->message().messageText = text;
|
||||||
|
this->message().searchText = text;
|
||||||
|
}
|
||||||
|
|
||||||
MessageBuilder::MessageBuilder(TimeoutMessageTag, const QString &timeoutUser,
|
MessageBuilder::MessageBuilder(TimeoutMessageTag, const QString &timeoutUser,
|
||||||
const QString &sourceUser,
|
const QString &sourceUser,
|
||||||
const QString &systemMessageText, int times,
|
const QString &systemMessageText, int times,
|
||||||
|
|
|
@ -53,6 +53,8 @@ namespace linkparser {
|
||||||
|
|
||||||
struct SystemMessageTag {
|
struct SystemMessageTag {
|
||||||
};
|
};
|
||||||
|
struct RaidEntryMessageTag {
|
||||||
|
};
|
||||||
struct TimeoutMessageTag {
|
struct TimeoutMessageTag {
|
||||||
};
|
};
|
||||||
struct LiveUpdatesUpdateEmoteMessageTag {
|
struct LiveUpdatesUpdateEmoteMessageTag {
|
||||||
|
@ -67,6 +69,7 @@ struct ImageUploaderResultTag {
|
||||||
};
|
};
|
||||||
|
|
||||||
const SystemMessageTag systemMessage{};
|
const SystemMessageTag systemMessage{};
|
||||||
|
const RaidEntryMessageTag raidEntryMessage{};
|
||||||
const TimeoutMessageTag timeoutMessage{};
|
const TimeoutMessageTag timeoutMessage{};
|
||||||
const LiveUpdatesUpdateEmoteMessageTag liveUpdatesUpdateEmoteMessage{};
|
const LiveUpdatesUpdateEmoteMessageTag liveUpdatesUpdateEmoteMessage{};
|
||||||
const LiveUpdatesRemoveEmoteMessageTag liveUpdatesRemoveEmoteMessage{};
|
const LiveUpdatesRemoveEmoteMessageTag liveUpdatesRemoveEmoteMessage{};
|
||||||
|
@ -109,6 +112,9 @@ public:
|
||||||
|
|
||||||
MessageBuilder(SystemMessageTag, const QString &text,
|
MessageBuilder(SystemMessageTag, const QString &text,
|
||||||
const QTime &time = QTime::currentTime());
|
const QTime &time = QTime::currentTime());
|
||||||
|
MessageBuilder(RaidEntryMessageTag, const QString &text,
|
||||||
|
const QString &loginName, const QString &displayName,
|
||||||
|
const MessageColor &userColor, const QTime &time);
|
||||||
MessageBuilder(TimeoutMessageTag, const QString &timeoutUser,
|
MessageBuilder(TimeoutMessageTag, const QString &timeoutUser,
|
||||||
const QString &sourceUser, const QString &systemMessageText,
|
const QString &sourceUser, const QString &systemMessageText,
|
||||||
int times, const QTime &time = QTime::currentTime());
|
int times, const QTime &time = QTime::currentTime());
|
||||||
|
|
|
@ -512,6 +512,18 @@ 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");
|
auto it = tags.find("system-msg");
|
||||||
|
|
||||||
if (it != tags.end())
|
if (it != tags.end())
|
||||||
|
@ -531,6 +543,29 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
||||||
{
|
{
|
||||||
messageText = "Announcement";
|
messageText = "Announcement";
|
||||||
}
|
}
|
||||||
|
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 = loginTag.value().toString();
|
||||||
|
MessageColor color = MessageColor::System;
|
||||||
|
if (auto colorTag = tags.find("color"); colorTag != tags.end())
|
||||||
|
{
|
||||||
|
// Blindly trust that it's a valid hex code
|
||||||
|
color = MessageColor(QColor{colorTag.value().toString()});
|
||||||
|
}
|
||||||
|
|
||||||
|
auto displayName = displayNameTag.value().toString();
|
||||||
|
auto b = MessageBuilder(
|
||||||
|
raidEntryMessage, parseTagString(messageText), login,
|
||||||
|
displayName, color, calculateMessageTime(message).time());
|
||||||
|
|
||||||
|
buildAndEmplaceMessage(b);
|
||||||
|
return builtMessages;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (msgType == "subgift")
|
else if (msgType == "subgift")
|
||||||
{
|
{
|
||||||
if (auto monthsIt = tags.find("msg-param-gift-months");
|
if (auto monthsIt = tags.find("msg-param-gift-months");
|
||||||
|
@ -600,14 +635,7 @@ std::vector<MessagePtr> parseUserNoticeMessage(Channel *channel,
|
||||||
|
|
||||||
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
auto b = MessageBuilder(systemMessage, parseTagString(messageText),
|
||||||
calculateMessageTime(message).time());
|
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;
|
return builtMessages;
|
||||||
|
|
Loading…
Reference in a new issue