Merge branch 'master' into apa-bits

This commit is contained in:
fourtf
2019-09-08 18:02:58 +02:00
committed by GitHub
94 changed files with 1178 additions and 1640 deletions
+17 -10
View File
@@ -87,7 +87,6 @@ TwitchChannel::TwitchChannel(const QString &name,
, globalFfz_(ffz)
, bttvEmotes_(std::make_shared<EmoteMap>())
, ffzEmotes_(std::make_shared<EmoteMap>())
, ffzCustomModBadge_(name)
, mod_(false)
{
log("[TwitchChannel:{}] Opened", name);
@@ -113,6 +112,8 @@ TwitchChannel::TwitchChannel(const QString &name,
this->refreshLiveStatus();
this->refreshBadges();
this->refreshCheerEmotes();
this->refreshFFZChannelEmotes();
this->refreshBTTVChannelEmotes();
});
// timers
@@ -135,9 +136,7 @@ TwitchChannel::TwitchChannel(const QString &name,
void TwitchChannel::initialize()
{
this->refreshChatters();
this->refreshChannelEmotes();
this->refreshBadges();
this->ffzCustomModBadge_.loadCustomModBadge();
}
bool TwitchChannel::isEmpty() const
@@ -150,19 +149,30 @@ bool TwitchChannel::canSendMessage() const
return !this->isEmpty();
}
void TwitchChannel::refreshChannelEmotes()
void TwitchChannel::refreshBTTVChannelEmotes()
{
BttvEmotes::loadChannel(
this->getName(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
this->roomId(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
if (auto shared = weak.lock())
this->bttvEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
});
}
void TwitchChannel::refreshFFZChannelEmotes()
{
FfzEmotes::loadChannel(
this->getName(), [this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
this->roomId(),
[this, weak = weakOf<Channel>(this)](auto &&emoteMap) {
if (auto shared = weak.lock())
this->ffzEmotes_.set(
std::make_shared<EmoteMap>(std::move(emoteMap)));
},
[this, weak = weakOf<Channel>(this)](auto &&modBadge) {
if (auto shared = weak.lock())
{
this->ffzCustomModBadge_.set(std::move(modBadge));
}
});
}
@@ -818,10 +828,7 @@ boost::optional<EmotePtr> TwitchChannel::twitchBadge(
boost::optional<EmotePtr> TwitchChannel::ffzCustomModBadge() const
{
if (auto badge = this->ffzCustomModBadge_.badge())
return badge;
return boost::none;
return this->ffzCustomModBadge_.get();
}
boost::optional<CheerEmote> TwitchChannel::cheerEmote(const QString &string)