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>())
, notifications(&this->emplace<NotificationController>())
, twitch2(&this->emplace<TwitchIrcServer>())
, twitch(&this->emplace<TwitchIrcServer>())
, chatterinoBadges(&this->emplace<ChatterinoBadges>())
, ffzBadges(&this->emplace<FfzBadges>())
, logging(&this->emplace<Logging>())
@ -71,9 +71,6 @@ Application::Application(Settings &_settings, Paths &_paths)
this->fonts->fontChanged.connect([this]() {
this->windows->layoutChannelViews();
});
this->twitch.server = this->twitch2;
this->twitch.pubsub = this->twitch2->pubsub;
}
void Application::initialize(Settings &settings, Paths &paths)
@ -147,7 +144,7 @@ int Application::run(QApplication &qtApp)
{
assert(isAppInitialized);
this->twitch.server->connect();
this->twitch->connect();
if (!getArgs().isFramelessEmbed)
{
@ -199,10 +196,9 @@ void Application::initNm(Paths &paths)
void Application::initPubsub()
{
this->twitch.pubsub->signals_.moderation.chatCleared.connect(
this->twitch->pubsub->signals_.moderation.chatCleared.connect(
[this](const auto &action) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
@ -283,10 +276,9 @@ void Application::initPubsub()
chan->addOrReplaceTimeout(msg);
});
});
this->twitch.pubsub->signals_.moderation.messageDeleted.connect(
this->twitch->pubsub->signals_.moderation.messageDeleted.connect(
[&](const auto &action) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
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) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
@ -376,10 +365,9 @@ void Application::initPubsub()
chan->deleteMessage(msg->id);
});
this->twitch.pubsub->signals_.moderation.automodInfoMessage.connect(
this->twitch->pubsub->signals_.moderation.automodInfoMessage.connect(
[&](const auto &action) {
auto chan =
this->twitch.server->getChannelOrEmptyByID(action.roomID);
auto chan = this->twitch->getChannelOrEmptyByID(action.roomID);
if (chan->isEmpty())
{
@ -392,36 +380,38 @@ void Application::initPubsub()
});
});
this->twitch.pubsub->signals_.pointReward.redeemed.connect([&](auto &data) {
QString channelId;
if (rj::getSafe(data, "channel_id", channelId))
{
auto chan = this->twitch.server->getChannelOrEmptyByID(channelId);
this->twitch->pubsub->signals_.pointReward.redeemed.connect(
[&](auto &data) {
QString channelId;
if (rj::getSafe(data, "channel_id", channelId))
{
auto chan = this->twitch->getChannelOrEmptyByID(channelId);
auto reward = ChannelPointReward(data);
auto reward = ChannelPointReward(data);
postToThread([chan, reward] {
if (auto channel = dynamic_cast<TwitchChannel *>(chan.get()))
{
channel->addChannelPointReward(reward);
}
});
}
else
{
qCDebug(chatterinoApp)
<< "Couldn't find channel id of point reward";
}
});
postToThread([chan, reward] {
if (auto channel =
dynamic_cast<TwitchChannel *>(chan.get()))
{
channel->addChannelPointReward(reward);
}
});
}
else
{
qCDebug(chatterinoApp)
<< "Couldn't find channel id of point reward";
}
});
this->twitch.pubsub->start();
this->twitch->pubsub->start();
auto RequestModerationActions = [=]() {
this->twitch.server->pubsub->unlistenAllModerationActions();
this->twitch->pubsub->unlistenAllModerationActions();
// 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());
};

View file

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

View file

@ -142,13 +142,13 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
}
// Bttv Global
for (auto &emote : *getApp()->twitch2->getBttvEmotes().emotes())
for (auto &emote : *getApp()->twitch->getBttvEmotes().emotes())
{
addString(emote.first.string, TaggedString::Type::BTTVChannelEmote);
}
// Ffz Global
for (auto &emote : *getApp()->twitch2->getFfzEmotes().emotes())
for (auto &emote : *getApp()->twitch->getFfzEmotes().emotes())
{
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
toSend.replace(ZERO_WIDTH_JOINER, ESCAPE_TAG);
app->twitch.server->sendMessage("jtv", toSend);
app->twitch->sendMessage("jtv", toSend);
}
bool appendWhisperMessageWordsLocally(const QStringList &words)
@ -68,8 +68,8 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
const auto &acc = app->accounts->twitch.getCurrent();
const auto &accemotes = *acc->accessEmotes();
const auto &bttvemotes = app->twitch.server->getBttvEmotes();
const auto &ffzemotes = app->twitch.server->getFfzEmotes();
const auto &bttvemotes = app->twitch->getBttvEmotes();
const auto &ffzemotes = app->twitch->getFfzEmotes();
auto flags = MessageElementFlags();
auto emote = boost::optional<EmotePtr>{};
for (int i = 2; i < words.length(); i++)
@ -136,14 +136,14 @@ bool appendWhisperMessageWordsLocally(const QStringList &words)
b->flags.set(MessageFlag::Whisper);
auto messagexD = b.release();
app->twitch.server->whispersChannel->addMessage(messagexD);
app->twitch->whispersChannel->addMessage(messagexD);
auto overrideFlags = boost::optional<MessageFlags>(messagexD->flags);
overrideFlags->set(MessageFlag::DoNotLog);
if (getSettings()->inlineWhispers)
{
app->twitch.server->forEachChannel(
app->twitch->forEachChannel(
[&messagexD, overrideFlags](ChannelPtr _channel) {
_channel->addMessage(messagexD, overrideFlags);
});
@ -501,7 +501,7 @@ void CommandController::initialize(Settings &, Paths &paths)
stripChannelName(channelName);
ChannelPtr channelTemp =
getApp()->twitch2->getChannelOrEmpty(channelName);
getApp()->twitch->getChannelOrEmpty(channelName);
if (channelTemp->isEmpty())
{
@ -723,7 +723,7 @@ void CommandController::initialize(Settings &, Paths &paths)
auto *split = new Split(static_cast<SplitContainer *>(
window.getNotebook().getOrAddSelectedPage()));
split->setChannel(app->twitch.server->getOrAddChannel(target));
split->setChannel(app->twitch->getOrAddChannel(target));
window.getNotebook().getOrAddSelectedPage()->appendSplit(split);
@ -907,7 +907,7 @@ void CommandController::initialize(Settings &, Paths &paths)
});
this->registerCommand("/raw", [](const QStringList &words, ChannelPtr) {
getApp()->twitch2->sendRawMessage(words.mid(1).join(" "));
getApp()->twitch->sendRawMessage(words.mid(1).join(" "));
return "";
});
#ifndef NDEBUG
@ -922,7 +922,7 @@ void CommandController::initialize(Settings &, Paths &paths)
return "";
}
auto ircText = words.mid(1).join(" ");
getApp()->twitch2->addFakeMessage(ircText);
getApp()->twitch->addFakeMessage(ircText);
return "";
});
#endif

