Remove OfflineInputPeer.
GitOrigin-RevId: 1a3706ab5c923ba3dfb065c642e103fd9df688c9
This commit is contained in:
parent
b9a1ceec05
commit
b92223a61c
@ -30,7 +30,7 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
tl_object_ptr<telegram_api::InputPeer> OfflineInputPeer::get_input_peer() const {
|
||||
tl_object_ptr<telegram_api::InputPeer> PhotoSizeSource::DialogPhoto::get_input_peer() const {
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User: {
|
||||
UserId user_id = dialog_id.get_user_id();
|
||||
@ -60,8 +60,8 @@ bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) {
|
||||
}
|
||||
switch (lhs.type) {
|
||||
case PhotoSizeSource::Type::DialogPhoto:
|
||||
return lhs.dialog_photo().input_peer.dialog_id == rhs.dialog_photo().input_peer.dialog_id &&
|
||||
lhs.dialog_photo().input_peer.dialog_access_hash == rhs.dialog_photo().input_peer.dialog_access_hash &&
|
||||
return lhs.dialog_photo().dialog_id == rhs.dialog_photo().dialog_id &&
|
||||
lhs.dialog_photo().dialog_access_hash == rhs.dialog_photo().dialog_access_hash &&
|
||||
lhs.dialog_photo().is_big == rhs.dialog_photo().is_big;
|
||||
case PhotoSizeSource::Type::StickerSetThumbnail:
|
||||
return lhs.sticker_set_thumbnail().sticker_set_id == rhs.sticker_set_thumbnail().sticker_set_id &&
|
||||
@ -69,6 +69,7 @@ bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) {
|
||||
case PhotoSizeSource::Type::Thumbnail:
|
||||
return lhs.thumbnail().thumbnail_type == rhs.thumbnail().thumbnail_type;
|
||||
case PhotoSizeSource::Type::Empty:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -47,23 +47,6 @@ struct PhotoSize {
|
||||
FileId file_id;
|
||||
};
|
||||
|
||||
struct OfflineInputPeer {
|
||||
DialogId dialog_id;
|
||||
int64 dialog_access_hash = 0;
|
||||
|
||||
OfflineInputPeer() = default;
|
||||
OfflineInputPeer(DialogId dialog_id, int64 dialog_access_hash)
|
||||
: dialog_id(dialog_id), dialog_access_hash(dialog_access_hash) {
|
||||
}
|
||||
|
||||
tl_object_ptr<telegram_api::InputPeer> get_input_peer() const;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser);
|
||||
};
|
||||
|
||||
struct PhotoSizeSource {
|
||||
enum class Type : int32 { Empty, Thumbnail, DialogPhoto, StickerSetThumbnail };
|
||||
Type type;
|
||||
@ -76,15 +59,26 @@ struct PhotoSizeSource {
|
||||
}
|
||||
int32 thumbnail_type = 0;
|
||||
};
|
||||
|
||||
// for dialog photos
|
||||
struct DialogPhoto {
|
||||
DialogPhoto() = default;
|
||||
DialogPhoto(OfflineInputPeer input_peer, bool is_big) : input_peer(input_peer), is_big(is_big) {
|
||||
DialogPhoto(DialogId dialog_id, int64 dialog_access_hash, bool is_big)
|
||||
: dialog_id(dialog_id), dialog_access_hash(dialog_access_hash), is_big(is_big) {
|
||||
}
|
||||
|
||||
OfflineInputPeer input_peer;
|
||||
tl_object_ptr<telegram_api::InputPeer> get_input_peer() const;
|
||||
|
||||
DialogId dialog_id;
|
||||
int64 dialog_access_hash = 0;
|
||||
bool is_big = false;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const;
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser);
|
||||
};
|
||||
|
||||
// for sticker set thumbnails
|
||||
struct StickerSetThumbnail {
|
||||
int64 sticker_set_id = 0;
|
||||
@ -114,7 +108,7 @@ struct PhotoSizeSource {
|
||||
PhotoSizeSource(DialogId dialog_id, int64 dialog_access_hash, bool is_big)
|
||||
: type(Type::DialogPhoto)
|
||||
, file_type(FileType::ProfilePhoto)
|
||||
, variant(DialogPhoto(OfflineInputPeer(dialog_id, dialog_access_hash), is_big)) {
|
||||
, variant(DialogPhoto(dialog_id, dialog_access_hash, is_big)) {
|
||||
}
|
||||
PhotoSizeSource(int64 sticker_set_id, int64 sticker_set_access_hash)
|
||||
: type(Type::StickerSetThumbnail)
|
||||
|
@ -32,17 +32,20 @@ void PhotoSizeSource::StickerSetThumbnail::parse(ParserT &parser) {
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
void OfflineInputPeer::store(StorerT &storer) const {
|
||||
void PhotoSizeSource::DialogPhoto::store(StorerT &storer) const {
|
||||
using td::store;
|
||||
store(dialog_id, storer);
|
||||
store(dialog_access_hash, storer);
|
||||
store(is_big, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void OfflineInputPeer::parse(ParserT &parser) {
|
||||
void PhotoSizeSource::DialogPhoto::parse(ParserT &parser) {
|
||||
using td::parse;
|
||||
parse(dialog_id, parser);
|
||||
parse(dialog_access_hash, parser);
|
||||
parse(is_big, parser);
|
||||
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::SecretChat:
|
||||
case DialogType::None:
|
||||
@ -59,12 +62,9 @@ void PhotoSizeSource::store(StorerT &storer) const {
|
||||
store(file_type, storer);
|
||||
store(type, storer);
|
||||
switch (type) {
|
||||
case Type::DialogPhoto: {
|
||||
auto &dialog_photo = this->dialog_photo();
|
||||
store(dialog_photo.input_peer, storer);
|
||||
store(dialog_photo.is_big, storer);
|
||||
case Type::DialogPhoto:
|
||||
store(dialog_photo(), storer);
|
||||
break;
|
||||
}
|
||||
case Type::StickerSetThumbnail:
|
||||
store(sticker_set_thumbnail(), storer);
|
||||
break;
|
||||
@ -86,8 +86,7 @@ void PhotoSizeSource::parse(ParserT &parser) {
|
||||
switch (type) {
|
||||
case Type::DialogPhoto: {
|
||||
DialogPhoto dialog_photo;
|
||||
parse(dialog_photo.input_peer, parser);
|
||||
parse(dialog_photo.is_big, parser);
|
||||
parse(dialog_photo, parser);
|
||||
variant = dialog_photo;
|
||||
break;
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ class FullRemoteFileLocation {
|
||||
auto &dialog_photo = photo().source_.dialog_photo();
|
||||
return make_tl_object<telegram_api::inputPeerPhotoFileLocation>(
|
||||
dialog_photo.is_big * telegram_api::inputPeerPhotoFileLocation::Flags::BIG_MASK, dialog_photo.is_big,
|
||||
dialog_photo.input_peer.get_input_peer(), photo().volume_id_, photo().local_id_);
|
||||
dialog_photo.get_input_peer(), photo().volume_id_, photo().local_id_);
|
||||
}
|
||||
case PhotoSizeSource::Type::StickerSetThumbnail: {
|
||||
auto &sticker_set_thumbnail = photo().source_.sticker_set_thumbnail();
|
||||
|
Reference in New Issue
Block a user