-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApiScheme.cpp
637 lines (580 loc) · 22.1 KB
/
ApiScheme.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
/*
* This is the source code of tgnet library v. 1.1
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2015-2018.
*/
#include "ApiScheme.h"
#include "ByteArray.h"
#include "NativeByteBuffer.h"
#include "FileLog.h"
Bool *Bool::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
Bool *result = nullptr;
switch (constructor) {
case 0x997275b5:
result = new TL_boolTrue();
break;
case 0xbc799737:
result = new TL_boolFalse();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in Bool", constructor);
return nullptr;
}
result->readParams(stream, instanceNum, error);
return result;
}
void TL_boolTrue::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
void TL_boolFalse::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
TL_dcOption *TL_dcOption::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_dcOption::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_dcOption", constructor);
return nullptr;
}
TL_dcOption *result = new TL_dcOption();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_dcOption::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
ipv6 = (flags & 1) != 0;
media_only = (flags & 2) != 0;
tcpo_only = (flags & 4) != 0;
cdn = (flags & 8) != 0;
isStatic = (flags & 16) != 0;
id = stream->readInt32(&error);
ip_address = stream->readString(&error);
port = stream->readInt32(&error);
if ((flags & 1024) != 0) {
secret = std::unique_ptr<ByteArray>(stream->readByteArray(&error));
}
}
void TL_dcOption::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
flags = ipv6 ? (flags | 1) : (flags &~ 1);
flags = media_only ? (flags | 2) : (flags &~ 2);
flags = tcpo_only ? (flags | 4) : (flags &~ 4);
flags = cdn ? (flags | 8) : (flags &~ 8);
flags = isStatic ? (flags | 16) : (flags &~ 16);
stream->writeInt32(flags);
stream->writeInt32(id);
stream->writeString(ip_address);
stream->writeInt32(port);
if ((flags & 1024) != 0) {
stream->writeByteArray(secret.get());
}
}
TL_cdnPublicKey *TL_cdnPublicKey::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_cdnPublicKey::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_cdnPublicKey", constructor);
return nullptr;
}
TL_cdnPublicKey *result = new TL_cdnPublicKey();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_cdnPublicKey::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
dc_id = stream->readInt32(&error);
public_key = stream->readString(&error);
}
void TL_cdnPublicKey::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(dc_id);
stream->writeString(public_key);
}
TL_cdnConfig *TL_cdnConfig::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_cdnConfig::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_cdnConfig", constructor);
return nullptr;
}
TL_cdnConfig *result = new TL_cdnConfig();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_cdnConfig::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
int magic = stream->readInt32(&error);
if (magic != 0x1cb5c415) {
error = true;
if (LOGS_ENABLED) DEBUG_E("wrong Vector magic, got %x", magic);
return;
}
int count = stream->readInt32(&error);
for (int32_t a = 0; a < count; a++) {
TL_cdnPublicKey *object = TL_cdnPublicKey::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error);
if (object == nullptr) {
return;
}
public_keys.push_back(std::unique_ptr<TL_cdnPublicKey>(object));
}
}
void TL_cdnConfig::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(0x1cb5c415);
int32_t count = (int32_t) public_keys.size();
stream->writeInt32(count);
for (int32_t a = 0; a < count; a++) {
public_keys[a]->serializeToStream(stream);
}
}
bool TL_help_getCdnConfig::isNeedLayer() {
return true;
}
TLObject *TL_help_getCdnConfig::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
return TL_cdnConfig::TLdeserialize(stream, constructor, instanceNum, error);
}
void TL_help_getCdnConfig::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
TL_config *TL_config::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_config::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_config", constructor);
return nullptr;
}
TL_config *result = new TL_config();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_config::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
date = stream->readInt32(&error);
expires = stream->readInt32(&error);
test_mode = stream->readBool(&error);
this_dc = stream->readInt32(&error);
uint32_t magic = stream->readUint32(&error);
if (magic != 0x1cb5c415) {
error = true;
if (LOGS_ENABLED) DEBUG_E("wrong Vector magic, got %x", magic);
return;
}
int32_t count = stream->readInt32(&error);
for (int32_t a = 0; a < count; a++) {
TL_dcOption *object = TL_dcOption::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error);
if (object == nullptr) {
return;
}
dc_options.push_back(std::unique_ptr<TL_dcOption>(object));
}
dc_txt_domain_name = stream->readString(&error);
chat_size_max = stream->readInt32(&error);
megagroup_size_max = stream->readInt32(&error);
forwarded_count_max = stream->readInt32(&error);
online_update_period_ms = stream->readInt32(&error);
offline_blur_timeout_ms = stream->readInt32(&error);
offline_idle_timeout_ms = stream->readInt32(&error);
online_cloud_timeout_ms = stream->readInt32(&error);
notify_cloud_delay_ms = stream->readInt32(&error);
notify_default_delay_ms = stream->readInt32(&error);
push_chat_period_ms = stream->readInt32(&error);
push_chat_limit = stream->readInt32(&error);
saved_gifs_limit = stream->readInt32(&error);
edit_time_limit = stream->readInt32(&error);
revoke_time_limit = stream->readInt32(&error);
revoke_pm_time_limit = stream->readInt32(&error);
rating_e_decay = stream->readInt32(&error);
stickers_recent_limit = stream->readInt32(&error);
stickers_faved_limit = stream->readInt32(&error);
channels_read_media_period = stream->readInt32(&error);
if ((flags & 1) != 0) {
tmp_sessions = stream->readInt32(&error);
}
pinned_dialogs_count_max = stream->readInt32(&error);
pinned_infolder_count_max = stream->readInt32(&error);
call_receive_timeout_ms = stream->readInt32(&error);
call_ring_timeout_ms = stream->readInt32(&error);
call_connect_timeout_ms = stream->readInt32(&error);
call_packet_timeout_ms = stream->readInt32(&error);
me_url_prefix = stream->readString(&error);
if ((flags & 128) != 0) {
autoupdate_url_prefix = stream->readString(&error);
}
if ((flags & 512) != 0) {
gif_search_username = stream->readString(&error);
}
if ((flags & 1024) != 0) {
venue_search_username = stream->readString(&error);
}
if ((flags & 2048) != 0) {
img_search_username = stream->readString(&error);
}
if ((flags & 4096) != 0) {
static_maps_provider = stream->readString(&error);
}
caption_length_max = stream->readInt32(&error);
message_length_max = stream->readInt32(&error);
webfile_dc_id = stream->readInt32(&error);
if ((flags & 4) != 0) {
suggested_lang_code = stream->readString(&error);
}
if ((flags & 4) != 0) {
lang_pack_version = stream->readInt32(&error);
}
if ((flags & 4) != 0) {
base_lang_pack_version = stream->readInt32(&error);
}
}
void TL_config::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(flags);
stream->writeInt32(date);
stream->writeInt32(expires);
stream->writeBool(test_mode);
stream->writeInt32(this_dc);
stream->writeInt32(0x1cb5c415);
uint32_t count = (uint32_t) dc_options.size();
stream->writeInt32(count);
for (uint32_t a = 0; a < count; a++) {
dc_options[a]->serializeToStream(stream);
}
stream->writeString(dc_txt_domain_name);
stream->writeInt32(chat_size_max);
stream->writeInt32(megagroup_size_max);
stream->writeInt32(forwarded_count_max);
stream->writeInt32(online_update_period_ms);
stream->writeInt32(offline_blur_timeout_ms);
stream->writeInt32(offline_idle_timeout_ms);
stream->writeInt32(online_cloud_timeout_ms);
stream->writeInt32(notify_cloud_delay_ms);
stream->writeInt32(notify_default_delay_ms);
stream->writeInt32(push_chat_period_ms);
stream->writeInt32(push_chat_limit);
stream->writeInt32(saved_gifs_limit);
stream->writeInt32(edit_time_limit);
stream->writeInt32(revoke_time_limit);
stream->writeInt32(revoke_pm_time_limit);
stream->writeInt32(rating_e_decay);
stream->writeInt32(stickers_recent_limit);
stream->writeInt32(stickers_faved_limit);
stream->writeInt32(channels_read_media_period);
if ((flags & 1) != 0) {
stream->writeInt32(tmp_sessions);
}
stream->writeInt32(pinned_dialogs_count_max);
stream->writeInt32(pinned_infolder_count_max);
stream->writeInt32(call_receive_timeout_ms);
stream->writeInt32(call_ring_timeout_ms);
stream->writeInt32(call_connect_timeout_ms);
stream->writeInt32(call_packet_timeout_ms);
stream->writeString(me_url_prefix);
if ((flags & 128) != 0) {
stream->writeString(autoupdate_url_prefix);
}
if ((flags & 512) != 0) {
stream->writeString(gif_search_username);
}
if ((flags & 1024) != 0) {
stream->writeString(venue_search_username);
}
if ((flags & 2048) != 0) {
stream->writeString(img_search_username);
}
if ((flags & 4096) != 0) {
stream->writeString(static_maps_provider);
}
stream->writeInt32(caption_length_max);
stream->writeInt32(message_length_max);
stream->writeInt32(webfile_dc_id);
if ((flags & 4) != 0) {
stream->writeString(suggested_lang_code);
}
if ((flags & 4) != 0) {
stream->writeInt32(lang_pack_version);
}
if ((flags & 4) != 0) {
stream->writeInt32(base_lang_pack_version);
}
}
TLObject *TL_help_getConfig::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
return TL_config::TLdeserialize(stream, constructor, instanceNum, error);
}
void TL_help_getConfig::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
bool TL_help_getConfig::isNeedLayer() {
return true;
}
bool TL_account_registerDevice::isNeedLayer() {
return true;
}
TLObject *TL_account_registerDevice::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
return Bool::TLdeserialize(stream, constructor, instanceNum, error);
}
void TL_account_registerDevice::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(token_type);
stream->writeString(token);
}
User *User::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
User *result = nullptr;
switch (constructor) {
case 0x200250ba:
result = new TL_userEmpty();
break;
case 0x2e13f4c3:
result = new TL_user();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in User", constructor);
return nullptr;
}
result->readParams(stream, instanceNum, error);
return result;
}
void TL_userEmpty::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
id = stream->readInt32(&error);
}
void TL_userEmpty::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(id);
}
void TL_user::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
id = stream->readInt32(&error);
if ((flags & 1) != 0) {
access_hash = stream->readInt64(&error);
}
if ((flags & 2) != 0) {
first_name = stream->readString(&error);
}
if ((flags & 4) != 0) {
last_name = stream->readString(&error);
}
if ((flags & 8) != 0) {
username = stream->readString(&error);
}
if ((flags & 16) != 0) {
phone = stream->readString(&error);
}
if ((flags & 32) != 0) {
photo = std::unique_ptr<UserProfilePhoto>(UserProfilePhoto::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
}
if ((flags & 64) != 0) {
status = std::unique_ptr<UserStatus>(UserStatus::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
}
if ((flags & 16384) != 0) {
bot_info_version = stream->readInt32(&error);
}
if ((flags & 262144) != 0) {
restriction_reason = stream->readString(&error);
}
if ((flags & 524288) != 0) {
bot_inline_placeholder = stream->readString(&error);
}
if ((flags & 4194304) != 0) {
lang_code = stream->readString(&error);
}
}
void TL_user::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(flags);
stream->writeInt32(id);
if ((flags & 1) != 0) {
stream->writeInt64(access_hash);
}
if ((flags & 2) != 0) {
stream->writeString(first_name);
}
if ((flags & 4) != 0) {
stream->writeString(last_name);
}
if ((flags & 8) != 0) {
stream->writeString(username);
}
if ((flags & 16) != 0) {
stream->writeString(phone);
}
if ((flags & 32) != 0) {
photo->serializeToStream(stream);
}
if ((flags & 64) != 0) {
status->serializeToStream(stream);
}
if ((flags & 16384) != 0) {
stream->writeInt32(bot_info_version);
}
if ((flags & 262144) != 0) {
stream->writeString(restriction_reason);
}
if ((flags & 524288) != 0) {
stream->writeString(bot_inline_placeholder);
}
if ((flags & 4194304) != 0) {
stream->writeString(lang_code);
}
}
TL_auth_authorization *TL_auth_authorization::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_auth_authorization::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_auth_authorization", constructor);
return nullptr;
}
TL_auth_authorization *result = new TL_auth_authorization();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_auth_authorization::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
flags = stream->readInt32(&error);
if ((flags & 1) != 0) {
tmp_sessions = stream->readInt32(&error);
}
user = std::unique_ptr<User>(User::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
}
TL_auth_exportedAuthorization *TL_auth_exportedAuthorization::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
if (TL_auth_exportedAuthorization::constructor != constructor) {
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in TL_auth_exportedAuthorization", constructor);
return nullptr;
}
TL_auth_exportedAuthorization *result = new TL_auth_exportedAuthorization();
result->readParams(stream, instanceNum, error);
return result;
}
void TL_auth_exportedAuthorization::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
id = stream->readInt32(&error);
bytes = std::unique_ptr<ByteArray>(stream->readByteArray(&error));
}
bool TL_auth_exportAuthorization::isNeedLayer() {
return true;
}
TLObject *TL_auth_exportAuthorization::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
return TL_auth_exportedAuthorization::TLdeserialize(stream, constructor, instanceNum, error);
}
void TL_auth_exportAuthorization::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(dc_id);
}
bool TL_auth_importAuthorization::isNeedLayer() {
return true;
}
TLObject *TL_auth_importAuthorization::deserializeResponse(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
return TL_auth_authorization::TLdeserialize(stream, constructor, instanceNum, error);
}
void TL_auth_importAuthorization::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(id);
stream->writeByteArray(bytes.get());
}
UserStatus *UserStatus::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
UserStatus *result = nullptr;
switch (constructor) {
case 0x8c703f:
result = new TL_userStatusOffline();
break;
case 0x7bf09fc:
result = new TL_userStatusLastWeek();
break;
case 0x9d05049:
result = new TL_userStatusEmpty();
break;
case 0x77ebc742:
result = new TL_userStatusLastMonth();
break;
case 0xedb93949:
result = new TL_userStatusOnline();
break;
case 0xe26f42f1:
result = new TL_userStatusRecently();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in UserStatus", constructor);
return nullptr;
}
result->readParams(stream, instanceNum, error);
return result;
}
void TL_userStatusOffline::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
expires = stream->readInt32(&error);
}
void TL_userStatusOffline::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(expires);
}
void TL_userStatusLastWeek::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
void TL_userStatusEmpty::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
void TL_userStatusLastMonth::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
void TL_userStatusOnline::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
expires = stream->readInt32(&error);
}
void TL_userStatusOnline::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt32(expires);
}
void TL_userStatusRecently::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
FileLocation *FileLocation::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
FileLocation *result = nullptr;
switch (constructor) {
case 0xbc7fc6cd:
result = new TL_fileLocationToBeDeprecated();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in FileLocation", constructor);
return nullptr;
}
result->readParams(stream, instanceNum, error);
return result;
}
void TL_fileLocationToBeDeprecated::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
volume_id = stream->readInt64(&error);
local_id = stream->readInt32(&error);
}
void TL_fileLocationToBeDeprecated::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt64(volume_id);
stream->writeInt32(local_id);
}
UserProfilePhoto *UserProfilePhoto::TLdeserialize(NativeByteBuffer *stream, uint32_t constructor, int32_t instanceNum, bool &error) {
UserProfilePhoto *result = nullptr;
switch (constructor) {
case 0x4f11bae1:
result = new TL_userProfilePhotoEmpty();
break;
case 0xecd75d8c:
result = new TL_userProfilePhoto();
break;
default:
error = true;
if (LOGS_ENABLED) DEBUG_E("can't parse magic %x in UserProfilePhoto", constructor);
return nullptr;
}
result->readParams(stream, instanceNum, error);
return result;
}
void TL_userProfilePhotoEmpty::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}
void TL_userProfilePhoto::readParams(NativeByteBuffer *stream, int32_t instanceNum, bool &error) {
photo_id = stream->readInt64(&error);
photo_small = std::unique_ptr<FileLocation>(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
photo_big = std::unique_ptr<FileLocation>(FileLocation::TLdeserialize(stream, stream->readUint32(&error), instanceNum, error));
dc_id = stream->readInt32(&error);
}
void TL_userProfilePhoto::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
stream->writeInt64(photo_id);
photo_small->serializeToStream(stream);
photo_big->serializeToStream(stream);
stream->writeInt32(dc_id);
}
void TL_updatesTooLong::serializeToStream(NativeByteBuffer *stream) {
stream->writeInt32(constructor);
}