mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-11 11:47:09 +02:00
33 lines
784 B
C++
33 lines
784 B
C++
// This is the source code of AyuGram for Desktop.
|
|
//
|
|
// We do not and cannot prevent the use of our code,
|
|
// but be respectful and credit the original author.
|
|
//
|
|
// Copyright @Radolyn, 2023
|
|
#include "ayu_state.h"
|
|
|
|
namespace AyuState {
|
|
|
|
std::unordered_map<PeerId, std::unordered_set<MsgId>> hiddenMessages;
|
|
|
|
void hide(PeerId peerId, MsgId messageId) {
|
|
hiddenMessages[peerId].insert(messageId);
|
|
}
|
|
|
|
void hide(not_null<HistoryItem *> item) {
|
|
hide(item->history()->peer->id, item->id);
|
|
}
|
|
|
|
bool isHidden(PeerId peerId, MsgId messageId) {
|
|
const auto it = hiddenMessages.find(peerId);
|
|
if (it != hiddenMessages.end()) {
|
|
return it->second.contains(messageId);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool isHidden(not_null<HistoryItem *> item) {
|
|
return isHidden(item->history()->peer->id, item->id);
|
|
}
|
|
|
|
}
|