refactor: move seventv/bttv event apis to application (#5532)

This commit is contained in:
pajlada
2024-08-08 15:08:31 +02:00
committed by GitHub
parent 3257da1855
commit f0802af055
12 changed files with 133 additions and 97 deletions
+3 -30
View File
@@ -33,9 +33,6 @@ namespace {
using namespace chatterino;
const QString BTTV_LIVE_UPDATES_URL = "wss://sockets.betterttv.net/ws";
const QString SEVENTV_EVENTAPI_URL = "wss://events.7tv.io/v3";
void sendHelixMessage(const std::shared_ptr<TwitchChannel> &channel,
const QString &message, const QString &replyParentId = {})
{
@@ -145,20 +142,6 @@ TwitchIrcServer::TwitchIrcServer()
{
this->initializeIrc();
if (getSettings()->enableBTTVLiveUpdates &&
getSettings()->enableBTTVChannelEmotes)
{
this->bttvLiveUpdates =
std::make_unique<BttvLiveUpdates>(BTTV_LIVE_UPDATES_URL);
}
if (getSettings()->enableSevenTVEventAPI &&
getSettings()->enableSevenTVChannelEmotes)
{
this->seventvEventAPI =
std::make_unique<SeventvEventAPI>(SEVENTV_EVENTAPI_URL);
}
// getSettings()->twitchSeperateWriteConnection.connect([this](auto, auto) {
// this->connect(); },
// this->signalHolder_,
@@ -638,16 +621,6 @@ void TwitchIrcServer::onReplySendRequested(
sent = true;
}
std::unique_ptr<BttvLiveUpdates> &TwitchIrcServer::getBTTVLiveUpdates()
{
return this->bttvLiveUpdates;
}
std::unique_ptr<SeventvEventAPI> &TwitchIrcServer::getSeventvEventAPI()
{
return this->seventvEventAPI;
}
const IndirectChannel &TwitchIrcServer::getWatchingChannel() const
{
return this->watchingChannel;
@@ -759,7 +732,7 @@ void TwitchIrcServer::forEachSeventvUser(
void TwitchIrcServer::dropSeventvChannel(const QString &userID,
const QString &emoteSetID)
{
if (!this->seventvEventAPI)
if (!getApp()->getSeventvEventAPI())
{
return;
}
@@ -798,11 +771,11 @@ void TwitchIrcServer::dropSeventvChannel(const QString &userID,
if (!foundUser)
{
this->seventvEventAPI->unsubscribeUser(userID);
getApp()->getSeventvEventAPI()->unsubscribeUser(userID);
}
if (!foundSet)
{
this->seventvEventAPI->unsubscribeEmoteSet(emoteSetID);
getApp()->getSeventvEventAPI()->unsubscribeEmoteSet(emoteSetID);
}
}