2022-12-31 15:41:01 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-04 15:15:59 +02:00
|
|
|
#include "common/Aliases.hpp"
|
|
|
|
#include "common/Outcome.hpp"
|
Sort and force grouping of includes (#4172)
This change enforces strict include grouping using IncludeCategories
In addition to adding this to the .clang-format file and applying it in the tests/src and src directories, I also did the following small changes:
In ChatterSet.hpp, I changed lrucache to a <>include
In Irc2.hpp, I change common/SignalVector.hpp to a "project-include"
In AttachedWindow.cpp, NativeMessaging.cpp, WindowsHelper.hpp, BaseWindow.cpp, and StreamerMode.cpp, I disabled clang-format for the windows-includes
In WindowDescriptors.hpp, I added the missing vector include. It was previously not needed because the include was handled by another file that was previously included first.
clang-format minimum version has been bumped, so Ubuntu version used in the check-formatting job has been bumped to 22.04 (which is the latest LTS)
2022-11-27 19:32:53 +01:00
|
|
|
#include "messages/MessageBuilder.hpp"
|
2020-07-04 15:15:59 +02:00
|
|
|
|
|
|
|
#include <IrcMessage>
|
|
|
|
#include <QColor>
|
2021-05-08 15:57:00 +02:00
|
|
|
#include <QUrl>
|
2020-07-04 15:15:59 +02:00
|
|
|
|
2023-12-26 00:17:44 +01:00
|
|
|
#include <optional>
|
|
|
|
|
2020-07-04 15:15:59 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
2022-12-31 15:41:01 +01:00
|
|
|
class Badge;
|
|
|
|
class Channel;
|
|
|
|
|
2020-07-04 15:15:59 +02:00
|
|
|
class SharedMessageBuilder : public MessageBuilder
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SharedMessageBuilder() = delete;
|
|
|
|
|
|
|
|
explicit SharedMessageBuilder(Channel *_channel,
|
|
|
|
const Communi::IrcPrivateMessage *_ircMessage,
|
|
|
|
const MessageParseArgs &_args);
|
|
|
|
|
|
|
|
explicit SharedMessageBuilder(Channel *_channel,
|
|
|
|
const Communi::IrcMessage *_ircMessage,
|
|
|
|
const MessageParseArgs &_args,
|
|
|
|
QString content, bool isAction);
|
|
|
|
|
|
|
|
QString userName;
|
|
|
|
|
|
|
|
[[nodiscard]] virtual bool isIgnored() const;
|
|
|
|
|
|
|
|
// triggerHighlights triggers any alerts or sounds parsed by parseHighlights
|
|
|
|
virtual void triggerHighlights();
|
|
|
|
virtual MessagePtr build() = 0;
|
|
|
|
|
2022-05-28 11:55:48 +02:00
|
|
|
static std::pair<QString, QString> slashKeyValue(const QString &kvStr);
|
|
|
|
|
|
|
|
// Parses "badges" tag which contains a comma separated list of key-value elements
|
|
|
|
static std::vector<Badge> parseBadgeTag(const QVariantMap &tags);
|
|
|
|
|
2022-11-20 17:28:29 +01:00
|
|
|
static QString stylizeUsername(const QString &username,
|
|
|
|
const Message &message);
|
|
|
|
|
2020-07-04 15:15:59 +02:00
|
|
|
protected:
|
|
|
|
virtual void parse();
|
|
|
|
|
|
|
|
virtual void parseUsernameColor();
|
|
|
|
|
|
|
|
virtual void parseUsername();
|
|
|
|
|
|
|
|
virtual Outcome tryAppendEmote(const EmoteName &name)
|
|
|
|
{
|
2024-01-17 21:05:44 +01:00
|
|
|
(void)name;
|
2020-07-04 15:15:59 +02:00
|
|
|
return Failure;
|
|
|
|
}
|
|
|
|
|
|
|
|
// parseHighlights only updates the visual state of the message, but leaves the playing of alerts and sounds to the triggerHighlights function
|
|
|
|
virtual void parseHighlights();
|
2023-12-26 00:17:44 +01:00
|
|
|
static void triggerHighlights(const QString &channelName, bool playSound,
|
|
|
|
const std::optional<QUrl> &customSoundUrl,
|
|
|
|
bool windowAlert);
|
2020-07-04 15:15:59 +02:00
|
|
|
|
|
|
|
void appendChannelName();
|
|
|
|
|
|
|
|
Channel *channel;
|
|
|
|
const Communi::IrcMessage *ircMessage;
|
|
|
|
MessageParseArgs args;
|
|
|
|
const QVariantMap tags;
|
|
|
|
QString originalMessage_;
|
|
|
|
|
|
|
|
const bool action_{};
|
|
|
|
|
2021-06-20 15:55:35 +02:00
|
|
|
QColor usernameColor_ = {153, 153, 153};
|
2020-07-04 15:15:59 +02:00
|
|
|
|
|
|
|
bool highlightAlert_ = false;
|
|
|
|
bool highlightSound_ = false;
|
2023-12-26 00:17:44 +01:00
|
|
|
std::optional<QUrl> highlightSoundCustomUrl_{};
|
2020-07-04 15:15:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace chatterino
|