mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 23:27:23 +00:00
Update API scheme to layer 128.
This commit is contained in:
parent
c7a1771dec
commit
3ec3f6484f
@ -1863,7 +1863,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_payments_checkout_title" = "Checkout";
|
||||
"lng_payments_receipt_title" = "Receipt";
|
||||
"lng_payments_total_label" = "Total";
|
||||
"lng_payments_date_label" = "Date";
|
||||
"lng_payments_date_label" = "Paid";
|
||||
"lng_payments_pay_amount" = "Pay {amount}";
|
||||
"lng_payments_payment_method" = "Payment Method";
|
||||
"lng_payments_new_card" = "New Card...";
|
||||
|
@ -90,8 +90,8 @@ inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
|
||||
inputTakeoutFileLocation#29be5899 = InputFileLocation;
|
||||
inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
|
||||
inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;
|
||||
inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
|
||||
inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
|
||||
inputPeerPhotoFileLocation#37257e99 flags:# big:flags.0?true peer:InputPeer photo_id:long = InputFileLocation;
|
||||
inputStickerSetThumb#9d84f3db stickerset:InputStickerSet thumb_version:int = InputFileLocation;
|
||||
inputGroupCallStream#bba51639 call:InputGroupCall time_ms:long scale:int = InputFileLocation;
|
||||
|
||||
peerUser#9db1bc6d user_id:int = Peer;
|
||||
@ -113,7 +113,7 @@ userEmpty#200250ba id:int = User;
|
||||
user#938458c1 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true apply_min_photo:flags.25?true fake:flags.26?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?Vector<RestrictionReason> bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
userProfilePhoto#69d3ab26 flags:# has_video:flags.0?true photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;
|
||||
userProfilePhoto#82d1f706 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = UserProfilePhoto;
|
||||
|
||||
userStatusEmpty#9d05049 = UserStatus;
|
||||
userStatusOnline#edb93949 expires:int = UserStatus;
|
||||
@ -139,7 +139,7 @@ chatParticipantsForbidden#fc900c2b flags:# chat_id:int self_participant:flags.0?
|
||||
chatParticipants#3f460fed chat_id:int participants:Vector<ChatParticipant> version:int = ChatParticipants;
|
||||
|
||||
chatPhotoEmpty#37c1011c = ChatPhoto;
|
||||
chatPhoto#d20b9f3c flags:# has_video:flags.0?true photo_small:FileLocation photo_big:FileLocation dc_id:int = ChatPhoto;
|
||||
chatPhoto#1c6e1c11 flags:# has_video:flags.0?true photo_id:long stripped_thumb:flags.1?bytes dc_id:int = ChatPhoto;
|
||||
|
||||
messageEmpty#90a6ca84 flags:# id:int peer_id:flags.0?Peer = Message;
|
||||
message#bce383d2 flags:# out:flags.1?true mentioned:flags.4?true media_unread:flags.5?true silent:flags.13?true post:flags.14?true from_scheduled:flags.18?true legacy:flags.19?true edit_hide:flags.21?true pinned:flags.24?true id:int from_id:flags.8?Peer peer_id:Peer fwd_from:flags.2?MessageFwdHeader via_bot_id:flags.11?int reply_to:flags.3?MessageReplyHeader date:int message:string media:flags.9?MessageMedia reply_markup:flags.6?ReplyMarkup entities:flags.7?Vector<MessageEntity> views:flags.10?int forwards:flags.10?int replies:flags.23?MessageReplies edit_date:flags.15?int post_author:flags.16?string grouped_id:flags.17?long restriction_reason:flags.22?Vector<RestrictionReason> ttl_period:flags.25?int = Message;
|
||||
@ -194,10 +194,10 @@ photoEmpty#2331b22d id:long = Photo;
|
||||
photo#fb197a65 flags:# has_stickers:flags.0?true id:long access_hash:long file_reference:bytes date:int sizes:Vector<PhotoSize> video_sizes:flags.1?Vector<VideoSize> dc_id:int = Photo;
|
||||
|
||||
photoSizeEmpty#e17e23c type:string = PhotoSize;
|
||||
photoSize#77bfb61b type:string location:FileLocation w:int h:int size:int = PhotoSize;
|
||||
photoCachedSize#e9a734fa type:string location:FileLocation w:int h:int bytes:bytes = PhotoSize;
|
||||
photoSize#75c78e60 type:string w:int h:int size:int = PhotoSize;
|
||||
photoCachedSize#21e1ad6 type:string w:int h:int bytes:bytes = PhotoSize;
|
||||
photoStrippedSize#e0b0bc2e type:string bytes:bytes = PhotoSize;
|
||||
photoSizeProgressive#5aa86a51 type:string location:FileLocation w:int h:int sizes:Vector<int> = PhotoSize;
|
||||
photoSizeProgressive#fa3efb95 type:string w:int h:int sizes:Vector<int> = PhotoSize;
|
||||
photoPathSize#d8214d41 type:string bytes:bytes = PhotoSize;
|
||||
|
||||
geoPointEmpty#1117dd5f = GeoPoint;
|
||||
@ -554,7 +554,7 @@ inputStickerSetShortName#861cc8a0 short_name:string = InputStickerSet;
|
||||
inputStickerSetAnimatedEmoji#28703c8 = InputStickerSet;
|
||||
inputStickerSetDice#e67f520e emoticon:string = InputStickerSet;
|
||||
|
||||
stickerSet#40e237a8 flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int count:int hash:int = StickerSet;
|
||||
stickerSet#d7df217a flags:# archived:flags.1?true official:flags.2?true masks:flags.3?true animated:flags.5?true installed_date:flags.0?int id:long access_hash:long title:string short_name:string thumbs:flags.4?Vector<PhotoSize> thumb_dc_id:flags.4?int thumb_version:flags.4?int count:int hash:int = StickerSet;
|
||||
|
||||
messages.stickerSet#b60a24a6 set:StickerSet packs:Vector<StickerPack> documents:Vector<Document> = messages.StickerSet;
|
||||
|
||||
@ -648,6 +648,7 @@ inputBotInlineMessageMediaGeo#96929a85 flags:# geo_point:InputGeoPoint heading:f
|
||||
inputBotInlineMessageMediaVenue#417bbf11 flags:# geo_point:InputGeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaContact#a6edbffd flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageGame#4b425864 flags:# reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
inputBotInlineMessageMediaInvoice#d5348d85 flags:# title:string description:string photo:flags.0?InputWebDocument invoice:Invoice payload:bytes provider:string provider_data:DataJSON start_param:string reply_markup:flags.2?ReplyMarkup = InputBotInlineMessage;
|
||||
|
||||
inputBotInlineResult#88bf9319 flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?InputWebDocument content:flags.5?InputWebDocument send_message:InputBotInlineMessage = InputBotInlineResult;
|
||||
inputBotInlineResultPhoto#a8d864a7 id:string type:string photo:InputPhoto send_message:InputBotInlineMessage = InputBotInlineResult;
|
||||
@ -659,6 +660,7 @@ botInlineMessageText#8c7f65e2 flags:# no_webpage:flags.0?true message:string ent
|
||||
botInlineMessageMediaGeo#51846fd flags:# geo:GeoPoint heading:flags.0?int period:flags.1?int proximity_notification_radius:flags.3?int reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaVenue#8a86659c flags:# geo:GeoPoint title:string address:string provider:string venue_id:string venue_type:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaContact#18d1cdc2 flags:# phone_number:string first_name:string last_name:string vcard:string reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
botInlineMessageMediaInvoice#354a9b09 flags:# shipping_address_requested:flags.1?true test:flags.3?true title:string description:string photo:flags.0?WebDocument currency:string total_amount:long reply_markup:flags.2?ReplyMarkup = BotInlineMessage;
|
||||
|
||||
botInlineResult#11965f3a flags:# id:string type:string title:flags.1?string description:flags.2?string url:flags.3?string thumb:flags.4?WebDocument content:flags.5?WebDocument send_message:BotInlineMessage = BotInlineResult;
|
||||
botInlineMediaResult#17db940b flags:# id:string type:string photo:flags.0?Photo document:flags.1?Document title:flags.2?string description:flags.3?string send_message:BotInlineMessage = BotInlineResult;
|
||||
@ -792,7 +794,7 @@ dataJSON#7d748d04 data:string = DataJSON;
|
||||
|
||||
labeledPrice#cb296bf8 label:string amount:long = LabeledPrice;
|
||||
|
||||
invoice#c30aa358 flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true currency:string prices:Vector<LabeledPrice> = Invoice;
|
||||
invoice#24b6f6cd flags:# test:flags.0?true name_requested:flags.1?true phone_requested:flags.2?true email_requested:flags.3?true shipping_address_requested:flags.4?true flexible:flags.5?true phone_to_provider:flags.6?true email_to_provider:flags.7?true multiple_allowed:flags.9?true can_forward:flags.10?true currency:string prices:Vector<LabeledPrice> min_tip_amount:flags.8?long max_tip_amount:flags.8?long default_tip_amount:flags.8?long = Invoice;
|
||||
|
||||
paymentCharge#ea02c27e id:string provider_charge_id:string = PaymentCharge;
|
||||
|
||||
@ -812,14 +814,14 @@ inputWebFileGeoPointLocation#9f2221c9 geo_point:InputGeoPoint access_hash:long w
|
||||
|
||||
upload.webFile#21e753bc size:int mime_type:string file_type:storage.FileType mtime:int bytes:bytes = upload.WebFile;
|
||||
|
||||
payments.paymentForm#3f56aea3 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
|
||||
payments.paymentForm#8d0b2415 flags:# can_save_credentials:flags.2?true password_missing:flags.3?true form_id:long bot_id:int invoice:Invoice provider_id:int url:string native_provider:flags.4?string native_params:flags.4?DataJSON saved_info:flags.0?PaymentRequestedInfo saved_credentials:flags.1?PaymentSavedCredentials users:Vector<User> = payments.PaymentForm;
|
||||
|
||||
payments.validatedRequestedInfo#d1451883 flags:# id:flags.0?string shipping_options:flags.1?Vector<ShippingOption> = payments.ValidatedRequestedInfo;
|
||||
|
||||
payments.paymentResult#4e5f810d updates:Updates = payments.PaymentResult;
|
||||
payments.paymentVerificationNeeded#d8411139 url:string = payments.PaymentResult;
|
||||
|
||||
payments.paymentReceipt#500911e1 flags:# date:int bot_id:int invoice:Invoice provider_id:int info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
|
||||
payments.paymentReceipt#10b555d0 flags:# date:int bot_id:int provider_id:int title:string description:string photo:flags.2?WebDocument invoice:Invoice info:flags.0?PaymentRequestedInfo shipping:flags.1?ShippingOption tip_amount:flags.3?long currency:string total_amount:long credentials_title:string users:Vector<User> = payments.PaymentReceipt;
|
||||
|
||||
payments.savedInfo#fb8fe43c flags:# has_saved_credentials:flags.1?true saved_info:flags.0?PaymentRequestedInfo = payments.SavedInfo;
|
||||
|
||||
@ -1088,8 +1090,6 @@ emojiURL#a575739d url:string = EmojiURL;
|
||||
|
||||
emojiLanguage#b3fb5361 lang_code:string = EmojiLanguage;
|
||||
|
||||
fileLocationToBeDeprecated#bc7fc6cd volume_id:long local_id:int = FileLocation;
|
||||
|
||||
folder#ff544e65 flags:# autofill_new_broadcasts:flags.0?true autofill_public_groups:flags.1?true autofill_new_correspondents:flags.2?true id:int title:string photo:flags.3?ChatPhoto = Folder;
|
||||
|
||||
inputFolderPeer#fbd2c296 peer:InputPeer folder_id:int = InputFolderPeer;
|
||||
@ -1169,7 +1169,7 @@ stats.broadcastStats#bdf78394 period:StatsDateRangeDays followers:StatsAbsValueA
|
||||
help.promoDataEmpty#98f6ac75 expires:int = help.PromoData;
|
||||
help.promoData#8c39793f flags:# proxy:flags.0?true expires:int peer:Peer chats:Vector<Chat> users:Vector<User> psa_type:flags.1?string psa_message:flags.2?string = help.PromoData;
|
||||
|
||||
videoSize#e831c556 flags:# type:string location:FileLocation w:int h:int size:int video_start_ts:flags.0?double = VideoSize;
|
||||
videoSize#de33b094 flags:# type:string w:int h:int size:int video_start_ts:flags.0?double = VideoSize;
|
||||
|
||||
statsGroupTopPoster#18f3d0f7 user_id:int messages:int avg_chars:int = StatsGroupTopPoster;
|
||||
|
||||
@ -1207,7 +1207,7 @@ groupCall#c0c2052e flags:# join_muted:flags.1?true can_change_join_muted:flags.2
|
||||
|
||||
inputGroupCall#d8aa840f id:long access_hash:long = InputGroupCall;
|
||||
|
||||
groupCallParticipant#19adba89 flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long = GroupCallParticipant;
|
||||
groupCallParticipant#b96b25ee flags:# muted:flags.0?true left:flags.1?true can_self_unmute:flags.2?true just_joined:flags.4?true versioned:flags.5?true min:flags.8?true muted_by_you:flags.9?true volume_by_admin:flags.10?true self:flags.12?true peer:Peer date:int active_date:flags.3?int source:int volume:flags.7?int about:flags.11?string raise_hand_rating:flags.13?long params:flags.6?DataJSON = GroupCallParticipant;
|
||||
|
||||
phone.groupCall#9e727aad call:GroupCall participants:Vector<GroupCallParticipant> participants_next_offset:string chats:Vector<Chat> users:Vector<User> = phone.GroupCall;
|
||||
|
||||
@ -1592,10 +1592,10 @@ bots.sendCustomRequest#aa2769ed custom_method:string params:DataJSON = DataJSON;
|
||||
bots.answerWebhookJSONQuery#e6213f4d query_id:long data:DataJSON = Bool;
|
||||
bots.setBotCommands#805d46f6 commands:Vector<BotCommand> = Bool;
|
||||
|
||||
payments.getPaymentForm#99f09745 msg_id:int = payments.PaymentForm;
|
||||
payments.getPaymentReceipt#a092a980 msg_id:int = payments.PaymentReceipt;
|
||||
payments.validateRequestedInfo#770a8e74 flags:# save:flags.0?true msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
|
||||
payments.sendPaymentForm#2b8879b3 flags:# msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials = payments.PaymentResult;
|
||||
payments.getPaymentForm#8a333c8d flags:# peer:InputPeer msg_id:int theme_params:flags.0?DataJSON = payments.PaymentForm;
|
||||
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
|
||||
payments.validateRequestedInfo#db103170 flags:# save:flags.0?true peer:InputPeer msg_id:int info:PaymentRequestedInfo = payments.ValidatedRequestedInfo;
|
||||
payments.sendPaymentForm#30c3bc9d flags:# form_id:long peer:InputPeer msg_id:int requested_info_id:flags.0?string shipping_option_id:flags.1?string credentials:InputPaymentCredentials tip_amount:flags.2?long = payments.PaymentResult;
|
||||
payments.getSavedInfo#227d824b = payments.SavedInfo;
|
||||
payments.clearSavedInfo#d83d70c1 flags:# credentials:flags.0?true info:flags.1?true = Bool;
|
||||
payments.getBankCardData#2e79d779 number:string = payments.BankCardData;
|
||||
@ -1645,4 +1645,4 @@ stats.getMegagroupStats#dcdf8607 flags:# dark:flags.0?true channel:InputChannel
|
||||
stats.getMessagePublicForwards#5630281b channel:InputChannel msg_id:int offset_rate:int offset_peer:InputPeer offset_id:int limit:int = messages.Messages;
|
||||
stats.getMessageStats#b6e0a3f5 flags:# dark:flags.0?true channel:InputChannel msg_id:int = stats.MessageStats;
|
||||
|
||||
// LAYER 126
|
||||
// LAYER 128
|
||||
|
@ -561,7 +561,8 @@ void GroupCall::applyMeInCallLocally() {
|
||||
MTP_int(_mySsrc),
|
||||
MTP_int(volume),
|
||||
MTPstring(), // Don't update about text in local updates.
|
||||
MTP_long(raisedHandRating))),
|
||||
MTP_long(raisedHandRating),
|
||||
MTPDataJSON())),
|
||||
MTP_int(0)).c_updateGroupCallParticipants());
|
||||
}
|
||||
|
||||
@ -606,7 +607,8 @@ void GroupCall::applyParticipantLocally(
|
||||
MTP_int(participant->ssrc),
|
||||
MTP_int(volume.value_or(participant->volume)),
|
||||
MTPstring(), // Don't update about text in local updates.
|
||||
MTP_long(participant->raisedHandRating))),
|
||||
MTP_long(participant->raisedHandRating),
|
||||
MTPDataJSON())),
|
||||
MTP_int(0)).c_updateGroupCallParticipants());
|
||||
}
|
||||
|
||||
|
@ -77,12 +77,8 @@ ChannelData::ChannelData(not_null<Data::Session*> owner, PeerId id)
|
||||
}
|
||||
|
||||
void ChannelData::setPhoto(const MTPChatPhoto &photo) {
|
||||
setPhoto(userpicPhotoId(), photo);
|
||||
}
|
||||
|
||||
void ChannelData::setPhoto(PhotoId photoId, const MTPChatPhoto &photo) {
|
||||
photo.match([&](const MTPDchatPhoto & data) {
|
||||
updateUserpic(photoId, data.vdc_id().v, data.vphoto_small());
|
||||
updateUserpic(data.vphoto_id().v, data.vdc_id().v);
|
||||
}, [&](const MTPDchatPhotoEmpty &) {
|
||||
clearUserpic();
|
||||
});
|
||||
|
@ -126,10 +126,8 @@ public:
|
||||
|
||||
ChannelData(not_null<Data::Session*> owner, PeerId id);
|
||||
|
||||
void setPhoto(const MTPChatPhoto &photo);
|
||||
void setPhoto(PhotoId photoId, const MTPChatPhoto &photo);
|
||||
|
||||
void setName(const QString &name, const QString &username);
|
||||
void setPhoto(const MTPChatPhoto &photo);
|
||||
void setAccessHash(uint64 accessHash);
|
||||
|
||||
void setFlags(MTPDchannel::Flags which) {
|
||||
|
@ -37,12 +37,8 @@ ChatData::ChatData(not_null<Data::Session*> owner, PeerId id)
|
||||
}
|
||||
|
||||
void ChatData::setPhoto(const MTPChatPhoto &photo) {
|
||||
setPhoto(userpicPhotoId(), photo);
|
||||
}
|
||||
|
||||
void ChatData::setPhoto(PhotoId photoId, const MTPChatPhoto &photo) {
|
||||
photo.match([&](const MTPDchatPhoto &data) {
|
||||
updateUserpic(photoId, data.vdc_id().v, data.vphoto_small());
|
||||
updateUserpic(data.vphoto_id().v, data.vdc_id().v);
|
||||
}, [&](const MTPDchatPhotoEmpty &) {
|
||||
clearUserpic();
|
||||
});
|
||||
|
@ -39,10 +39,8 @@ public:
|
||||
|
||||
ChatData(not_null<Data::Session*> owner, PeerId id);
|
||||
|
||||
void setPhoto(const MTPChatPhoto &photo);
|
||||
void setPhoto(PhotoId photoId, const MTPChatPhoto &photo);
|
||||
|
||||
void setName(const QString &newName);
|
||||
void setPhoto(const MTPChatPhoto &photo);
|
||||
|
||||
void invalidateParticipants();
|
||||
[[nodiscard]] bool noParticipantInfo() const {
|
||||
|
@ -377,24 +377,19 @@ Data::FileOrigin PeerData::userpicPhotoOrigin() const {
|
||||
: Data::FileOrigin();
|
||||
}
|
||||
|
||||
void PeerData::updateUserpic(
|
||||
PhotoId photoId,
|
||||
MTP::DcId dcId,
|
||||
const MTPFileLocation &location) {
|
||||
setUserpicChecked(photoId, location.match([&](
|
||||
const MTPDfileLocationToBeDeprecated &deprecated) {
|
||||
return ImageLocation(
|
||||
void PeerData::updateUserpic(PhotoId photoId, MTP::DcId dcId) {
|
||||
setUserpicChecked(
|
||||
photoId,
|
||||
ImageLocation(
|
||||
{ StorageFileLocation(
|
||||
dcId,
|
||||
isSelf() ? peerToUser(id) : 0,
|
||||
MTP_inputPeerPhotoFileLocation(
|
||||
MTP_flags(0),
|
||||
input,
|
||||
deprecated.vvolume_id(),
|
||||
deprecated.vlocal_id())) },
|
||||
MTP_long(photoId))) },
|
||||
kUserpicSize,
|
||||
kUserpicSize);
|
||||
}));
|
||||
kUserpicSize));
|
||||
}
|
||||
|
||||
void PeerData::clearUserpic() {
|
||||
|
@ -404,10 +404,7 @@ protected:
|
||||
const QString &newName,
|
||||
const QString &newNameOrPhone,
|
||||
const QString &newUsername);
|
||||
void updateUserpic(
|
||||
PhotoId photoId,
|
||||
MTP::DcId dcId,
|
||||
const MTPFileLocation &small);
|
||||
void updateUserpic(PhotoId photoId, MTP::DcId dcId);
|
||||
void clearUserpic();
|
||||
|
||||
private:
|
||||
|
@ -72,10 +72,7 @@ void UserData::setIsContact(bool is) {
|
||||
// see Serialize::readPeer as well
|
||||
void UserData::setPhoto(const MTPUserProfilePhoto &photo) {
|
||||
photo.match([&](const MTPDuserProfilePhoto &data) {
|
||||
updateUserpic(
|
||||
data.vphoto_id().v,
|
||||
data.vdc_id().v,
|
||||
data.vphoto_small());
|
||||
updateUserpic(data.vphoto_id().v, data.vdc_id().v);
|
||||
}, [&](const MTPDuserProfilePhotoEmpty &) {
|
||||
clearUserpic();
|
||||
});
|
||||
|
@ -324,6 +324,7 @@ bool Stickers::applyArchivedResultFake() {
|
||||
MTP_string(raw->shortName),
|
||||
MTP_vector<MTPPhotoSize>(),
|
||||
MTP_int(0),
|
||||
MTP_int(0),
|
||||
MTP_int(raw->count),
|
||||
MTP_int(raw->hash));
|
||||
sets.push_back(MTP_stickerSetCovered(
|
||||
|
@ -49,25 +49,13 @@ std::tuple<const uint64 &, const uint64 &> value_ordering_helper(const LocationK
|
||||
LocationKey ComputeLocationKey(const Data::FileLocation &value) {
|
||||
auto result = LocationKey();
|
||||
result.type = value.dcId;
|
||||
value.data.match([&](const MTPDinputFileLocation &data) {
|
||||
result.type |= (1ULL << 24);
|
||||
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||
result.id = data.vvolume_id().v;
|
||||
}, [&](const MTPDinputDocumentFileLocation &data) {
|
||||
value.data.match([&](const MTPDinputDocumentFileLocation &data) {
|
||||
const auto letter = data.vthumb_size().v.isEmpty()
|
||||
? char(0)
|
||||
: data.vthumb_size().v[0];
|
||||
result.type |= (2ULL << 24);
|
||||
result.type |= (uint64(uint32(letter)) << 16);
|
||||
result.id = data.vid().v;
|
||||
}, [&](const MTPDinputSecureFileLocation &data) {
|
||||
result.type |= (3ULL << 24);
|
||||
result.id = data.vid().v;
|
||||
}, [&](const MTPDinputEncryptedFileLocation &data) {
|
||||
result.type |= (4ULL << 24);
|
||||
result.id = data.vid().v;
|
||||
}, [&](const MTPDinputTakeoutFileLocation &data) {
|
||||
result.type |= (5ULL << 24);
|
||||
}, [&](const MTPDinputPhotoFileLocation &data) {
|
||||
const auto letter = data.vthumb_size().v.isEmpty()
|
||||
? char(0)
|
||||
@ -75,22 +63,10 @@ LocationKey ComputeLocationKey(const Data::FileLocation &value) {
|
||||
result.type |= (6ULL << 24);
|
||||
result.type |= (uint64(uint32(letter)) << 16);
|
||||
result.id = data.vid().v;
|
||||
}, [&](const MTPDinputPeerPhotoFileLocation &data) {
|
||||
const auto letter = data.is_big() ? char(1) : char(0);
|
||||
result.type |= (7ULL << 24);
|
||||
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||
result.type |= (uint64(uint32(letter)) << 16);
|
||||
result.id = data.vvolume_id().v;
|
||||
}, [&](const MTPDinputStickerSetThumb &data) {
|
||||
result.type |= (8ULL << 24);
|
||||
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||
result.id = data.vvolume_id().v;
|
||||
}, [&](const MTPDinputPhotoLegacyFileLocation &data) {
|
||||
result.type |= (9ULL << 24);
|
||||
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||
result.id = data.vvolume_id().v;
|
||||
}, [&](const MTPDinputGroupCallStream &data) {
|
||||
result.type = (10ULL << 24);
|
||||
}, [&](const MTPDinputTakeoutFileLocation &data) {
|
||||
result.type |= (5ULL << 24);
|
||||
}, [](const auto &data) {
|
||||
Unexpected("File location type in Export::ComputeLocationKey.");
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ void activateBotCommand(
|
||||
} break;
|
||||
|
||||
case ButtonType::Buy: {
|
||||
Payments::CheckoutProcess::Start(msg);
|
||||
Payments::CheckoutProcess::Start(msg, Payments::Mode::Payment);
|
||||
} break;
|
||||
|
||||
case ButtonType::Url: {
|
||||
|
@ -954,40 +954,25 @@ void History::applyServiceChanges(
|
||||
} break;
|
||||
|
||||
case mtpc_messageActionChatEditPhoto: {
|
||||
auto &d = action.c_messageActionChatEditPhoto();
|
||||
const auto &d = action.c_messageActionChatEditPhoto();
|
||||
d.vphoto().match([&](const MTPDphoto &data) {
|
||||
const auto &sizes = data.vsizes().v;
|
||||
if (!sizes.isEmpty()) {
|
||||
auto photo = owner().processPhoto(data);
|
||||
photo->peer = peer;
|
||||
auto &smallSize = sizes.front();
|
||||
auto &bigSize = sizes.back();
|
||||
const MTPFileLocation *smallLoc = nullptr;
|
||||
const MTPFileLocation *bigLoc = nullptr;
|
||||
switch (smallSize.type()) {
|
||||
case mtpc_photoSize: smallLoc = &smallSize.c_photoSize().vlocation(); break;
|
||||
case mtpc_photoCachedSize: smallLoc = &smallSize.c_photoCachedSize().vlocation(); break;
|
||||
}
|
||||
switch (bigSize.type()) {
|
||||
case mtpc_photoSize: bigLoc = &bigSize.c_photoSize().vlocation(); break;
|
||||
case mtpc_photoCachedSize: bigLoc = &bigSize.c_photoCachedSize().vlocation(); break;
|
||||
}
|
||||
if (smallLoc && bigLoc) {
|
||||
const auto chatPhoto = MTP_chatPhoto(
|
||||
MTP_flags(photo->hasVideo()
|
||||
? MTPDchatPhoto::Flag::f_has_video
|
||||
: MTPDchatPhoto::Flag(0)),
|
||||
*smallLoc,
|
||||
*bigLoc,
|
||||
data.vdc_id());
|
||||
if (const auto chat = peer->asChat()) {
|
||||
chat->setPhoto(photo->id, chatPhoto);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
channel->setPhoto(photo->id, chatPhoto);
|
||||
}
|
||||
peer->loadUserpic();
|
||||
}
|
||||
using Flag = MTPDchatPhoto::Flag;
|
||||
const auto photo = owner().processPhoto(data);
|
||||
photo->peer = peer;
|
||||
const auto chatPhoto = MTP_chatPhoto(
|
||||
MTP_flags((photo->hasVideo() ? Flag::f_has_video : Flag(0))
|
||||
| (photo->inlineThumbnailBytes().isEmpty()
|
||||
? Flag(0)
|
||||
: Flag::f_stripped_thumb)),
|
||||
MTP_long(photo->id),
|
||||
MTP_bytes(photo->inlineThumbnailBytes()),
|
||||
data.vdc_id());
|
||||
if (const auto chat = peer->asChat()) {
|
||||
chat->setPhoto(chatPhoto);
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
channel->setPhoto(chatPhoto);
|
||||
}
|
||||
peer->loadUserpic();
|
||||
}, [&](const MTPDphotoEmpty &data) {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
chat->setPhoto(MTP_chatPhotoEmpty());
|
||||
|
@ -57,10 +57,23 @@ base::flat_map<not_null<Main::Session*>, SessionProcesses> Processes;
|
||||
|
||||
} // namespace
|
||||
|
||||
void CheckoutProcess::Start(not_null<const HistoryItem*> item) {
|
||||
void CheckoutProcess::Start(not_null<const HistoryItem*> item, Mode mode) {
|
||||
auto &processes = LookupSessionProcesses(item);
|
||||
const auto session = &item->history()->session();
|
||||
const auto id = item->fullId();
|
||||
const auto media = item->media();
|
||||
const auto invoice = media ? media->invoice() : nullptr;
|
||||
if (mode == Mode::Payment && !invoice) {
|
||||
return;
|
||||
}
|
||||
const auto id = (invoice && invoice->receiptMsgId)
|
||||
? FullMsgId(item->history()->channelId(), invoice->receiptMsgId)
|
||||
: item->fullId();
|
||||
if (invoice) {
|
||||
mode = invoice->receiptMsgId ? Mode::Receipt : Mode::Payment;
|
||||
} else if (mode == Mode::Payment) {
|
||||
LOG(("API Error: CheckoutProcess Payment start without invoice."));
|
||||
return;
|
||||
}
|
||||
const auto i = processes.map.find(id);
|
||||
if (i != end(processes.map)) {
|
||||
i->second->requestActivate();
|
||||
@ -68,16 +81,21 @@ void CheckoutProcess::Start(not_null<const HistoryItem*> item) {
|
||||
}
|
||||
const auto j = processes.map.emplace(
|
||||
id,
|
||||
std::make_unique<CheckoutProcess>(session, id, PrivateTag{})).first;
|
||||
std::make_unique<CheckoutProcess>(
|
||||
item->history()->peer,
|
||||
id.msg,
|
||||
mode,
|
||||
PrivateTag{})).first;
|
||||
j->second->requestActivate();
|
||||
}
|
||||
|
||||
CheckoutProcess::CheckoutProcess(
|
||||
not_null<Main::Session*> session,
|
||||
FullMsgId itemId,
|
||||
not_null<PeerData*> peer,
|
||||
MsgId itemId,
|
||||
Mode mode,
|
||||
PrivateTag)
|
||||
: _session(session)
|
||||
, _form(std::make_unique<Form>(session, itemId))
|
||||
: _session(&peer->session())
|
||||
, _form(std::make_unique<Form>(peer, itemId, (mode == Mode::Receipt)))
|
||||
, _panel(std::make_unique<Ui::Panel>(panelDelegate())) {
|
||||
_form->updates(
|
||||
) | rpl::start_with_next([=](const FormUpdate &update) {
|
||||
|
@ -28,17 +28,23 @@ class Form;
|
||||
struct FormUpdate;
|
||||
struct Error;
|
||||
|
||||
enum class Mode {
|
||||
Payment,
|
||||
Receipt,
|
||||
};
|
||||
|
||||
class CheckoutProcess final
|
||||
: public base::has_weak_ptr
|
||||
, private Ui::PanelDelegate {
|
||||
struct PrivateTag {};
|
||||
|
||||
public:
|
||||
static void Start(not_null<const HistoryItem*> item);
|
||||
static void Start(not_null<const HistoryItem*> item, Mode mode);
|
||||
|
||||
CheckoutProcess(
|
||||
not_null<Main::Session*> session,
|
||||
FullMsgId itemId,
|
||||
not_null<PeerData*> peer,
|
||||
MsgId itemId,
|
||||
Mode mode,
|
||||
PrivateTag);
|
||||
~CheckoutProcess();
|
||||
|
||||
|
@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_countries.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_service.h" // HistoryServicePayment.
|
||||
#include "stripe/stripe_api_client.h"
|
||||
#include "stripe/stripe_error.h"
|
||||
#include "stripe/stripe_token.h"
|
||||
@ -89,12 +90,15 @@ namespace {
|
||||
|
||||
} // namespace
|
||||
|
||||
Form::Form(not_null<Main::Session*> session, FullMsgId itemId)
|
||||
: _session(session)
|
||||
Form::Form(not_null<PeerData*> peer, MsgId itemId, bool receipt)
|
||||
: _session(&peer->session())
|
||||
, _api(&_session->mtp())
|
||||
, _msgId(itemId) {
|
||||
, _peer(peer)
|
||||
, _msgId(itemId)
|
||||
, _receiptMode(receipt) {
|
||||
fillInvoiceFromMessage();
|
||||
if (_receiptMsgId) {
|
||||
if (_receiptMode) {
|
||||
_invoice.receipt.paid = true;
|
||||
requestReceipt();
|
||||
} else {
|
||||
requestForm();
|
||||
@ -104,23 +108,24 @@ Form::Form(not_null<Main::Session*> session, FullMsgId itemId)
|
||||
Form::~Form() = default;
|
||||
|
||||
void Form::fillInvoiceFromMessage() {
|
||||
if (const auto item = _session->data().message(_msgId)) {
|
||||
if (const auto media = item->media()) {
|
||||
if (const auto invoice = media->invoice()) {
|
||||
_receiptMsgId = FullMsgId(
|
||||
_msgId.channel,
|
||||
invoice->receiptMsgId);
|
||||
_invoice.cover = Ui::Cover{
|
||||
.title = invoice->title,
|
||||
.description = invoice->description,
|
||||
};
|
||||
if (_receiptMsgId) {
|
||||
_invoice.receipt.paid = true;
|
||||
}
|
||||
if (const auto photo = invoice->photo) {
|
||||
loadThumbnail(photo);
|
||||
const auto id = FullMsgId(peerToChannel(_peer->id), _msgId);
|
||||
if (const auto item = _session->data().message(id)) {
|
||||
const auto media = [&] {
|
||||
if (const auto payment = item->Get<HistoryServicePayment>()) {
|
||||
if (payment->msg) {
|
||||
return payment->msg->media();
|
||||
}
|
||||
}
|
||||
return item->media();
|
||||
}();
|
||||
if (const auto invoice = media ? media->invoice() : nullptr) {
|
||||
_invoice.cover = Ui::Cover{
|
||||
.title = invoice->title,
|
||||
.description = invoice->description,
|
||||
};
|
||||
if (const auto photo = invoice->photo) {
|
||||
loadThumbnail(photo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,7 +146,9 @@ void Form::loadThumbnail(not_null<PhotoData*> photo) {
|
||||
_invoice.cover.thumbnail = prepareEmptyThumbnail();
|
||||
}
|
||||
_thumbnailLoadProcess->view = std::move(view);
|
||||
photo->load(Data::PhotoSize::Thumbnail, _msgId);
|
||||
photo->load(
|
||||
Data::PhotoSize::Thumbnail,
|
||||
FullMsgId(peerToChannel(_peer->id), _msgId));
|
||||
_session->downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
const auto &view = _thumbnailLoadProcess->view;
|
||||
@ -205,7 +212,10 @@ QImage Form::prepareEmptyThumbnail() const {
|
||||
|
||||
void Form::requestForm() {
|
||||
_api.request(MTPpayments_GetPaymentForm(
|
||||
MTP_int(_msgId.msg)
|
||||
MTP_flags(0),
|
||||
_peer->input,
|
||||
MTP_int(_msgId),
|
||||
MTP_dataJSON(MTP_string(QString()))
|
||||
)).done([=](const MTPpayments_PaymentForm &result) {
|
||||
result.match([&](const auto &data) {
|
||||
processForm(data);
|
||||
@ -217,7 +227,8 @@ void Form::requestForm() {
|
||||
|
||||
void Form::requestReceipt() {
|
||||
_api.request(MTPpayments_GetPaymentReceipt(
|
||||
MTP_int(_receiptMsgId.msg)
|
||||
_peer->input,
|
||||
MTP_int(_msgId)
|
||||
)).done([=](const MTPpayments_PaymentReceipt &result) {
|
||||
result.match([&](const auto &data) {
|
||||
processReceipt(data);
|
||||
@ -300,6 +311,7 @@ void Form::processDetails(const MTPDpayments_paymentForm &data) {
|
||||
[&](const MTPDdataJSON &data) { return data.vdata().v; })
|
||||
: QByteArray();
|
||||
_details = FormDetails{
|
||||
.formId = data.vform_id().v,
|
||||
.url = qs(data.vurl()),
|
||||
.nativeProvider = qs(data.vnative_provider().value_or_empty()),
|
||||
.nativeParamsJson = std::move(nativeParamsJson),
|
||||
@ -429,12 +441,15 @@ void Form::submit() {
|
||||
| (_shippingOptions.selectedId.isEmpty()
|
||||
? Flag(0)
|
||||
: Flag::f_shipping_option_id)),
|
||||
MTP_int(_msgId.msg),
|
||||
MTP_long(_details.formId),
|
||||
_peer->input,
|
||||
MTP_int(_msgId),
|
||||
MTP_string(_requestedInformationId),
|
||||
MTP_string(_shippingOptions.selectedId),
|
||||
MTP_inputPaymentCredentials(
|
||||
MTP_flags(0),
|
||||
MTP_dataJSON(MTP_bytes(_paymentMethod.newCredentials.data)))
|
||||
MTP_dataJSON(MTP_bytes(_paymentMethod.newCredentials.data))),
|
||||
MTP_long(0) // #TODO payments tip_amount
|
||||
)).done([=](const MTPpayments_PaymentResult &result) {
|
||||
result.match([&](const MTPDpayments_paymentResult &data) {
|
||||
_updates.fire(PaymentFinished{ data.vupdates() });
|
||||
@ -466,7 +481,8 @@ void Form::validateInformation(const Ui::RequestedInformation &information) {
|
||||
|
||||
_validateRequestId = _api.request(MTPpayments_ValidateRequestedInfo(
|
||||
MTP_flags(0), // #TODO payments save information
|
||||
MTP_int(_msgId.msg),
|
||||
_peer->input,
|
||||
MTP_int(_msgId),
|
||||
Serialize(information)
|
||||
)).done([=](const MTPpayments_ValidatedRequestedInfo &result) {
|
||||
_validateRequestId = 0;
|
||||
|
@ -27,7 +27,10 @@ class PhotoMedia;
|
||||
|
||||
namespace Payments {
|
||||
|
||||
enum class Mode;
|
||||
|
||||
struct FormDetails {
|
||||
uint64 formId = 0;
|
||||
QString url;
|
||||
QString nativeProvider;
|
||||
QByteArray nativeParamsJson;
|
||||
@ -143,7 +146,7 @@ struct FormUpdate : std::variant<
|
||||
|
||||
class Form final : public base::has_weak_ptr {
|
||||
public:
|
||||
Form(not_null<Main::Session*> session, FullMsgId itemId);
|
||||
Form(not_null<PeerData*> peer, MsgId itemId, bool receipt);
|
||||
~Form();
|
||||
|
||||
[[nodiscard]] const Ui::Invoice &invoice() const {
|
||||
@ -219,8 +222,9 @@ private:
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
MTP::Sender _api;
|
||||
FullMsgId _msgId;
|
||||
FullMsgId _receiptMsgId;
|
||||
not_null<PeerData*> _peer;
|
||||
MsgId _msgId = 0;
|
||||
bool _receiptMode = false;
|
||||
|
||||
Ui::Invoice _invoice;
|
||||
std::unique_ptr<ThumbnailLoadProcess> _thumbnailLoadProcess;
|
||||
|
@ -187,7 +187,6 @@ void FormSummary::setupCover(not_null<VerticalLayout*> layout) {
|
||||
}
|
||||
|
||||
void FormSummary::setupPrices(not_null<VerticalLayout*> layout) {
|
||||
Settings::AddSkip(layout, st::paymentsPricesTopSkip);
|
||||
const auto addRow = [&](
|
||||
const QString &label,
|
||||
const QString &value,
|
||||
@ -218,6 +217,18 @@ void FormSummary::setupPrices(not_null<VerticalLayout*> layout) {
|
||||
right->moveToRight(st::paymentsPricePadding.right(), top, width);
|
||||
}, right->lifetime());
|
||||
};
|
||||
|
||||
Settings::AddSkip(layout, st::paymentsPricesTopSkip);
|
||||
if (_invoice.receipt) {
|
||||
Settings::AddDivider(layout);
|
||||
Settings::AddSkip(layout, st::paymentsPricesBottomSkip);
|
||||
addRow(
|
||||
tr::lng_payments_date_label(tr::now),
|
||||
langDateTime(base::unixtime::parse(_invoice.receipt.date)),
|
||||
true);
|
||||
Settings::AddSkip(layout, st::paymentsPricesBottomSkip);
|
||||
}
|
||||
|
||||
const auto add = [&](
|
||||
const QString &label,
|
||||
int64 amount,
|
||||
@ -238,15 +249,6 @@ void FormSummary::setupPrices(not_null<VerticalLayout*> layout) {
|
||||
}
|
||||
add(tr::lng_payments_total_label(tr::now), computeTotalAmount(), true);
|
||||
Settings::AddSkip(layout, st::paymentsPricesBottomSkip);
|
||||
if (_invoice.receipt) {
|
||||
Settings::AddDivider(layout);
|
||||
Settings::AddSkip(layout, st::paymentsPricesBottomSkip);
|
||||
addRow(
|
||||
tr::lng_payments_date_label(tr::now),
|
||||
langDateTime(base::unixtime::parse(_invoice.receipt.date)),
|
||||
true);
|
||||
Settings::AddSkip(layout, st::paymentsPricesBottomSkip);
|
||||
}
|
||||
}
|
||||
|
||||
void FormSummary::setupSections(not_null<VerticalLayout*> layout) {
|
||||
|
@ -79,7 +79,6 @@ PreparedFileThumbnail PrepareFileThumbnail(QImage &&original) {
|
||||
: std::move(original);
|
||||
result.mtpSize = MTP_photoSize(
|
||||
MTP_string(),
|
||||
MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)),
|
||||
MTP_int(result.image.width()),
|
||||
MTP_int(result.image.height()),
|
||||
MTP_int(0));
|
||||
@ -210,7 +209,6 @@ SendMediaReady PreparePeerPhoto(MTP::DcId dcId, PeerId peerId, QImage &&image) {
|
||||
QByteArray bytes = QByteArray()) {
|
||||
photoSizes.push_back(MTP_photoSize(
|
||||
MTP_string(type),
|
||||
MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)),
|
||||
MTP_int(image.width()),
|
||||
MTP_int(image.height()), MTP_int(0)));
|
||||
photoThumbs.emplace(type[0], PreparedPhotoThumb{
|
||||
@ -887,13 +885,13 @@ void FileLoadTask::process(Args &&args) {
|
||||
writer.write(full);
|
||||
}
|
||||
photoThumbs.emplace('m', PreparedPhotoThumb{ .image = medium });
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("m"), MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)), MTP_int(medium.width()), MTP_int(medium.height()), MTP_int(0)));
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("m"), MTP_int(medium.width()), MTP_int(medium.height()), MTP_int(0)));
|
||||
|
||||
photoThumbs.emplace('y', PreparedPhotoThumb{
|
||||
.image = full,
|
||||
.bytes = filedata
|
||||
});
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("y"), MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)));
|
||||
photoSizes.push_back(MTP_photoSize(MTP_string("y"), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)));
|
||||
|
||||
photo = MTP_photo(
|
||||
MTP_flags(0),
|
||||
|
@ -119,14 +119,14 @@ StorageFileLocation::StorageFileLocation(
|
||||
const auto fillPeer = base::overload([&](
|
||||
const MTPDinputPeerEmpty &data) {
|
||||
_id = 0;
|
||||
}, [&](const MTPDinputPeerSelf & data) {
|
||||
}, [&](const MTPDinputPeerSelf &data) {
|
||||
_id = peerFromUser(self);
|
||||
}, [&](const MTPDinputPeerChat & data) {
|
||||
}, [&](const MTPDinputPeerChat &data) {
|
||||
_id = peerFromChat(data.vchat_id());
|
||||
}, [&](const MTPDinputPeerUser & data) {
|
||||
}, [&](const MTPDinputPeerUser &data) {
|
||||
_id = peerFromUser(data.vuser_id());
|
||||
_accessHash = data.vaccess_hash().v;
|
||||
}, [&](const MTPDinputPeerChannel & data) {
|
||||
}, [&](const MTPDinputPeerChannel &data) {
|
||||
_id = peerFromChannel(data.vchannel_id());
|
||||
_accessHash = data.vaccess_hash().v;
|
||||
});
|
||||
@ -146,8 +146,8 @@ StorageFileLocation::StorageFileLocation(
|
||||
_inMessagePeerId = -data.vchannel_id().v;
|
||||
_inMessageId = data.vmsg_id().v;
|
||||
});
|
||||
_volumeId = data.vvolume_id().v;
|
||||
_localId = data.vlocal_id().v;
|
||||
_volumeId = data.vphoto_id().v;
|
||||
_localId = 0;
|
||||
_sizeLetter = data.is_big() ? 'c' : 'a';
|
||||
}, [&](const MTPDinputStickerSetThumb &data) {
|
||||
_type = Type::StickerSetThumb;
|
||||
@ -156,16 +156,11 @@ StorageFileLocation::StorageFileLocation(
|
||||
}, [&](const MTPDinputStickerSetID &data) {
|
||||
_id = data.vid().v;
|
||||
_accessHash = data.vaccess_hash().v;
|
||||
}, [&](const MTPDinputStickerSetShortName &data) {
|
||||
Unexpected("inputStickerSetShortName in StorageFileLocation.");
|
||||
}, [&](const MTPDinputStickerSetAnimatedEmoji &data) {
|
||||
Unexpected(
|
||||
"inputStickerSetAnimatedEmoji in StorageFileLocation.");
|
||||
}, [&](const MTPDinputStickerSetDice &data) {
|
||||
Unexpected("inputStickerSetDice in StorageFileLocation.");
|
||||
}, [&](const auto &data) {
|
||||
Unexpected("InputStickerSet type in StorageFileLocation.");
|
||||
});
|
||||
_volumeId = data.vvolume_id().v;
|
||||
_localId = data.vlocal_id().v;
|
||||
_volumeId = 0;
|
||||
_localId = data.vthumb_version().v;
|
||||
}, [&](const MTPDinputGroupCallStream &data) {
|
||||
_type = Type::GroupCallStream;
|
||||
data.vcall().match([&](const MTPDinputGroupCall &data) {
|
||||
@ -249,13 +244,11 @@ MTPInputFileLocation StorageFileLocation::tl(int32 self) const {
|
||||
_inMessagePeerId,
|
||||
_inMessageId,
|
||||
self),
|
||||
MTP_long(_volumeId),
|
||||
MTP_int(_localId));
|
||||
MTP_long(_volumeId));
|
||||
|
||||
case Type::StickerSetThumb:
|
||||
return MTP_inputStickerSetThumb(
|
||||
MTP_inputStickerSetID(MTP_long(_id), MTP_long(_accessHash)),
|
||||
MTP_long(_volumeId),
|
||||
MTP_int(_localId));
|
||||
|
||||
case Type::GroupCallStream:
|
||||
|
@ -196,11 +196,10 @@ ImageWithLocation FromPhotoSize(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPDstickerSet &set,
|
||||
const MTPPhotoSize &size) {
|
||||
if (!set.vthumb_dc_id()) {
|
||||
if (!set.vthumb_dc_id() || !set.vthumb_version()) {
|
||||
return ImageWithLocation();
|
||||
}
|
||||
return size.match([&](const MTPDphotoSize &data) {
|
||||
const auto &location = data.vlocation().c_fileLocationToBeDeprecated();
|
||||
return ImageWithLocation{
|
||||
.location = ImageLocation(
|
||||
DownloadLocation{ StorageFileLocation(
|
||||
@ -208,14 +207,12 @@ ImageWithLocation FromPhotoSize(
|
||||
session->userId(),
|
||||
MTP_inputStickerSetThumb(
|
||||
MTP_inputStickerSetID(set.vid(), set.vaccess_hash()),
|
||||
location.vvolume_id(),
|
||||
location.vlocal_id())) },
|
||||
MTP_int(set.vthumb_version()->v))) },
|
||||
data.vw().v,
|
||||
data.vh().v),
|
||||
.bytesCount = data.vsize().v
|
||||
};
|
||||
}, [&](const MTPDphotoCachedSize &data) {
|
||||
const auto &location = data.vlocation().c_fileLocationToBeDeprecated();
|
||||
const auto bytes = qba(data.vbytes());
|
||||
return ImageWithLocation{
|
||||
.location = ImageLocation(
|
||||
@ -224,8 +221,7 @@ ImageWithLocation FromPhotoSize(
|
||||
session->userId(),
|
||||
MTP_inputStickerSetThumb(
|
||||
MTP_inputStickerSetID(set.vid(), set.vaccess_hash()),
|
||||
location.vvolume_id(),
|
||||
location.vlocal_id())) },
|
||||
MTP_int(set.vthumb_version()->v))) },
|
||||
data.vw().v,
|
||||
data.vh().v),
|
||||
.bytes = bytes,
|
||||
@ -235,7 +231,6 @@ ImageWithLocation FromPhotoSize(
|
||||
if (data.vsizes().v.isEmpty()) {
|
||||
return ImageWithLocation();
|
||||
}
|
||||
const auto &location = data.vlocation().c_fileLocationToBeDeprecated();
|
||||
return ImageWithLocation{
|
||||
.location = ImageLocation(
|
||||
DownloadLocation{ StorageFileLocation(
|
||||
@ -243,8 +238,7 @@ ImageWithLocation FromPhotoSize(
|
||||
session->userId(),
|
||||
MTP_inputStickerSetThumb(
|
||||
MTP_inputStickerSetID(set.vid(), set.vaccess_hash()),
|
||||
location.vvolume_id(),
|
||||
location.vlocal_id())) },
|
||||
MTP_int(set.vthumb_version()->v))) },
|
||||
data.vw().v,
|
||||
data.vh().v),
|
||||
.bytesCount = data.vsizes().v.back().v
|
||||
|
@ -461,7 +461,6 @@ SendMediaReady PrepareWallPaper(MTP::DcId dcId, const QImage &image) {
|
||||
const auto push = [&](const char *type, QImage &&image) {
|
||||
sizes.push_back(MTP_photoSize(
|
||||
MTP_string(type),
|
||||
MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)),
|
||||
MTP_int(image.width()),
|
||||
MTP_int(image.height()), MTP_int(0)));
|
||||
thumbnails.emplace(
|
||||
|
@ -433,7 +433,6 @@ SendMediaReady PrepareThemeMedia(
|
||||
QByteArray bytes = QByteArray()) {
|
||||
sizes.push_back(MTP_photoSize(
|
||||
MTP_string(type),
|
||||
MTP_fileLocationToBeDeprecated(MTP_long(0), MTP_int(0)),
|
||||
MTP_int(image.width()),
|
||||
MTP_int(image.height()), MTP_int(0)));
|
||||
thumbnails.emplace(type[0], PreparedPhotoThumb{
|
||||
|
Loading…
Reference in New Issue
Block a user