2018-04-15 15:09:31 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <rapidjson/document.h>
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <cinttypes>
|
|
|
|
|
|
|
|
namespace chatterino {
|
|
|
|
namespace singletons {
|
|
|
|
|
|
|
|
struct ActionUser {
|
|
|
|
QString id;
|
|
|
|
QString name;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
PubSubAction(const rapidjson::Value &data, const QString &_roomID);
|
2018-04-15 15:09:31 +02:00
|
|
|
ActionUser source;
|
|
|
|
|
|
|
|
std::chrono::steady_clock::time_point timestamp;
|
2018-04-22 15:37:02 +02:00
|
|
|
QString roomID;
|
2018-04-15 15:09:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Used when a chat mode (i.e. slowmode, subscribers only mode) is enabled or disabled
|
|
|
|
struct ModeChangedAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
|
|
|
|
enum Mode {
|
|
|
|
Unknown,
|
|
|
|
Slow,
|
|
|
|
R9K,
|
|
|
|
SubscribersOnly,
|
|
|
|
EmoteOnly,
|
|
|
|
} mode;
|
|
|
|
|
|
|
|
// Whether the mode was turned on or off
|
|
|
|
enum State {
|
|
|
|
Off,
|
|
|
|
On,
|
|
|
|
} state;
|
|
|
|
|
|
|
|
union {
|
|
|
|
uint32_t duration;
|
|
|
|
} args;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TimeoutAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
|
|
|
|
ActionUser target;
|
|
|
|
|
|
|
|
QString reason;
|
|
|
|
uint32_t duration;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BanAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
|
|
|
|
ActionUser target;
|
|
|
|
|
|
|
|
QString reason;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct UnbanAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
|
|
|
|
ActionUser target;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
Banned,
|
|
|
|
TimedOut,
|
|
|
|
} previousState;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ClearChatAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ModerationStateAction : PubSubAction {
|
2018-04-22 15:37:02 +02:00
|
|
|
using PubSubAction::PubSubAction;
|
2018-04-15 15:09:31 +02:00
|
|
|
|
|
|
|
ActionUser target;
|
|
|
|
|
|
|
|
// true = modded
|
|
|
|
// false = unmodded
|
|
|
|
bool modded;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace singletons
|
|
|
|
} // namespace chatterino
|