Respect follower emotes context, making them only available in their owner channels (#2951)

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-07-11 11:12:49 +02:00
committed by GitHub
parent 2844c8e7e0
commit d5add46730
14 changed files with 180 additions and 28 deletions
+16 -5
View File
@@ -10,6 +10,7 @@
#include "providers/twitch/TwitchIrcServer.hpp"
#include "singletons/Emotes.hpp"
#include "singletons/Settings.hpp"
#include "util/QStringHash.hpp"
#include <QtAlgorithms>
#include <utility>
@@ -96,14 +97,24 @@ void CompletionModel::refresh(const QString &prefix, bool isFirstWord)
if (auto channel = dynamic_cast<TwitchChannel *>(&this->channel_))
{
// account emotes
if (auto account = getApp()->accounts->twitch.getCurrent())
{
for (const auto &emote : account->accessEmotes()->allEmoteNames)
// Twitch Emotes available globally
for (const auto &emote : account->accessEmotes()->emotes)
{
// XXX: No way to discern between a twitch global emote and sub
// emote right now
addString(emote.string, TaggedString::Type::TwitchGlobalEmote);
addString(emote.first.string, TaggedString::TwitchGlobalEmote);
}
// Twitch Emotes available locally
auto localEmoteData = account->accessLocalEmotes();
if (localEmoteData->find(channel->roomId()) !=
localEmoteData->end())
{
for (const auto &emote : localEmoteData->at(channel->roomId()))
{
addString(emote.first.string,
TaggedString::Type::TwitchLocalEmote);
}
}
}