2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-11 09:31:45 +02:00
|
|
|
#include "messages/messagebuilder.hpp"
|
2017-09-24 18:43:24 +02:00
|
|
|
#include "messages/messageparseargs.hpp"
|
2017-12-31 00:50:07 +01:00
|
|
|
#include "singletons/emotemanager.hpp"
|
|
|
|
|
|
|
|
#include <IrcMessage>
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
#include <QString>
|
2017-06-13 21:13:58 +02:00
|
|
|
#include <QVariant>
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace chatterino {
|
2017-07-02 18:12:11 +02:00
|
|
|
class Channel;
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace twitch {
|
2017-12-31 00:50:07 +01:00
|
|
|
class TwitchChannel;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
class TwitchMessageBuilder : public messages::MessageBuilder
|
|
|
|
{
|
|
|
|
public:
|
2017-07-23 11:59:05 +02:00
|
|
|
enum UsernameDisplayMode : int {
|
|
|
|
Username = 1, // Username
|
|
|
|
LocalizedName = 2, // Localized name
|
|
|
|
UsernameAndLocalizedName = 3, // Username (Localized name)
|
|
|
|
};
|
|
|
|
|
2017-07-02 18:12:11 +02:00
|
|
|
TwitchMessageBuilder() = delete;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-12-31 00:50:07 +01:00
|
|
|
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcPrivateMessage *_ircMessage,
|
2017-07-02 18:12:11 +02:00
|
|
|
const messages::MessageParseArgs &_args);
|
|
|
|
|
|
|
|
Channel *channel;
|
2017-09-16 00:05:06 +02:00
|
|
|
TwitchChannel *twitchChannel;
|
2017-07-02 18:12:11 +02:00
|
|
|
const Communi::IrcPrivateMessage *ircMessage;
|
|
|
|
messages::MessageParseArgs args;
|
|
|
|
const QVariantMap tags;
|
|
|
|
|
|
|
|
QString messageID;
|
2017-04-12 17:46:44 +02:00
|
|
|
QString userName;
|
|
|
|
|
2018-01-23 21:33:49 +01:00
|
|
|
bool isIgnored() const;
|
2018-01-23 23:28:06 +01:00
|
|
|
messages::MessagePtr build();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
private:
|
2017-11-04 14:57:29 +01:00
|
|
|
QString roomID;
|
2017-07-02 18:12:11 +02:00
|
|
|
|
|
|
|
QColor usernameColor;
|
|
|
|
|
|
|
|
void parseMessageID();
|
|
|
|
void parseRoomID();
|
2018-01-23 23:28:06 +01:00
|
|
|
void appendChannelName();
|
2017-07-02 18:12:11 +02:00
|
|
|
void parseUsername();
|
2017-08-12 13:18:48 +02:00
|
|
|
void appendUsername();
|
2017-07-31 01:19:25 +02:00
|
|
|
void parseHighlights();
|
2017-07-02 18:12:11 +02:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
|
2017-12-31 22:58:35 +01:00
|
|
|
std::vector<std::pair<long, util::EmoteData>> &vec);
|
2017-07-23 09:53:50 +02:00
|
|
|
bool tryAppendEmote(QString &emoteString);
|
2017-07-02 18:12:11 +02:00
|
|
|
|
2018-01-23 23:28:06 +01:00
|
|
|
void appendTwitchBadges();
|
|
|
|
void appendChatterinoBadges();
|
2018-01-12 19:37:11 +01:00
|
|
|
bool tryParseCheermote(const QString &string);
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
2017-06-07 10:09:24 +02:00
|
|
|
|
|
|
|
} // namespace twitch
|
|
|
|
} // namespace chatterino
|