@@ -217,6 +217,28 @@ public static function generate(int|string $layer, string $inputSchema, string $
217217 );
218218 $ locations ['help.getPremiumPromo ' ][] = new CopyMethodCallOp ('help.getPremiumPromo ' , 'fileSourcePremiumPromo ' );
219219
220+ $ locations ['help.getAppUpdate ' ][] = new Noop ("Don't handle file references from ephemeral app update info " );
221+ $ locations ['help.getRecentMeUrls ' ][] = new Noop ("Don't handle file references from recent t.me URLs " );
222+
223+ $ stickerMethods = [
224+ 'messages.getAttachedStickers ' => true ,
225+ ];
226+ foreach ([
227+ 'messages.FeaturedStickers ' ,
228+ 'messages.StickerSet ' ,
229+ 'messages.ArchivedStickers ' ,
230+ 'messages.Stickers ' ,
231+ 'messages.StickerSetInstallResult ' ,
232+ 'messages.FoundStickerSets ' ,
233+ 'messages.MyStickers ' ,
234+ 'messages.FavedStickers ' ,
235+ 'messages.FoundStickers ' ,
236+ ] as $ stickerType ) {
237+ foreach ($ TL ->getMethodsOfType ($ stickerType ) as $ method => $ _ ) {
238+ $ stickerMethods [$ method ] = true ;
239+ }
240+ }
241+
220242 $ starMethods = [];
221243 foreach ($ TL ->getMethodsOfType ('payments.StarsStatus ' ) as $ method => $ _ ) {
222244 $ starMethods [$ method ] = true ;
@@ -370,13 +392,40 @@ public static function generate(int|string $layer, string $inputSchema, string $
370392
371393 $ locations ['messages.getWebPagePreview ' ][] = new Noop ("No locations are added for the method call, as it doesn't use persistent IDs as input; the location is instead extracted from the persistent IDs in the returned WebPage object " );
372394
395+ foreach (['users.getSavedMusic ' , 'users.getSavedMusicByID ' ] as $ m ) {
396+ $ locations ['document ' ][] = new CallOp (
397+ 'users.getSavedMusicByID ' ,
398+ [
399+ 'id ' => new GetInputUserOp (new Path ([[$ m , 'id ' ]], true )),
400+ 'documents ' => new ArrayOp (
401+ new ConstructorOp (
402+ 'inputDocument ' ,
403+ [
404+ 'id ' => new CopyOp ([['document ' , 'id ' ]]),
405+ 'access_hash ' => new CopyOp ([['document ' , 'access_hash ' ]]),
406+ 'file_reference ' => new PrimitiveLiteralOp ('bytes ' , '' ),
407+ ],
408+ ),
409+ ),
410+ ],
411+ 'fileSourceSavedMusic '
412+ );
413+ }
414+
373415 // Ignore these for now
374- foreach (['payments.ResaleStarGifts ' , 'payments.StarGiftUpgradePreview ' , 'StarGift ' ] as $ type ) {
416+ foreach (['payments.ResaleStarGifts ' , 'payments.StarGiftUpgradePreview ' , 'StarGift ' , ' StarGiftCollection ' , ' payments.StarGiftCollections ' ] as $ type ) {
375417 foreach ($ TL ->getConstructorsOfType ($ type ) as $ constructor => $ _ ) {
418+ if ($ constructor === 'payments.starGiftCollectionsNotModified ' ) {
419+ continue ;
420+ }
376421 $ locations [$ constructor ][] = new Noop ('Contexts for star gifts are not yet implemented ' );
377422 }
378423 }
379424
425+ $ locations ['messages.getCustomEmojiDocuments ' ][] = new Noop ("Do not store file references in this context " );
426+
427+ $ locations ['account.uploadTheme ' ][] = new Noop ('A freshly uploaded theme file will obtain a context only once it is created via account.createTheme ' );
428+
380429 $ recurse = static function (Closure $ onStackEnd , string $ type , array &$ stack , array &$ stackTypes ) use ($ TL , &$ recurse ): void {
381430 if ($ type === 'Update ' || $ type === 'Updates ' ) {
382431 $ onStackEnd ($ stack );
@@ -504,9 +553,10 @@ public static function generate(int|string $layer, string $inputSchema, string $
504553 $ stack = [[$ constructor , 'file_reference ' ]];
505554 $ stackTypes = [$ type => 1 ];
506555 $ recurse (
507- static function (array $ stack ) use ($ locations , $ TL , $ tmp , &$ validated , $ storyMethods , $ starMethods ): void {
556+ static function (array $ stack ) use ($ locations , $ TL , $ tmp , &$ validated , $ storyMethods , $ starMethods, $ stickerMethods ): void {
508557 $ slice = [];
509558 $ hadAny = false ;
559+ $ hadAnyWithNoFlags = false ;
510560 $ skippedDueToFlags = [];
511561 $ top = end ($ stack )[0 ];
512562 for ($ x = \count ($ stack )-1 ; $ x >= 0 ; $ x --) {
@@ -525,12 +575,16 @@ static function (array $stack) use ($locations, $TL, $tmp, &$validated, $storyMe
525575 $ skippedDueToFlags []= $ op ;
526576 continue ;
527577 }
578+ $ hadAnyWithNoFlags = true ;
528579 }
529580 $ slice [] = $ pair ;
530581 }
531582 if (!$ hadAny ) {
532583 throw new AssertionError ("Uncovered path: " . json_encode ($ stack ));
533584 }
585+ if ($ hadAnyWithNoFlags ) {
586+ return ;
587+ }
534588 if ($ skippedDueToFlags ) {
535589 if ($ top === 'updateStory '
536590 || $ top === 'peerStories '
@@ -545,6 +599,11 @@ static function (array $stack) use ($locations, $TL, $tmp, &$validated, $storyMe
545599 || $ top === 'channels.getFullChannel '
546600 || $ top === 'users.getFullUser '
547601 // The three above are related to botInfo, ignore as we already store a context for the chat info.
602+
603+ || isset ($ stickerMethods [$ top ])
604+ || $ top === 'messages.getRecentStickers '
605+ || $ top === 'updateNewStickerSet '
606+ // The above are covered by the GetInputStickerSet document context
548607 ) {
549608 return ;
550609 }
0 commit comments