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-06-15 23:13:01 +02:00
|
|
|
#include "resources.hpp"
|
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-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
class EmoteManager;
|
|
|
|
class WindowManager;
|
2017-07-02 18:12:11 +02:00
|
|
|
class Channel;
|
|
|
|
class ColorScheme;
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
namespace twitch {
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
class TwitchMessageBuilder : public messages::MessageBuilder
|
|
|
|
{
|
|
|
|
public:
|
2017-07-02 18:12:11 +02:00
|
|
|
TwitchMessageBuilder() = delete;
|
2017-04-12 17:46:44 +02:00
|
|
|
|
2017-07-02 18:12:11 +02:00
|
|
|
explicit TwitchMessageBuilder(Channel *_channel, Resources &_resources,
|
|
|
|
EmoteManager &_emoteManager, WindowManager &_windowManager,
|
|
|
|
const Communi::IrcPrivateMessage *_ircMessage,
|
|
|
|
const messages::MessageParseArgs &_args);
|
|
|
|
|
|
|
|
Channel *channel;
|
|
|
|
Resources &resources;
|
|
|
|
WindowManager &windowManager;
|
|
|
|
ColorScheme &colorScheme;
|
|
|
|
EmoteManager &emoteManager;
|
|
|
|
const Communi::IrcPrivateMessage *ircMessage;
|
|
|
|
messages::MessageParseArgs args;
|
|
|
|
const QVariantMap tags;
|
|
|
|
|
|
|
|
QString messageID;
|
2017-04-12 17:46:44 +02:00
|
|
|
QString userName;
|
|
|
|
|
2017-07-02 18:12:11 +02:00
|
|
|
messages::SharedMessage parse();
|
2017-04-12 17:46:44 +02:00
|
|
|
|
|
|
|
// static bool sortTwitchEmotes(
|
|
|
|
// const std::pair<long int, messages::LazyLoadedImage *> &a,
|
|
|
|
// const std::pair<long int, messages::LazyLoadedImage *> &b);
|
2017-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
private:
|
2017-07-02 18:12:11 +02:00
|
|
|
std::string roomID;
|
|
|
|
|
|
|
|
QColor usernameColor;
|
|
|
|
|
|
|
|
void parseMessageID();
|
|
|
|
void parseRoomID();
|
|
|
|
void parseChannelName();
|
|
|
|
void parseUsername();
|
|
|
|
|
|
|
|
void appendModerationButtons();
|
2017-06-13 21:13:58 +02:00
|
|
|
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
|
|
|
|
std::vector<std::pair<long int, messages::LazyLoadedImage *>> &vec,
|
|
|
|
EmoteManager &emoteManager);
|
2017-07-02 18:12:11 +02:00
|
|
|
|
|
|
|
void parseTwitchBadges();
|
2017-04-12 17:46:44 +02:00
|
|
|
};
|
2017-06-07 10:09:24 +02:00
|
|
|
|
|
|
|
} // namespace twitch
|
|
|
|
} // namespace chatterino
|