TelegramTUI/inc/chat.h

67 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
#include <string>
enum class ChatType : uint32_t {
UNKNOWN = 0,
GROUP = 1,
PRIVATE,
SECRET,
SUPERGROUP,
CHANNEL
};
struct SupergroupInfo {
std::string username;
int64_t created;
bool signMessages;
bool verified;
std::string restriction;
bool scam;
bool fake;
};
struct Chat {
//basic information
int64_t id;
int64_t supergroupid; //diffrent than id
ChatType type;
std::string title;
bool hasPhoto;
//full information
std::string description;
uint32_t memberCount;
uint32_t adminCount;
uint32_t restrictedCount;
uint32_t bannedCount;
int64_t linkedGroupId;
uint32_t slowmode;
uint64_t slowModeExpiresTS; //timestamp, when slow mode ends
int64_t sitckerSetId; // 0 = none
std::string link = ""; //invite link, may be empty
//loacation
bool hasLocation = false;
std::string address = "";
double latitude = 0;
double longitude = 0;
double locationAccourcay = 0;
//other supergroupInforation
SupergroupInfo* moreinfo = nullptr;
};
struct ChatIdentifier {
int64_t chatid = 0;
std::string username = "";
bool operator<(const ChatIdentifier& rhs) const;
bool operator<(const int64_t rhs) const;
};
bool constexpr operator<(const int64_t l, const ChatIdentifier& rhs) {
return l < rhs.chatid;
}