From 9afd60534ab9674ba95b9d6c4e35179e80e66613 Mon Sep 17 00:00:00 2001 From: nerix Date: Thu, 13 Feb 2025 13:46:52 +0100 Subject: [PATCH] refactor(eventsub): more references, less const (#5953) --- CHANGELOG.md | 2 +- .../benchmarks/src/parse.cpp | 41 +++++++++++-------- .../include/twitch-eventsub-ws/listener.hpp | 35 ++++++++-------- .../twitch-eventsub-ws/messages/metadata.hpp | 10 ++--- .../payloads/channel-ban-v1.hpp | 4 +- .../payloads/channel-chat-message-v1.hpp | 4 +- .../payloads/channel-chat-notification-v1.hpp | 4 +- .../payloads/channel-update-v1.hpp | 20 ++++----- .../payloads/session-welcome.hpp | 2 +- .../payloads/stream-offline-v1.hpp | 10 ++--- .../payloads/stream-online-v1.hpp | 16 ++++---- .../payloads/subscription.hpp | 18 ++++---- lib/twitch-eventsub-ws/src/session.cpp | 17 ++++---- lib/twitch-eventsub-ws/tests/src/parse.cpp | 38 +++++++++-------- src/providers/twitch/eventsub/Connection.cpp | 35 ++++++++-------- src/providers/twitch/eventsub/Connection.hpp | 37 +++++++++-------- 16 files changed, 154 insertions(+), 139 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f830149..829eb034 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ - Bugfix: Fixed search in emote popup not always working correctly. (#5946) - Bugfix: Fixed channel point redemptions with messages not showing up if PubSub is disconnected. (#5948) - Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947) -- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952) +- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953) - Dev: Remove unneeded platform specifier for toasts. (#5914) - Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784) - Dev: Removed unused PubSub whisper code. (#5898) diff --git a/lib/twitch-eventsub-ws/benchmarks/src/parse.cpp b/lib/twitch-eventsub-ws/benchmarks/src/parse.cpp index 5941b8f7..bc064f42 100644 --- a/lib/twitch-eventsub-ws/benchmarks/src/parse.cpp +++ b/lib/twitch-eventsub-ws/benchmarks/src/parse.cpp @@ -14,7 +14,8 @@ using namespace chatterino::eventsub::lib; std::vector readMessages() { QFile file(":/bench/messages.ndjson"); - assert(file.open(QFile::ReadOnly)); + bool ok = file.open(QFile::ReadOnly); + assert(ok); std::vector messages; while (!file.atEnd()) @@ -41,67 +42,71 @@ public: NoopListener() = default; // NOLINTBEGIN(cppcoreguidelines-pro-type-const-cast) - void onSessionWelcome(messages::Metadata metadata, - payload::session_welcome::Payload payload) override + void onSessionWelcome( + const messages::Metadata &metadata, + const payload::session_welcome::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } - void onNotification(messages::Metadata metadata, + void onNotification(const messages::Metadata &metadata, const boost::json::value &jv) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&jv); } - void onChannelBan(messages::Metadata metadata, - payload::channel_ban::v1::Payload payload) override + void onChannelBan(const messages::Metadata &metadata, + const payload::channel_ban::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } - void onStreamOnline(messages::Metadata metadata, - payload::stream_online::v1::Payload payload) override + void onStreamOnline( + const messages::Metadata &metadata, + const payload::stream_online::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } - void onStreamOffline(messages::Metadata metadata, - payload::stream_offline::v1::Payload payload) override + void onStreamOffline( + const messages::Metadata &metadata, + const payload::stream_offline::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } void onChannelChatNotification( - messages::Metadata metadata, - payload::channel_chat_notification::v1::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_chat_notification::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } - void onChannelUpdate(messages::Metadata metadata, - payload::channel_update::v1::Payload payload) override + void onChannelUpdate( + const messages::Metadata &metadata, + const payload::channel_update::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } void onChannelChatMessage( - messages::Metadata metadata, - payload::channel_chat_message::v1::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_chat_message::v1::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); } void onChannelModerate( - messages::Metadata metadata, - payload::channel_moderate::v2::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_moderate::v2::Payload &payload) override { benchmark::DoNotOptimize(&metadata); benchmark::DoNotOptimize(&payload); diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/listener.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/listener.hpp index 724e075c..b0b7c2f6 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/listener.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/listener.hpp @@ -18,39 +18,40 @@ public: virtual ~Listener() = default; virtual void onSessionWelcome( - messages::Metadata metadata, - payload::session_welcome::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::session_welcome::Payload &payload) = 0; - virtual void onNotification(messages::Metadata metadata, + virtual void onNotification(const messages::Metadata &metadata, const boost::json::value &jv) = 0; // Subscription types - virtual void onChannelBan(messages::Metadata metadata, - payload::channel_ban::v1::Payload payload) = 0; + virtual void onChannelBan( + const messages::Metadata &metadata, + const payload::channel_ban::v1::Payload &payload) = 0; virtual void onStreamOnline( - messages::Metadata metadata, - payload::stream_online::v1::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::stream_online::v1::Payload &payload) = 0; virtual void onStreamOffline( - messages::Metadata metadata, - payload::stream_offline::v1::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::stream_offline::v1::Payload &payload) = 0; virtual void onChannelChatNotification( - messages::Metadata metadata, - payload::channel_chat_notification::v1::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::channel_chat_notification::v1::Payload &payload) = 0; virtual void onChannelUpdate( - messages::Metadata metadata, - payload::channel_update::v1::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::channel_update::v1::Payload &payload) = 0; virtual void onChannelChatMessage( - messages::Metadata metadata, - payload::channel_chat_message::v1::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::channel_chat_message::v1::Payload &payload) = 0; virtual void onChannelModerate( - messages::Metadata metadata, - payload::channel_moderate::v2::Payload payload) = 0; + const messages::Metadata &metadata, + const payload::channel_moderate::v2::Payload &payload) = 0; // Add your new subscription types above this line }; diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/messages/metadata.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/messages/metadata.hpp index 7bd93272..cd603851 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/messages/metadata.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/messages/metadata.hpp @@ -21,13 +21,13 @@ namespace chatterino::eventsub::lib::messages { */ struct Metadata { - const std::string messageID; - const std::string messageType; + std::string messageID; + std::string messageType; // TODO: should this be chronofied? - const std::string messageTimestamp; + std::string messageTimestamp; - const std::optional subscriptionType; - const std::optional subscriptionVersion; + std::optional subscriptionType; + std::optional subscriptionVersion; }; #include "twitch-eventsub-ws/messages/metadata.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-ban-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-ban-v1.hpp index ed367942..2a689992 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-ban-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-ban-v1.hpp @@ -91,9 +91,9 @@ struct Event { }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/channel-ban-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-message-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-message-v1.hpp index d775eb38..a98917b2 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-message-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-message-v1.hpp @@ -135,9 +135,9 @@ struct Event { }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/channel-chat-message-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp index d678a946..d467b72b 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-chat-notification-v1.hpp @@ -190,9 +190,9 @@ struct Event { }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/channel-chat-notification-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-update-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-update-v1.hpp index 92efd3a5..0eec2a52 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-update-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/channel-update-v1.hpp @@ -10,31 +10,31 @@ namespace chatterino::eventsub::lib::payload::channel_update::v1 { struct Event { // The broadcaster's user ID - const std::string broadcasterUserID; + std::string broadcasterUserID; // The broadcaster's user login - const std::string broadcasterUserLogin; + std::string broadcasterUserLogin; // The broadcaster's user display name - const std::string broadcasterUserName; + std::string broadcasterUserName; // The channel's stream title - const std::string title; + std::string title; // The channel's broadcast language - const std::string language; + std::string language; // The channels category ID - const std::string categoryID; + std::string categoryID; // The category name - const std::string categoryName; + std::string categoryName; // A boolean identifying whether the channel is flagged as mature - const bool isMature; + bool isMature; }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/channel-update-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/session-welcome.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/session-welcome.hpp index 8088fd69..b71391cb 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/session-welcome.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/session-welcome.hpp @@ -23,7 +23,7 @@ namespace chatterino::eventsub::lib::payload::session_welcome { /// json_inner=session struct Payload { - const std::string id; + std::string id; }; #include "twitch-eventsub-ws/payloads/session-welcome.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-offline-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-offline-v1.hpp index f9487c0f..afe6bd93 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-offline-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-offline-v1.hpp @@ -10,17 +10,17 @@ namespace chatterino::eventsub::lib::payload::stream_offline::v1 { struct Event { // The broadcaster's user ID - const std::string broadcasterUserID; + std::string broadcasterUserID; // The broadcaster's user login - const std::string broadcasterUserLogin; + std::string broadcasterUserLogin; // The broadcaster's user display name - const std::string broadcasterUserName; + std::string broadcasterUserName; }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/stream-offline-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-online-v1.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-online-v1.hpp index 114061ed..f39a4cdd 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-online-v1.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/stream-online-v1.hpp @@ -10,27 +10,27 @@ namespace chatterino::eventsub::lib::payload::stream_online::v1 { struct Event { // The ID of the stream - const std::string id; + std::string id; // The broadcaster's user ID - const std::string broadcasterUserID; + std::string broadcasterUserID; // The broadcaster's user login - const std::string broadcasterUserLogin; + std::string broadcasterUserLogin; // The broadcaster's user display name - const std::string broadcasterUserName; + std::string broadcasterUserName; // The stream type (e.g. live, playlist, watch_party) - const std::string type; + std::string type; // The timestamp at which the stream went online // TODO: chronofy? - const std::string startedAt; + std::string startedAt; }; struct Payload { - const subscription::Subscription subscription; + subscription::Subscription subscription; - const Event event; + Event event; }; #include "twitch-eventsub-ws/payloads/stream-online-v1.inc" diff --git a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/subscription.hpp b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/subscription.hpp index 9b8eee5d..d2548844 100644 --- a/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/subscription.hpp +++ b/lib/twitch-eventsub-ws/include/twitch-eventsub-ws/payloads/subscription.hpp @@ -33,23 +33,23 @@ namespace chatterino::eventsub::lib::payload::subscription { */ struct Transport { - const std::string method; - const std::string sessionID; + std::string method; + std::string sessionID; }; struct Subscription { - const std::string id; - const std::string status; - const std::string type; - const std::string version; + std::string id; + std::string status; + std::string type; + std::string version; // TODO: How do we map condition here? vector of key/value pairs? - const Transport transport; + Transport transport; // TODO: chronofy? - const std::string createdAt; - const int cost; + std::string createdAt; + int cost; }; #include "twitch-eventsub-ws/payloads/subscription.inc" diff --git a/lib/twitch-eventsub-ws/src/session.cpp b/lib/twitch-eventsub-ws/src/session.cpp index a468d406..e633edcf 100644 --- a/lib/twitch-eventsub-ws/src/session.cpp +++ b/lib/twitch-eventsub-ws/src/session.cpp @@ -32,15 +32,16 @@ using EventSubSubscription = std::pair; using NotificationHandlers = std::unordered_map< EventSubSubscription, - std::function &)>, + std::function &)>, boost::hash>; -using MessageHandlers = - std::unordered_map &, - const NotificationHandlers &)>>; +using MessageHandlers = std::unordered_map< + std::string, + std::function &, const NotificationHandlers &)>>; namespace { @@ -153,7 +154,7 @@ namespace { { return oPayload.error(); } - listener->onChannelModerate(metadata, std::move(*oPayload)); + listener->onChannelModerate(metadata, *oPayload); return boost::system::error_code{}; }, }, diff --git a/lib/twitch-eventsub-ws/tests/src/parse.cpp b/lib/twitch-eventsub-ws/tests/src/parse.cpp index 9069dcee..32b949ab 100644 --- a/lib/twitch-eventsub-ws/tests/src/parse.cpp +++ b/lib/twitch-eventsub-ws/tests/src/parse.cpp @@ -55,51 +55,55 @@ boost::beast::flat_buffer readToFlatBuffer(const std::filesystem::path &path) class NoOpListener : public chatterino::eventsub::lib::Listener { - void onSessionWelcome(messages::Metadata metadata, - payload::session_welcome::Payload payload) override + void onSessionWelcome( + const messages::Metadata &metadata, + const payload::session_welcome::Payload &payload) override { } - void onNotification(messages::Metadata metadata, + void onNotification(const messages::Metadata &metadata, const boost::json::value &jv) override { } - void onChannelBan(messages::Metadata metadata, - payload::channel_ban::v1::Payload payload) override + void onChannelBan(const messages::Metadata &metadata, + const payload::channel_ban::v1::Payload &payload) override { } - void onStreamOnline(messages::Metadata metadata, - payload::stream_online::v1::Payload payload) override + void onStreamOnline( + const messages::Metadata &metadata, + const payload::stream_online::v1::Payload &payload) override { } - void onStreamOffline(messages::Metadata metadata, - payload::stream_offline::v1::Payload payload) override + void onStreamOffline( + const messages::Metadata &metadata, + const payload::stream_offline::v1::Payload &payload) override { } void onChannelChatNotification( - messages::Metadata metadata, - payload::channel_chat_notification::v1::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_chat_notification::v1::Payload &payload) override { } - void onChannelUpdate(messages::Metadata metadata, - payload::channel_update::v1::Payload payload) override + void onChannelUpdate( + const messages::Metadata &metadata, + const payload::channel_update::v1::Payload &payload) override { } void onChannelChatMessage( - messages::Metadata metadata, - payload::channel_chat_message::v1::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_chat_message::v1::Payload &payload) override { } void onChannelModerate( - messages::Metadata metadata, - payload::channel_moderate::v2::Payload payload) override + const messages::Metadata &metadata, + const payload::channel_moderate::v2::Payload &payload) override { } }; diff --git a/src/providers/twitch/eventsub/Connection.cpp b/src/providers/twitch/eventsub/Connection.cpp index 8fed2dd4..df3be48e 100644 --- a/src/providers/twitch/eventsub/Connection.cpp +++ b/src/providers/twitch/eventsub/Connection.cpp @@ -28,8 +28,8 @@ const auto &LOG = chatterinoTwitchEventSub; namespace chatterino::eventsub { void Connection::onSessionWelcome( - lib::messages::Metadata metadata, - lib::payload::session_welcome::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::session_welcome::Payload &payload) { (void)metadata; qCDebug(LOG) << "On session welcome:" << payload.id.c_str(); @@ -37,7 +37,7 @@ void Connection::onSessionWelcome( this->sessionID = QString::fromStdString(payload.id); } -void Connection::onNotification(lib::messages::Metadata metadata, +void Connection::onNotification(const lib::messages::Metadata &metadata, const boost::json::value &jv) { (void)metadata; @@ -45,8 +45,9 @@ void Connection::onNotification(lib::messages::Metadata metadata, qCDebug(LOG) << "on notification: " << jsonString.c_str(); } -void Connection::onChannelBan(lib::messages::Metadata metadata, - lib::payload::channel_ban::v1::Payload payload) +void Connection::onChannelBan( + const lib::messages::Metadata &metadata, + const lib::payload::channel_ban::v1::Payload &payload) { (void)metadata; @@ -91,8 +92,8 @@ void Connection::onChannelBan(lib::messages::Metadata metadata, } void Connection::onStreamOnline( - lib::messages::Metadata metadata, - lib::payload::stream_online::v1::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::stream_online::v1::Payload &payload) { (void)metadata; qCDebug(LOG) << "On stream online event for channel" @@ -100,8 +101,8 @@ void Connection::onStreamOnline( } void Connection::onStreamOffline( - lib::messages::Metadata metadata, - lib::payload::stream_offline::v1::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::stream_offline::v1::Payload &payload) { (void)metadata; qCDebug(LOG) << "On stream offline event for channel" @@ -109,8 +110,8 @@ void Connection::onStreamOffline( } void Connection::onChannelChatNotification( - lib::messages::Metadata metadata, - lib::payload::channel_chat_notification::v1::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::channel_chat_notification::v1::Payload &payload) { (void)metadata; qCDebug(LOG) << "On channel chat notification for" @@ -118,8 +119,8 @@ void Connection::onChannelChatNotification( } void Connection::onChannelUpdate( - lib::messages::Metadata metadata, - lib::payload::channel_update::v1::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::channel_update::v1::Payload &payload) { (void)metadata; qCDebug(LOG) << "On channel update for" @@ -127,8 +128,8 @@ void Connection::onChannelUpdate( } void Connection::onChannelChatMessage( - lib::messages::Metadata metadata, - lib::payload::channel_chat_message::v1::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::channel_chat_message::v1::Payload &payload) { (void)metadata; @@ -137,8 +138,8 @@ void Connection::onChannelChatMessage( } void Connection::onChannelModerate( - lib::messages::Metadata metadata, - lib::payload::channel_moderate::v2::Payload payload) + const lib::messages::Metadata &metadata, + const lib::payload::channel_moderate::v2::Payload &payload) { (void)metadata; diff --git a/src/providers/twitch/eventsub/Connection.hpp b/src/providers/twitch/eventsub/Connection.hpp index 2627b52b..b28ba649 100644 --- a/src/providers/twitch/eventsub/Connection.hpp +++ b/src/providers/twitch/eventsub/Connection.hpp @@ -15,38 +15,41 @@ class Connection final : public lib::Listener { public: void onSessionWelcome( - lib::messages::Metadata metadata, - lib::payload::session_welcome::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::session_welcome::Payload &payload) override; - void onNotification(lib::messages::Metadata metadata, + void onNotification(const lib::messages::Metadata &metadata, const boost::json::value &jv) override; - void onChannelBan(lib::messages::Metadata metadata, - lib::payload::channel_ban::v1::Payload payload) override; + void onChannelBan( + const lib::messages::Metadata &metadata, + const lib::payload::channel_ban::v1::Payload &payload) override; void onStreamOnline( - lib::messages::Metadata metadata, - lib::payload::stream_online::v1::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::stream_online::v1::Payload &payload) override; void onStreamOffline( - lib::messages::Metadata metadata, - lib::payload::stream_offline::v1::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::stream_offline::v1::Payload &payload) override; void onChannelChatNotification( - lib::messages::Metadata metadata, - lib::payload::channel_chat_notification::v1::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::channel_chat_notification::v1::Payload &payload) + override; void onChannelUpdate( - lib::messages::Metadata metadata, - lib::payload::channel_update::v1::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::channel_update::v1::Payload &payload) override; void onChannelChatMessage( - lib::messages::Metadata metadata, - lib::payload::channel_chat_message::v1::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::channel_chat_message::v1::Payload &payload) + override; void onChannelModerate( - lib::messages::Metadata metadata, - lib::payload::channel_moderate::v2::Payload payload) override; + const lib::messages::Metadata &metadata, + const lib::payload::channel_moderate::v2::Payload &payload) override; QString getSessionID() const;