added limit to cached username colors (#2515)

This commit is contained in:
fourtf
2021-03-13 15:34:11 +01:00
committed by GitHub
parent 1090524dec
commit 8a4ffc5f5b
9 changed files with 145 additions and 6 deletions
+6 -1
View File
@@ -3,6 +3,9 @@
#include "common/Channel.hpp"
#include "common/UniqueAccess.hpp"
#include "common/UsernameSet.hpp"
#include "util/QStringHash.hpp"
#include "lrucache/lrucache.hpp"
namespace chatterino {
@@ -22,11 +25,13 @@ public:
void setUserColor(const QString &user, const QColor &color);
private:
static constexpr int maxChatterColorCount = 5000;
Channel &channel_;
// maps 2 char prefix to set of names
UniqueAccess<UsernameSet> chatters_;
UniqueAccess<std::map<QString, QColor>> chatterColors_;
UniqueAccess<cache::lru_cache<QString, QRgb>> chatterColors_;
// combines multiple joins/parts into one message
UniqueAccess<QStringList> joinedUsers_;