@@ -377,6 +377,17 @@ TL_username *TL_username::TLdeserialize(NativeByteBuffer *stream, uint32_t const
377
377
return result;
378
378
}
379
379
380
+ TL_peerColor *TL_peerColor::TLdeserialize (NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
381
+ if (TL_peerColor::constructor != constructor) {
382
+ error = true ;
383
+ if (LOGS_ENABLED) DEBUG_FATAL (" can't parse magic %x in TL_peerColor" , constructor);
384
+ return nullptr ;
385
+ }
386
+ TL_peerColor *result = new TL_peerColor ();
387
+ result->readParams (stream, instanceNum, error);
388
+ return result;
389
+ }
390
+
380
391
void TL_restrictionReason::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
381
392
platform = stream->readString (&error);
382
393
reason = stream->readString (&error);
@@ -405,6 +416,132 @@ void TL_username::serializeToStream(NativeByteBuffer *stream) {
405
416
stream->writeString (username);
406
417
}
407
418
419
+ void TL_peerColor::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
420
+ flags = stream->readInt32 (&error);
421
+ if ((flags & 1 ) != 0 ) {
422
+ color = stream->readInt32 (&error);
423
+ }
424
+ if ((flags & 2 ) != 0 ) {
425
+ background_emoji_id = stream->readInt64 (&error);
426
+ }
427
+ }
428
+
429
+ void TL_peerColor::serializeToStream (NativeByteBuffer *stream) {
430
+ stream->writeInt32 (constructor);
431
+ stream->writeInt32 (flags);
432
+ if ((flags & 1 ) != 0 ) {
433
+ stream->writeInt32 (color);
434
+ }
435
+ if ((flags & 2 ) != 0 ) {
436
+ stream->writeInt64 (background_emoji_id);
437
+ }
438
+ }
439
+
440
+ EmojiStatus *EmojiStatus::TLdeserialize (NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
441
+ EmojiStatus *result = nullptr ;
442
+ switch (constructor) {
443
+ case TL_emojiStatusEmpty::constructor:
444
+ result = new TL_emojiStatusEmpty ();
445
+ break ;
446
+ case TL_emojiStatus::constructor:
447
+ result = new TL_emojiStatus ();
448
+ break ;
449
+ case TL_emojiStatusCollectible::constructor:
450
+ result = new TL_emojiStatusCollectible ();
451
+ break ;
452
+ case TL_emojiStatus_layer197::constructor:
453
+ result = new TL_emojiStatus_layer197 ();
454
+ break ;
455
+ case TL_emojiStatusUntil_layer197::constructor:
456
+ result = new TL_emojiStatusUntil_layer197 ();
457
+ break ;
458
+ default :
459
+ error = true ;
460
+ if (LOGS_ENABLED) DEBUG_FATAL (" can't parse magic %x in User" , constructor);
461
+ return nullptr ;
462
+ }
463
+ result->readParams (stream, instanceNum, error);
464
+ return result;
465
+ }
466
+
467
+ void TL_emojiStatusEmpty::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
468
+
469
+ }
470
+
471
+ void TL_emojiStatusEmpty::serializeToStream (NativeByteBuffer *stream) {
472
+ stream->writeInt32 (constructor);
473
+ }
474
+
475
+ void TL_emojiStatus::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
476
+ flags = stream->readInt32 (&error);
477
+ document_id = stream->readInt64 (&error);
478
+ if ((flags & 1 ) != 0 ) {
479
+ until = stream->readInt64 (&error);
480
+ }
481
+ }
482
+
483
+ void TL_emojiStatus::serializeToStream (NativeByteBuffer *stream) {
484
+ stream->writeInt32 (constructor);
485
+ stream->writeInt32 (flags);
486
+ stream->writeInt64 (document_id);
487
+ if ((flags & 1 ) != 0 ) {
488
+ stream->writeInt32 (until);
489
+ }
490
+ }
491
+
492
+ void TL_emojiStatus_layer197::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
493
+ document_id = stream->readInt64 (&error);
494
+ }
495
+
496
+ void TL_emojiStatus_layer197::serializeToStream (NativeByteBuffer *stream) {
497
+ stream->writeInt32 (constructor);
498
+ stream->writeInt64 (document_id);
499
+ }
500
+
501
+ void TL_emojiStatusUntil_layer197::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
502
+ document_id = stream->readInt64 (&error);
503
+ until = stream->readInt32 (&error);
504
+ }
505
+
506
+ void TL_emojiStatusUntil_layer197::serializeToStream (NativeByteBuffer *stream) {
507
+ stream->writeInt32 (constructor);
508
+ stream->writeInt64 (document_id);
509
+ stream->writeInt32 (until);
510
+ }
511
+
512
+ void TL_emojiStatusCollectible::readParams (NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
513
+ flags = stream->readInt32 (&error);
514
+ collectible_id = stream->readInt64 (&error);
515
+ document_id = stream->readInt64 (&error);
516
+ title = stream->readString (&error);
517
+ slug = stream->readString (&error);
518
+ pattern_document_id = stream->readInt64 (&error);
519
+ center_color = stream->readInt32 (&error);
520
+ edge_color = stream->readInt32 (&error);
521
+ pattern_color = stream->readInt32 (&error);
522
+ text_color = stream->readInt32 (&error);
523
+ if ((flags & 1 ) != 0 ) {
524
+ until = stream->readInt64 (&error);
525
+ }
526
+ }
527
+
528
+ void TL_emojiStatusCollectible::serializeToStream (NativeByteBuffer *stream) {
529
+ stream->writeInt32 (constructor);
530
+ stream->writeInt32 (flags);
531
+ stream->writeInt64 (collectible_id);
532
+ stream->writeInt64 (document_id);
533
+ stream->writeString (title);
534
+ stream->writeString (slug);
535
+ stream->writeInt64 (pattern_document_id);
536
+ stream->writeInt32 (center_color);
537
+ stream->writeInt32 (edge_color);
538
+ stream->writeInt32 (pattern_color);
539
+ stream->writeInt32 (text_color);
540
+ if ((flags & 1 ) != 0 ) {
541
+ stream->writeInt32 (until);
542
+ }
543
+ }
544
+
408
545
User *User::TLdeserialize (NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
409
546
User *result = nullptr ;
410
547
switch (constructor) {
@@ -483,21 +620,7 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er
483
620
lang_code = stream->readString (&error);
484
621
}
485
622
if ((flags & 1073741824 ) != 0 ) {
486
- emojiStatusMagic = stream->readUint32 (&error);
487
- if (emojiStatusMagic == 0x2de11aae ) {
488
- // emojiStatusEmpty
489
- } else if (emojiStatusMagic == 0x929b619d ) {
490
- // emojiStatus
491
- emojiStatusDocumentId = stream->readInt64 (&error);
492
- } else if (emojiStatusMagic == 0xfa30a8c7 ) {
493
- // emojiStatusUntil
494
- emojiStatusDocumentId = stream->readInt64 (&error);
495
- emojiStatusUntil = stream->readInt32 (&error);
496
- } else {
497
- error = true ;
498
- if (LOGS_ENABLED) DEBUG_FATAL (" wrong EmojiStatus magic, got %x" , emojiStatusMagic);
499
- return ;
500
- }
623
+ emoji_status = std::unique_ptr<EmojiStatus>(EmojiStatus::TLdeserialize (stream, stream->readInt32 (&error), instanceNum, error));
501
624
}
502
625
if ((flags2 & 1 ) != 0 ) {
503
626
uint32_t magic = stream->readUint32 (&error);
@@ -519,18 +642,17 @@ void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &er
519
642
stories_max_id = stream->readInt32 (&error);
520
643
}
521
644
if ((flags2 & 256 ) != 0 ) {
522
- int magic = stream->readInt32 (&error);
523
- color_color = stream->readInt32 (&error);
524
- color_background_emoji_id = stream->readInt64 (&error);
645
+ color = std::unique_ptr<TL_peerColor>(TL_peerColor::TLdeserialize (stream, stream->readUint32 (&error), instanceNum, error));
525
646
}
526
647
if ((flags2 & 512 ) != 0 ) {
527
- int magic = stream->readInt32 (&error);
528
- profile_color_color = stream->readInt32 (&error);
529
- profile_color_background_emoji_id = stream->readInt64 (&error);
648
+ profile_color = std::unique_ptr<TL_peerColor>(TL_peerColor::TLdeserialize (stream, stream->readUint32 (&error), instanceNum, error));
530
649
}
531
650
if ((flags2 & 4096 ) != 0 ) {
532
651
bot_active_users = stream->readInt32 (&error);
533
652
}
653
+ if ((flags2 & 16384 ) != 0 ) {
654
+ bot_verification_icon = stream->readInt64 (&error);
655
+ }
534
656
}
535
657
536
658
void TL_user::serializeToStream (NativeByteBuffer *stream) {
@@ -577,15 +699,7 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) {
577
699
stream->writeString (lang_code);
578
700
}
579
701
if ((flags & 1073741824 ) != 0 ) {
580
- stream->writeInt32 (emojiStatusMagic);
581
- if (emojiStatusMagic == 0x929b619d ) {
582
- // emojiStatus
583
- stream->writeInt64 (emojiStatusDocumentId);
584
- } else if (emojiStatusMagic == 0xfa30a8c7 ) {
585
- // emojiStatusUntil
586
- stream->writeInt64 (emojiStatusDocumentId);
587
- stream->writeInt32 (emojiStatusUntil);
588
- }
702
+ emoji_status->serializeToStream (stream);
589
703
}
590
704
if ((flags2 & 1 ) != 0 ) {
591
705
stream->writeInt32 (0x1cb5c415 );
@@ -599,18 +713,17 @@ void TL_user::serializeToStream(NativeByteBuffer *stream) {
599
713
stream->writeInt32 (stories_max_id);
600
714
}
601
715
if ((flags2 & 256 ) != 0 ) {
602
- stream->writeInt32 (0xba278146 );
603
- stream->writeInt32 (color_color);
604
- stream->writeInt32 (color_background_emoji_id);
716
+ color->serializeToStream (stream);
605
717
}
606
718
if ((flags2 & 512 ) != 0 ) {
607
- stream->writeInt32 (0xba278146 );
608
- stream->writeInt32 (profile_color_color);
609
- stream->writeInt32 (profile_color_background_emoji_id);
719
+ profile_color->serializeToStream (stream);
610
720
}
611
721
if ((flags2 & 4096 ) != 0 ) {
612
722
stream->writeInt32 (bot_active_users);
613
723
}
724
+ if ((flags2 & 16384 ) != 0 ) {
725
+ stream->writeInt64 (bot_verification_icon);
726
+ }
614
727
}
615
728
616
729
InputPeer *InputPeer::TLdeserialize (NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
0 commit comments