2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

31 layer, IPv6 support, bot support started

This commit is contained in:
John Preston
2015-06-10 15:48:26 +03:00
parent 7afda6dfc3
commit 85635dbefd
25 changed files with 1232 additions and 722 deletions

View File

@@ -118,15 +118,30 @@ private:
PeerData *_peer;
};
struct BotCommand {
BotCommand(const QString &command, const QString &params, const QString &description) : command(command), params(params), description(description) {
}
QString command, params, description;
};
struct BotInfo {
int32 version;
QString shareText, description;
QList<BotCommand> commands;
};
struct PhotoData;
struct UserData : public PeerData {
UserData(const PeerId &id) : PeerData(id), lnk(new PeerLink(this)), onlineTill(0), contact(-1), photosCount(-1) {
UserData(const PeerId &id) : PeerData(id), lnk(new PeerLink(this)), photoId(0), onlineTill(0), contact(-1), photosCount(-1), botInfo(0) {
}
void setPhoto(const MTPUserProfilePhoto &photo);
void setName(const QString &first, const QString &last, const QString &phoneName, const QString &username);
void setPhone(const QString &newPhone);
void setBotInfoVersion(int32 version);
void setBotInfo(const MTPBotInfo &info);
void nameUpdated();
void madeAction(); // pseudo-online
QString firstName;
QString lastName;
QString username;
@@ -140,6 +155,8 @@ struct UserData : public PeerData {
typedef QList<PhotoData*> Photos;
Photos photos;
int32 photosCount; // -1 not loaded, 0 all loaded
BotInfo *botInfo;
};
struct ChatData : public PeerData {
@@ -164,6 +181,10 @@ struct ChatData : public PeerData {
// geo
};
inline int32 newMessageFlags(PeerData *p) {
return (p->input.type() == mtpc_inputPeerSelf) ? 0 : (((p->chat || !p->asUser()->botInfo) ? MTPDmessage_flag_unread : 0) | MTPDmessage_flag_out);
}
typedef QMap<char, QPixmap> PreparedPhotoThumbs;
struct PhotoData {
PhotoData(const PhotoId &id, const uint64 &access = 0, int32 user = 0, int32 date = 0, const ImagePtr &thumb = ImagePtr(), const ImagePtr &medium = ImagePtr(), const ImagePtr &full = ImagePtr()) :