Refactor 7TV EventAPI (#4342)

* refactor: remove file prefix

* refactor: put eventapi into a namespace

* refactor: support multiple conditions

* fix: handle ack

* docs: add changelog entry

* fix: unsubscribe in destructor

* fix: naming of parameter

* fix: namespaces

* chore: casing

* fix: missing namespace

---------

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
nerix
2023-02-04 13:42:52 +01:00
committed by GitHub
parent 6516116244
commit 0c74ab17ed
23 changed files with 580 additions and 493 deletions
+16 -15
View File
@@ -18,7 +18,7 @@
#include "providers/bttv/BttvLiveUpdates.hpp"
#include "providers/bttv/liveupdates/BttvLiveUpdateMessages.hpp"
#include "providers/RecentMessagesApi.hpp"
#include "providers/seventv/eventapi/SeventvEventAPIDispatch.hpp"
#include "providers/seventv/eventapi/Dispatch.hpp"
#include "providers/seventv/SeventvEmotes.hpp"
#include "providers/seventv/SeventvEventAPI.hpp"
#include "providers/twitch/api/Helix.hpp"
@@ -121,16 +121,6 @@ TwitchChannel::TwitchChannel(const QString &name)
this->loadRecentMessagesReconnect();
});
this->destroyed.connect([this]() {
getApp()->twitch->dropSeventvChannel(this->seventvUserID_,
this->seventvEmoteSetID_);
if (getApp()->twitch->bttvLiveUpdates)
{
getApp()->twitch->bttvLiveUpdates->partChannel(this->roomId());
}
});
this->messageRemovedFromStart.connect([this](MessagePtr &msg) {
if (msg->replyThread)
{
@@ -169,6 +159,17 @@ TwitchChannel::TwitchChannel(const QString &name)
#endif
}
TwitchChannel::~TwitchChannel()
{
getApp()->twitch->dropSeventvChannel(this->seventvUserID_,
this->seventvEmoteSetID_);
if (getApp()->twitch->bttvLiveUpdates)
{
getApp()->twitch->bttvLiveUpdates->partChannel(this->roomId());
}
}
void TwitchChannel::initialize()
{
this->fetchDisplayName();
@@ -691,7 +692,7 @@ void TwitchChannel::removeBttvEmote(
}
void TwitchChannel::addSeventvEmote(
const SeventvEventAPIEmoteAddDispatch &dispatch)
const seventv::eventapi::EmoteAddDispatch &dispatch)
{
if (!SeventvEmotes::addEmote(this->seventvEmotes_, dispatch))
{
@@ -703,7 +704,7 @@ void TwitchChannel::addSeventvEmote(
}
void TwitchChannel::updateSeventvEmote(
const SeventvEventAPIEmoteUpdateDispatch &dispatch)
const seventv::eventapi::EmoteUpdateDispatch &dispatch)
{
if (!SeventvEmotes::updateEmote(this->seventvEmotes_, dispatch))
{
@@ -717,7 +718,7 @@ void TwitchChannel::updateSeventvEmote(
}
void TwitchChannel::removeSeventvEmote(
const SeventvEventAPIEmoteRemoveDispatch &dispatch)
const seventv::eventapi::EmoteRemoveDispatch &dispatch)
{
auto removed = SeventvEmotes::removeEmote(this->seventvEmotes_, dispatch);
if (!removed)
@@ -730,7 +731,7 @@ void TwitchChannel::removeSeventvEmote(
}
void TwitchChannel::updateSeventvUser(
const SeventvEventAPIUserConnectionUpdateDispatch &dispatch)
const seventv::eventapi::UserConnectionUpdateDispatch &dispatch)
{
if (dispatch.connectionIndex != this->seventvUserTwitchConnectionIndex_)
{