mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
76 lines
2 KiB
C++
76 lines
2 KiB
C++
#pragma once
|
|
|
|
#include "messages/MessageBuilder.hpp"
|
|
#include "messages/MessageParseArgs.hpp"
|
|
#include "singletons/EmoteManager.hpp"
|
|
|
|
#include <IrcMessage>
|
|
|
|
#include <QString>
|
|
#include <QVariant>
|
|
|
|
namespace chatterino {
|
|
class Channel;
|
|
|
|
namespace providers {
|
|
namespace twitch {
|
|
class TwitchChannel;
|
|
|
|
class TwitchMessageBuilder : public messages::MessageBuilder
|
|
{
|
|
public:
|
|
enum UsernameDisplayMode : int {
|
|
Username = 1, // Username
|
|
LocalizedName = 2, // Localized name
|
|
UsernameAndLocalizedName = 3, // Username (Localized name)
|
|
};
|
|
|
|
TwitchMessageBuilder() = delete;
|
|
|
|
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage,
|
|
const messages::MessageParseArgs &_args);
|
|
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage,
|
|
const messages::MessageParseArgs &_args, QString content,
|
|
bool isAction);
|
|
|
|
Channel *channel;
|
|
TwitchChannel *twitchChannel;
|
|
const Communi::IrcMessage *ircMessage;
|
|
messages::MessageParseArgs args;
|
|
const QVariantMap tags;
|
|
|
|
QString messageID;
|
|
QString userName;
|
|
|
|
bool isIgnored() const;
|
|
messages::MessagePtr build();
|
|
|
|
private:
|
|
QString roomID;
|
|
|
|
QColor usernameColor;
|
|
const QString originalMessage;
|
|
bool senderIsBroadcaster{};
|
|
|
|
const bool action = false;
|
|
|
|
void parseMessageID();
|
|
void parseRoomID();
|
|
void appendChannelName();
|
|
void parseUsername();
|
|
void appendUsername();
|
|
void parseHighlights();
|
|
|
|
void appendTwitchEmote(const Communi::IrcMessage *ircMessage, const QString &emote,
|
|
std::vector<std::pair<long, util::EmoteData>> &vec);
|
|
bool tryAppendEmote(QString &emoteString);
|
|
|
|
void appendTwitchBadges();
|
|
void appendChatterinoBadges();
|
|
bool tryParseCheermote(const QString &string);
|
|
};
|
|
|
|
} // namespace twitch
|
|
} // namespace providers
|
|
} // namespace chatterino
|