View file

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

View file

@ -163,7 +163,7 @@ void NotificationController::fetchFakeChannels()
for (std::vector<int>::size_type i = 0;
i != channelMap[Platform::Twitch].raw().size(); i++)
{
auto chan = getApp()->twitch.server->getChannelOrEmpty(
auto chan = getApp()->twitch->getChannelOrEmpty(
channelMap[Platform::Twitch].raw()[i]);
if (chan->isEmpty())
{
@ -236,7 +236,7 @@ void NotificationController::checkStream(bool live, QString channelName)
}
MessageBuilder 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
fakeTwitchChannels.push_back(channelName);

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

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)

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()

View file

@ -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>{};

View file

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

View file

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

View file

@ -76,7 +76,7 @@ bool isInStreamerMode()
{
shouldShowWarning = false;
getApp()->twitch2->addGlobalSystemMessage(
getApp()->twitch->addGlobalSystemMessage(
"Streamer Mode is set to Automatic, but pgrep is missing. "
"Install it to fix the issue or set Streamer Mode to "
"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();
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;
auto app = getApp();
const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg);
app->twitch->addFakeMessage(msg);
return "";
});
@ -262,7 +262,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = cheerMessages;
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg);
getApp()->twitch->addFakeMessage(msg);
return "";
});
@ -271,7 +271,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
static int index = 0;
auto app = getApp();
const auto &msg = messages[index++ % messages.size()];
app->twitch.server->addFakeMessage(msg);
app->twitch->addFakeMessage(msg);
return "";
});
@ -282,15 +282,15 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
if (alt)
{
doc.Parse(channelRewardMessage);
app->twitch.server->addFakeMessage(channelRewardIRCMessage);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke(
app->twitch->addFakeMessage(channelRewardIRCMessage);
app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]);
alt = !alt;
}
else
{
doc.Parse(channelRewardMessage2);
app->twitch.pubsub->signals_.pointReward.redeemed.invoke(
app->twitch->pubsub->signals_.pointReward.redeemed.invoke(
doc["data"]["message"]["data"]["redemption"]);
alt = !alt;
}
@ -301,7 +301,7 @@ void Window::addDebugStuff(HotkeyController::HotkeyMap &actions)
const auto &messages = emoteTestMessages;
static int index = 0;
const auto &msg = messages[index++ % messages.size()];
getApp()->twitch.server->addFakeMessage(msg);
getApp()->twitch->addFakeMessage(msg);
return "";
});
#endif
@ -466,7 +466,7 @@ void Window::addShortcuts()
this->notebook_->select(splitContainer);
Split *split = new Split(splitContainer);
split->setChannel(
getApp()->twitch.server->getOrAddChannel(si.channelName));
getApp()->twitch->getOrAddChannel(si.channelName));
split->setFilters(si.filters);
splitContainer->appendSplit(split);
return "";

View file

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

View file

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

View file

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

View file

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

View file

@ -1016,15 +1016,15 @@ MessageElementFlags ChannelView::getFlags() const
{
flags.set(MessageElementFlag::ModeratorTools);
}
if (this->underlyingChannel_ == app->twitch.server->mentionsChannel ||
this->underlyingChannel_ == app->twitch.server->liveChannel)
if (this->underlyingChannel_ == app->twitch->mentionsChannel ||
this->underlyingChannel_ == app->twitch->liveChannel)
{
flags.set(MessageElementFlag::ChannelName);
flags.unset(MessageElementFlag::ChannelPointReward);
}
}
if (this->sourceChannel_ == app->twitch.server->mentionsChannel)
if (this->sourceChannel_ == app->twitch->mentionsChannel)
flags.set(MessageElementFlag::ChannelName);
return flags;
@ -1071,8 +1071,7 @@ void ChannelView::drawMessages(QPainter &painter)
bool windowFocused = this->window() == QApplication::activeWindow();
auto app = getApp();
bool isMentions =
this->underlyingChannel_ == app->twitch.server->mentionsChannel;
bool isMentions = this->underlyingChannel_ == app->twitch->mentionsChannel;
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");
}
if (auto bttvG = getApp()->twitch2->getBttvEmotes().emotes())
if (auto bttvG = getApp()->twitch->getBttvEmotes().emotes())
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");
addEmojis(emotes, getApp()->emotes->emojis.emojis, text);

View file

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

View file

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