Remove global third party emotes from TwitchChannel class (#3000)

Those are still accessible under getApp()->twitch2 instance.
This commit is contained in:
Paweł
2021-07-13 13:23:50 +02:00
committed by GitHub
parent 8c113c2311
commit c8c28d7f55
6 changed files with 11 additions and 28 deletions
+2 -2
View File
@@ -148,13 +148,13 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
} }
// Bttv Global // Bttv Global
for (auto &emote : *channel->globalBttv().emotes()) for (auto &emote : *getApp()->twitch2->getBttvEmotes().emotes())
{ {
addString(emote.first.string, TaggedString::Type::BTTVChannelEmote); addString(emote.first.string, TaggedString::Type::BTTVChannelEmote);
} }
// Ffz Global // Ffz Global
for (auto &emote : *channel->globalFfz().emotes()) for (auto &emote : *getApp()->twitch2->getFfzEmotes().emotes())
{ {
addString(emote.first.string, TaggedString::Type::FFZChannelEmote); addString(emote.first.string, TaggedString::Type::FFZChannelEmote);
} }
+1 -14
View File
@@ -144,8 +144,7 @@ namespace {
} }
} // namespace } // namespace
TwitchChannel::TwitchChannel(const QString &name, BttvEmotes &bttv, TwitchChannel::TwitchChannel(const QString &name)
FfzEmotes &ffz)
: Channel(name, Channel::Type::Twitch) : Channel(name, Channel::Type::Twitch)
, ChannelChatters(*static_cast<Channel *>(this)) , ChannelChatters(*static_cast<Channel *>(this))
, nameOptions{name, name} , nameOptions{name, name}
@@ -153,8 +152,6 @@ TwitchChannel::TwitchChannel(const QString &name, BttvEmotes &bttv,
, channelUrl_("https://twitch.tv/" + name) , channelUrl_("https://twitch.tv/" + name)
, popoutPlayerUrl_("https://player.twitch.tv/?parent=twitch.tv&channel=" + , popoutPlayerUrl_("https://player.twitch.tv/?parent=twitch.tv&channel=" +
name) name)
, globalBttv_(bttv)
, globalFfz_(ffz)
, bttvEmotes_(std::make_shared<EmoteMap>()) , bttvEmotes_(std::make_shared<EmoteMap>())
, ffzEmotes_(std::make_shared<EmoteMap>()) , ffzEmotes_(std::make_shared<EmoteMap>())
, mod_(false) , mod_(false)
@@ -499,16 +496,6 @@ SharedAccessGuard<const TwitchChannel::StreamStatus>
return this->streamStatus_.accessConst(); return this->streamStatus_.accessConst();
} }
const BttvEmotes &TwitchChannel::globalBttv() const
{
return this->globalBttv_;
}
const FfzEmotes &TwitchChannel::globalFfz() const
{
return this->globalFfz_;
}
boost::optional<EmotePtr> TwitchChannel::bttvEmote(const EmoteName &name) const boost::optional<EmotePtr> TwitchChannel::bttvEmote(const EmoteName &name) const
{ {
auto emotes = this->bttvEmotes_.get(); auto emotes = this->bttvEmotes_.get();
+1 -6
View File
@@ -87,8 +87,6 @@ public:
SharedAccessGuard<const StreamStatus> accessStreamStatus() const; SharedAccessGuard<const StreamStatus> accessStreamStatus() const;
// Emotes // Emotes
const BttvEmotes &globalBttv() const;
const FfzEmotes &globalFfz() const;
boost::optional<EmotePtr> bttvEmote(const EmoteName &name) const; boost::optional<EmotePtr> bttvEmote(const EmoteName &name) const;
boost::optional<EmotePtr> ffzEmote(const EmoteName &name) const; boost::optional<EmotePtr> ffzEmote(const EmoteName &name) const;
std::shared_ptr<const EmoteMap> bttvEmotes() const; std::shared_ptr<const EmoteMap> bttvEmotes() const;
@@ -127,8 +125,7 @@ private:
} nameOptions; } nameOptions;
protected: protected:
explicit TwitchChannel(const QString &channelName, BttvEmotes &globalBttv, explicit TwitchChannel(const QString &channelName);
FfzEmotes &globalFfz);
private: private:
// Methods // Methods
@@ -162,8 +159,6 @@ private:
UniqueAccess<RoomModes> roomModes_; UniqueAccess<RoomModes> roomModes_;
protected: protected:
BttvEmotes &globalBttv_;
FfzEmotes &globalFfz_;
Atomic<std::shared_ptr<const EmoteMap>> bttvEmotes_; Atomic<std::shared_ptr<const EmoteMap>> bttvEmotes_;
Atomic<std::shared_ptr<const EmoteMap>> ffzEmotes_; Atomic<std::shared_ptr<const EmoteMap>> ffzEmotes_;
Atomic<boost::optional<EmotePtr>> ffzCustomModBadge_; Atomic<boost::optional<EmotePtr>> ffzCustomModBadge_;
+2 -2
View File
@@ -90,8 +90,8 @@ void TwitchIrcServer::initializeConnection(IrcConnection *connection,
std::shared_ptr<Channel> TwitchIrcServer::createChannel( std::shared_ptr<Channel> TwitchIrcServer::createChannel(
const QString &channelName) const QString &channelName)
{ {
auto channel = std::shared_ptr<TwitchChannel>( auto channel =
new TwitchChannel(channelName, this->bttv, this->ffz)); std::shared_ptr<TwitchChannel>(new TwitchChannel(channelName));
channel->initialize(); channel->initialize();
channel->sendMessageSignal.connect( channel->sendMessageSignal.connect(
+3 -2
View File
@@ -7,6 +7,7 @@
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "messages/MessageBuilder.hpp" #include "messages/MessageBuilder.hpp"
#include "providers/twitch/TwitchChannel.hpp" #include "providers/twitch/TwitchChannel.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Emotes.hpp" #include "singletons/Emotes.hpp"
#include "singletons/WindowManager.hpp" #include "singletons/WindowManager.hpp"
#include "util/Shortcut.hpp" #include "util/Shortcut.hpp"
@@ -229,9 +230,9 @@ void EmotePopup::loadChannel(ChannelPtr _channel)
*globalChannel, *subChannel, _channel->getName()); *globalChannel, *subChannel, _channel->getName());
// global // global
addEmotes(*globalChannel, *twitchChannel->globalBttv().emotes(), addEmotes(*globalChannel, *getApp()->twitch2->getBttvEmotes().emotes(),
"BetterTTV", MessageElementFlag::BttvEmote); "BetterTTV", MessageElementFlag::BttvEmote);
addEmotes(*globalChannel, *twitchChannel->globalFfz().emotes(), addEmotes(*globalChannel, *getApp()->twitch2->getFfzEmotes().emotes(),
"FrankerFaceZ", MessageElementFlag::FfzEmote); "FrankerFaceZ", MessageElementFlag::FfzEmote);
// channel // channel
+2 -2
View File
@@ -104,9 +104,9 @@ void InputCompletionPopup::updateEmotes(const QString &text, ChannelPtr channel)
if (auto ffz = tc->ffzEmotes()) if (auto ffz = tc->ffzEmotes())
addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ"); addEmotes(emotes, *ffz, text, "Channel FrankerFaceZ");
if (auto bttvG = tc->globalBttv().emotes()) if (auto bttvG = getApp()->twitch2->getBttvEmotes().emotes())
addEmotes(emotes, *bttvG, text, "Global BetterTTV"); addEmotes(emotes, *bttvG, text, "Global BetterTTV");
if (auto ffzG = tc->globalFfz().emotes()) if (auto ffzG = getApp()->twitch2->getFfzEmotes().emotes())
addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ"); addEmotes(emotes, *ffzG, text, "Global FrankerFaceZ");
} }