feat: add initial experimental Twitch Eventsub support (#5837)
Co-authored-by: nerix <nerixdev@outlook.de>
This commit is contained in:
@@ -44,6 +44,8 @@ struct Message {
|
||||
QString id;
|
||||
QString searchText;
|
||||
QString messageText;
|
||||
// TODO: This field is used ambiguously, it could use a comment or a name change to
|
||||
// clarify the intent of the field
|
||||
QString loginName;
|
||||
QString displayName;
|
||||
QString localizedName;
|
||||
|
||||
@@ -173,6 +173,12 @@ public:
|
||||
void appendOrEmplaceSystemTextAndUpdate(const QString &text,
|
||||
QString &toUpdate);
|
||||
|
||||
// Helper method that emplaces some text stylized as system text
|
||||
// and then appends that text to the QString parameter "toUpdate".
|
||||
// Returns the TextElement that was emplaced.
|
||||
TextElement *emplaceSystemTextAndUpdate(const QString &text,
|
||||
QString &toUpdate);
|
||||
|
||||
static void triggerHighlights(const Channel *channel,
|
||||
const HighlightAlert &alert);
|
||||
|
||||
@@ -287,12 +293,6 @@ private:
|
||||
MessageElement &back();
|
||||
std::unique_ptr<MessageElement> releaseBack();
|
||||
|
||||
// Helper method that emplaces some text stylized as system text
|
||||
// and then appends that text to the QString parameter "toUpdate".
|
||||
// Returns the TextElement that was emplaced.
|
||||
TextElement *emplaceSystemTextAndUpdate(const QString &text,
|
||||
QString &toUpdate);
|
||||
|
||||
void parse();
|
||||
void parseUsernameColor(const QVariantMap &tags, const QString &userID);
|
||||
void parseUsername(const Communi::IrcMessage *ircMessage,
|
||||
|
||||
@@ -918,6 +918,22 @@ MentionElement::MentionElement(const QString &displayName, QString loginName_,
|
||||
{
|
||||
}
|
||||
|
||||
template <typename>
|
||||
MentionElement::MentionElement(const QString &displayName, QString loginName_,
|
||||
MessageColor fallbackColor_, QColor userColor_)
|
||||
: TextElement(displayName,
|
||||
{MessageElementFlag::Text, MessageElementFlag::Mention})
|
||||
, fallbackColor(fallbackColor_)
|
||||
, userColor(userColor_.isValid() ? userColor_ : fallbackColor_)
|
||||
, userLoginName(std::move(loginName_))
|
||||
{
|
||||
}
|
||||
|
||||
template MentionElement::MentionElement(const QString &displayName,
|
||||
QString loginName_,
|
||||
MessageColor fallbackColor_,
|
||||
QColor userColor_);
|
||||
|
||||
void MentionElement::addToContainer(MessageLayoutContainer &container,
|
||||
const MessageLayoutContext &ctx)
|
||||
{
|
||||
|
||||
@@ -340,8 +340,15 @@ private:
|
||||
class MentionElement : public TextElement
|
||||
{
|
||||
public:
|
||||
MentionElement(const QString &displayName, QString loginName_,
|
||||
MessageColor fallbackColor_, MessageColor userColor_);
|
||||
explicit MentionElement(const QString &displayName, QString loginName_,
|
||||
MessageColor fallbackColor_,
|
||||
MessageColor userColor_);
|
||||
/// Deprioritized ctor allowing us to pass through a potentially invalid userColor_
|
||||
///
|
||||
/// If the userColor_ is invalid, we fall back to the fallbackColor_
|
||||
template <typename = void>
|
||||
explicit MentionElement(const QString &displayName, QString loginName_,
|
||||
MessageColor fallbackColor_, QColor userColor_);
|
||||
~MentionElement() override = default;
|
||||
MentionElement(const MentionElement &) = delete;
|
||||
MentionElement(MentionElement &&) = delete;
|
||||
|
||||
Reference in New Issue
Block a user