Update API scheme to layer 197.

This commit is contained in:
John Preston 2025-01-07 09:41:41 +04:00
parent b412ee258d
commit ba34d92cd3
7 changed files with 48 additions and 7 deletions

View file

@ -805,8 +805,11 @@ std::optional<Data::StarGift> FromTL(
auto result = Data::StarGift{
.id = uint64(data.vid().v),
.unique = std::make_shared<Data::UniqueGift>(Data::UniqueGift{
.slug = qs(data.vslug()),
.title = qs(data.vtitle()),
.ownerId = peerFromUser(UserId(data.vowner_id().v)),
.ownerName = qs(data.vowner_name().value_or_empty()),
.ownerId = peerFromUser(
UserId(data.vowner_id().value_or_empty())),
.number = data.vnum().v,
.model = *model,
.pattern = *pattern,

View file

@ -59,6 +59,24 @@ struct FileReferenceAccumulator {
push(data.vdocuments());
}, [&](const MTPDwebPageAttributeStickerSet &data) {
push(data.vstickers());
}, [&](const MTPDwebPageAttributeUniqueStarGift &data) {
push(data.vgift());
});
}
void push(const MTPStarGift &data) {
data.match([&](const MTPDstarGift &data) {
push(data.vsticker());
}, [&](const MTPDstarGiftUnique &data) {
push(data.vattributes());
});
}
void push(const MTPStarGiftAttribute &data) {
data.match([&](const MTPDstarGiftAttributeModel &data) {
push(data.vdocument());
}, [&](const MTPDstarGiftAttributePattern &data) {
push(data.vdocument());
}, [&](const MTPDstarGiftAttributeBackdrop &data) {
}, [&](const MTPDstarGiftAttributeOriginalDetails &data) {
});
}
void push(const MTPWebPage &data) {

View file

@ -3572,6 +3572,8 @@ void Session::webpageApplyFields(
return (DocumentData*)nullptr;
}, [](const MTPDwebPageAttributeStickerSet &) {
return (DocumentData*)nullptr;
}, [](const MTPDwebPageAttributeUniqueStarGift &) {
return (DocumentData*)nullptr;
});
if (result) {
return result;

View file

@ -37,7 +37,9 @@ struct UniqueGiftOriginalDetails {
};
struct UniqueGift {
QString slug;
QString title;
QString ownerName;
PeerId ownerId = 0;
int number = 0;
int starsForTransfer = -1;

View file

@ -87,6 +87,7 @@ using UpdateFlag = StoryUpdate::Flag;
}, [&](const MTPDmediaAreaChannelPost &data) {
}, [&](const MTPDmediaAreaUrl &data) {
}, [&](const MTPDmediaAreaWeather &data) {
}, [&](const MTPDmediaAreaStarGift &data) {
}, [&](const MTPDinputMediaAreaChannelPost &data) {
LOG(("API Error: Unexpected inputMediaAreaChannelPost from API."));
}, [&](const MTPDinputMediaAreaVenue &data) {
@ -110,6 +111,7 @@ using UpdateFlag = StoryUpdate::Flag;
}, [&](const MTPDmediaAreaChannelPost &data) {
}, [&](const MTPDmediaAreaUrl &data) {
}, [&](const MTPDmediaAreaWeather &data) {
}, [&](const MTPDmediaAreaStarGift &data) {
}, [&](const MTPDinputMediaAreaChannelPost &data) {
LOG(("API Error: Unexpected inputMediaAreaChannelPost from API."));
}, [&](const MTPDinputMediaAreaVenue &data) {
@ -133,6 +135,7 @@ using UpdateFlag = StoryUpdate::Flag;
});
}, [&](const MTPDmediaAreaUrl &data) {
}, [&](const MTPDmediaAreaWeather &data) {
}, [&](const MTPDmediaAreaStarGift &data) {
}, [&](const MTPDinputMediaAreaChannelPost &data) {
LOG(("API Error: Unexpected inputMediaAreaChannelPost from API."));
}, [&](const MTPDinputMediaAreaVenue &data) {
@ -154,6 +157,7 @@ using UpdateFlag = StoryUpdate::Flag;
.url = qs(data.vurl()),
});
}, [&](const MTPDmediaAreaWeather &data) {
}, [&](const MTPDmediaAreaStarGift &data) {
}, [&](const MTPDinputMediaAreaChannelPost &data) {
LOG(("API Error: Unexpected inputMediaAreaChannelPost from API."));
}, [&](const MTPDinputMediaAreaVenue &data) {
@ -180,6 +184,7 @@ using UpdateFlag = StoryUpdate::Flag;
-274.,
1'000'000.)),
});
}, [&](const MTPDmediaAreaStarGift &data) {
}, [&](const MTPDinputMediaAreaChannelPost &data) {
LOG(("API Error: Unexpected inputMediaAreaChannelPost from API."));
}, [&](const MTPDinputMediaAreaVenue &data) {

View file

@ -158,11 +158,15 @@ void WebpageResolver::request(const QString &link, bool force) {
MTP_flags(0),
MTP_string(link),
MTPVector<MTPMessageEntity>()
)).done([=](const MTPMessageMedia &result, mtpRequestId requestId) {
)).done([=](
const MTPmessages_WebPagePreview &result,
mtpRequestId requestId) {
if (_requestId == requestId) {
_requestId = 0;
}
result.match([=](const MTPDmessageMediaWebPage &data) {
const auto &data = result.data();
_session->data().processUsers(data.vusers());
data.vmedia().match([=](const MTPDmessageMediaWebPage &data) {
done(data);
}, [&](const auto &d) {
fail();

View file

@ -1268,6 +1268,7 @@ themeSettings#fa58b6d4 flags:# message_colors_animated:flags.2?true base_theme:B
webPageAttributeTheme#54b56617 flags:# documents:flags.0?Vector<Document> settings:flags.1?ThemeSettings = WebPageAttribute;
webPageAttributeStory#2e94c3e7 flags:# peer:Peer id:int story:flags.0?StoryItem = WebPageAttribute;
webPageAttributeStickerSet#50cc03d3 flags:# emojis:flags.0?true text_color:flags.1?true stickers:Vector<Document> = WebPageAttribute;
webPageAttributeUniqueStarGift#cf6f6db8 gift:StarGift = WebPageAttribute;
messages.votesList#4899484e flags:# count:int votes:Vector<MessagePeerVote> chats:Vector<Chat> users:Vector<User> next_offset:flags.0?string = messages.VotesList;
@ -1640,6 +1641,7 @@ mediaAreaChannelPost#770416af coordinates:MediaAreaCoordinates channel_id:long m
inputMediaAreaChannelPost#2271f2bf coordinates:MediaAreaCoordinates channel:InputChannel msg_id:int = MediaArea;
mediaAreaUrl#37381085 coordinates:MediaAreaCoordinates url:string = MediaArea;
mediaAreaWeather#49a6549c coordinates:MediaAreaCoordinates emoji:string temperature_c:double color:int = MediaArea;
mediaAreaStarGift#5787686d coordinates:MediaAreaCoordinates slug:string = MediaArea;
peerStories#9a35e999 flags:# peer:Peer max_read_id:flags.0?int stories:Vector<StoryItem> = PeerStories;
@ -1874,7 +1876,7 @@ starsGiveawayOption#94ce852a flags:# extended:flags.0?true default:flags.1?true
starsGiveawayWinnersOption#54236209 flags:# default:flags.0?true users:int per_user_stars:long = StarsGiveawayWinnersOption;
starGift#2cc73c8 flags:# limited:flags.0?true sold_out:flags.1?true birthday:flags.2?true id:long sticker:Document stars:long availability_remains:flags.0?int availability_total:flags.0?int convert_stars:long first_sale_date:flags.1?int last_sale_date:flags.1?int upgrade_stars:flags.3?long = StarGift;
starGiftUnique#6a1407cd id:long title:string num:int owner_id:long attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift;
starGiftUnique#3482f322 flags:# id:long title:string slug:string num:int owner_id:flags.0?long owner_name:flags.1?string attributes:Vector<StarGiftAttribute> availability_issued:int availability_total:int = StarGift;
payments.starGiftsNotModified#a388a368 = payments.StarGifts;
payments.starGifts#901689ea hash:int gifts:Vector<StarGift> = payments.StarGifts;
@ -1922,6 +1924,10 @@ payments.starGiftUpgradePreview#167bd90b sample_attributes:Vector<StarGiftAttrib
users.users#62d706b8 users:Vector<User> = users.Users;
users.usersSlice#315a4974 count:int users:Vector<User> = users.Users;
payments.uniqueStarGift#caa2f60b gift:StarGift users:Vector<User> = payments.UniqueStarGift;
messages.webPagePreview#b53e8b21 media:MessageMedia users:Vector<User> = messages.WebPagePreview;
---functions---
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
@ -2140,7 +2146,7 @@ messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool;
messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;
messages.getStickers#d5a5d3a1 emoticon:string hash:long = messages.Stickers;
messages.getAllStickers#b8a0a1a8 hash:long = messages.AllStickers;
messages.getWebPagePreview#8b68b0cc flags:# message:string entities:flags.3?Vector<MessageEntity> = MessageMedia;
messages.getWebPagePreview#570d6f6f flags:# message:string entities:flags.3?Vector<MessageEntity> = messages.WebPagePreview;
messages.exportChatInvite#a455de90 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?int usage_limit:flags.1?int title:flags.4?string subscription_pricing:flags.5?StarsSubscriptionPricing = ExportedChatInvite;
messages.checkChatInvite#3eadb1bb hash:string = ChatInvite;
messages.importChatInvite#6c50051c hash:string = Updates;
@ -2466,7 +2472,7 @@ bots.checkDownloadFileParams#50077589 bot:InputUser file_name:string url:string
bots.getAdminedBots#b0711d83 = Vector<User>;
bots.updateStarRefProgram#778b5ab3 flags:# bot:InputUser commission_permille:int duration_months:flags.0?int = StarRefProgram;
bots.setCustomVerification#8b89dfbd flags:# enabled:flags.1?true bot:flags.0?InputUser peer:InputPeer custom_description:flags.2?string = Bool;
bots.getBotRecommendations#2855be61 flags:# bot:InputUser = users.Users;
bots.getBotRecommendations#a1b70815 bot:InputUser = users.Users;
payments.getPaymentForm#37148dbb flags:# invoice:InputInvoice theme_params:flags.0?DataJSON = payments.PaymentForm;
payments.getPaymentReceipt#2478d1cc peer:InputPeer msg_id:int = payments.PaymentReceipt;
@ -2512,6 +2518,7 @@ payments.getStarGiftUpgradePreview#9c9abcb1 gift_id:long = payments.StarGiftUpgr
payments.upgradeStarGift#cf4f0781 flags:# keep_original_details:flags.0?true msg_id:int = Updates;
payments.transferStarGift#333fb526 msg_id:int to_id:InputUser = Updates;
payments.getUserStarGift#b502e4a5 msg_id:Vector<int> = payments.UserStarGifts;
payments.getUniqueStarGift#a1974d72 slug:string = payments.UniqueStarGift;
stickers.createStickerSet#9021ab67 flags:# masks:flags.0?true emojis:flags.5?true text_color:flags.6?true user_id:InputUser title:string short_name:string thumb:flags.2?InputDocument stickers:Vector<InputStickerSetItem> software:flags.3?string = messages.StickerSet;
stickers.removeStickerFromSet#f7760f51 sticker:InputDocument = messages.StickerSet;
@ -2632,4 +2639,4 @@ smsjobs.finishJob#4f1ebf24 flags:# job_id:string error:flags.0?string = Bool;
fragment.getCollectibleInfo#be1e85ba collectible:InputCollectible = fragment.CollectibleInfo;
// LAYER 196
// LAYER 197