Improve Twitch PubSub connection reliability (#3643)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2022-05-07 17:22:39 +02:00
committed by GitHub
parent 4aa5b04e37
commit f97780d84e
64 changed files with 3094 additions and 2126 deletions
@@ -0,0 +1,55 @@
#pragma once
#include <QColor>
#include <QJsonObject>
#include <QString>
#include <magic_enum.hpp>
namespace chatterino {
struct PubSubWhisperMessage {
enum class Type {
WhisperReceived,
WhisperSent,
Thread,
INVALID,
};
QString typeString;
Type type = Type::INVALID;
QString messageID;
int id;
QString threadID;
QString body;
QString fromUserID;
QString fromUserLogin;
QString fromUserDisplayName;
QColor fromUserColor;
PubSubWhisperMessage(const QJsonObject &root);
};
} // namespace chatterino
template <>
constexpr magic_enum::customize::customize_t
magic_enum::customize::enum_name<chatterino::PubSubWhisperMessage::Type>(
chatterino::PubSubWhisperMessage::Type value) noexcept
{
switch (value)
{
case chatterino::PubSubWhisperMessage::Type::WhisperReceived:
return "whisper_received";
case chatterino::PubSubWhisperMessage::Type::WhisperSent:
return "whisper_sent";
case chatterino::PubSubWhisperMessage::Type::Thread:
return "thread";
default:
return default_tag;
}
}