mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
3184234c19
commitea07bbef0b
Merge:0b36f436
5cfcf114
Author: hemirt <hemirt@email.cz> Date: Sun Sep 23 20:05:14 2018 +0200 Merge branch 'blacklist' into blacklistnew commit5cfcf114b6
Author: hemirt <hemirt@email.cz> Date: Sun Sep 23 20:00:16 2018 +0200 rename second pattern to replacement commitf08cc4cf88
Author: hemirt <hemirt@email.cz> Date: Sun Sep 23 19:52:30 2018 +0200 delete out commented code commit1acb1278aa
Author: hemirt <hemirt@email.cz> Date: Sun Sep 23 19:52:03 2018 +0200 fix replacement with emotes issues commit646268ab18
Author: hemirt <hemirt@email.cz> Date: Sun Aug 19 01:06:36 2018 +0200 fix build commitad711b4c15
Merge:e8e059f8
8bcc9c48
Author: hemirt <hemirt@email.cz> Date: Sun Aug 19 00:52:38 2018 +0200 Merge branch 'master' of https://github.com/fourtf/chatterino2 into blacklist commite8e059f847
Author: hemirt <hemirt@email.cz> Date: Sun Aug 19 00:25:58 2018 +0200 add replaced emotes into twitchEmotes commita63454f00d
Merge:e7f2f397
63eaf3b9
Author: hemirt <hemirt@email.cz> Date: Sat Aug 11 22:38:16 2018 +0200 Merge branch 'master' of https://github.com/fourtf/chatterino2 into blacklist commite7f2f39737
Author: hemirt <hemirt@email.cz> Date: Sat Aug 11 21:54:01 2018 +0200 emotedata commitf00d3da537
Author: hemirt <hemirt@email.cz> Date: Sat Jul 28 19:53:55 2018 +0200 rename variables to fit better, emotes in capture groups from regex work commit00c9fa080a
Author: hemirt <hemirt@email.cz> Date: Mon Jul 9 19:53:53 2018 +0200 add case sensitivity checkbox and fix validity issues due to isValid that checked regex commit4385fcd13f
Author: hemirt <hemirt@email.cz> Date: Sun Jul 8 21:09:14 2018 +0200 remove commented code commit1834342f74
Author: hemirt <hemirt@email.cz> Date: Sun Jul 8 21:03:13 2018 +0200 IgnorePhrase replacement also removes twitch emotes info about the matched and changed parts and shifts positions of other emotes from emote infos to the corresponding new position commitd3b6e294ed
Author: hemirt <hemirt@email.cz> Date: Sun Jul 8 16:21:33 2018 +0200 ignore phrases
79 lines
2.1 KiB
C++
79 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include "common/Aliases.hpp"
|
|
#include "common/Outcome.hpp"
|
|
#include "messages/MessageBuilder.hpp"
|
|
|
|
#include <IrcMessage>
|
|
#include <QString>
|
|
#include <QVariant>
|
|
|
|
namespace chatterino {
|
|
|
|
struct Emote;
|
|
using EmotePtr = std::shared_ptr<const Emote>;
|
|
|
|
class Channel;
|
|
class TwitchChannel;
|
|
|
|
class TwitchMessageBuilder : public 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 MessageParseArgs &_args);
|
|
explicit TwitchMessageBuilder(Channel *_channel, const Communi::IrcMessage *_ircMessage,
|
|
const MessageParseArgs &_args, QString content, bool isAction);
|
|
|
|
Channel *channel;
|
|
TwitchChannel *twitchChannel;
|
|
const Communi::IrcMessage *ircMessage;
|
|
MessageParseArgs args;
|
|
const QVariantMap tags;
|
|
|
|
QString messageID;
|
|
QString userName;
|
|
|
|
bool isIgnored() const;
|
|
MessagePtr build();
|
|
|
|
private:
|
|
void parseMessageID();
|
|
void parseRoomID();
|
|
void appendChannelName();
|
|
void parseUsername();
|
|
void appendUsername();
|
|
void parseHighlights(bool isPastMsg);
|
|
|
|
void appendTwitchEmote(const QString &emote,
|
|
std::vector<std::tuple<int, EmotePtr, EmoteName>> &vec);
|
|
Outcome tryAppendEmote(const EmoteName &name);
|
|
|
|
void addWords(const QStringList &words,
|
|
const std::vector<std::tuple<int, EmotePtr, EmoteName>> &twitchEmotes);
|
|
void addTextOrEmoji(EmotePtr emote);
|
|
void addTextOrEmoji(const QString &value);
|
|
|
|
void appendTwitchBadges();
|
|
void appendChatterinoBadges();
|
|
Outcome tryParseCheermote(const QString &string);
|
|
|
|
QString roomID_;
|
|
bool hasBits_ = false;
|
|
|
|
QColor usernameColor_;
|
|
QString originalMessage_;
|
|
bool senderIsBroadcaster{};
|
|
|
|
const bool action_ = false;
|
|
};
|
|
|
|
} // namespace chatterino
|