chore: refactor TwitchIrcServer (#5421)
This commit is contained in:
@@ -236,14 +236,13 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
||||
}
|
||||
|
||||
postToThread([=] {
|
||||
auto *app = getApp();
|
||||
|
||||
if (!name.isEmpty())
|
||||
{
|
||||
auto channel = app->twitch->getOrAddChannel(name);
|
||||
if (app->twitch->watchingChannel.get() != channel)
|
||||
auto channel =
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name);
|
||||
if (getIApp()->getTwitch()->getWatchingChannel().get() != channel)
|
||||
{
|
||||
app->twitch->watchingChannel.reset(channel);
|
||||
getIApp()->getTwitch()->setWatchingChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +252,8 @@ void NativeMessagingServer::ReceiverThread::handleSelect(
|
||||
auto *window = AttachedWindow::getForeground(args);
|
||||
if (!name.isEmpty())
|
||||
{
|
||||
window->setChannel(app->twitch->getOrAddChannel(name));
|
||||
window->setChannel(
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -294,8 +294,6 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
auto *app = getApp();
|
||||
|
||||
std::vector<ChannelPtr> updated;
|
||||
updated.reserve(twitchChannels.size());
|
||||
for (const auto &value : twitchChannels)
|
||||
@@ -306,7 +304,8 @@ void NativeMessagingServer::syncChannels(const QJsonArray &twitchChannels)
|
||||
continue;
|
||||
}
|
||||
// the deduping is done on the extension side
|
||||
updated.emplace_back(app->twitch->getOrAddChannel(name));
|
||||
updated.emplace_back(
|
||||
getIApp()->getTwitchAbstract()->getOrAddChannel(name));
|
||||
}
|
||||
|
||||
// This will destroy channels that aren't used anymore.
|
||||
|
||||
Reference in New Issue
Block a user