2017-06-07 10:09:24 +02:00
|
|
|
#pragma once
|
2017-01-05 16:07:20 +01:00
|
|
|
|
2018-06-26 17:20:03 +02:00
|
|
|
#include "common/FlagsEnum.hpp"
|
2020-10-18 15:16:56 +02:00
|
|
|
#include "providers/twitch/TwitchBadge.hpp"
|
2022-05-28 11:55:48 +02:00
|
|
|
#include "util/QStringHash.hpp"
|
2018-06-26 14:09:39 +02:00
|
|
|
#include "widgets/helper/ScrollbarHighlight.hpp"
|
2017-03-11 11:32:19 +01:00
|
|
|
|
2018-04-03 02:55:32 +02:00
|
|
|
#include <QTime>
|
2018-08-11 22:23:06 +02:00
|
|
|
#include <boost/noncopyable.hpp>
|
2018-01-11 20:16:25 +01:00
|
|
|
#include <cinttypes>
|
2017-04-12 17:46:44 +02:00
|
|
|
#include <memory>
|
2017-09-24 18:43:24 +02:00
|
|
|
#include <vector>
|
2017-01-11 01:08:20 +01:00
|
|
|
|
2018-01-11 20:16:25 +01:00
|
|
|
namespace chatterino {
|
2018-08-11 22:23:06 +02:00
|
|
|
class MessageElement;
|
2022-07-31 12:45:25 +02:00
|
|
|
class MessageThread;
|
2018-03-31 11:32:29 +02:00
|
|
|
|
2022-10-03 20:55:46 +02:00
|
|
|
enum class MessageFlag : int64_t {
|
|
|
|
None = 0LL,
|
|
|
|
System = (1LL << 0),
|
|
|
|
Timeout = (1LL << 1),
|
|
|
|
Highlighted = (1LL << 2),
|
|
|
|
DoNotTriggerNotification = (1LL << 3), // disable notification sound
|
|
|
|
Centered = (1LL << 4),
|
|
|
|
Disabled = (1LL << 5),
|
|
|
|
DisableCompactEmotes = (1LL << 6),
|
|
|
|
Collapsed = (1LL << 7),
|
|
|
|
ConnectedMessage = (1LL << 8),
|
|
|
|
DisconnectedMessage = (1LL << 9),
|
|
|
|
Untimeout = (1LL << 10),
|
|
|
|
PubSub = (1LL << 11),
|
|
|
|
Subscription = (1LL << 12),
|
|
|
|
DoNotLog = (1LL << 13),
|
|
|
|
AutoMod = (1LL << 14),
|
|
|
|
RecentMessage = (1LL << 15),
|
|
|
|
Whisper = (1LL << 16),
|
|
|
|
HighlightedWhisper = (1LL << 17),
|
|
|
|
Debug = (1LL << 18),
|
|
|
|
Similar = (1LL << 19),
|
|
|
|
RedeemedHighlight = (1LL << 20),
|
|
|
|
RedeemedChannelPointReward = (1LL << 21),
|
|
|
|
ShowInMentions = (1LL << 22),
|
|
|
|
FirstMessage = (1LL << 23),
|
|
|
|
ReplyMessage = (1LL << 24),
|
|
|
|
ElevatedMessage = (1LL << 25),
|
2022-10-08 16:25:32 +02:00
|
|
|
ParticipatedThread = (1LL << 26),
|
2022-10-18 20:26:12 +02:00
|
|
|
CheerMessage = (1LL << 27),
|
2018-08-07 07:55:31 +02:00
|
|
|
};
|
|
|
|
using MessageFlags = FlagsEnum<MessageFlag>;
|
2018-01-05 23:14:55 +01:00
|
|
|
|
2018-08-07 07:55:31 +02:00
|
|
|
struct Message : boost::noncopyable {
|
2018-08-07 01:35:24 +02:00
|
|
|
Message();
|
|
|
|
~Message();
|
|
|
|
|
2018-09-01 15:43:17 +02:00
|
|
|
// Making this a mutable means that we can update a messages flags,
|
|
|
|
// while still keeping Message constant. This means that a message's flag
|
|
|
|
// can be updated without the renderer being made aware, which might be bad.
|
|
|
|
// This is a temporary effort until we can figure out what the right
|
|
|
|
// const-correct way to deal with this is.
|
|
|
|
// This might bring race conditions with it
|
|
|
|
mutable MessageFlags flags;
|
2018-01-28 03:29:42 +01:00
|
|
|
QTime parseTime;
|
|
|
|
QString id;
|
|
|
|
QString searchText;
|
2019-05-01 16:43:52 +02:00
|
|
|
QString messageText;
|
2018-01-28 03:29:42 +01:00
|
|
|
QString loginName;
|
|
|
|
QString displayName;
|
|
|
|
QString localizedName;
|
|
|
|
QString timeoutUser;
|
2020-10-18 15:16:56 +02:00
|
|
|
QString channelName;
|
|
|
|
QColor usernameColor;
|
2022-05-15 08:08:28 +02:00
|
|
|
QDateTime serverReceivedTime;
|
2020-10-18 15:16:56 +02:00
|
|
|
std::vector<Badge> badges;
|
2022-05-28 11:55:48 +02:00
|
|
|
std::unordered_map<QString, QString> badgeInfos;
|
2020-01-25 11:03:10 +01:00
|
|
|
std::shared_ptr<QColor> highlightColor;
|
2022-07-31 12:45:25 +02:00
|
|
|
// Each reply holds a reference to the thread. When every reply is dropped,
|
|
|
|
// the reply thread will be cleaned up by the TwitchChannel.
|
|
|
|
// The root of the thread does not have replyThread set.
|
|
|
|
std::shared_ptr<MessageThread> replyThread;
|
2018-04-27 18:35:31 +02:00
|
|
|
uint32_t count = 1;
|
2018-08-07 01:35:24 +02:00
|
|
|
std::vector<std::unique_ptr<MessageElement>> elements;
|
2018-04-27 18:35:31 +02:00
|
|
|
|
2018-06-26 17:06:17 +02:00
|
|
|
ScrollbarHighlight getScrollBarHighlight() const;
|
2017-01-05 16:07:20 +01:00
|
|
|
};
|
2017-01-28 20:29:02 +01:00
|
|
|
|
2018-08-07 01:35:24 +02:00
|
|
|
using MessagePtr = std::shared_ptr<const Message>;
|
2018-03-31 11:32:29 +02:00
|
|
|
|
2017-04-14 17:52:22 +02:00
|
|
|
} // namespace chatterino
|