AyuGramDesktop/Telegram/SourceFiles/ayu/ayu_state.cpp
ZavaruKitsu 8d93b21947 feat: message details
feat: rework `Hide`
feat: context menu configuration
2024-01-01 19:28:48 +03:00

38 lines
794 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)
{
auto it = hiddenMessages.find(peerId);
if (it != hiddenMessages.end()) {
return it->second.find(messageId) != it->second.end();
}
return false;
}
bool isHidden(not_null<HistoryItem *> item)
{
return isHidden(item->history()->peer->id, item->id);
}
}