refactor(message-builder): move static helper methods to functions (#5652)

This commit is contained in:
nerix
2024-10-18 13:03:36 +02:00
committed by GitHub
parent 6d139af553
commit 800f6df2cf
12 changed files with 1090 additions and 928 deletions
+1 -27
View File
@@ -45,6 +45,7 @@ struct HelixVip;
using HelixModerator = HelixVip;
struct ChannelPointReward;
struct DeleteAction;
struct TwitchEmoteOccurrence;
namespace linkparser {
struct Parsed;
@@ -89,19 +90,6 @@ struct MessageParseArgs {
QString channelPointRewardId = "";
};
struct TwitchEmoteOccurrence {
int start;
int end;
EmotePtr ptr;
EmoteName name;
bool operator==(const TwitchEmoteOccurrence &other) const
{
return std::tie(this->start, this->end, this->ptr, this->name) ==
std::tie(other.start, other.end, other.ptr, other.name);
}
};
class MessageBuilder
{
public:
@@ -237,20 +225,6 @@ public:
static MessagePtr makeLowTrustUpdateMessage(
const PubSubLowTrustUsersMessage &action);
static std::unordered_map<QString, QString> parseBadgeInfoTag(
const QVariantMap &tags);
// Parses "badges" tag which contains a comma separated list of key-value elements
static std::vector<Badge> parseBadgeTag(const QVariantMap &tags);
static std::vector<TwitchEmoteOccurrence> parseTwitchEmotes(
const QVariantMap &tags, const QString &originalMessage,
int messageOffset);
static void processIgnorePhrases(
const std::vector<IgnorePhrase> &phrases, QString &originalMessage,
std::vector<TwitchEmoteOccurrence> &twitchEmotes);
protected:
void addTextOrEmoji(EmotePtr emote);
void addTextOrEmoji(const QString &string_);