chore: replace usages of obsolete twitch struct with backing field (#3614)

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
This commit is contained in:
James Upjohn
2022-03-20 00:02:29 +13:00
committed by GitHub
parent 4c275cb183
commit 67c10fafc7
23 changed files with 120 additions and 142 deletions
+1 -1
View File
@@ -195,7 +195,7 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message)
if (highlighted && showInMentions)
{
getApp()->twitch2->mentionsChannel->addMessage(msg);
getApp()->twitch->mentionsChannel->addMessage(msg);
}
}
else
+14 -14
View File
@@ -343,7 +343,7 @@ void IrcMessageHandler::handleRoomStateMessage(Communi::IrcMessage *message)
{
return;
}
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName);
auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get());
if (!twitchChannel)
@@ -404,7 +404,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
}
// get channel
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName);
auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
if (chan->isEmpty())
{
@@ -463,7 +463,7 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
}
// get channel
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName);
auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
if (chan->isEmpty())
{
@@ -510,7 +510,7 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
return;
}
auto c = getApp()->twitch.server->getChannelOrEmpty(channelName);
auto c = getApp()->twitch->getChannelOrEmpty(channelName);
if (c->isEmpty())
{
return;
@@ -565,7 +565,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
args.isReceivedWhisper = true;
auto c = getApp()->twitch.server->whispersChannel.get();
auto c = getApp()->twitch->whispersChannel.get();
TwitchMessageBuilder builder(
c, message, args,
@@ -581,11 +581,11 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
MessagePtr _message = builder.build();
builder.triggerHighlights();
getApp()->twitch.server->lastUserThatWhisperedMe.set(builder.userName);
getApp()->twitch->lastUserThatWhisperedMe.set(builder.userName);
if (_message->flags.has(MessageFlag::Highlighted))
{
getApp()->twitch.server->mentionsChannel->addMessage(_message);
getApp()->twitch->mentionsChannel->addMessage(_message);
}
c->addMessage(_message);
@@ -596,7 +596,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
if (getSettings()->inlineWhispers)
{
getApp()->twitch.server->forEachChannel(
getApp()->twitch->forEachChannel(
[&_message, overrideFlags](ChannelPtr channel) {
channel->addMessage(_message, overrideFlags);
});
@@ -797,7 +797,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
{
// Notice wasn't targeted at a single channel, send to all twitch
// channels
getApp()->twitch.server->forEachChannelAndSpecialChannels(
getApp()->twitch->forEachChannelAndSpecialChannels(
[msg](const auto &c) {
c->addMessage(msg);
});
@@ -805,7 +805,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
return;
}
auto channel = getApp()->twitch.server->getChannelOrEmpty(channelName);
auto channel = getApp()->twitch->getChannelOrEmpty(channelName);
if (channel->isEmpty())
{
@@ -887,8 +887,8 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
{
auto channel = getApp()->twitch.server->getChannelOrEmpty(
message->parameter(0).remove(0, 1));
auto channel =
getApp()->twitch->getChannelOrEmpty(message->parameter(0).remove(0, 1));
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (!twitchChannel)
@@ -906,8 +906,8 @@ void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
void IrcMessageHandler::handlePartMessage(Communi::IrcMessage *message)
{
auto channel = getApp()->twitch.server->getChannelOrEmpty(
message->parameter(0).remove(0, 1));
auto channel =
getApp()->twitch->getChannelOrEmpty(message->parameter(0).remove(0, 1));
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (!twitchChannel)
+6 -7
View File
@@ -482,7 +482,7 @@ bool TwitchChannel::canReconnect() const
void TwitchChannel::reconnect()
{
getApp()->twitch.server->connect();
getApp()->twitch->connect();
}
QString TwitchChannel::roomId() const
@@ -611,7 +611,7 @@ void TwitchChannel::setLive(bool newLiveStatus)
MessageBuilder builder2;
TwitchMessageBuilder::liveMessage(this->getDisplayName(),
&builder2);
getApp()->twitch2->liveChannel->addMessage(builder2.release());
getApp()->twitch->liveChannel->addMessage(builder2.release());
// Notify on all channels with a ping sound
if (getSettings()->notificationOnAnyChannel &&
@@ -631,7 +631,7 @@ void TwitchChannel::setLive(bool newLiveStatus)
// "delete" old 'CHANNEL is live' message
LimitedQueueSnapshot<MessagePtr> snapshot =
getApp()->twitch2->liveChannel->getMessageSnapshot();
getApp()->twitch->liveChannel->getMessageSnapshot();
int snapshotLength = snapshot.size();
// MSVC hates this code if the parens are not there
@@ -877,10 +877,9 @@ void TwitchChannel::refreshPubsub()
return;
auto account = getApp()->accounts->twitch.getCurrent();
getApp()->twitch2->pubsub->listenToChannelModerationActions(roomId,
account);
getApp()->twitch2->pubsub->listenToAutomod(roomId, account);
getApp()->twitch2->pubsub->listenToChannelPointRewards(roomId, account);
getApp()->twitch->pubsub->listenToChannelModerationActions(roomId, account);
getApp()->twitch->pubsub->listenToAutomod(roomId, account);
getApp()->twitch->pubsub->listenToChannelPointRewards(roomId, account);
}
void TwitchChannel::refreshChatters()
@@ -972,8 +972,8 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
{
auto *app = getApp();
const auto &globalBttvEmotes = app->twitch.server->getBttvEmotes();
const auto &globalFfzEmotes = app->twitch.server->getFfzEmotes();
const auto &globalBttvEmotes = app->twitch->getBttvEmotes();
const auto &globalFfzEmotes = app->twitch->getFfzEmotes();
auto flags = MessageElementFlags();
auto emote = boost::optional<EmotePtr>{};