Reuse shared channel avatars in direct message conversations
This commit is contained in:
1 parent
b8ddf0f52d
commit
405755f06a
2 files changed
+12
-2
No files matched your search
@@ -118,6 +118,12 @@ QMap<quint64, QString> AvatarManager::servers() const {
|
||||
}
|
||||
|
||||
QImage AvatarManager::image(const QString& channel, quint64 owner) {
|
||||
if (!channel.toULongLong()) {
|
||||
quint64 selected = 0;
|
||||
for (const auto& ref : m_refs) if (ref.owner == owner && ref.server && !ref.hash.isEmpty() && (!selected || ref.group < selected))
|
||||
selected = ref.group;
|
||||
return selected ? image(QString::number(selected), owner) : QImage();
|
||||
}
|
||||
const QString context = key(channel.toULongLong(), owner); const Ref ref = m_refs.value(context);
|
||||
if (!m_ready || !ref.server || ref.hash.isEmpty()) return {};
|
||||
m_wanted.insert(context);
|
||||
|
||||
Reference in new issue
Block a user