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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 120 additions and 142 deletions

View file

@ -61,7 +61,7 @@ Application::Application(Settings &_settings, Paths &_paths)
, commands(&this->emplace<CommandController>()) , commands(&this->emplace<CommandController>())
, notifications(&this->emplace<NotificationController>()) , notifications(&this->emplace<NotificationController>())
, twitch2(&this->emplace<TwitchIrcServer>()) , twitch(&this->emplace<TwitchIrcServer>())
, chatterinoBadges(&this->emplace<ChatterinoBadges>()) , chatterinoBadges(&this->emplace<ChatterinoBadges>())
, ffzBadges(&this->emplace<FfzBadges>()) , ffzBadges(&this->emplace<FfzBadges>())
, logging(&this->emplace<Logging>()) , logging(&this->emplace<Logging>())
@ -71,9 +71,6 @@ Application::Application(Settings &_settings, Paths &_paths)
this->fonts->fontChanged.connect([this]() { this->fonts->fontChanged.connect([this]() {
this->windows->layoutChannelViews(); this->windows->layoutChannelViews();
}); });
this->twitch.server = this->twitch2;
this->twitch.pubsub = this->twitch2->pubsub;
} }
void Application::initialize(Settings &settings, Paths &paths) void Application::initialize(Settings &settings, Paths &paths)
@ -147,7 +144,7 @@ int Application::run(QApplication &qtApp)
{ {
assert(isAppInitialized); assert(isAppInitialized);
this->twitch.server->connect(); this->twitch->connect();
if (!getArgs().isFramelessEmbed) if (!getArgs().isFramelessEmbed)
{ {
@ -199,10 +196,9 @@ void Application::initNm(Paths &paths)
void Application::initPubsub() void Application::initPubsub()
{ {
this->twitch.pubsub->signals_.moderation.chatCleared.connect( this->twitch->pubsub->signals_.moderation.chatCleared.connect(
[this](const auto &action) { [this](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
return; return;
@ -217,10 +213,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.modeChanged.connect( this->twitch->pubsub->signals_.moderation.modeChanged.connect(
[this](const auto &action) { [this](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
return; return;
@ -244,10 +239,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.moderationStateChanged.connect( this->twitch->pubsub->signals_.moderation.moderationStateChanged.connect(
[this](const auto &action) { [this](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
return; return;
@ -266,10 +260,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.userBanned.connect( this->twitch->pubsub->signals_.moderation.userBanned.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -283,10 +276,9 @@ void Application::initPubsub()
chan->addOrReplaceTimeout(msg); chan->addOrReplaceTimeout(msg);
}); });
}); });
this->twitch.pubsub->signals_.moderation.messageDeleted.connect( this->twitch->pubsub->signals_.moderation.messageDeleted.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty() || getSettings()->hideDeletionActions) if (chan->isEmpty() || getSettings()->hideDeletionActions)
{ {
@ -324,10 +316,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.userUnbanned.connect( this->twitch->pubsub->signals_.moderation.userUnbanned.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -341,10 +332,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.automodMessage.connect( this->twitch->pubsub->signals_.moderation.automodMessage.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -358,10 +348,9 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.moderation.automodUserMessage.connect( this->twitch->pubsub->signals_.moderation.automodUserMessage.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -376,10 +365,9 @@ void Application::initPubsub()
chan->deleteMessage(msg->id); chan->deleteMessage(msg->id);
}); });
this->twitch.pubsub->signals_.moderation.automodInfoMessage.connect( this->twitch->pubsub->signals_.moderation.automodInfoMessage.connect(
[&](const auto &action) { [&](const auto &action) {
auto chan = auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
this->twitch.server->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -392,36 +380,38 @@ void Application::initPubsub()
}); });
}); });
this->twitch.pubsub->signals_.pointReward.redeemed.connect([&](auto &data) { this->twitch->pubsub->signals_.pointReward.redeemed.connect(
QString channelId; [&](auto &data) {
if (rj::getSafe(data, "channel_id", channelId)) QString channelId;
{ if (rj::getSafe(data, "channel_id", channelId))
auto chan = this->twitch.server->getChannelOrEmptyByID(channelId); {
auto chan = this->twitch->getChannelOrEmptyByID(channelId);
auto reward = ChannelPointReward(data); auto reward = ChannelPointReward(data);
postToThread([chan, reward] { postToThread([chan, reward] {
if (auto channel = dynamic_cast<TwitchChannel *>(chan.get())) if (auto channel =
{ dynamic_cast<TwitchChannel *>(chan.get()))
channel->addChannelPointReward(reward); {
} channel->addChannelPointReward(reward);
}); }
} });
else }
{ else
qCDebug(chatterinoApp) {
<< "Couldn't find channel id of point reward"; qCDebug(chatterinoApp)
} << "Couldn't find channel id of point reward";
}); }
});
this->twitch.pubsub->start(); this->twitch->pubsub->start();
auto RequestModerationActions = [=]() { auto RequestModerationActions = [=]() {
this->twitch.server->pubsub->unlistenAllModerationActions(); this->twitch->pubsub->unlistenAllModerationActions();
// TODO(pajlada): Unlisten to all authed topics instead of only // TODO(pajlada): Unlisten to all authed topics instead of only
// moderation topics this->twitch.pubsub->UnlistenAllAuthedTopics(); // moderation topics this->twitch->pubsub->UnlistenAllAuthedTopics();
this->twitch.server->pubsub->listenToWhispers( this->twitch->pubsub->listenToWhispers(
this->accounts->twitch.getCurrent()); this->accounts->twitch.getCurrent());
}; };

View file

@ -58,18 +58,12 @@ public:
CommandController *const commands{}; CommandController *const commands{};
NotificationController *const notifications{}; NotificationController *const notifications{};
TwitchIrcServer *const twitch2{}; TwitchIrcServer *const twitch{};
ChatterinoBadges *const chatterinoBadges{}; ChatterinoBadges *const chatterinoBadges{};
FfzBadges *const ffzBadges{}; FfzBadges *const ffzBadges{};
/*[[deprecated]]*/ Logging *const logging{}; /*[[deprecated]]*/ Logging *const logging{};
/// Provider-specific
struct {
/*[[deprecated("use twitch2 instead")]]*/ TwitchIrcServer *server{};
/*[[deprecated("use twitch2->pubsub instead")]]*/ PubSub *pubsub{};
} twitch;
private: private:
void addSingleton(Singleton *singleton); void addSingleton(Singleton *singleton);
void initPubsub(); void initPubsub();

View file

@ -142,13 +142,13 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
} }
// Bttv Global // Bttv Global
for (auto &emote : *getApp()->twitch2->getBttvEmotes().emotes()) for (auto &emote : *getApp()->twitch->getBttvEmotes().emotes())
{ {
addString(emote.first.string, TaggedString::Type::BTTVChannelEmote); addString(emote.first.string, TaggedString::Type::BTTVChannelEmote);
} }
// Ffz Global // Ffz Global
for (auto &emote : *getApp()->twitch2->getFfzEmotes().emotes()) for (auto &emote : *getApp()->twitch->getFfzEmotes().emotes())
{ {
addString(emote.first.string, TaggedString::Type::FFZChannelEmote); addString(emote.first.string, TaggedString::Type::FFZChannelEmote);
} }

View file

@ -48,7 +48,7 @@ void sendWhisperMessage(const QString &text)
// Constants used here are defined in TwitchChannel.hpp // Constants used here are defined in TwitchChannel.hpp
toSend.replace(ZERO_WIDTH_JOINER, ESCAPE_TAG); toSend.replace(ZERO_WIDTH_JOINER, ESCAPE_TAG);
app->twitch.server->sendMessage("jtv", toSend); app->twitch->sendMessage("jtv", toSend);
} }
bool appendWhisperMessageWordsLocally(const QStringList &words) bool appendWhisperMessageWordsLocally(const QStringList &words)
@ -68,8 +68,8 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
const auto &acc = app->accounts->twitch.getCurrent(); const auto &acc = app->accounts->twitch.getCurrent();
const auto &accemotes = *acc->accessEmotes(); const auto &accemotes = *acc->accessEmotes();
const auto &bttvemotes = app->twitch.server->getBttvEmotes(); const auto &bttvemotes = app->twitch->getBttvEmotes();
const auto &ffzemotes = app->twitch.server->getFfzEmotes(); const auto &ffzemotes = app->twitch->getFfzEmotes();
auto flags = MessageElementFlags(); auto flags = MessageElementFlags();
auto emote = boost::optional<EmotePtr>{}; auto emote = boost::optional<EmotePtr>{};
for (int i = 2; i < words.length(); i++) for (int i = 2; i < words.length(); i++)
@ -136,14 +136,14 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
b->flags.set(MessageFlag::Whisper); b->flags.set(MessageFlag::Whisper);
auto messagexD = b.release(); auto messagexD = b.release();
app->twitch.server->whispersChannel->addMessage(messagexD); app->twitch->whispersChannel->addMessage(messagexD);
auto overrideFlags = boost::optional<MessageFlags>(messagexD->flags); auto overrideFlags = boost::optional<MessageFlags>(messagexD->flags);
overrideFlags->set(MessageFlag::DoNotLog); overrideFlags->set(MessageFlag::DoNotLog);
if (getSettings()->inlineWhispers) if (getSettings()->inlineWhispers)
{ {
app->twitch.server->forEachChannel( app->twitch->forEachChannel(
[&messagexD, overrideFlags](ChannelPtr _channel) { [&messagexD, overrideFlags](ChannelPtr _channel) {
_channel->addMessage(messagexD, overrideFlags); _channel->addMessage(messagexD, overrideFlags);
}); });
@ -501,7 +501,7 @@ void CommandController::initialize(Settings &, Paths &paths)
stripChannelName(channelName); stripChannelName(channelName);
ChannelPtr channelTemp = ChannelPtr channelTemp =
getApp()->twitch2->getChannelOrEmpty(channelName); getApp()->twitch->getChannelOrEmpty(channelName);
if (channelTemp->isEmpty()) if (channelTemp->isEmpty())
{ {
@ -723,7 +723,7 @@ void CommandController::initialize(Settings &, Paths &paths)
auto *split = new Split(static_cast<SplitContainer *>( auto *split = new Split(static_cast<SplitContainer *>(
window.getNotebook().getOrAddSelectedPage())); window.getNotebook().getOrAddSelectedPage()));
split->setChannel(app->twitch.server->getOrAddChannel(target)); split->setChannel(app->twitch->getOrAddChannel(target));
window.getNotebook().getOrAddSelectedPage()->appendSplit(split); window.getNotebook().getOrAddSelectedPage()->appendSplit(split);
@ -907,7 +907,7 @@ void CommandController::initialize(Settings &, Paths &paths)
}); });
this->registerCommand("/raw", [](const QStringList &words, ChannelPtr) { this->registerCommand("/raw", [](const QStringList &words, ChannelPtr) {
getApp()->twitch2->sendRawMessage(words.mid(1).join(" ")); getApp()->twitch->sendRawMessage(words.mid(1).join(" "));
return ""; return "";
}); });
#ifndef NDEBUG #ifndef NDEBUG
@ -922,7 +922,7 @@ void CommandController::initialize(Settings &, Paths &paths)
return ""; return "";
} }
auto ircText = words.mid(1).join(" "); auto ircText = words.mid(1).join(" ");
getApp()->twitch2->addFakeMessage(ircText); getApp()->twitch->addFakeMessage(ircText);
return ""; return "";
}); });
#endif #endif

