mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-16 22:29:36 -05:00
Disconnect Twitch chat and event connection on plugin stop
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "twitch-helpers.hpp"
|
||||
|
||||
#include <log-helper.hpp>
|
||||
#include <plugin-state-helpers.hpp>
|
||||
|
||||
#undef DispatchMessage
|
||||
|
||||
@@ -339,6 +340,24 @@ static constexpr std::string_view defaultURL =
|
||||
std::map<TwitchChatConnection::ChatMapKey, std::weak_ptr<TwitchChatConnection>>
|
||||
TwitchChatConnection::_chatMap = {};
|
||||
|
||||
void TwitchChatConnection::DisconnectAll()
|
||||
{
|
||||
for (auto &[key, weakConn] : _chatMap) {
|
||||
auto conn = weakConn.lock();
|
||||
if (conn) {
|
||||
conn->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool setupChatConnectionSupport()
|
||||
{
|
||||
AddStopStep(TwitchChatConnection::DisconnectAll);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool _chatSetup = setupChatConnectionSupport();
|
||||
|
||||
TwitchChatConnection::TwitchChatConnection(const TwitchToken &token,
|
||||
const TwitchChannel &channel)
|
||||
: QObject(nullptr),
|
||||
|
||||
Reference in New Issue
Block a user