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
+7 -2
View File
@@ -7,6 +7,7 @@
#include "controllers/accounts/Account.hpp"
#include "messages/Emote.hpp"
#include "providers/twitch/TwitchUser.hpp"
#include "util/QStringHash.hpp"
#include <rapidjson/document.h>
#include <QColor>
@@ -62,6 +63,7 @@ public:
QString key;
QString channelName;
QString text;
bool local{false};
std::vector<TwitchEmote> emotes;
};
@@ -70,8 +72,8 @@ public:
struct TwitchAccountEmoteData {
std::vector<std::shared_ptr<EmoteSet>> emoteSets;
std::vector<EmoteName> allEmoteNames;
// this EmoteMap should contain all emotes available globally
// excluding locally available emotes, such as follower ones
EmoteMap emotes;
};
@@ -118,6 +120,8 @@ public:
// Returns true if the newly inserted emote sets differ from the ones previously saved
[[nodiscard]] bool setUserstateEmoteSets(QStringList newEmoteSets);
SharedAccessGuard<const TwitchAccountEmoteData> accessEmotes() const;
SharedAccessGuard<const std::unordered_map<QString, EmoteMap>>
accessLocalEmotes() const;
// Automod actions
void autoModAllow(const QString msgID, ChannelPtr channel);
@@ -140,6 +144,7 @@ private:
// std::map<UserId, TwitchAccountEmoteData> emotes;
UniqueAccess<TwitchAccountEmoteData> emotes_;
UniqueAccess<std::unordered_map<QString, EmoteMap>> localEmotes_;
};
} // namespace chatterino