Files
AyuGramDesktop/Telegram/SourceFiles/ayu/data/entities.h
T
2026-02-19 16:37:30 +03:00

138 lines
2.5 KiB
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, 2026
#pragma once
#include <string>
#define ID long long
class AyuMessageBase
{
public:
ID fakeId;
ID userId;
ID dialogId;
ID groupedId;
ID peerId;
ID fromId;
ID topicId;
int messageId;
int date;
int flags;
int editDate;
int views;
int fwdFlags;
ID fwdFromId;
std::string fwdName;
int fwdDate;
std::string fwdPostAuthor;
std::string postAuthor;
int replyFlags;
int replyMessageId;
ID replyPeerId;
int replyTopId;
bool replyForumTopic;
std::vector<char> replySerialized;
std::vector<char> replyMarkupSerialized;
int entityCreateDate;
std::string text;
std::vector<char> textEntities;
std::string mediaPath;
std::string hqThumbPath;
int documentType;
std::vector<char> documentSerialized;
std::vector<char> thumbsSerialized;
std::vector<char> documentAttributesSerialized;
std::string mimeType;
};
class DeletedMessage : public AyuMessageBase
{
};
class EditedMessage : public AyuMessageBase
{
};
class DeletedDialog
{
public:
ID fakeId;
ID userId;
ID dialogId;
ID peerId;
std::unique_ptr<int> folderId; // nullable
int topMessage;
int lastMessageDate;
int flags;
int entityCreateDate;
};
class RegexFilter
{
public:
std::vector<char> id;
std::string text;
bool enabled;
bool reversed;
bool caseInsensitive;
std::optional<ID> dialogId; // nullable
bool operator==(const RegexFilter &other) const {
return id == other.id &&
text == other.text &&
caseInsensitive == other.caseInsensitive &&
reversed == other.reversed &&
dialogId == other.dialogId &&
enabled == other.enabled;
}
[[nodiscard]] QJsonObject toJson() const {
QJsonObject json;
json["id"] = QString::fromUtf8(id.data());
json["text"] = QString::fromStdString(text);
json["enabled"] = enabled;
json["reversed"] = reversed;
json["caseInsensitive"] = caseInsensitive;
if (dialogId.has_value()) {
json["dialogId"] = dialogId.value();
}
return json;
}
};
class RegexFilterGlobalExclusion
{
public:
ID fakeId;
ID dialogId;
std::vector<char> filterId;
bool operator==(const RegexFilterGlobalExclusion& other) const {
return dialogId == other.dialogId && filterId == other.filterId;
}
};
class SpyMessageRead
{
public:
ID fakeId;
ID userId;
ID dialogId;
int messageId;
int entityCreateDate;
};
class SpyMessageContentsRead
{
public:
ID fakeId;
ID userId;
ID dialogId;
int messageId;
int entityCreateDate;
};