Clean up twitch message parsing
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "channel.hpp"
|
||||
#include "messages/messagebuilder.hpp"
|
||||
#include "resources.hpp"
|
||||
|
||||
@@ -11,34 +10,55 @@ namespace chatterino {
|
||||
|
||||
class EmoteManager;
|
||||
class WindowManager;
|
||||
class Channel;
|
||||
class ColorScheme;
|
||||
|
||||
namespace twitch {
|
||||
|
||||
class TwitchMessageBuilder : public messages::MessageBuilder
|
||||
{
|
||||
public:
|
||||
TwitchMessageBuilder();
|
||||
TwitchMessageBuilder() = delete;
|
||||
|
||||
QString messageId;
|
||||
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;
|
||||
QString userName;
|
||||
|
||||
static messages::SharedMessage parse(const Communi::IrcPrivateMessage *ircMessage,
|
||||
Channel *channel, const messages::MessageParseArgs &args,
|
||||
Resources &resources, EmoteManager &emoteManager,
|
||||
WindowManager &windowManager);
|
||||
messages::SharedMessage parse();
|
||||
|
||||
// static bool sortTwitchEmotes(
|
||||
// const std::pair<long int, messages::LazyLoadedImage *> &a,
|
||||
// const std::pair<long int, messages::LazyLoadedImage *> &b);
|
||||
|
||||
private:
|
||||
void appendModerationWords(const Communi::IrcPrivateMessage *ircMessage,
|
||||
const Resources &resources);
|
||||
std::string roomID;
|
||||
|
||||
QColor usernameColor;
|
||||
|
||||
void parseMessageID();
|
||||
void parseRoomID();
|
||||
void parseChannelName();
|
||||
void parseUsername();
|
||||
|
||||
void appendModerationButtons();
|
||||
void appendTwitchEmote(const Communi::IrcPrivateMessage *ircMessage, const QString &emote,
|
||||
std::vector<std::pair<long int, messages::LazyLoadedImage *>> &vec,
|
||||
EmoteManager &emoteManager);
|
||||
void appendTwitchBadges(const QStringList &badges, Resources &resources,
|
||||
EmoteManager &emoteManager, const Resources::Channel &channelResources);
|
||||
|
||||
void parseTwitchBadges();
|
||||
};
|
||||
|
||||
} // namespace twitch
|
||||
|
||||
Reference in New Issue
Block a user