View file

@ -9,8 +9,7 @@ namespace filterparser {
ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel) ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
{ {
auto watchingChannel = auto watchingChannel = chatterino::getApp()->twitch->watchingChannel.get();
chatterino::getApp()->twitch.server->watchingChannel.get();
/* Known Identifiers /* Known Identifiers
* *

View file

@ -163,7 +163,7 @@ void NotificationController::fetchFakeChannels()
for (std::vector<int>::size_type i = 0; for (std::vector<int>::size_type i = 0;
i != channelMap[Platform::Twitch].raw().size(); i++) i != channelMap[Platform::Twitch].raw().size(); i++)
{ {
auto chan = getApp()->twitch.server->getChannelOrEmpty( auto chan = getApp()->twitch->getChannelOrEmpty(
channelMap[Platform::Twitch].raw()[i]); channelMap[Platform::Twitch].raw()[i]);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -236,7 +236,7 @@ void NotificationController::checkStream(bool live, QString channelName)
} }
MessageBuilder builder; MessageBuilder builder;
TwitchMessageBuilder::liveMessage(channelName, &builder); TwitchMessageBuilder::liveMessage(channelName, &builder);
getApp()->twitch2->liveChannel->addMessage(builder.release()); getApp()->twitch->liveChannel->addMessage(builder.release());
// Indicate that we have pushed notifications for this stream // Indicate that we have pushed notifications for this stream
fakeTwitchChannels.push_back(channelName); fakeTwitchChannels.push_back(channelName);

View file

@ -195,7 +195,7 @@ void IrcServer::privateMessageReceived(Communi::IrcPrivateMessage *message)
if (highlighted && showInMentions) if (highlighted && showInMentions)
{ {
getApp()->twitch2->mentionsChannel->addMessage(msg); getApp()->twitch->mentionsChannel->addMessage(msg);
} }
} }
else else

View file

@ -343,7 +343,7 @@ void IrcMessageHandler::handleRoomStateMessage(Communi::IrcMessage *message)
{ {
return; return;
} }
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName); auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get()); auto *twitchChannel = dynamic_cast<TwitchChannel *>(chan.get());
if (!twitchChannel) if (!twitchChannel)
@ -404,7 +404,7 @@ void IrcMessageHandler::handleClearChatMessage(Communi::IrcMessage *message)
} }
// get channel // get channel
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName); auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -463,7 +463,7 @@ void IrcMessageHandler::handleClearMessageMessage(Communi::IrcMessage *message)
} }
// get channel // get channel
auto chan = getApp()->twitch.server->getChannelOrEmpty(chanName); auto chan = getApp()->twitch->getChannelOrEmpty(chanName);
if (chan->isEmpty()) if (chan->isEmpty())
{ {
@ -510,7 +510,7 @@ void IrcMessageHandler::handleUserStateMessage(Communi::IrcMessage *message)
return; return;
} }
auto c = getApp()->twitch.server->getChannelOrEmpty(channelName); auto c = getApp()->twitch->getChannelOrEmpty(channelName);
if (c->isEmpty()) if (c->isEmpty())
{ {
return; return;
@ -565,7 +565,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
args.isReceivedWhisper = true; args.isReceivedWhisper = true;
auto c = getApp()->twitch.server->whispersChannel.get(); auto c = getApp()->twitch->whispersChannel.get();
TwitchMessageBuilder builder( TwitchMessageBuilder builder(
c, message, args, c, message, args,
@ -581,11 +581,11 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
MessagePtr _message = builder.build(); MessagePtr _message = builder.build();
builder.triggerHighlights(); builder.triggerHighlights();
getApp()->twitch.server->lastUserThatWhisperedMe.set(builder.userName); getApp()->twitch->lastUserThatWhisperedMe.set(builder.userName);
if (_message->flags.has(MessageFlag::Highlighted)) if (_message->flags.has(MessageFlag::Highlighted))
{ {
getApp()->twitch.server->mentionsChannel->addMessage(_message); getApp()->twitch->mentionsChannel->addMessage(_message);
} }
c->addMessage(_message); c->addMessage(_message);
@ -596,7 +596,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message)
if (getSettings()->inlineWhispers) if (getSettings()->inlineWhispers)
{ {
getApp()->twitch.server->forEachChannel( getApp()->twitch->forEachChannel(
[&_message, overrideFlags](ChannelPtr channel) { [&_message, overrideFlags](ChannelPtr channel) {
channel->addMessage(_message, overrideFlags); 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 // Notice wasn't targeted at a single channel, send to all twitch
// channels // channels
getApp()->twitch.server->forEachChannelAndSpecialChannels( getApp()->twitch->forEachChannelAndSpecialChannels(
[msg](const auto &c) { [msg](const auto &c) {
c->addMessage(msg); c->addMessage(msg);
}); });
@ -805,7 +805,7 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
return; return;
} }
auto channel = getApp()->twitch.server->getChannelOrEmpty(channelName); auto channel = getApp()->twitch->getChannelOrEmpty(channelName);
if (channel->isEmpty()) if (channel->isEmpty())
{ {
@ -887,8 +887,8 @@ void IrcMessageHandler::handleNoticeMessage(Communi::IrcNoticeMessage *message)
void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message) void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
{ {
auto channel = getApp()->twitch.server->getChannelOrEmpty( auto channel =
message->parameter(0).remove(0, 1)); getApp()->twitch->getChannelOrEmpty(message->parameter(0).remove(0, 1));
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()); auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (!twitchChannel) if (!twitchChannel)
@ -906,8 +906,8 @@ void IrcMessageHandler::handleJoinMessage(Communi::IrcMessage *message)
void IrcMessageHandler::handlePartMessage(Communi::IrcMessage *message) void IrcMessageHandler::handlePartMessage(Communi::IrcMessage *message)
{ {
auto channel = getApp()->twitch.server->getChannelOrEmpty( auto channel =
message->parameter(0).remove(0, 1)); getApp()->twitch->getChannelOrEmpty(message->parameter(0).remove(0, 1));
auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()); auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (!twitchChannel) if (!twitchChannel)

View file

@ -482,7 +482,7 @@ bool TwitchChannel::canReconnect() const
void TwitchChannel::reconnect() void TwitchChannel::reconnect()
{ {
getApp()->twitch.server->connect(); getApp()->twitch->connect();
} }
QString TwitchChannel::roomId() const QString TwitchChannel::roomId() const
@ -611,7 +611,7 @@ void TwitchChannel::setLive(bool newLiveStatus)
MessageBuilder builder2; MessageBuilder builder2;
TwitchMessageBuilder::liveMessage(this->getDisplayName(), TwitchMessageBuilder::liveMessage(this->getDisplayName(),
&builder2); &builder2);
getApp()->twitch2->liveChannel->addMessage(builder2.release()); getApp()->twitch->liveChannel->addMessage(builder2.release());
// Notify on all channels with a ping sound // Notify on all channels with a ping sound
if (getSettings()->notificationOnAnyChannel && if (getSettings()->notificationOnAnyChannel &&
@ -631,7 +631,7 @@ void TwitchChannel::setLive(bool newLiveStatus)
// "delete" old 'CHANNEL is live' message // "delete" old 'CHANNEL is live' message
LimitedQueueSnapshot<MessagePtr> snapshot = LimitedQueueSnapshot<MessagePtr> snapshot =
getApp()->twitch2->liveChannel->getMessageSnapshot(); getApp()->twitch->liveChannel->getMessageSnapshot();
int snapshotLength = snapshot.size(); int snapshotLength = snapshot.size();
// MSVC hates this code if the parens are not there // MSVC hates this code if the parens are not there
@ -877,10 +877,9 @@ void TwitchChannel::refreshPubsub()
return; return;
auto account = getApp()->accounts->twitch.getCurrent(); auto account = getApp()->accounts->twitch.getCurrent();
getApp()->twitch2->pubsub->listenToChannelModerationActions(roomId, getApp()->twitch->pubsub->listenToChannelModerationActions(roomId, account);
account); getApp()->twitch->pubsub->listenToAutomod(roomId, account);
getApp()->twitch2->pubsub->listenToAutomod(roomId, account); getApp()->twitch->pubsub->listenToChannelPointRewards(roomId, account);
getApp()->twitch2->pubsub->listenToChannelPointRewards(roomId, account);
} }
void TwitchChannel::refreshChatters() void TwitchChannel::refreshChatters()

View file

@ -972,8 +972,8 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
{ {
auto *app = getApp(); auto *app = getApp();
const auto &globalBttvEmotes = app->twitch.server->getBttvEmotes(); const auto &globalBttvEmotes = app->twitch->getBttvEmotes();
const auto &globalFfzEmotes = app->twitch.server->getFfzEmotes(); const auto &globalFfzEmotes = app->twitch->getFfzEmotes();
auto flags = MessageElementFlags(); auto flags = MessageElementFlags();
auto emote = boost::optional<EmotePtr>{}; auto emote = boost::optional<EmotePtr>{};

View file

@ -240,8 +240,8 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
postToThread([=] { postToThread([=] {
if (!name.isEmpty()) if (!name.isEmpty())
{ {
app->twitch.server->watchingChannel.reset( app->twitch->watchingChannel.reset(
app->twitch.server->getOrAddChannel(name)); app->twitch->getOrAddChannel(name));
} }
if (attach || attachFullscreen) if (attach || attachFullscreen)
@ -252,8 +252,7 @@ void NativeMessagingServer::ReceiverThread::handleMessage(
AttachedWindow::get(::GetForegroundWindow(), args); AttachedWindow::get(::GetForegroundWindow(), args);
if (!name.isEmpty()) if (!name.isEmpty())
{ {
window->setChannel( window->setChannel(app->twitch->getOrAddChannel(name));
app->twitch.server->getOrAddChannel(name));
} }
// } // }
// window->show(); // window->show();

View file

@ -605,23 +605,23 @@ IndirectChannel WindowManager::decodeChannel(const SplitDescriptor &descriptor)
if (descriptor.type_ == "twitch") if (descriptor.type_ == "twitch")
{ {
return app->twitch.server->getOrAddChannel(descriptor.channelName_); return app->twitch->getOrAddChannel(descriptor.channelName_);
} }
else if (descriptor.type_ == "mentions") else if (descriptor.type_ == "mentions")
{ {
return app->twitch.server->mentionsChannel; return app->twitch->mentionsChannel;
} }
else if (descriptor.type_ == "watching") else if (descriptor.type_ == "watching")
{ {
return app->twitch.server->watchingChannel; return app->twitch->watchingChannel;
} }
else if (descriptor.type_ == "whispers") else if (descriptor.type_ == "whispers")
{ {
return app->twitch.server->whispersChannel; return app->twitch->whispersChannel;
} }
else if (descriptor.type_ == "live") else if (descriptor.type_ == "live")
{ {
return app->twitch.server->liveChannel; return app->twitch->liveChannel;
} }
else if (descriptor.type_ == "irc") else if (descriptor.type_ == "irc")
{ {

View file

@ -76,7 +76,7 @@ bool isInStreamerMode()
{ {
shouldShowWarning = false; shouldShowWarning = false;
getApp()->twitch2->addGlobalSystemMessage( getApp()->twitch->addGlobalSystemMessage(
"Streamer Mode is set to Automatic, but pgrep is missing. " "Streamer Mode is set to Automatic, but pgrep is missing. "
"Install it to fix the issue or set Streamer Mode to " "Install it to fix the issue or set Streamer Mode to "
"Enabled or Disabled in the Settings."); "Enabled or Disabled in the Settings.");

View file

@ -49,7 +49,7 @@ bool FramelessEmbedWindow::nativeEvent(const QByteArray &eventType,
auto channelName = root.value("channel-name").toString(); auto channelName = root.value("channel-name").toString();
this->split_->setChannel( this->split_->setChannel(
getApp()->twitch2->getOrAddChannel(channelName)); getApp()->twitch->getOrAddChannel(channelName));
} }
} }
} }

View file

@ -254,7 +254,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
static int index = 0; static int index = 0;
auto app = getApp(); auto app = getApp();
const auto &msg = messages[index++ % messages.size()]; const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg); app->twitch->addFakeMessage(msg);
return ""; return "";
}); });
@ -262,7 +262,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = cheerMessages; const auto &messages = cheerMessages;
static int index = 0; static int index = 0;
const auto &msg = messages[index++ % messages.size()]; const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg); getApp()->twitch->addFakeMessage(msg);
return ""; return "";
}); });
@ -271,7 +271,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
static int index = 0; static int index = 0;
auto app = getApp(); auto app = getApp();
const auto &msg = messages[index++ % messages.size()]; const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg); app->twitch->addFakeMessage(msg);
return ""; return "";
}); });
@ -282,15 +282,15 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
if (alt) if (alt)
{ {
doc.Parse(channelRewardMessage); doc.Parse(channelRewardMessage);
app->twitch.server->addFakeMessage(channelRewardIRCMessage); app->twitch->addFakeMessage(channelRewardIRCMessage);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke( app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]); doc["data"]["message"]["data"]["redemption"]);
alt = !alt; alt = !alt;
} }
else else
{ {
doc.Parse(channelRewardMessage2); doc.Parse(channelRewardMessage2);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke( app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]); doc["data"]["message"]["data"]["redemption"]);
alt = !alt; alt = !alt;
} }
@ -301,7 +301,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = emoteTestMessages; const auto &messages = emoteTestMessages;
static int index = 0; static int index = 0;
const auto &msg = messages[index++ % messages.size()]; const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg); getApp()->twitch->addFakeMessage(msg);
return ""; return "";
}); });
#endif #endif
@ -466,7 +466,7 @@ void Window::addShortcuts()
this->notebook_->select(splitContainer); this->notebook_->select(splitContainer);
Split *split = new Split(splitContainer); Split *split = new Split(splitContainer);
split->setChannel( split->setChannel(
getApp()->twitch.server->getOrAddChannel(si.channelName)); getApp()->twitch->getOrAddChannel(si.channelName));
split->setFilters(si.filters); split->setFilters(si.filters);
splitContainer->appendSplit(split); splitContainer->appendSplit(split);
return ""; return "";

View file

@ -341,9 +341,9 @@ void EmotePopup::loadChannel(ChannelPtr channel)
*globalChannel, *subChannel, this->channel_->getName()); *globalChannel, *subChannel, this->channel_->getName());
// global // global
addEmotes(*globalChannel, *getApp()->twitch2->getBttvEmotes().emotes(), addEmotes(*globalChannel, *getApp()->twitch->getBttvEmotes().emotes(),
"BetterTTV", MessageElementFlag::BttvEmote); "BetterTTV", MessageElementFlag::BttvEmote);
addEmotes(*globalChannel, *getApp()->twitch2->getFfzEmotes().emotes(), addEmotes(*globalChannel, *getApp()->twitch->getFfzEmotes().emotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote); "FrankerFaceZ", MessageElementFlag::FfzEmote);
// channel // channel
@ -406,9 +406,9 @@ void EmotePopup::filterTwitchEmotes(std::shared_ptr<Channel> searchChannel,
} }
auto bttvGlobalEmotes = this->filterEmoteMap( auto bttvGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch2->getBttvEmotes().emotes()); searchText, getApp()->twitch->getBttvEmotes().emotes());
auto ffzGlobalEmotes = this->filterEmoteMap( auto ffzGlobalEmotes = this->filterEmoteMap(
searchText, getApp()->twitch2->getFfzEmotes().emotes()); searchText, getApp()->twitch->getFfzEmotes().emotes());
// twitch // twitch
addEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel, addEmoteSets(twitchGlobalEmotes, *searchChannel, *searchChannel,

View file

@ -350,24 +350,24 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
case TAB_TWITCH: { case TAB_TWITCH: {
if (this->ui_.twitch.channel->isChecked()) if (this->ui_.twitch.channel->isChecked())
{ {
return app->twitch.server->getOrAddChannel( return app->twitch->getOrAddChannel(
this->ui_.twitch.channelName->text().trimmed()); this->ui_.twitch.channelName->text().trimmed());
} }
else if (this->ui_.twitch.watching->isChecked()) else if (this->ui_.twitch.watching->isChecked())
{ {
return app->twitch.server->watchingChannel; return app->twitch->watchingChannel;
} }
else if (this->ui_.twitch.mentions->isChecked()) else if (this->ui_.twitch.mentions->isChecked())
{ {
return app->twitch.server->mentionsChannel; return app->twitch->mentionsChannel;
} }
else if (this->ui_.twitch.whispers->isChecked()) else if (this->ui_.twitch.whispers->isChecked())
{ {
return app->twitch.server->whispersChannel; return app->twitch->whispersChannel;
} }
else if (this->ui_.twitch.live->isChecked()) else if (this->ui_.twitch.live->isChecked())
{ {
return app->twitch.server->liveChannel; return app->twitch->liveChannel;
} }
} }
break; break;

View file

@ -301,7 +301,7 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent)
auto split = window.getNotebook() auto split = window.getNotebook()
.getOrAddSelectedPage() .getOrAddSelectedPage()
->appendNewSplit(false); ->appendNewSplit(false);
split->setChannel(app->twitch2->getOrAddChannel( split->setChannel(app->twitch->getOrAddChannel(
loginName.toLower())); loginName.toLower()));
}); });

View file

@ -25,8 +25,7 @@ void NewTabItem::action()
SplitContainer *container = nb.addPage(true); SplitContainer *container = nb.addPage(true);
Split *split = new Split(container); Split *split = new Split(container);
split->setChannel( split->setChannel(getApp()->twitch->getOrAddChannel(this->channelName_));
getApp()->twitch.server->getOrAddChannel(this->channelName_));
container->appendSplit(split); container->appendSplit(split);
} }

View file

@ -1016,15 +1016,15 @@ MessageElementFlags ChannelView::getFlags() const
{ {
flags.set(MessageElementFlag::ModeratorTools); flags.set(MessageElementFlag::ModeratorTools);
} }
if (this->underlyingChannel_ == app->twitch.server->mentionsChannel || if (this->underlyingChannel_ == app->twitch->mentionsChannel ||
this->underlyingChannel_ == app->twitch.server->liveChannel) this->underlyingChannel_ == app->twitch->liveChannel)
{ {
flags.set(MessageElementFlag::ChannelName); flags.set(MessageElementFlag::ChannelName);
flags.unset(MessageElementFlag::ChannelPointReward); flags.unset(MessageElementFlag::ChannelPointReward);
} }
} }
if (this->sourceChannel_ == app->twitch.server->mentionsChannel) if (this->sourceChannel_ == app->twitch->mentionsChannel)
flags.set(MessageElementFlag::ChannelName); flags.set(MessageElementFlag::ChannelName);
return flags; return flags;
@ -1071,8 +1071,7 @@ void ChannelView::drawMessages(QPainter &painter)
bool windowFocused = this->window() == QApplication::activeWindow(); bool windowFocused = this->window() == QApplication::activeWindow();
auto app = getApp(); auto app = getApp();
bool isMentions = bool isMentions = this->underlyingChannel_ == app->twitch->mentionsChannel;
this->underlyingChannel_ == app->twitch.server->mentionsChannel;
for (size_t i = start; i < messagesSnapshot.size(); ++i) for (size_t i = start; i < messagesSnapshot.size(); ++i)
{ {

View file

@ -106,9 +106,9 @@ void InputCompletionPopup::updateEmotes(const QString &text, ChannelPtr channel)
addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ"); addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ");
} }
if (auto bttvG = getApp()->twitch2->getBttvEmotes().emotes()) if (auto bttvG = getApp()->twitch->getBttvEmotes().emotes())
addEmotes(emotes, *bttvG, text, "Global BetterTTV"); addEmotes(emotes, *bttvG, text, "Global BetterTTV");
if (auto ffzG = getApp()->twitch2->getFfzEmotes().emotes()) if (auto ffzG = getApp()->twitch->getFfzEmotes().emotes())
addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ"); addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ");
addEmojis(emotes, getApp()->emotes->emojis.emojis, text); addEmojis(emotes, getApp()->emotes->emojis.emojis, text);

View file

@ -125,8 +125,7 @@ Split::Split(QWidget *parent)
this->view_->openChannelIn.connect([this]( this->view_->openChannelIn.connect([this](
QString twitchChannel, QString twitchChannel,
FromTwitchLinkOpenChannelIn openIn) { FromTwitchLinkOpenChannelIn openIn) {
ChannelPtr channel = ChannelPtr channel = getApp()->twitch->getOrAddChannel(twitchChannel);
getApp()->twitch.server->getOrAddChannel(twitchChannel);
switch (openIn) switch (openIn)
{ {
case FromTwitchLinkOpenChannelIn::Split: case FromTwitchLinkOpenChannelIn::Split:

View file

@ -687,7 +687,7 @@ void SplitInput::editTextChanged()
if (text.startsWith("/r ", Qt::CaseInsensitive) && if (text.startsWith("/r ", Qt::CaseInsensitive) &&
this->split_->getChannel()->isTwitchChannel()) this->split_->getChannel()->isTwitchChannel())
{ {
QString lastUser = app->twitch.server->lastUserThatWhisperedMe.get(); QString lastUser = app->twitch->lastUserThatWhisperedMe.get();
if (!lastUser.isEmpty()) if (!lastUser.isEmpty())
{ {
this->ui_.textEdit->setPlainText("/w " + lastUser + text.mid(2)); this->ui_.textEdit->setPlainText("/w " + lastUser + text.mid(2));