diff --git a/.gitignore b/.gitignore index 19c18e0cf..94b1d353e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ *.suo *.sdf *.opensdf +*.opendb /Telegram/*.aps /Win32/ ipch/ diff --git a/README.md b/README.md index f4edaa479..32398eb24 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ The source code is published under GPLv3 with OpenSSL exception, the license is ## Supported systems * Windows XP - Windows 10 (**not** RT) -* Mac OS X 10.8 - Mac OS X 10.10 +* Mac OS X 10.8 - Mac OS X 10.11 * Mac OS X 10.6 - Mac OS X 10.7 (separate build) -* Ubuntu 12.04 - Ubuntu 14.04 +* Ubuntu 12.04 - Ubuntu 15.04 * Fedora 22 ## Third-party libraries @@ -82,7 +82,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is * ### MetaLang - Creates from languagepack file `Resources/lang.txt` language constants code and language file parse code: + Creates from languagepack file `Resources/lang.strings` language constants code and language file parse code: * GeneratedFiles/lang.h * GeneratedFiles/lang.cpp diff --git a/Telegram/Deploy.sh b/Telegram/Deploy.sh index 4a54d780a..3f40b0fc7 100755 --- a/Telegram/Deploy.sh +++ b/Telegram/Deploy.sh @@ -57,7 +57,11 @@ elif [ "$BuildTarget" == "mac" ]; then echo "Deploying version $AppVersionStrFull for Windows.." else DeployMac="1" - DeployMac32="1" + if [ "$BetaVersion" != "0" ]; then + DeployMac32="0" + else + DeployMac32="1" + fi DeployWin="1" echo "Deploying three versions of $AppVersionStrFull: for Windows, OS X 10.6 and 10.7 and OS X 10.8+.." fi @@ -188,7 +192,6 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$Build fi if [ "$DeployMac" == "1" ]; then - cp -v "$DeployPath/$UpdateFile" "$DropboxDeployPath/" cp -v "$DeployPath/$SetupFile" "$DropboxDeployPath/$DropboxSetupFile" if [ -d "$DropboxDeployPath/Telegram.app.dSYM" ]; then rm -rf "$DropboxDeployPath/Telegram.app.dSYM" @@ -196,7 +199,6 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$Build cp -rv "$DeployPath/Telegram.app.dSYM" "$DropboxDeployPath/" fi if [ "$DeployMac32" == "1" ]; then - mv -v "$Mac32DeployPath/$Mac32UpdateFile" "$DropboxDeployPath/" mv -v "$Mac32DeployPath/$Mac32SetupFile" "$DropboxDeployPath/$DropboxMac32SetupFile" if [ -d "$DropboxDeployPath/Telegram32.app.dSYM" ]; then rm -rf "$DropboxDeployPath/Telegram32.app.dSYM" @@ -207,7 +209,6 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ] || [ "$Build mv -v "$WinDeployPath/Telegram.pdb" "$DropboxDeployPath/" mv -v "$WinDeployPath/Updater.exe" "$DropboxDeployPath/" mv -v "$WinDeployPath/Updater.pdb" "$DropboxDeployPath/" - mv -v "$WinDeployPath/$WinUpdateFile" "$DropboxDeployPath/" if [ "$BetaVersion" == "0" ]; then mv -v "$WinDeployPath/$WinSetupFile" "$DropboxDeployPath/" fi diff --git a/Telegram/Resources/lang.strings b/Telegram/Resources/lang.strings index 9039db902..c5b317fdd 100644 --- a/Telegram/Resources/lang.strings +++ b/Telegram/Resources/lang.strings @@ -86,8 +86,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cancel" = "Cancel"; "lng_continue" = "Continue"; "lng_close" = "Close"; -"lng_connecting" = "Connecting.."; -"lng_reconnecting" = "Reconnect {count:now|in # s|in # s}.."; +"lng_connecting" = "Connecting..."; +"lng_reconnecting" = "Reconnect {count:now|in # s|in # s}..."; "lng_reconnecting_try_now" = "Try now"; "lng_status_service_notifications" = "service notifications"; @@ -108,7 +108,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_status_lastseen_date" = "last seen {date}"; "lng_status_lastseen_date_time" = "last seen {date} at {time}"; "lng_status_online" = "online"; -"lng_status_connecting" = "connecting.."; +"lng_status_connecting" = "connecting..."; "lng_chat_status_unaccessible" = "group is unaccessible"; "lng_chat_status_members" = "{count:no members|# member|# members}"; @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "This message was deleted"; "lng_edit_too_long" = "Your message text is too long"; "lng_edit_message" = "Edit message"; -"lng_edit_message_text" = "New message text.."; +"lng_edit_message_text" = "New message text..."; "lng_deleted" = "Unknown"; "lng_deleted_message" = "Deleted message"; "lng_pinned_message" = "Pinned message"; @@ -162,7 +162,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_code_telegram" = "Please enter the code you've just\nreceived in your previous [b]Telegram[/b] app."; "lng_code_no_telegram" = "Send code via SMS"; "lng_code_call" = "Telegram will dial your number in {minutes}:{seconds}"; -"lng_code_calling" = "Requesting a call from Telegram.."; +"lng_code_calling" = "Requesting a call from Telegram..."; "lng_code_called" = "Telegram dialed your number"; "lng_bad_phone" = "Invalid phone number. Please try again."; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "Channel name"; "lng_no_contacts" = "You have no contacts"; "lng_no_chats" = "Your chats will be here"; -"lng_contacts_loading" = "Loading.."; +"lng_contacts_loading" = "Loading..."; "lng_contacts_not_found" = "No contacts found"; "lng_dlg_search_chat" = "Search in this chat"; "lng_dlg_search_channel" = "Search in this channel"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Save"; "lng_settings_upload" = "Set Profile Photo"; "lng_settings_crop_profile" = "Select a square area for your profile photo"; -"lng_settings_uploading_photo" = "Uploading photo.."; +"lng_settings_uploading_photo" = "Uploading photo..."; "lng_username_title" = "Username"; "lng_username_about" = "You can choose a username on Telegram.\nIf you do, other people will be able to find\nyou by this username and contact you\nwithout knowing your phone number.\n\nYou can use a-z, 0-9 and underscores.\nMinimum length is 5 characters."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "Update automatically"; "lng_settings_current_version" = "Version {version}"; "lng_settings_check_now" = "Check for updates"; -"lng_settings_update_checking" = "Checking for updates.."; +"lng_settings_update_checking" = "Checking for updates..."; "lng_settings_latest_installed" = "Latest version is installed"; -"lng_settings_downloading" = "Downloading update {ready} / {total} MB.."; +"lng_settings_downloading" = "Downloading update {ready} / {total} MB..."; "lng_settings_update_ready" = "New version is ready"; "lng_settings_update_now" = "Restart Now"; "lng_settings_update_fail" = "Update check failed :("; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "File download could not be started. It could happen because of a bad download location.\n\nYou can change download path in Settings."; "lng_download_path_settings" = "Settings"; "lng_download_finish_failed" = "File download could not be finished.\n\nWould you like to try again?"; -"lng_download_path_clearing" = "Clearing.."; +"lng_download_path_clearing" = "Clearing..."; "lng_download_path_cleared" = "Cleared!"; "lng_download_path_clear_failed" = "Clear failed :("; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|# image|# images}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# voice message|# voice messages}, {size}"; "lng_local_storage_clear" = "Clear all"; -"lng_local_storage_clearing" = "Clearing.."; +"lng_local_storage_clearing" = "Clearing..."; "lng_local_storage_cleared" = "Cleared!"; "lng_local_storage_clear_failed" = "Clear failed :("; @@ -331,7 +331,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_passcode_logout" = "Log out"; "lng_passcode_need_unblock" = "You need to unlock me first."; -"lng_cloud_password_waiting" = "Confirmation link sent to {email}.."; +"lng_cloud_password_waiting" = "Confirmation link sent to {email}..."; "lng_cloud_password_change" = "Change cloud password"; "lng_cloud_password_create" = "Cloud password"; "lng_cloud_password_remove" = "Remove cloud password"; @@ -358,9 +358,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "Password was not changed"; "lng_connection_type" = "Connection type:"; -"lng_connection_auto_connecting" = "Default (connecting..)"; +"lng_connection_auto_connecting" = "Default (connecting...)"; "lng_connection_auto" = "Default ({transport} used)"; -"lng_connection_proxy_connecting" = "Connecting through proxy.."; +"lng_connection_proxy_connecting" = "Connecting through proxy..."; "lng_connection_proxy" = "{transport} with proxy"; "lng_connection_header" = "Connection type"; "lng_connection_auto_rb" = "Auto (TCP if available or HTTP)"; @@ -396,7 +396,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_sessions_other_desc" = "You can log in to Telegram from other mobile, tablet and desktop devices, using the same phone number. All your data will be instantly synchronized."; "lng_sessions_terminate_all" = "Terminate all other sessions"; -"lng_preview_loading" = "Getting Link Info.."; +"lng_preview_loading" = "Getting Link Info..."; "lng_profile_chat_unaccessible" = "Group is unaccessible"; "lng_topbar_info" = "Info"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "Remove {user} from the group?"; "lng_profile_sure_kick_channel" = "Remove {user} from the channel?"; "lng_profile_sure_kick_admin" = "Remove {user} from administrators?"; -"lng_profile_loading" = "Loading.."; +"lng_profile_loading" = "Loading..."; "lng_profile_shared_media" = "Shared media"; "lng_profile_no_media" = "No media in this conversation."; "lng_profile_photos" = "{count:_not_used_|# photo|# photos} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# shared link|# shared links} »"; "lng_profile_shared_links_header" = "Shared links overview"; "lng_profile_copy_phone" = "Copy phone number"; +"lng_profile_copy_fullname" = "Copy name"; "lng_channel_add_admins" = "New administrator"; "lng_channel_add_members" = "Add members"; @@ -659,12 +660,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_remove" = "Delete"; "lng_stickers_return" = "Undo"; "lng_stickers_restore" = "Restore"; -"lng_stickers_count" = "{count:Loading..|# sticker|# stickers}"; +"lng_stickers_count" = "{count:Loading...|# sticker|# stickers}"; "lng_in_dlg_photo" = "Photo"; -"lng_in_dlg_video" = "Video"; +"lng_in_dlg_video" = "Video file"; +"lng_in_dlg_audio_file" = "Audio file"; "lng_in_dlg_contact" = "Contact"; -"lng_in_dlg_audio" = "Audio"; +"lng_in_dlg_audio" = "Voice message"; "lng_in_dlg_file" = "File"; "lng_in_dlg_sticker" = "Sticker"; "lng_in_dlg_sticker_emoji" = "{emoji} (sticker)"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "Are you sure you want to report spam in this group?"; "lng_report_spam_sure_channel" = "Are you sure you want to report spam in this channel?"; "lng_report_spam_ok" = "Report"; -"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment. {more_info}"; -"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment. {more_info}"; -"lng_cant_invite_not_contact_channel" = "Sorry, you can only add mutual contacts\nto channels at the moment. {more_info}"; +"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment.\n{more_info}"; +"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment.\n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Sorry, you can only add mutual contacts\nto channels at the moment.\n{more_info}"; "lng_cant_more_info" = "More info »"; +"lng_cant_invite_banned" = "Sorry, only admin can add this user."; "lng_cant_invite_privacy" = "Sorry, you cannot add this user to groups because of the privacy settings."; "lng_cant_invite_privacy_channel" = "Sorry, you cannot add this user to channels because of the privacy settings."; +"lng_cant_do_this" = "Sorry, this action is unavailable."; "lng_send_button" = "Send"; -"lng_message_ph" = "Write a message.."; -"lng_comment_ph" = "Write a comment.."; -"lng_broadcast_ph" = "Broadcast a message.."; -"lng_broadcast_silent_ph" = "Silent broadcast.."; +"lng_message_ph" = "Write a message..."; +"lng_comment_ph" = "Write a comment..."; +"lng_broadcast_ph" = "Broadcast a message..."; +"lng_broadcast_silent_ph" = "Silent broadcast..."; "lng_record_cancel" = "Release outside this field to cancel"; "lng_will_be_notified" = "Members will be notified when you post"; "lng_wont_be_notified" = "Members will not be notified when you post"; @@ -717,28 +721,29 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} is typing"; "lng_users_typing" = "{user} and {second_user} are typing"; "lng_many_typing" = "{count:_not_used_|# is|# are} typing"; -"lng_send_action_record_video" = "recording video"; -"lng_user_action_record_video" = "{user} is recording video"; -"lng_send_action_upload_video" = "sending video"; -"lng_user_action_upload_video" = "{user} is sending video"; -"lng_send_action_record_audio" = "recording audio"; -"lng_user_action_record_audio" = "{user} is recording audio"; -"lng_send_action_upload_audio" = "sending audio"; -"lng_user_action_upload_audio" = "{user} is sending audio"; -"lng_send_action_upload_photo" = "sending photo"; -"lng_user_action_upload_photo" = "{user} is sending photo"; -"lng_send_action_upload_file" = "sending file"; -"lng_user_action_upload_file" = "{user} is sending file"; -"lng_send_action_geo_location" = "picking location"; -"lng_user_action_geo_location" = "{user} is picking location"; -"lng_send_action_choose_contact" = "choosing contact"; -"lng_user_action_choose_contact" = "{user} is choosing contact"; +"lng_send_action_record_video" = "recording a video"; +"lng_user_action_record_video" = "{user} is recording a video"; +"lng_send_action_upload_video" = "sending a video"; +"lng_user_action_upload_video" = "{user} is sending a video"; +"lng_send_action_record_audio" = "recording a voice message"; +"lng_user_action_record_audio" = "{user} is recording a voice message"; +"lng_send_action_upload_audio" = "sending a voice message"; +"lng_user_action_upload_audio" = "{user} is sending a voice message"; +"lng_send_action_upload_photo" = "sending a photo"; +"lng_user_action_upload_photo" = "{user} is sending a photo"; +"lng_send_action_upload_file" = "sending a file"; +"lng_user_action_upload_file" = "{user} is sending a file"; +"lng_send_action_geo_location" = "picking a location"; +"lng_user_action_geo_location" = "{user} is picking a location"; +"lng_send_action_choose_contact" = "choosing a contact"; +"lng_user_action_choose_contact" = "{user} is choosing a contact"; "lng_unread_bar" = "{count:_not_used_|# unread message|# unread messages}"; "lng_maps_point" = "Location"; "lng_save_photo" = "Save image"; -"lng_save_video" = "Save video"; -"lng_save_audio" = "Save audio"; +"lng_save_video" = "Save video file"; +"lng_save_audio_file" = "Save audio file"; +"lng_save_audio" = "Save voice message"; "lng_save_file" = "Save file"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "Copy email address"; "lng_context_copy_hashtag" = "Copy hashtag"; "lng_context_copy_mention" = "Copy username"; -"lng_context_save_image" = "Save Image As.."; +"lng_context_save_image" = "Save Image As..."; "lng_context_forward_image" = "Forward Image"; "lng_context_delete_image" = "Delete Image"; "lng_context_copy_image" = "Copy Image"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Cancel Download"; "lng_context_show_in_folder" = "Show in Folder"; "lng_context_show_in_finder" = "Show in Finder"; -"lng_context_save_video" = "Save Video As.."; -"lng_context_save_audio" = "Save Audio As.."; +"lng_context_save_video" = "Save Video File As..."; +"lng_context_save_audio_file" = "Save Audio File As..."; +"lng_context_save_audio" = "Save Voice Message As..."; "lng_context_pack_info" = "Pack Info"; "lng_context_pack_add" = "Add Stickers"; -"lng_context_save_file" = "Save File As.."; +"lng_context_save_file" = "Save File As..."; "lng_context_forward_file" = "Forward File"; "lng_context_delete_file" = "Delete File"; "lng_context_close_file" = "Close File"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "Could not send a file, because it is larger than 1.5 GB :("; "lng_send_folder" = "Could not send «{name}» because it is a directory :("; -"lng_forward_choose" = "Choose recipient.."; +"lng_forward_choose" = "Choose recipient..."; "lng_forward_cant" = "Sorry, no way to forward here :("; "lng_forward_confirm" = "Forward to {recipient}?"; "lng_forward_share_contact" = "Share contact to {recipient}?"; @@ -857,7 +863,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_search_global_results" = "Global search results"; "lng_media_save_progress" = "{ready} of {total} {mb}"; -"lng_mediaview_save_as" = "Save As.."; +"lng_mediaview_save_as" = "Save As..."; "lng_mediaview_copy" = "Copy"; "lng_mediaview_forward" = "Forward"; "lng_mediaview_delete" = "Delete"; diff --git a/Telegram/Resources/style.txt b/Telegram/Resources/style.txt index df9a6e615..5ada019a8 100644 --- a/Telegram/Resources/style.txt +++ b/Telegram/Resources/style.txt @@ -975,6 +975,21 @@ topBarBackAlpha: 0.8; topBarBackImg: sprite(65px, 112px, 9px, 16px); topBarBackColor: #005faf; topBarBackFont: font(16px); +topBarSearch: iconedButton(btnDefIconed) { + bgColor: transparent; + overBgColor: transparent; + + icon: sprite(84px, 374px, 18px, 18px); + iconPos: point(13px, 18px); + downIcon: sprite(84px, 374px, 18px, 18px); + downIconPos: point(13px, 18px); + + opacity: 0.22; + overOpacity: 0.36; + + width: 44px; + height: topBarHeight; +} topBarMinPadding: 5px; topBarButton: flatButton(btnDefFlat) { color: btnYesColor; @@ -1034,10 +1049,11 @@ msgServiceNameFont: semiboldFont; msgServicePhotoWidth: 100px; msgDateFont: font(13px); msgMinWidth: 190px; -msgPhotoSize: 30px; +msgPhotoSize: 33px; msgPhotoSkip: 40px; msgPadding: margins(13px, 7px, 13px, 8px); -msgMargin: margins(13px, 4px, 53px, 4px); +msgMargin: margins(13px, 6px, 53px, 2px); +msgMarginTopAttached: 2px; msgLnkPadding: 2px; // for media open / save links msgBorder: #f0f0f0; msgInBg: #fff; @@ -1073,7 +1089,7 @@ msgServiceBg: #89a0b47f; msgServiceSelectBg: #bbc8d4a2; msgServiceColor: #FFF; msgServicePadding: margins(12px, 3px, 12px, 4px); -msgServiceMargin: margins(10px, 7px, 80px, 7px); +msgServiceMargin: margins(10px, 9px, 80px, 5px); msgColor: #000; msgDateColor: #000; @@ -1132,7 +1148,7 @@ collapseButton: flatButton(btnDefFlat) { textTop: 3px; overTextTop: 3px; downTextTop: 3px; - height: 24px; + height: 25px; } collapseHideDuration: 200; collapseShowDuration: 200; diff --git a/Telegram/SourceFiles/_other/genlang.cpp b/Telegram/SourceFiles/_other/genlang.cpp index 2050bfcbf..614f81de5 100644 --- a/Telegram/SourceFiles/_other/genlang.cpp +++ b/Telegram/SourceFiles/_other/genlang.cpp @@ -189,7 +189,7 @@ void readKeyValue(const char *&from, const char *end) { if (*from == ':') { start = ++from; - + QVector &counted(keysCounted[varName][tagName]); QByteArray subvarValue; bool foundtag = false; @@ -391,7 +391,7 @@ bool genLang(const QString &lang_in, const QString &lang_out) { th.setCodec("ISO 8859-1"); th << "\ /*\n\ -Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\ +Created from \'/Resources/lang.strings\' by \'/MetaLang\' project\n\ \n\ WARNING! All changes made in this file will be lost!\n\ \n\ @@ -475,7 +475,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ tcpp << "\ /*\n\ -Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\ +Created from \'/Resources/lang.strings\' by \'/MetaLang\' project\n\ \n\ WARNING! All changes made in this file will be lost!\n\ \n\ @@ -606,13 +606,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ ++depth; current += ich; - if (tag == current) { + bool exact = (tag == current); + if (exact) { tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " == e) {\n"; tcpp << tab.repeated(depth + 1) << "\treturn lt_" << tag << ";\n"; tcpp << tab.repeated(depth + 1) << "}\n"; } - tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n"; + QByteArray nexttag = j.key(); + if (exact && depth > 0 && nexttag.mid(0, depth) != current) { + current.chop(1); + --depth; + tcpp << tab.repeated(depth + 1) << "break;\n"; + break; + } else { + tcpp << tab.repeated(depth + 1) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n"; + } } while (true); ++j; } @@ -637,7 +646,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ tcpp << "\tswitch (*(ch + " << depth << ")) {\n"; for (LangKeys::const_iterator i = keys.cbegin(), j = i + 1, e = keys.cend(); i != e; ++i) { QByteArray key = i.key(); - while (key.mid(0, depth) != current) { + while (depth > 0 && key.mid(0, depth) != current) { tcpp << tab.repeated(depth - 3) << "}\n"; current.chop(1); --depth; @@ -645,7 +654,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ } do { if (key == current) break; - + char ich = i.key().at(current.size()); tcpp << tab.repeated(current.size() - 3) << "case '" << ich << "':\n"; if (j == e || ich != ((j.key().size() > depth) ? j.key().at(depth) : 0)) { @@ -661,13 +670,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ ++depth; current += ich; - if (key == current) { + bool exact = (key == current); + if (exact) { tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " == e) {\n"; tcpp << tab.repeated(depth - 3) << "\treturn " << key << (keysTags[key].isEmpty() ? "" : "__tagged") << ";\n"; tcpp << tab.repeated(depth - 3) << "}\n"; } - tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n"; + QByteArray nextkey = j.key(); + if (exact && depth > 0 && nextkey.mid(0, depth) != current) { + current.chop(1); + --depth; + tcpp << tab.repeated(depth - 3) << "break;\n"; + break; + } else { + tcpp << tab.repeated(depth - 3) << "if (ch + " << depth << " < e) switch (*(ch + " << depth << ")) {\n"; + } } while (true); ++j; } @@ -707,16 +725,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ tcpp << "\tif (index >= lngtags_max_counted_values) return lngkeys_cnt;\n\n"; if (!tags.isEmpty()) { tcpp << "\tswitch (key) {\n"; - for (int i = 0, l = keysOrder.size(); i < l; ++i) { - QVector &tagsList(keysTags[keysOrder[i]]); + for (auto key : keysOrder) { + QVector &tagsList(keysTags[key]); if (tagsList.isEmpty()) continue; - QMap > &countedTags(keysCounted[keysOrder[i]]); - tcpp << "\tcase " << keysOrder[i] << "__tagged: {\n"; + QMap > &countedTags(keysCounted[key]); + bool hasCounted = false; + for (auto tag : tagsList) { + if (!countedTags[tag].isEmpty()) { + hasCounted = true; + break; + } + } + if (!hasCounted) continue; + + tcpp << "\tcase " << key << "__tagged: {\n"; tcpp << "\t\tswitch (tag) {\n"; - for (int j = 0, s = tagsList.size(); j < s; ++j) { - if (!countedTags[tagsList[j]].isEmpty()) { - tcpp << "\t\tcase lt_" << tagsList[j] << ": return LangKey(" << keysOrder[i] << "__" << tagsList[j] << "0 + index);\n"; + for (auto tag : tagsList) { + if (!countedTags[tag].isEmpty()) { + tcpp << "\t\tcase lt_" << tag << ": return LangKey(" << key << "__" << tag << "0 + index);\n"; } } tcpp << "\t\t}\n"; @@ -724,7 +751,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\ } tcpp << "\t}\n\n"; } - tcpp << "\treturn lngkeys_cnt;"; + tcpp << "\treturn lngkeys_cnt;\n"; tcpp << "}\n\n"; tcpp << "bool LangLoader::feedKeyValue(LangKey key, const QString &value) {\n"; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 4632b36f1..720e37ccc 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -230,7 +230,7 @@ void ApiWrap::gotChatFull(PeerData *peer, const MTPmessages_ChatFull &result, mt } if (f.has_migrated_from_chat_id()) { if (!channel->mgInfo) { - channel->flags |= MTPDchannel::flag_megagroup; + channel->flags |= MTPDchannel::Flag::f_megagroup; channel->flagsUpdated(); } ChatData *cfrom = App::chat(peerFromChat(f.vmigrated_from_chat_id)); @@ -685,8 +685,8 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) if (d.vset.type() != mtpc_stickerSet) return; const MTPDstickerSet &s(d.vset.c_stickerSet()); - StickerSets &sets(cRefStickerSets()); - StickerSets::iterator it = sets.find(setId); + Stickers::Sets &sets(Global::RefStickerSets()); + auto it = sets.find(setId); if (it == sets.cend()) return; it->access = s.vaccess_hash.v; @@ -696,7 +696,7 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) it->flags = s.vflags.v; const QVector &d_docs(d.vdocuments.c_vector().v); - StickerSets::iterator custom = sets.find(CustomStickerSetId); + auto custom = sets.find(Stickers::CustomSetId); StickerPack pack; pack.reserve(d_docs.size()); @@ -729,8 +729,8 @@ void ApiWrap::gotStickerSet(uint64 setId, const MTPmessages_StickerSet &result) } if (pack.isEmpty()) { - int32 removeIndex = cStickerSetsOrder().indexOf(setId); - if (removeIndex >= 0) cRefStickerSetsOrder().removeAt(removeIndex); + int removeIndex = Global::StickerSetsOrder().indexOf(setId); + if (removeIndex >= 0) Global::RefStickerSetsOrder().removeAt(removeIndex); sets.erase(it); } else { it->stickers = pack; @@ -903,10 +903,8 @@ void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &msgs } for (QMap::const_iterator i = msgsIds.cbegin(), e = msgsIds.cend(); i != e; ++i) { - HistoryItem *item = App::histories().addNewMessage(v->at(i.value()), NewMessageExisting); - if (item) { - item->initDimensions(); - Notify::historyItemResized(item); + if (HistoryItem *item = App::histories().addNewMessage(v->at(i.value()), NewMessageExisting)) { + item->setPendingInitDimensions(); } } @@ -918,8 +916,7 @@ void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &msgs WebPageItems::const_iterator j = items.constFind(i.key()); if (j != items.cend()) { for (HistoryItemsMap::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) { - k.key()->initDimensions(); - Notify::historyItemResized(k.key()); + k.key()->setPendingInitDimensions(); } } } diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 61e44eef0..4887c2681 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -57,7 +57,7 @@ namespace { typedef QMap ReplyMarkups; ReplyMarkups replyMarkups; - ReplyMarkup zeroMarkup(MTPDreplyKeyboardMarkup_flag_ZERO); + ReplyMarkup zeroMarkup(qFlags(MTPDreplyKeyboardMarkup_ClientFlag::f_zero)); typedef QMap ChannelReplyMarkups; ChannelReplyMarkups channelReplyMarkups; @@ -67,7 +67,8 @@ namespace { SharedContactItems sharedContactItems; GifItems gifItems; - typedef QMap > DependentItems; + typedef OrderedSet DependentItemsSet; + typedef QMap DependentItems; DependentItems dependentItems; Histories histories; @@ -326,6 +327,25 @@ namespace App { return lng_status_lastseen_date(lt_date, dOnline.date().toString(qsl("dd.MM.yy"))); } + namespace { + // we should get a full restriction in "{fulltype}: {reason}" format and we + // need to find a "-all" tag in {fulltype}, otherwise ignore this restriction + QString extractRestrictionReason(const QString &fullRestriction) { + int fullTypeEnd = fullRestriction.indexOf(':'); + if (fullTypeEnd <= 0) { + return QString(); + } + + // {fulltype} is in "{type}-{tag}-{tag}-{tag}" format + // if we find "all" tag we return the restriction string + QStringList typeTags = fullRestriction.mid(0, fullTypeEnd).split('-').mid(1); + if (typeTags.contains(qsl("all"))) { + return fullRestriction.midRef(fullTypeEnd + 1).trimmed().toString(); + } + return QString(); + } + } + bool onlineColorUse(UserData *user, int32 now) { if (isServiceUser(user->id) || user->botInfo) { return false; @@ -388,6 +408,11 @@ namespace App { data->input = MTP_inputPeerUser(d.vid, d.vaccess_hash); data->inputUser = MTP_inputUser(d.vid, d.vaccess_hash); } + if (d.is_restricted()) { + data->setRestrictionReason(extractRestrictionReason(qs(d.vrestriction_reason))); + } else { + data->setRestrictionReason(QString()); + } } if (d.is_deleted()) { data->setPhone(QString()); @@ -396,9 +421,13 @@ namespace App { data->access = UserNoAccess; status = &emptyStatus; } else { + // apply first_name and last_name from minimal user only if we don't have + // local values for first name and last name already, otherwise skip + bool noLocalName = data->firstName.isEmpty() && data->lastName.isEmpty(); + QString fname = (!minimal || noLocalName) ? (d.has_first_name() ? textOneLine(qs(d.vfirst_name)) : QString()) : data->firstName; + QString lname = (!minimal || noLocalName) ? (d.has_last_name() ? textOneLine(qs(d.vlast_name)) : QString()) : data->lastName; + QString phone = minimal ? data->phone : (d.has_phone() ? qs(d.vphone) : QString()); - QString fname = d.has_first_name() ? textOneLine(qs(d.vfirst_name)) : QString(); - QString lname = d.has_last_name() ? textOneLine(qs(d.vlast_name)) : QString(); QString uname = minimal ? data->username : (d.has_username() ? textOneLine(qs(d.vusername)) : QString()); bool phoneChanged = (data->phone != phone); @@ -450,7 +479,13 @@ namespace App { if (!data) continue; - data->loaded = true; + if (minimal) { + if (data->loadedStatus == PeerData::NotLoaded) { + data->loadedStatus = PeerData::MinimalLoaded; + } + } else if (data->loadedStatus != PeerData::FullLoaded) { + data->loadedStatus = PeerData::FullLoaded; + } if (status && !minimal) switch (status->type()) { case mtpc_userStatusEmpty: data->onlineTill = 0; break; case mtpc_userStatusRecently: @@ -507,7 +542,7 @@ namespace App { const MTPDinputChannel &c(d.vmigrated_to.c_inputChannel()); ChannelData *channel = App::channel(peerFromChannel(c.vchannel_id)); if (!channel->mgInfo) { - channel->flags |= MTPDchannel::flag_megagroup; + channel->flags |= MTPDchannel::Flag::f_megagroup; channel->flagsUpdated(); } if (!channel->access) { @@ -538,7 +573,7 @@ namespace App { } } - if (!(cdata->flags & MTPDchat::flag_admins_enabled) && (d.vflags.v & MTPDchat::flag_admins_enabled)) { + if (!(cdata->flags & MTPDchat::Flag::f_admins_enabled) && (d.vflags.v & MTPDchat::Flag::f_admins_enabled)) { cdata->invalidateParticipants(); } cdata->flags = d.vflags.v; @@ -583,7 +618,7 @@ namespace App { ChannelData *cdata = data->asChannel(); if (minimal) { - int32 mask = MTPDchannel::flag_broadcast | MTPDchannel::flag_verified | MTPDchannel::flag_megagroup | MTPDchannel::flag_democracy; + int32 mask = MTPDchannel::Flag::f_broadcast | MTPDchannel::Flag::f_verified | MTPDchannel::Flag::f_megagroup | MTPDchannel::Flag::f_democracy; cdata->flags = (cdata->flags & ~mask) | (d.vflags.v & mask); } else { cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash); @@ -593,6 +628,11 @@ namespace App { if (cdata->version < d.vversion.v) { cdata->version = d.vversion.v; } + if (d.is_restricted()) { + cdata->setRestrictionReason(extractRestrictionReason(qs(d.vrestriction_reason))); + } else { + cdata->setRestrictionReason(QString()); + } } QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString(); cdata->setName(qs(d.vtitle), uname); @@ -622,7 +662,13 @@ namespace App { } if (!data) continue; - data->loaded = true; + if (minimal) { + if (data->loadedStatus == PeerData::NotLoaded) { + data->loadedStatus = PeerData::MinimalLoaded; + } + } else if (data->loadedStatus != PeerData::FullLoaded) { + data->loadedStatus = PeerData::FullLoaded; + } if (App::main()) { if (emitPeerUpdated) { App::main()->peerUpdated(data); @@ -654,7 +700,7 @@ namespace App { int32 pversion = chat->participants.isEmpty() ? 1 : (chat->participants.begin().value() + 1); chat->invitedByMe = ChatData::InvitedByMe(); chat->admins = ChatData::Admins(); - chat->flags &= ~MTPDchat::flag_admin; + chat->flags &= ~MTPDchat::Flag::f_admin; for (QVector::const_iterator i = v.cbegin(), e = v.cend(); i != e; ++i) { int32 uid = 0, inviter = 0; switch (i->type()) { @@ -685,7 +731,7 @@ namespace App { if (i->type() == mtpc_chatParticipantAdmin) { chat->admins.insert(user); if (user->isSelf()) { - chat->flags |= MTPDchat::flag_admin; + chat->flags |= MTPDchat::Flag::f_admin; } } } else { @@ -805,7 +851,7 @@ namespace App { chat->invitedByMe.remove(user); chat->admins.remove(user); if (user->isSelf()) { - chat->flags &= ~MTPDchat::flag_admin; + chat->flags &= ~MTPDchat::Flag::f_admin; } History *h = App::historyLoaded(chat->id); @@ -852,13 +898,12 @@ namespace App { } chat->version = d.vversion.v; if (mtpIsTrue(d.venabled)) { - chat->flags |= MTPDchat::flag_admins_enabled; + chat->flags |= MTPDchat::Flag::f_admins_enabled; if (!badVersion) { chat->invalidateParticipants(); } } else { - chat->flags &= ~MTPDchat::flag_admins_enabled; - chat->flags &= ~MTPDchat::flag_admin; + chat->flags &= ~MTPDchat::Flag::f_admins_enabled; } if (emitPeerUpdated) { App::main()->peerUpdated(chat); @@ -887,7 +932,7 @@ namespace App { if (user) { if (mtpIsTrue(d.vis_admin)) { if (user->isSelf()) { - chat->flags |= MTPDchat::flag_admin; + chat->flags |= MTPDchat::Flag::f_admin; } if (chat->noParticipantInfo()) { App::api()->requestFullPeer(chat); @@ -896,7 +941,7 @@ namespace App { } } else { if (user->isSelf()) { - chat->flags &= ~MTPDchat::flag_admin; + chat->flags &= ~MTPDchat::Flag::f_admin; } chat->admins.remove(user); } @@ -921,10 +966,7 @@ namespace App { if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) { existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText()); existing->updateMedia(m.has_media() ? (&m.vmedia) : 0); - existing->setViewsCount(m.has_views() ? m.vviews.v : -1, false); - existing->initDimensions(); - Notify::historyItemResized(existing); - + existing->setViewsCount(m.has_views() ? m.vviews.v : -1); existing->addToOverview(AddToOverviewNew); if (!existing->detached()) { @@ -945,16 +987,13 @@ namespace App { if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) { existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText()); existing->updateMedia(m.has_media() ? (&m.vmedia) : 0, true); - existing->setViewsCount(m.has_views() ? m.vviews.v : -1, false); - existing->initDimensions(); + existing->setViewsCount(m.has_views() ? m.vviews.v : -1); if (existing->history()->textCachedFor == existing) { existing->history()->textCachedFor = 0; } if (App::main()) { App::main()->dlgUpdated(existing->history(), existing->id); } - App::historyUpdateDependent(existing); - Notify::historyItemResized(existing); } } @@ -974,7 +1013,7 @@ namespace App { } void checkSavedGif(HistoryItem *item) { - if (!item->Is() && (item->out() || item->history()->peer == App::self())) { + if (!item->Has() && (item->out() || item->history()->peer == App::self())) { if (HistoryMedia *media = item->getMedia()) { if (DocumentData *doc = media->getDocument()) { if (doc->isGifv()) { @@ -1095,7 +1134,6 @@ namespace App { } void feedWereDeleted(ChannelId channelId, const QVector &msgsIds) { - bool resized = false; MsgsData *data = fetchMsgsData(channelId, false); if (!data) return; @@ -1106,9 +1144,6 @@ namespace App { MsgsData::const_iterator j = data->constFind(i->v); if (j != data->cend()) { History *h = (*j)->history(); - if (App::main() && (h->peer == App::main()->peer() || (App::main()->peer() && h->peer->migrateTo() == App::main()->peer())) && !(*j)->detached()) { - resized = true; - } (*j)->destroy(); if (!h->lastMsg) historiesToCheck.insert(h, true); } else { @@ -1120,9 +1155,6 @@ namespace App { } } } - if (resized) { - Notify::historyItemsResized(); - } if (main()) { for (QMap::const_iterator i = historiesToCheck.cbegin(), e = historiesToCheck.cend(); i != e; ++i) { main()->checkPeerHistory(i.key()->peer); @@ -1375,41 +1407,16 @@ namespace App { return 0; } - PeerData *peerLoaded(const PeerId &peer) { - PeersData::const_iterator i = peersData.constFind(peer); - return (i != peersData.cend()) ? i.value() : 0; - } - - UserData *userLoaded(const PeerId &id) { - PeerData *peer = peerLoaded(id); - return (peer && peer->loaded) ? peer->asUser() : 0; - } - ChatData *chatLoaded(const PeerId &id) { - PeerData *peer = peerLoaded(id); - return (peer && peer->loaded) ? peer->asChat() : 0; - } - ChannelData *channelLoaded(const PeerId &id) { - PeerData *peer = peerLoaded(id); - return (peer && peer->loaded) ? peer->asChannel() : 0; - } - UserData *userLoaded(int32 user_id) { - return userLoaded(peerFromUser(user_id)); - } - ChatData *chatLoaded(int32 chat_id) { - return chatLoaded(peerFromChat(chat_id)); - } - ChannelData *channelLoaded(int32 channel_id) { - return channelLoaded(peerFromChannel(channel_id)); - } - UserData *curUser() { return user(MTP::authedId()); } - PeerData *peer(const PeerId &id) { - PeersData::const_iterator i = peersData.constFind(id); + PeerData *peer(const PeerId &id, PeerData::LoadedStatus restriction) { + if (!id) return nullptr; + + auto i = peersData.constFind(id); if (i == peersData.cend()) { - PeerData *newData = 0; + PeerData *newData = nullptr; if (peerIsUser(id)) { newData = new UserData(id); } else if (peerIsChat(id)) { @@ -1417,33 +1424,26 @@ namespace App { } else if (peerIsChannel(id)) { newData = new ChannelData(id); } - if (!newData) return 0; + t_assert(newData != nullptr); newData->input = MTPinputPeer(MTP_inputPeerEmpty()); i = peersData.insert(id, newData); } + switch (restriction) { + case PeerData::MinimalLoaded: { + if (i.value()->loadedStatus == PeerData::NotLoaded) { + return nullptr; + } + } break; + case PeerData::FullLoaded: { + if (i.value()->loadedStatus != PeerData::FullLoaded) { + return nullptr; + } + } break; + } return i.value(); } - UserData *user(const PeerId &id) { - return peer(id)->asUser(); - } - ChatData *chat(const PeerId &id) { - return peer(id)->asChat(); - } - ChannelData *channel(const PeerId &id) { - return peer(id)->asChannel(); - } - UserData *user(int32 user_id) { - return user(peerFromUser(user_id)); - } - ChatData *chat(int32 chat_id) { - return chat(peerFromChat(chat_id)); - } - ChannelData *channel(int32 channel_id) { - return channel(peerFromChannel(channel_id)); - } - UserData *self() { return ::self; } @@ -1794,19 +1794,22 @@ namespace App { MsgsData *data = fetchMsgsData(item->channelId(), false); if (!data) return; - MsgsData::iterator i = data->find(item->id); + auto i = data->find(item->id); if (i != data->cend()) { if (i.value() == item) { data->erase(i); } } historyItemDetached(item); - DependentItems::iterator j = ::dependentItems.find(item); + auto j = ::dependentItems.find(item); if (j != ::dependentItems.cend()) { - for (OrderedSet::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) { - k.key()->dependencyItemRemoved(item); - } + DependentItemsSet items; + std::swap(items, j.value()); ::dependentItems.erase(j); + + for_const (HistoryItem *dependent, items) { + dependent->dependencyItemRemoved(item); + } } if (App::main() && !App::quitting()) { App::main()->itemRemoved(item); @@ -1816,8 +1819,8 @@ namespace App { void historyUpdateDependent(HistoryItem *item) { DependentItems::iterator j = ::dependentItems.find(item); if (j != ::dependentItems.cend()) { - for (OrderedSet::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) { - k.key()->updateDependencyItem(); + for_const (HistoryItem *dependent, j.value()) { + dependent->updateDependencyItem(); } } if (App::main()) { @@ -1829,15 +1832,15 @@ namespace App { ::dependentItems.clear(); QVector toDelete; - for (MsgsData::const_iterator i = msgsData.cbegin(), e = msgsData.cend(); i != e; ++i) { - if ((*i)->detached()) { - toDelete.push_back(*i); + for_const (HistoryItem *item, msgsData) { + if (item->detached()) { + toDelete.push_back(item); } } - for (ChannelMsgsData::const_iterator j = channelMsgsData.cbegin(), end = channelMsgsData.cend(); j != end; ++j) { - for (MsgsData::const_iterator i = j->cbegin(), e = j->cend(); i != e; ++i) { - if ((*i)->detached()) { - toDelete.push_back(*i); + for_const (const MsgsData &chMsgsData, channelMsgsData) { + for_const (HistoryItem *item, chMsgsData) { + if (item->detached()) { + toDelete.push_back(item); } } } @@ -1878,9 +1881,9 @@ namespace App { webPagesData.clear(); if (api()) api()->clearWebPageRequests(); cSetRecentStickers(RecentStickerPack()); - cSetStickerSets(StickerSets()); - cSetStickerSetsOrder(StickerSetsOrder()); - cSetLastStickersUpdate(0); + Global::SetStickerSets(Stickers::Sets()); + Global::SetStickerSetsOrder(Stickers::Order()); + Global::SetLastStickersUpdate(0); cSetSavedGifs(SavedGifs()); cSetLastSavedGifsUpdate(0); cSetReportSpamStatuses(ReportSpamStatuses()); @@ -1903,7 +1906,7 @@ namespace App { } void historyUnregDependency(HistoryItem *dependent, HistoryItem *dependency) { - DependentItems::iterator i = ::dependentItems.find(dependency); + auto i = ::dependentItems.find(dependency); if (i != ::dependentItems.cend()) { i.value().remove(dependent); if (i.value().isEmpty()) { @@ -2446,13 +2449,13 @@ namespace App { case mtpc_replyKeyboardHide: { const MTPDreplyKeyboardHide &d(markup.c_replyKeyboardHide()); if (d.vflags.v) { - insertReplyMarkup(channelId, msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_ZERO)); + insertReplyMarkup(channelId, msgId, ReplyMarkup(mtpCastFlags(d.vflags.v) | MTPDreplyKeyboardMarkup_ClientFlag::f_zero)); } } break; case mtpc_replyKeyboardForceReply: { const MTPDreplyKeyboardForceReply &d(markup.c_replyKeyboardForceReply()); - insertReplyMarkup(channelId, msgId, ReplyMarkup(d.vflags.v | MTPDreplyKeyboardMarkup_flag_FORCE_REPLY)); + insertReplyMarkup(channelId, msgId, ReplyMarkup(mtpCastFlags(d.vflags.v) | MTPDreplyKeyboardMarkup_ClientFlag::f_force_reply)); } break; } } @@ -2486,9 +2489,12 @@ namespace App { } void setProxySettings(QNetworkAccessManager &manager) { +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY manager.setProxy(getHttpProxySettings()); +#endif } +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QNetworkProxy getHttpProxySettings() { const ConnectionProxy *proxy = 0; if (Global::started()) { @@ -2501,14 +2507,17 @@ namespace App { } return QNetworkProxy(QNetworkProxy::DefaultProxy); } +#endif void setProxySettings(QTcpSocket &socket) { +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY if (cConnectionType() == dbictTcpProxy) { const ConnectionProxy &p(cConnectionProxy()); socket.setProxy(QNetworkProxy(QNetworkProxy::Socks5Proxy, p.host, p.port, p.user, p.password)); } else { socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy)); } +#endif } QImage **cornersMask() { diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h index aeaaf5c87..ebe1711e5 100644 --- a/Telegram/SourceFiles/app.h +++ b/Telegram/SourceFiles/app.h @@ -45,11 +45,11 @@ typedef QHash PhotosData; typedef QHash DocumentsData; struct ReplyMarkup { - ReplyMarkup(int32 flags = 0) : flags(flags) { + ReplyMarkup(MTPDreplyKeyboardMarkup::Flags flags = 0) : flags(flags) { } typedef QList > Commands; Commands commands; - int32 flags; + MTPDreplyKeyboardMarkup::Flags flags; }; class LayeredWidget; @@ -110,21 +110,47 @@ namespace App { WebPageData *feedWebPage(const MTPDwebPagePending &webpage, WebPageData *convert = 0); WebPageData *feedWebPage(const MTPWebPage &webpage); - PeerData *peerLoaded(const PeerId &id); - UserData *userLoaded(const PeerId &id); - ChatData *chatLoaded(const PeerId &id); - ChannelData *channelLoaded(const PeerId &id); - UserData *userLoaded(int32 user); - ChatData *chatLoaded(int32 chat); - ChannelData *channelLoaded(int32 channel); + PeerData *peer(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded); + inline UserData *user(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asUser(peer(id, restriction)); + } + inline ChatData *chat(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asChat(peer(id, restriction)); + } + inline ChannelData *channel(const PeerId &id, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asChannel(peer(id, restriction)); + } + inline UserData *user(UserId userId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asUser(peer(peerFromUser(userId), restriction)); + } + inline ChatData *chat(ChatId chatId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asChat(peer(peerFromChat(chatId), restriction)); + } + inline ChannelData *channel(ChannelId channelId, PeerData::LoadedStatus restriction = PeerData::NotLoaded) { + return asChannel(peer(peerFromChannel(channelId), restriction)); + } + inline PeerData *peerLoaded(const PeerId &id) { + return peer(id, PeerData::FullLoaded); + } + inline UserData *userLoaded(const PeerId &id) { + return user(id, PeerData::FullLoaded); + } + inline ChatData *chatLoaded(const PeerId &id) { + return chat(id, PeerData::FullLoaded); + } + inline ChannelData *channelLoaded(const PeerId &id) { + return channel(id, PeerData::FullLoaded); + } + inline UserData *userLoaded(UserId userId) { + return user(userId, PeerData::FullLoaded); + } + inline ChatData *chatLoaded(ChatId chatId) { + return chat(chatId, PeerData::FullLoaded); + } + inline ChannelData *channelLoaded(ChannelId channelId) { + return channel(channelId, PeerData::FullLoaded); + } - PeerData *peer(const PeerId &id); - UserData *user(const PeerId &id); - ChatData *chat(const PeerId &id); - ChannelData *channel(const PeerId &id); - UserData *user(int32 user_id); - ChatData *chat(int32 chat_id); - ChannelData *channel(int32 channel_id); UserData *self(); PeerData *peerByName(const QString &username); QString peerName(const PeerData *peer, bool forDialogs = false); @@ -145,10 +171,11 @@ namespace App { History *historyLoaded(const PeerId &peer); HistoryItem *histItemById(ChannelId channelId, MsgId itemId); inline History *history(const PeerData *peer) { + t_assert(peer != nullptr); return history(peer->id); } inline History *historyLoaded(const PeerData *peer) { - return historyLoaded(peer->id); + return peer ? historyLoaded(peer->id) : nullptr; } inline HistoryItem *histItemById(const ChannelData *channel, MsgId itemId) { return histItemById(channel ? peerToChannel(channel->id) : 0, itemId); @@ -250,7 +277,9 @@ namespace App { const ReplyMarkup &replyMarkup(ChannelId channelId, MsgId msgId); void setProxySettings(QNetworkAccessManager &manager); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QNetworkProxy getHttpProxySettings(); +#endif void setProxySettings(QTcpSocket &socket); QImage **cornersMask(); diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index 610f6a26a..f84770840 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -120,16 +120,16 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) #endif if (cManyInstance()) { - LOG(("Many instance allowed, starting..")); + LOG(("Many instance allowed, starting...")); singleInstanceChecked(); } else { - LOG(("Connecting local socket to %1..").arg(_localServerName)); + LOG(("Connecting local socket to %1...").arg(_localServerName)); _localSocket.connectToServer(_localServerName); } } void Application::socketConnected() { - LOG(("Socket connected, this is not the first application instance, sending show command..")); + LOG(("Socket connected, this is not the first application instance, sending show command...")); _secondInstance = true; QString commands; @@ -154,7 +154,7 @@ void Application::socketWritten(qint64/* bytes*/) { if (_localSocket.bytesToWrite()) { return; } - LOG(("Show command written, waiting response..")); + LOG(("Show command written, waiting response...")); } void Application::socketReading() { @@ -166,7 +166,7 @@ void Application::socketReading() { if (QRegularExpression("RES:(\\d+);").match(_localSocketReadData).hasMatch()) { uint64 pid = _localSocketReadData.mid(4, _localSocketReadData.length() - 5).toULongLong(); psActivateProcess(pid); - LOG(("Show command response received, pid = %1, activating and quitting..").arg(pid)); + LOG(("Show command response received, pid = %1, activating and quitting...").arg(pid)); return App::quit(); } } @@ -175,14 +175,14 @@ void Application::socketError(QLocalSocket::LocalSocketError e) { if (App::quitting()) return; if (_secondInstance) { - LOG(("Could not write show command, error %1, quitting..").arg(e)); + LOG(("Could not write show command, error %1, quitting...").arg(e)); return App::quit(); } if (e == QLocalSocket::ServerNotFoundError) { - LOG(("This is the only instance of Telegram, starting server and app..")); + LOG(("This is the only instance of Telegram, starting server and app...")); } else { - LOG(("Socket connect error %1, starting server and app..").arg(e)); + LOG(("Socket connect error %1, starting server and app...").arg(e)); } _localSocket.close(); @@ -196,7 +196,7 @@ void Application::socketError(QLocalSocket::LocalSocketError e) { #ifndef TDESKTOP_DISABLE_AUTOUPDATE if (!cNoStartUpdate() && checkReadyUpdate()) { cSetRestartingUpdate(true); - DEBUG_LOG(("Application Info: installing update instead of starting app..")); + DEBUG_LOG(("Application Info: installing update instead of starting app...")); return App::quit(); } #endif @@ -235,7 +235,7 @@ void Application::singleInstanceChecked() { void Application::socketDisconnected() { if (_secondInstance) { - DEBUG_LOG(("Application Error: socket disconnected before command response received, quitting..")); + DEBUG_LOG(("Application Error: socket disconnected before command response received, quitting...")); return App::quit(); } } @@ -704,7 +704,7 @@ AppClass::AppClass() : QObject() anim::startManager(); historyInit(); - DEBUG_LOG(("Application Info: inited..")); + DEBUG_LOG(("Application Info: inited...")); application()->installNativeEventFilter(psNativeEventFilter()); @@ -714,7 +714,7 @@ AppClass::AppClass() : QObject() connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions())); - DEBUG_LOG(("Application Info: starting app..")); + DEBUG_LOG(("Application Info: starting app...")); QMimeDatabase().mimeTypeForName(qsl("text/plain")); // create mime database @@ -724,7 +724,7 @@ AppClass::AppClass() : QObject() Sandbox::connect(SIGNAL(applicationStateChanged(Qt::ApplicationState)), this, SLOT(onAppStateChanged(Qt::ApplicationState))); - DEBUG_LOG(("Application Info: window created..")); + DEBUG_LOG(("Application Info: window created...")); Shortcuts::start(); @@ -734,16 +734,16 @@ AppClass::AppClass() : QObject() Local::ReadMapState state = Local::readMap(QByteArray()); if (state == Local::ReadMapPassNeeded) { cSetHasPasscode(true); - DEBUG_LOG(("Application Info: passcode nneded..")); + DEBUG_LOG(("Application Info: passcode needed...")); } else { - DEBUG_LOG(("Application Info: local map read..")); + DEBUG_LOG(("Application Info: local map read...")); MTP::start(); } MTP::setStateChangedHandler(mtpStateChanged); MTP::setSessionResetHandler(mtpSessionReset); - DEBUG_LOG(("Application Info: MTP started..")); + DEBUG_LOG(("Application Info: MTP started...")); DEBUG_LOG(("Application Info: showing.")); if (state == Local::ReadMapPassNeeded) { @@ -761,7 +761,9 @@ AppClass::AppClass() : QObject() _window->showSettings(); } +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QNetworkProxyFactory::setUseSystemConfiguration(true); +#endif if (state != Local::ReadMapPassNeeded) { checkMapVersion(); @@ -899,12 +901,16 @@ void AppClass::onAppStateChanged(Qt::ApplicationState state) { } } +void AppClass::call_handleHistoryUpdate() { + Notify::handlePendingHistoryUpdate(); +} + void AppClass::killDownloadSessions() { uint64 ms = getms(), left = MTPAckSendWaiting + MTPKillFileSessionTimeout; for (QMap::iterator i = killDownloadSessionTimes.begin(); i != killDownloadSessionTimes.end(); ) { if (i.value() <= ms) { for (int j = 0; j < MTPDownloadSessionsCount; ++j) { - MTP::stopSession(MTP::dld(j) + i.key()); + MTP::stopSession(MTP::dldDcId(i.key(), j)); } i = killDownloadSessionTimes.erase(i); } else { @@ -998,7 +1004,7 @@ void AppClass::uploadProfilePhoto(const QImage &tosend, const PeerId &peerId) { QBuffer jpegBuffer(&jpeg); full.save(&jpegBuffer, "JPG", 87); - PhotoId id = MTP::nonce(); + PhotoId id = rand_value(); MTPPhoto photo(MTP_photo(MTP_long(id), MTP_long(0), MTP_int(unixtime()), MTP_vector(photoSizes))); @@ -1019,10 +1025,10 @@ void AppClass::checkMapVersion() { if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion()) { QString versionFeatures; - if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9031) { + if ((cDevVersion() || cBetaVersion()) && Local::oldMapVersion() < 9035) { // QString ctrl = (cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? qsl("Cmd") : qsl("Ctrl"); -// versionFeatures = QString::fromUtf8("\xe2\x80\x94 %1+W or %2+F4 for close window\n\xe2\x80\x94 %3+L to lock Telegram if you use a local passcode\n\xe2\x80\x94 Bug fixes and other minor improvements").arg(ctrl).arg(ctrl).arg(ctrl);// .replace('@', qsl("@") + QChar(0x200D)); - versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed(); + versionFeatures = QString::fromUtf8("\xe2\x80\x94 Design improvements\n\xe2\x80\x94 Bug fixes and other minor improvements");// .replace('@', qsl("@") + QChar(0x200D)); +// versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed(); } else if (Local::oldMapVersion() < 9031) { versionFeatures = lng_new_version_text(lt_link, qsl("https://telegram.org/blog/supergroups5k")).trimmed(); } else { diff --git a/Telegram/SourceFiles/application.h b/Telegram/SourceFiles/application.h index 1f69aaaa4..3e0a37e56 100644 --- a/Telegram/SourceFiles/application.h +++ b/Telegram/SourceFiles/application.h @@ -200,6 +200,8 @@ public slots: void killDownloadSessions(); void onAppStateChanged(Qt::ApplicationState state); + void call_handleHistoryUpdate(); + private: QMap photoUpdates; diff --git a/Telegram/SourceFiles/art/sprite.png b/Telegram/SourceFiles/art/sprite.png index 33ee6037f..86e0fd4ec 100644 Binary files a/Telegram/SourceFiles/art/sprite.png and b/Telegram/SourceFiles/art/sprite.png differ diff --git a/Telegram/SourceFiles/art/sprite_200x.png b/Telegram/SourceFiles/art/sprite_200x.png index d8de7abeb..3c2c54606 100644 Binary files a/Telegram/SourceFiles/art/sprite_200x.png and b/Telegram/SourceFiles/art/sprite_200x.png differ diff --git a/Telegram/SourceFiles/audio.cpp b/Telegram/SourceFiles/audio.cpp index 6393fc3dd..29205c7af 100644 --- a/Telegram/SourceFiles/audio.cpp +++ b/Telegram/SourceFiles/audio.cpp @@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" + #include "audio.h" #include @@ -27,10 +28,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #define AL_ALEXT_PROTOTYPES #include -#ifdef Q_OS_MAC - extern "C" { +#include +#include +#include +#include +#ifdef Q_OS_MAC #include #undef iconv_open @@ -46,10 +50,9 @@ size_t iconv (iconv_t cd, char* * inbuf, size_t *inbytesleft, char* * outbuf, s int iconv_close (iconv_t cd) { return libiconv_close(cd); } +#endif // Q_OS_MAC -} - -#endif +} // extern "C" namespace { ALCdevice *audioDevice = 0; @@ -224,12 +227,15 @@ void audioPlayNotify() { emit audioPlayer()->faderOnTimer(); } +// can be called at any moment when audio error void audioFinish() { if (player) { delete player; + player = nullptr; } if (capture) { delete capture; + capture = nullptr; } alSourceStop(notifySource); @@ -243,14 +249,14 @@ void audioFinish() { } if (audioContext) { - alcMakeContextCurrent(NULL); + alcMakeContextCurrent(nullptr); alcDestroyContext(audioContext); - audioContext = 0; + audioContext = nullptr; } if (audioDevice) { alcCloseDevice(audioDevice); - audioDevice = 0; + audioDevice = nullptr; } cSetHasAudioCapture(false); @@ -1685,7 +1691,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const err = SetupErrorAtStart; QMutexLocker lock(&playerMutex); AudioPlayer *voice = audioPlayer(); - if (!voice) return 0; + if (!voice) return nullptr; bool isGoodId = false; AudioPlayer::Msg *m = 0; @@ -1717,7 +1723,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const if (!l || !m) { LOG(("Audio Error: trying to load part of audio, that is not current at the moment")); err = SetupErrorNotPlaying; - return 0; + return nullptr; } if (*l && (!isGoodId || !(*l)->check(m->file, m->data))) { @@ -1741,27 +1747,26 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const // if (!f.open(QIODevice::ReadOnly)) { // LOG(("Audio Error: could not open file '%1'").arg(m->fname)); // m->state = AudioPlayerStoppedAtStart; -// return 0; +// return nullptr; // } // header = f.read(8); // } // if (header.size() < 8) { // LOG(("Audio Error: could not read header from file '%1', data size %2").arg(m->fname).arg(m->data.isEmpty() ? QFileInfo(m->fname).size() : m->data.size())); // m->state = AudioPlayerStoppedAtStart; -// return 0; +// return nullptr; // } *l = new FFMpegLoader(m->file, m->data); - int ret; if (!(*l)->open(position)) { m->state = AudioPlayerStoppedAtStart; - return 0; + return nullptr; } int64 duration = (*l)->duration(); if (duration <= 0) { m->state = AudioPlayerStoppedAtStart; - return 0; + return nullptr; } m->duration = duration; m->frequency = (*l)->frequency(); @@ -1771,7 +1776,7 @@ AudioPlayerLoader *AudioPlayerLoaders::setupLoader(MediaOverviewType type, const if (!m->skipEnd) { err = SetupErrorLoadedFull; LOG(("Audio Error: trying to load part of audio, that is already loaded to the end")); - return 0; + return nullptr; } } return *l; @@ -2029,7 +2034,7 @@ void AudioCaptureInner::onStart() { } // Open audio stream - if ((res = avcodec_open2(d->codecContext, d->codec, NULL)) < 0) { + if ((res = avcodec_open2(d->codecContext, d->codec, nullptr)) < 0) { LOG(("Audio Error: Unable to avcodec_open2 for capture, error %1, %2").arg(res).arg(av_make_error_string(err, sizeof(err), res))); onStop(false); emit error(); @@ -2505,7 +2510,7 @@ MTPDocumentAttribute audioReadSongAttributes(const QString &fname, const QByteAr cover = reader.cover(); coverBytes = reader.coverBytes(); coverFormat = reader.coverFormat(); - return MTP_documentAttributeAudio(MTP_int(MTPDdocumentAttributeAudio::flag_title | MTPDdocumentAttributeAudio::flag_performer), MTP_int(duration), MTP_string(reader.title()), MTP_string(reader.performer()), MTPstring()); + return MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer), MTP_int(duration), MTP_string(reader.title()), MTP_string(reader.performer()), MTPstring()); } } return MTP_documentAttributeFilename(MTP_string(fname)); diff --git a/Telegram/SourceFiles/autoupdater.cpp b/Telegram/SourceFiles/autoupdater.cpp index 7471dde59..6c46f60c1 100644 --- a/Telegram/SourceFiles/autoupdater.cpp +++ b/Telegram/SourceFiles/autoupdater.cpp @@ -20,9 +20,22 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" + +#include "autoupdater.h" + +#include +#include +#include +#include + +#ifdef Q_OS_WIN // use Lzma SDK for win +#include +#else // Q_OS_WIN +#include +#endif // else of Q_OS_WIN + #include "application.h" #include "pspecific.h" -#include "autoupdater.h" #ifndef TDESKTOP_DISABLE_AUTOUPDATE @@ -51,7 +64,7 @@ void UpdateChecker::initOutput() { fileName = m.captured(1).replace(QRegularExpression(qsl("[^a-zA-Z0-9_\\-]")), QString()); } if (fileName.isEmpty()) { - fileName = qsl("tupdate-%1").arg(MTP::nonce() % 1000000); + fileName = qsl("tupdate-%1").arg(rand_value() % 1000000); } QString dirStr = cWorkingDir() + qsl("tupdates/"); fileName = dirStr + fileName; @@ -556,7 +569,7 @@ bool checkReadyUpdate() { } #elif defined Q_OS_MAC QDir().mkpath(QFileInfo(curUpdater).absolutePath()); - DEBUG_LOG(("Update Info: moving %1 to %2..").arg(updater.absoluteFilePath()).arg(curUpdater)); + DEBUG_LOG(("Update Info: moving %1 to %2...").arg(updater.absoluteFilePath()).arg(curUpdater)); if (!objc_moveFile(updater.absoluteFilePath(), curUpdater)) { UpdateChecker::clearAll(); return false; diff --git a/Telegram/SourceFiles/boxes/aboutbox.cpp b/Telegram/SourceFiles/boxes/aboutbox.cpp index 913465e84..87e01f6a3 100644 --- a/Telegram/SourceFiles/boxes/aboutbox.cpp +++ b/Telegram/SourceFiles/boxes/aboutbox.cpp @@ -107,6 +107,7 @@ void AboutBox::paintEvent(QPaintEvent *e) { paintTitle(p, qsl("Telegram Desktop")); } +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS QString _getCrashReportFile(const QMimeData *m) { if (!m || m->urls().size() != 1) return QString(); @@ -115,19 +116,24 @@ QString _getCrashReportFile(const QMimeData *m) { return file.endsWith(qstr(".telegramcrash"), Qt::CaseInsensitive) ? file : QString(); } +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS void AboutBox::dragEnterEvent(QDragEnterEvent *e) { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS if (!_getCrashReportFile(e->mimeData()).isEmpty()) { e->setDropAction(Qt::CopyAction); e->accept(); } +#endif } void AboutBox::dropEvent(QDropEvent *e) { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS if (!_getCrashReportFile(e->mimeData()).isEmpty()) { e->acceptProposedAction(); showCrashReportWindow(_getCrashReportFile(e->mimeData())); } +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } QString telegramFaqLink() { diff --git a/Telegram/SourceFiles/boxes/addcontactbox.cpp b/Telegram/SourceFiles/boxes/addcontactbox.cpp index c70c7caf0..53d9e5d80 100644 --- a/Telegram/SourceFiles/boxes/addcontactbox.cpp +++ b/Telegram/SourceFiles/boxes/addcontactbox.cpp @@ -188,11 +188,11 @@ void AddContactBox::onSave() { } _sentName = firstName; if (_user) { - _contactId = MTP::nonce(); + _contactId = rand_value(); QVector v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(_user->phone), MTP_string(firstName), MTP_string(lastName))); _addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector(v), MTP_bool(false)), rpcDone(&AddContactBox::onSaveUserDone), rpcFail(&AddContactBox::onSaveUserFail)); } else { - _contactId = MTP::nonce(); + _contactId = rand_value(); QVector v(1, MTP_inputPhoneContact(MTP_long(_contactId), MTP_string(phone), MTP_string(firstName), MTP_string(lastName))); _addRequest = MTP::send(MTPcontacts_ImportContacts(MTP_vector(v), MTP_bool(false)), rpcDone(&AddContactBox::onImportDone)); } @@ -224,18 +224,15 @@ void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) { App::feedUsers(d.vusers); const QVector &v(d.vimported.c_vector().v); - int32 uid = 0; + UserData *user = nullptr; if (!v.isEmpty()) { const MTPDimportedContact &c(v.front().c_importedContact()); if (c.vclient_id.v != _contactId) return; - uid = c.vuser_id.v; - if (uid && !App::userLoaded(uid)) { - uid = 0; - } + user = App::userLoaded(c.vuser_id.v); } - if (uid) { - Notify::userIsContactChanged(App::userLoaded(peerFromUser(uid)), true); + if (user) { + Notify::userIsContactChanged(user, true); Ui::hideLayer(); } else { _save.hide(); @@ -499,8 +496,8 @@ void GroupInfoBox::onNext() { Ui::showLayer(new ContactsBox(title, _photoBig), KeepOtherLayers); } else { bool mega = false; - int32 flags = mega ? MTPchannels_CreateChannel::flag_megagroup : MTPchannels_CreateChannel::flag_broadcast; - _creationRequestId = MTP::send(MTPchannels_CreateChannel(MTP_int(flags), MTP_string(title), MTP_string(description)), rpcDone(&GroupInfoBox::creationDone), rpcFail(&GroupInfoBox::creationFail)); + MTPchannels_CreateChannel::Flags flags = mega ? MTPchannels_CreateChannel::Flag::f_megagroup : MTPchannels_CreateChannel::Flag::f_broadcast; + _creationRequestId = MTP::send(MTPchannels_CreateChannel(MTP_flags(flags), MTP_string(title), MTP_string(description)), rpcDone(&GroupInfoBox::creationDone), rpcFail(&GroupInfoBox::creationFail)); } } @@ -540,6 +537,9 @@ bool GroupInfoBox::creationFail(const RPCError &error) { _title.setFocus(); _title.showError(); return true; + } else if (error.type() == qstr("USER_RESTRICTED")) { + Ui::showLayer(new InformBox(lang(lng_cant_do_this))); + return true; } return false; } @@ -839,7 +839,7 @@ void SetupChannelBox::onChange() { } _checkTimer.stop(); } else { - int32 i, len = name.size(); + int32 len = name.size(); for (int32 i = 0; i < len; ++i) { QChar ch = name.at(i); if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_') { @@ -1115,8 +1115,8 @@ void EditNameTitleBox::onSave() { } _sentName = first; if (_peer == App::self()) { - int32 flags = MTPaccount_UpdateProfile::flag_first_name | MTPaccount_UpdateProfile::flag_last_name; - _requestId = MTP::send(MTPaccount_UpdateProfile(MTP_int(flags), MTP_string(first), MTP_string(last), MTPstring()), rpcDone(&EditNameTitleBox::onSaveSelfDone), rpcFail(&EditNameTitleBox::onSaveSelfFail)); + MTPaccount_UpdateProfile::Flags flags = MTPaccount_UpdateProfile::Flag::f_first_name | MTPaccount_UpdateProfile::Flag::f_last_name; + _requestId = MTP::send(MTPaccount_UpdateProfile(MTP_flags(flags), MTP_string(first), MTP_string(last), MTPstring()), rpcDone(&EditNameTitleBox::onSaveSelfDone), rpcFail(&EditNameTitleBox::onSaveSelfFail)); } else if (_peer->isChat()) { _requestId = MTP::send(MTPmessages_EditChatTitle(_peer->asChat()->inputChat, MTP_string(first)), rpcDone(&EditNameTitleBox::onSaveChatDone), rpcFail(&EditNameTitleBox::onSaveChatFail)); } diff --git a/Telegram/SourceFiles/boxes/confirmbox.cpp b/Telegram/SourceFiles/boxes/confirmbox.cpp index b73b15d89..3e379aae0 100644 --- a/Telegram/SourceFiles/boxes/confirmbox.cpp +++ b/Telegram/SourceFiles/boxes/confirmbox.cpp @@ -404,8 +404,11 @@ void PinMessageBox::resizeEvent(QResizeEvent *e) { void PinMessageBox::onPin() { if (_requestId) return; - int32 flags = _notify.checked() ? 0 : MTPchannels_UpdatePinnedMessage::flag_silent; - _requestId = MTP::send(MTPchannels_UpdatePinnedMessage(MTP_int(flags), _channel->inputChannel, MTP_int(_msgId)), rpcDone(&PinMessageBox::pinDone), rpcFail(&PinMessageBox::pinFail)); + MTPchannels_UpdatePinnedMessage::Flags flags = 0; + if (_notify.checked()) { + flags |= MTPchannels_UpdatePinnedMessage::Flag::f_silent; + } + _requestId = MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(flags), _channel->inputChannel, MTP_int(_msgId)), rpcDone(&PinMessageBox::pinDone), rpcFail(&PinMessageBox::pinFail)); } void PinMessageBox::showAll() { @@ -473,7 +476,7 @@ void RichDeleteMessageBox::onDelete() { if (_deleteAll.checked()) { App::main()->deleteAllFromUser(_channel, _from); } - if (auto item = App::histItemById(_channel ? peerToChannel(_channel->id) : 0, _msgId)) { + if (HistoryItem *item = App::histItemById(_channel ? peerToChannel(_channel->id) : 0, _msgId)) { bool wasLast = (item->history()->lastMsg == item); item->destroy(); if (_msgId > 0) { @@ -482,7 +485,6 @@ void RichDeleteMessageBox::onDelete() { App::main()->checkPeerHistory(_channel); } } - Notify::historyItemsResized(); Ui::hideLayer(); } diff --git a/Telegram/SourceFiles/boxes/connectionbox.cpp b/Telegram/SourceFiles/boxes/connectionbox.cpp index 27b2ce7ff..aa5ebd767 100644 --- a/Telegram/SourceFiles/boxes/connectionbox.cpp +++ b/Telegram/SourceFiles/boxes/connectionbox.cpp @@ -201,8 +201,10 @@ void ConnectionBox::onSave() { } else { cSetConnectionType(dbictAuto); cSetConnectionProxy(ConnectionProxy()); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QNetworkProxyFactory::setUseSystemConfiguration(false); QNetworkProxyFactory::setUseSystemConfiguration(true); +#endif } if (cPlatform() == dbipWindows && cTryIPv6() != _tryIPv6.checked()) { cSetTryIPv6(_tryIPv6.checked()); diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 833054800..3e0cf9212 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -224,7 +224,7 @@ void ContactsInner::onPeerNameChanged(PeerData *peer, const PeerData::Names &old void ContactsInner::onAddBot() { if (_bot->botInfo && !_bot->botInfo->startGroupToken.isEmpty()) { - MTP::send(MTPmessages_StartBot(_bot->inputUser, _addToPeer->input, MTP_long(MTP::nonce()), MTP_string(_bot->botInfo->startGroupToken)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _bot)); + MTP::send(MTPmessages_StartBot(_bot->inputUser, _addToPeer->input, MTP_long(rand_value()), MTP_string(_bot->botInfo->startGroupToken)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _bot)); } else { App::main()->addParticipants(_addToPeer, QVector(1, _bot)); } @@ -284,6 +284,8 @@ bool ContactsInner::addAdminFail(const RPCError &error, mtpRequestId req) { Ui::showLayer(new MaxInviteBox(_channel->invitationUrl), KeepOtherLayers); } else if (error.type() == "ADMINS_TOO_MUCH") { Ui::showLayer(new InformBox(lang(lng_channel_admins_too_much)), KeepOtherLayers); + } else if (error.type() == qstr("USER_RESTRICTED")) { + Ui::showLayer(new InformBox(lang(lng_cant_do_this)), KeepOtherLayers); } else { emit adminAdded(); } @@ -362,7 +364,7 @@ void ContactsInner::loadProfilePhotos(int32 yFrom) { preloadFrom != _contacts->list.end && (_newItemHeight + preloadFrom->pos * _rowHeight) < yTo; preloadFrom = preloadFrom->next ) { - preloadFrom->history->peer->photo->load(); + preloadFrom->history->peer->loadUserpic(); } } } else if (!_filtered.isEmpty()) { @@ -373,7 +375,7 @@ void ContactsInner::loadProfilePhotos(int32 yFrom) { if (to > _filtered.size()) to = _filtered.size(); for (; from < to; ++from) { - _filtered[from]->history->peer->photo->load(); + _filtered[from]->history->peer->loadUserpic(); } } } @@ -445,7 +447,7 @@ void ContactsInner::paintDialog(Painter &p, PeerData *peer, ContactData *data, b } p.fillRect(0, 0, width(), _rowHeight, inverse ? st::contactsBgActive : (sel ? st::contactsBgOver : st::white)); p.setPen(inverse ? st::white : st::black); - p.drawPixmapLeft(st::contactsPadding.left(), st::contactsPadding.top(), width(), peer->photo->pix(st::contactsPhotoSize)); + peer->paintUserpicLeft(p, st::contactsPhotoSize, st::contactsPadding.left(), st::contactsPadding.top(), width()); int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(); int32 iconw = (_chat || _creating != CreatingGroupNone) ? (st::contactsCheckPosition.x() * 2 + st::contactsCheckIcon.pxWidth()) : 0; @@ -783,7 +785,9 @@ void ContactsInner::changeCheckState(ContactData *data, PeerData *peer) { data->check = true; _checkedContacts.insert(peer, true); ++_selCount; - } else if ((!_channel || !_channel->isMegagroup()) && selectedCount() >= Global::ChatSizeMax() && selectedCount() < Global::MegagroupSizeMax()) { + } else if (_channel && !_channel->isMegagroup()) { + Ui::showLayer(new MaxInviteBox(_channel->invitationUrl), KeepOtherLayers); + } else if (!_channel && selectedCount() >= Global::ChatSizeMax() && selectedCount() < Global::MegagroupSizeMax()) { Ui::showLayer(new InformBox(lng_profile_add_more_after_upgrade(lt_count, Global::MegagroupSizeMax())), KeepOtherLayers); } if (cnt != _selCount) emit chosenChanged(); @@ -1549,7 +1553,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) { paintTitle(p, lang(lng_channel_admins)); } else if (_inner.chat() || _inner.creating() != CreatingGroupNone) { QString title(lang(addingAdmin ? lng_channel_add_admin : lng_profile_add_participant)); - QString additional(addingAdmin ? QString() : QString("%1 / %2").arg(_inner.selectedCount()).arg(Global::MegagroupSizeMax())); + QString additional((addingAdmin || (_inner.channel() && !_inner.channel()->isMegagroup())) ? QString() : QString("%1 / %2").arg(_inner.selectedCount()).arg(Global::MegagroupSizeMax())); paintTitle(p, title, additional); } else if (_inner.bot()) { paintTitle(p, lang(lng_bot_choose_group)); @@ -1666,12 +1670,15 @@ void ContactsBox::getAdminsDone(const MTPmessages_ChatFull &result) { } } _saveRequestId = 0; - for (ChatData::Admins::const_iterator i = curadmins.cbegin(), e = curadmins.cend(); i != e; ++i) { - MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, i.key()->inputUser, MTP_boolFalse()), rpcDone(&ContactsBox::removeAdminDone, i.key()), rpcFail(&ContactsBox::editAdminFail), 0, (appoint.isEmpty() && i + 1 == e) ? 0 : 10); + + for_const (UserData *user, curadmins) { + MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, user->inputUser, MTP_boolFalse()), rpcDone(&ContactsBox::removeAdminDone, user), rpcFail(&ContactsBox::editAdminFail), 0, 10); } - for (int32 i = 0, l = appoint.size(); i < l; ++i) { - MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, appoint.at(i)->inputUser, MTP_boolTrue()), rpcDone(&ContactsBox::setAdminDone, appoint.at(i)), rpcFail(&ContactsBox::editAdminFail), 0, (i + 1 == l) ? 0 : 10); + for_const (UserData *user, appoint) { + MTP::send(MTPmessages_EditChatAdmin(_inner.chat()->inputChat, user->inputUser, MTP_boolTrue()), rpcDone(&ContactsBox::setAdminDone, user), rpcFail(&ContactsBox::editAdminFail), 0, 10); } + MTP::sendAnything(); + _saveRequestId = curadmins.size() + appoint.size(); if (!_saveRequestId) { onClose(); @@ -1718,7 +1725,13 @@ bool ContactsBox::editAdminFail(const RPCError &error) { if (mtpIsFlood(error)) return true; --_saveRequestId; _inner.chat()->invalidateParticipants(); - if (!_saveRequestId) onClose(); + if (!_saveRequestId) { + if (error.type() == qstr("USER_RESTRICTED")) { + Ui::showLayer(new InformBox(lang(lng_cant_do_this))); + return true; + } + onClose(); + } return false; } @@ -1765,6 +1778,9 @@ bool ContactsBox::creationFail(const RPCError &error) { } else if (error.type() == "PEER_FLOOD") { Ui::showLayer(new InformBox(lng_cant_invite_not_contact(lt_more_info, textcmdLink(qsl("https://telegram.org/faq?_hash=can-39t-send-messages-to-non-contacts"), lang(lng_cant_more_info)))), KeepOtherLayers); return true; + } else if (error.type() == qstr("USER_RESTRICTED")) { + Ui::showLayer(new InformBox(lang(lng_cant_do_this))); + return true; } return false; } @@ -1909,7 +1925,7 @@ void MembersInner::paintDialog(Painter &p, PeerData *peer, MemberData *data, boo UserData *user = peer->asUser(); p.fillRect(0, 0, width(), _rowHeight, (sel ? st::contactsBgOver : st::white)->b); - p.drawPixmapLeft(st::contactsPadding.left(), st::contactsPadding.top(), width(), peer->photo->pix(st::contactsPhotoSize)); + peer->paintUserpicLeft(p, st::contactsPhotoSize, st::contactsPadding.left(), st::contactsPadding.top(), width()); p.setPen(st::black); @@ -1994,7 +2010,7 @@ void MembersInner::loadProfilePhotos(int32 yFrom) { if (to > _rows.size()) to = _rows.size(); for (; from < to; ++from) { - _rows[from]->photo->load(); + _rows[from]->loadUserpic(); } } } diff --git a/Telegram/SourceFiles/boxes/languagebox.cpp b/Telegram/SourceFiles/boxes/languagebox.cpp index 115123b91..f6e7daf2f 100644 --- a/Telegram/SourceFiles/boxes/languagebox.cpp +++ b/Telegram/SourceFiles/boxes/languagebox.cpp @@ -88,7 +88,7 @@ void LanguageBox::mousePressEvent(QMouseEvent *e) { return; } else if (!loader.warnings().isEmpty()) { QString warn = loader.warnings(); - if (warn.size() > 256) warn = warn.mid(0, 254) + qsl(".."); + if (warn.size() > 256) warn = warn.mid(0, 253) + qsl("..."); Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" warnings :(\n\nWarnings: ") + warn)); return; } diff --git a/Telegram/SourceFiles/boxes/passcodebox.cpp b/Telegram/SourceFiles/boxes/passcodebox.cpp index b0815abb2..c90e4c0b4 100644 --- a/Telegram/SourceFiles/boxes/passcodebox.cpp +++ b/Telegram/SourceFiles/boxes/passcodebox.cpp @@ -400,11 +400,11 @@ void PasscodeBox::onSave(bool force) { if (!_oldPasscode.isHidden()) { hashSha256(oldPasswordData.constData(), oldPasswordData.size(), oldPasswordHash.data()); } - int32 flags = MTPDaccount_passwordInputSettings::flag_new_salt | MTPDaccount_passwordInputSettings::flag_new_password_hash | MTPDaccount_passwordInputSettings::flag_hint; + MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_new_salt | MTPDaccount_passwordInputSettings::Flag::f_new_password_hash | MTPDaccount_passwordInputSettings::Flag::f_hint; if (_oldPasscode.isHidden() || _newPasscode.isHidden()) { - flags |= MTPDaccount_passwordInputSettings::flag_email; + flags |= MTPDaccount_passwordInputSettings::Flag::f_email; } - MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_int(flags), MTP_string(_newSalt), MTP_string(newPasswordHash), MTP_string(hint), MTP_string(email))); + MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_string(_newSalt), MTP_string(newPasswordHash), MTP_string(hint), MTP_string(email))); _setRequest = MTP::send(MTPaccount_UpdatePasswordSettings(MTP_string(oldPasswordHash), settings), rpcDone(&PasscodeBox::setPasswordDone), rpcFail(&PasscodeBox::setPasswordFail)); } } else { diff --git a/Telegram/SourceFiles/boxes/photosendbox.cpp b/Telegram/SourceFiles/boxes/photosendbox.cpp index 9ef73bebd..f3a202ccc 100644 --- a/Telegram/SourceFiles/boxes/photosendbox.cpp +++ b/Telegram/SourceFiles/boxes/photosendbox.cpp @@ -69,8 +69,8 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW if (_animated) { int32 limitW = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 limitH = st::confirmMaxHeight; - maxW = dimensions.width(); - maxH = dimensions.height(); + maxW = qMax(dimensions.width(), 1); + maxH = qMax(dimensions.height(), 1); if (maxW * limitH > maxH * limitW) { if (maxW < limitW) { maxH = maxH * limitW / maxW; @@ -82,7 +82,7 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW maxH = limitH; } } - _thumb = imagePix(_file->thumb.toImage(), maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), true, true, false, maxW, maxH); + _thumb = imagePix(_file->thumb.toImage(), maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), ImagePixSmooth | ImagePixBlurred, maxW, maxH); } else { for (PreparedPhotoThumbs::const_iterator i = _file->photoThumbs.cbegin(), e = _file->photoThumbs.cend(); i != e; ++i) { if (i->width() >= maxW && i->height() >= maxH) { @@ -124,7 +124,7 @@ PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxW } else { _thumbw = st::msgFileThumbSize; } - _thumb = imagePix(_thumb.toImage(), _thumbw * cIntRetinaFactor(), 0, true, false, true, st::msgFileThumbSize, st::msgFileThumbSize); + _thumb = imagePix(_thumb.toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRounded, st::msgFileThumbSize, st::msgFileThumbSize); } _name.setText(st::semiboldFont, _file->filename, _textNameOptions); @@ -274,7 +274,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) { p.drawSpriteCenter(inner, _isImage ? st::msgFileOutImage : st::msgFileOutFile); } else { - p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixRounded(st::msgFileSize)); + p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize)); } p.setFont(st::semiboldFont); p.setPen(st::black); @@ -428,7 +428,7 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth) } else { _thumbw = st::msgFileThumbSize; } - _thumb = imagePix(image->pix().toImage(), _thumbw * cIntRetinaFactor(), 0, true, false, true, st::msgFileThumbSize, st::msgFileThumbSize); + _thumb = imagePix(image->pix().toImage(), _thumbw * cIntRetinaFactor(), 0, ImagePixSmooth | ImagePixRounded, st::msgFileThumbSize, st::msgFileThumbSize); } if (doc) { @@ -446,8 +446,8 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth) if (_animated) { int32 limitW = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 limitH = st::confirmMaxHeight; - maxW = dimensions.width(); - maxH = dimensions.height(); + maxW = qMax(dimensions.width(), 1); + maxH = qMax(dimensions.height(), 1); if (maxW * limitH > maxH * limitW) { if (maxW < limitW) { maxH = maxH * limitW / maxW; @@ -459,11 +459,11 @@ EditCaptionBox::EditCaptionBox(HistoryItem *msg) : AbstractBox(st::boxWideWidth) maxH = limitH; } } - _thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), true, true, false, maxW, maxH); + _thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), ImagePixSmooth | ImagePixBlurred, maxW, maxH); } else { maxW = dimensions.width(); maxH = dimensions.height(); - _thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), true, false, false, maxW, maxH); + _thumb = image->pixNoCache(maxW * cIntRetinaFactor(), maxH * cIntRetinaFactor(), ImagePixSmooth | ImagePixRounded, maxW, maxH); } int32 tw = _thumb.width(), th = _thumb.height(); if (!tw || !th) { @@ -648,15 +648,15 @@ void EditCaptionBox::onSave(bool ctrlShiftEnter) { return; } - int32 flags = 0; + MTPchannels_EditMessage::Flags flags = 0; if (_previewCancelled) { - flags |= MTPchannels_EditMessage::flag_no_webpage; + flags |= MTPchannels_EditMessage::Flag::f_no_webpage; } MTPVector sentEntities; if (!sentEntities.c_vector().v.isEmpty()) { - flags |= MTPmessages_SendMessage::flag_entities; + flags |= MTPchannels_EditMessage::Flag::f_entities; } - _saveRequestId = MTP::send(MTPchannels_EditMessage(MTP_int(flags), item->history()->peer->asChannel()->inputChannel, MTP_int(item->id), MTP_string(_field->getLastText()), sentEntities), rpcDone(&EditCaptionBox::saveDone), rpcFail(&EditCaptionBox::saveFail)); + _saveRequestId = MTP::send(MTPchannels_EditMessage(MTP_flags(flags), item->history()->peer->asChannel()->inputChannel, MTP_int(item->id), MTP_string(_field->getLastText()), sentEntities), rpcDone(&EditCaptionBox::saveDone), rpcFail(&EditCaptionBox::saveFail)); } void EditCaptionBox::saveDone(const MTPUpdates &updates) { diff --git a/Telegram/SourceFiles/boxes/stickersetbox.cpp b/Telegram/SourceFiles/boxes/stickersetbox.cpp index 65fdd9b32..fd0d70e0a 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.cpp +++ b/Telegram/SourceFiles/boxes/stickersetbox.cpp @@ -117,17 +117,17 @@ bool StickerSetInner::failedSet(const RPCError &error) { } void StickerSetInner::installDone(const MTPBool &result) { - StickerSets &sets(cRefStickerSets()); + Stickers::Sets &sets(Global::RefStickerSets()); - _setFlags &= ~MTPDstickerSet::flag_disabled; - StickerSets::iterator it = sets.find(_setId); + _setFlags &= ~MTPDstickerSet::Flag::f_disabled; + auto it = sets.find(_setId); if (it == sets.cend()) { - it = sets.insert(_setId, StickerSet(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)); + it = sets.insert(_setId, Stickers::Set(_setId, _setAccess, _setTitle, _setShortName, _setCount, _setHash, _setFlags)); } it.value().stickers = _pack; it.value().emoji = _emoji; - StickerSetsOrder &order(cRefStickerSetsOrder()); + Stickers::Order &order(Global::RefStickerSetsOrder()); int32 insertAtIndex = 0, currentIndex = order.indexOf(_setId); if (currentIndex != insertAtIndex) { if (currentIndex > 0) { @@ -136,7 +136,7 @@ void StickerSetInner::installDone(const MTPBool &result) { order.insert(insertAtIndex, _setId); } - StickerSets::iterator custom = sets.find(CustomStickerSetId); + auto custom = sets.find(Stickers::CustomSetId); if (custom != sets.cend()) { for (int32 i = 0, l = _pack.size(); i < l; ++i) { int32 removeIndex = custom->stickers.indexOf(_pack.at(i)); @@ -224,12 +224,8 @@ void StickerSetInner::paintEvent(QPaintEvent *e) { if (doc->status == FileReady) { doc->automaticLoad(0); } - if (doc->sticker()->img->isNull() && doc->loaded() && doc->loaded(true)) { - if (doc->data().isEmpty()) { - doc->sticker()->img = ImagePtr(doc->already()); - } else { - doc->sticker()->img = ImagePtr(doc->data()); - } + if (doc->sticker()->img->isNull() && doc->loaded(DocumentData::FilePathResolveChecked)) { + doc->sticker()->img = doc->data().isEmpty() ? ImagePtr(doc->filepath()) : ImagePtr(doc->data()); } } @@ -260,8 +256,8 @@ bool StickerSetInner::loaded() const { int32 StickerSetInner::notInstalled() const { if (!_loaded) return 0; - StickerSets::const_iterator it = cStickerSets().constFind(_setId); - if (it == cStickerSets().cend() || (it->flags & MTPDstickerSet::flag_disabled)) return _pack.size(); + auto it = Global::StickerSets().constFind(_setId); + if (it == Global::StickerSets().cend() || (it->flags & MTPDstickerSet::Flag::f_disabled)) return _pack.size(); return 0; } @@ -686,14 +682,14 @@ void StickersInner::rebuild() { int32 namew = st::boxWideWidth - namex - st::contactsPadding.right() - st::contactsCheckPosition.x() - qMax(qMax(_returnWidth, _removeWidth), _restoreWidth); clear(); - const StickerSetsOrder &order(cStickerSetsOrder()); + const Stickers::Order &order(Global::StickerSetsOrder()); _animStartTimes.reserve(order.size()); - const StickerSets &sets(cStickerSets()); - for (int32 i = 0, l = order.size(); i < l; ++i) { - StickerSets::const_iterator it = sets.constFind(order.at(i)); + const Stickers::Sets &sets(Global::StickerSets()); + for (int i = 0, l = order.size(); i < l; ++i) { + auto it = sets.constFind(order.at(i)); if (it != sets.cend()) { - bool disabled = (it->flags & MTPDstickerSet::flag_disabled); + bool disabled = (it->flags & MTPDstickerSet::Flag::f_disabled); DocumentData *sticker = it->stickers.isEmpty() ? 0 : it->stickers.at(0); int32 pixw = 0, pixh = 0; @@ -718,10 +714,10 @@ void StickersInner::rebuild() { if (titleWidth > namew) { title = st::contactsNameFont->elided(title, namew); } - bool official = (it->flags & MTPDstickerSet::flag_official); + bool official = (it->flags & MTPDstickerSet::Flag::f_official); (disabled ? rowsDisabled : rows).push_back(new StickerSetRow(it->id, sticker, it->stickers.size(), title, official, disabled, pixw, pixh)); _animStartTimes.push_back(0); - if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_flag_NOT_LOADED)) { + if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) { App::api()->scheduleStickerSetRequest(it->id, it->access); } } @@ -736,8 +732,8 @@ QVector StickersInner::getOrder() const { result.reserve(_rows.size()); for (int32 i = 0, l = _rows.size(); i < l; ++i) { if (_rows.at(i)->disabled) { - StickerSets::const_iterator it = cStickerSets().constFind(_rows.at(i)->id); - if (it == cStickerSets().cend() || !(it->flags & MTPDstickerSet::flag_official)) { + auto it = Global::StickerSets().constFind(_rows.at(i)->id); + if (it == Global::StickerSets().cend() || !(it->flags & MTPDstickerSet::Flag::f_official)) { continue; } } @@ -837,7 +833,7 @@ void StickersBox::reorderDone(const MTPBool &result) { bool StickersBox::reorderFail(const RPCError &result) { if (mtpIsFlood(result)) return false; _reorderRequest = 0; - cSetLastStickersUpdate(0); + Global::SetLastStickersUpdate(0); App::main()->updateStickers(); onClose(); return true; @@ -861,12 +857,12 @@ void StickersBox::closePressed() { MTP::cancel(i.key()); } _disenableRequests.clear(); - cSetLastStickersUpdate(0); + Global::SetLastStickersUpdate(0); App::main()->updateStickers(); } else if (_reorderRequest) { MTP::cancel(_reorderRequest); _reorderRequest = 0; - cSetLastStickersUpdate(0); + Global::SetLastStickersUpdate(0); App::main()->updateStickers(); } } @@ -918,11 +914,11 @@ void StickersBox::onSave() { bool writeRecent = false; RecentStickerPack &recent(cGetRecentStickers()); - StickerSets &sets(cRefStickerSets()); + Stickers::Sets &sets(Global::RefStickerSets()); QVector reorder = _inner.getOrder(), disabled = _inner.getDisabledSets(); for (int32 i = 0, l = disabled.size(); i < l; ++i) { - StickerSets::iterator it = sets.find(disabled.at(i)); + auto it = sets.find(disabled.at(i)); if (it != sets.cend()) { for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) { if (it->stickers.indexOf(i->first) >= 0) { @@ -932,35 +928,35 @@ void StickersBox::onSave() { ++i; } } - if (!(it->flags & MTPDstickerSet::flag_disabled)) { + if (!(it->flags & MTPDstickerSet::Flag::f_disabled)) { MTPInputStickerSet setId = (it->id && it->access) ? MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)) : MTP_inputStickerSetShortName(MTP_string(it->shortName)); - if (it->flags & MTPDstickerSet::flag_official) { + if (it->flags & MTPDstickerSet::Flag::f_official) { _disenableRequests.insert(MTP::send(MTPmessages_InstallStickerSet(setId, MTP_boolTrue()), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); - it->flags |= MTPDstickerSet::flag_disabled; + it->flags |= MTPDstickerSet::Flag::f_disabled; } else { _disenableRequests.insert(MTP::send(MTPmessages_UninstallStickerSet(setId), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); - int32 removeIndex = cStickerSetsOrder().indexOf(it->id); - if (removeIndex >= 0) cRefStickerSetsOrder().removeAt(removeIndex); + int removeIndex = Global::StickerSetsOrder().indexOf(it->id); + if (removeIndex >= 0) Global::RefStickerSetsOrder().removeAt(removeIndex); sets.erase(it); } } } } - StickerSetsOrder &order(cRefStickerSetsOrder()); + Stickers::Order &order(Global::RefStickerSetsOrder()); order.clear(); - for (int32 i = 0, l = reorder.size(); i < l; ++i) { - StickerSets::iterator it = sets.find(reorder.at(i)); + for (int i = 0, l = reorder.size(); i < l; ++i) { + auto it = sets.find(reorder.at(i)); if (it != sets.cend()) { - if ((it->flags & MTPDstickerSet::flag_disabled) && !disabled.contains(it->id)) { + if ((it->flags & MTPDstickerSet::Flag::f_disabled) && !disabled.contains(it->id)) { MTPInputStickerSet setId = (it->id && it->access) ? MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)) : MTP_inputStickerSetShortName(MTP_string(it->shortName)); _disenableRequests.insert(MTP::send(MTPmessages_InstallStickerSet(setId, MTP_boolFalse()), rpcDone(&StickersBox::disenableDone), rpcFail(&StickersBox::disenableFail), 0, 5), NullType()); - it->flags &= ~MTPDstickerSet::flag_disabled; + it->flags &= ~MTPDstickerSet::Flag::f_disabled; } order.push_back(reorder.at(i)); } } - for (StickerSets::iterator it = sets.begin(); it != sets.cend();) { - if (it->id == CustomStickerSetId || it->id == RecentStickerSetId || order.contains(it->id)) { + for (auto it = sets.begin(); it != sets.cend();) { + if (it->id == Stickers::CustomSetId || it->id == Stickers::RecentSetId || order.contains(it->id)) { ++it; } else { it = sets.erase(it); @@ -996,12 +992,12 @@ void StickersBox::showAll() { int32 stickerPacksCount(bool includeDisabledOfficial) { int32 result = 0; - const StickerSetsOrder &order(cStickerSetsOrder()); - const StickerSets &sets(cStickerSets()); - for (int32 i = 0, l = order.size(); i < l; ++i) { - StickerSets::const_iterator it = sets.constFind(order.at(i)); + const Stickers::Order &order(Global::StickerSetsOrder()); + const Stickers::Sets &sets(Global::StickerSets()); + for (int i = 0, l = order.size(); i < l; ++i) { + auto it = sets.constFind(order.at(i)); if (it != sets.cend()) { - if (!(it->flags & MTPDstickerSet::flag_disabled) || ((it->flags & MTPDstickerSet::flag_official) && includeDisabledOfficial)) { + if (!(it->flags & MTPDstickerSet::Flag::f_disabled) || ((it->flags & MTPDstickerSet::Flag::f_official) && includeDisabledOfficial)) { ++result; } } diff --git a/Telegram/SourceFiles/boxes/stickersetbox.h b/Telegram/SourceFiles/boxes/stickersetbox.h index 356fd4b60..fc2c9a513 100644 --- a/Telegram/SourceFiles/boxes/stickersetbox.h +++ b/Telegram/SourceFiles/boxes/stickersetbox.h @@ -70,7 +70,8 @@ private: bool _loaded; uint64 _setId, _setAccess; QString _title, _setTitle, _setShortName; - int32 _setCount, _setHash, _setFlags; + int32 _setCount, _setHash; + MTPDstickerSet::Flags _setFlags; int32 _bottom; MTPInputStickerSet _input; diff --git a/Telegram/SourceFiles/boxes/usernamebox.cpp b/Telegram/SourceFiles/boxes/usernamebox.cpp index 13786841f..247db630f 100644 --- a/Telegram/SourceFiles/boxes/usernamebox.cpp +++ b/Telegram/SourceFiles/boxes/usernamebox.cpp @@ -160,7 +160,7 @@ void UsernameBox::onChanged() { } _checkTimer.stop(); } else { - int32 i, len = name.size(); + int32 len = name.size(); for (int32 i = 0; i < len; ++i) { QChar ch = name.at(i); if ((ch < 'A' || ch > 'Z') && (ch < 'a' || ch > 'z') && (ch < '0' || ch > '9') && ch != '_' && (ch != '@' || i > 0)) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index fd7b7f1f0..39e5008f3 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -20,10 +20,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 9033; -static const wchar_t *AppVersionStr = L"0.9.33"; -static const bool DevVersion = false; -//#define BETA_VERSION (9030002ULL) // just comment this line to build public version +static const int32 AppVersion = 9036; +static const wchar_t *AppVersionStr = L"0.9.36"; +static const bool DevVersion = true; +//#define BETA_VERSION (9034004ULL) // just comment this line to build public version static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppName = L"Telegram Desktop"; @@ -101,6 +101,9 @@ enum { MediaOverviewStartPerPage = 5, MediaOverviewPreloadCount = 4, + // a new message from the same sender is attached to previous within 15 minutes + AttachMessageToPreviousSecondsDelta = 900, + AudioVoiceMsgSimultaneously = 4, AudioSongSimultaneously = 4, AudioCheckPositionTimeout = 100, // 100ms per check audio pos @@ -197,7 +200,7 @@ inline const char *cGUIDStr() { return gGuidStr; } -inline const char **cPublicRSAKeys(uint32 &cnt) { +inline const char **cPublicRSAKeys(int &keysCount) { static const char *(keys[]) = {"\ -----BEGIN RSA PUBLIC KEY-----\n\ MIIBCgKCAQEAwVACPi9w23mF3tBkdZz+zwrzKOaaQdr01vAbU4E1pvkfj4sqDsm6\n\ @@ -207,7 +210,7 @@ Efzk2DWgkBluml8OREmvfraX3bkHZJTKX4EQSjBbbdJ2ZXIsRrYOXfaA+xayEGB+\n\ 8hdlLmAjbCVfaigxX0CDqWeR1yFL9kwd9P0NsZRPsmoqVwMbMu7mStFai6aIhc3n\n\ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB\n\ -----END RSA PUBLIC KEY-----"}; - cnt = sizeof(keys) / sizeof(const char*); + keysCount = arraysize(keys); return keys; } diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index a90b299a7..15c6d61b4 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -247,11 +247,8 @@ void DialogsInner::peopleResultPaint(PeerData *peer, Painter &p, int32 w, bool a History *history = App::history(peer->id); - if (peer->migrateTo()) { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, peer->migrateTo()->photo->pix(st::dlgPhotoSize)); - } else { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, peer->photo->pix(st::dlgPhotoSize)); - } + PeerData *userpicPeer = (peer->migrateTo() ? peer->migrateTo() : peer); + userpicPeer->paintUserpicLeft(p, st::dlgPhotoSize, st::dlgPaddingHor, st::dlgPaddingVer, fullWidth()); int32 nameleft = st::dlgPaddingHor + st::dlgPhotoSize + st::dlgPhotoPadding; int32 namewidth = w - nameleft - st::dlgPaddingHor; @@ -299,7 +296,7 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c p.fillRect(fullRect, st::dlgBG->b); if (onlyBackground) return; - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, _searchInPeer->photo->pix(st::dlgPhotoSize)); + _searchInPeer->paintUserpicLeft(p, st::dlgPhotoSize, st::dlgPaddingHor, st::dlgPaddingVer, fullWidth()); int32 nameleft = st::dlgPaddingHor + st::dlgPhotoSize + st::dlgPhotoPadding; int32 namewidth = w - nameleft - st::dlgPaddingHor * 2 - st::btnCancelSearch.width; @@ -1373,7 +1370,7 @@ void DialogsInner::loadPeerPhotos(int32 yFrom) { if (yFrom < otherStart) { dialogs.list.adjustCurrent(yFrom, st::dlgHeight); for (DialogRow *row = dialogs.list.current; row != dialogs.list.end && (row->pos * st::dlgHeight) < yTo; row = row->next) { - row->history->peer->photo->load(); + row->history->peer->loadUserpic(); } yFrom = 0; } else { @@ -1383,7 +1380,7 @@ void DialogsInner::loadPeerPhotos(int32 yFrom) { if (yTo > 0) { contactsNoDialogs.list.adjustCurrent(yFrom, st::dlgHeight); for (DialogRow *row = contactsNoDialogs.list.current; row != contactsNoDialogs.list.end && (row->pos * st::dlgHeight) < yTo; row = row->next) { - row->history->peer->photo->load(); + row->history->peer->loadUserpic(); } } } else if (_state == FilteredState || _state == SearchedState) { @@ -1394,7 +1391,7 @@ void DialogsInner::loadPeerPhotos(int32 yFrom) { if (to > _filterResults.size()) to = _filterResults.size(); for (; from < to; ++from) { - _filterResults[from]->history->peer->photo->load(); + _filterResults[from]->history->peer->loadUserpic(); } } @@ -1405,7 +1402,7 @@ void DialogsInner::loadPeerPhotos(int32 yFrom) { if (to > _peopleResults.size()) to = _peopleResults.size(); for (; from < to; ++from) { - _peopleResults[from]->photo->load(); + _peopleResults[from]->loadUserpic(); } } from = (yFrom > filteredOffset() + ((_peopleResults.isEmpty() ? 0 : st::searchedBarHeight) + st::searchedBarHeight) ? ((yFrom - filteredOffset() - (_peopleResults.isEmpty() ? 0 : st::searchedBarHeight) - st::searchedBarHeight) / int32(st::dlgHeight)) : 0) - _filterResults.size() - _peopleResults.size(); @@ -1415,7 +1412,7 @@ void DialogsInner::loadPeerPhotos(int32 yFrom) { if (to > _searchResults.size()) to = _searchResults.size(); for (; from < to; ++from) { - _searchResults[from]->_item->history()->peer->photo->load(); + _searchResults[from]->_item->history()->peer->loadUserpic(); } } } @@ -2055,8 +2052,11 @@ bool DialogsWidget::onSearchMessages(bool searchCache) { MTP::cancel(_searchRequest); } if (_searchInPeer) { - int32 flags = (_searchInPeer->isChannel() && !_searchInPeer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart)); + MTPmessages_Search::Flags flags = 0; + if (_searchInPeer->isChannel() && !_searchInPeer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart)); } else { _searchRequest = MTP::send(MTPmessages_SearchGlobal(MTP_string(_searchQuery), MTP_int(0), MTP_inputPeerEmpty(), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart), rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart)); } @@ -2116,8 +2116,11 @@ void DialogsWidget::onSearchMore() { PeerData *offsetPeer = _inner.lastSearchPeer(); MsgId offsetId = _inner.lastSearchId(); if (_searchInPeer) { - int32 flags = (_searchInPeer->isChannel() && !_searchInPeer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart)); + MTPmessages_Search::Flags flags = 0; + if (_searchInPeer->isChannel() && !_searchInPeer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInPeer->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart)); } else { _searchRequest = MTP::send(MTPmessages_SearchGlobal(MTP_string(_searchQuery), MTP_int(offsetDate), offsetPeer ? offsetPeer->input : MTP_inputPeerEmpty(), MTP_int(offsetId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart), rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart)); } @@ -2126,8 +2129,11 @@ void DialogsWidget::onSearchMore() { } } else if (_searchInMigrated && !_searchFullMigrated) { MsgId offsetMigratedId = _inner.lastSearchMigratedId(); - int32 flags = (_searchInMigrated->isChannel() && !_searchInMigrated->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _searchInMigrated->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetMigratedId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart), rpcFail(&DialogsWidget::searchFailed, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart)); + MTPmessages_Search::Flags flags = 0; + if (_searchInMigrated->isChannel() && !_searchInMigrated->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _searchInMigrated->input, MTP_string(_searchQuery), MTP_inputMessagesFilterEmpty(), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(offsetMigratedId), MTP_int(SearchPerPage)), rpcDone(&DialogsWidget::searchReceived, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart), rpcFail(&DialogsWidget::searchFailed, offsetMigratedId ? DialogsSearchMigratedFromOffset : DialogsSearchMigratedFromStart)); } } } diff --git a/Telegram/SourceFiles/dropdown.cpp b/Telegram/SourceFiles/dropdown.cpp index 87d450196..ee475348b 100644 --- a/Telegram/SourceFiles/dropdown.cpp +++ b/Telegram/SourceFiles/dropdown.cpp @@ -1097,7 +1097,7 @@ void EmojiPanInner::fillPanels(QVector &panels) { int y = 0; panels.reserve(emojiTabCount); for (int c = 0; c < emojiTabCount; ++c) { - panels.push_back(new EmojiPanel(parentWidget(), lang(LangKey(lng_emoji_category0 + c)), NoneStickerSetId, true, y)); + panels.push_back(new EmojiPanel(parentWidget(), lang(LangKey(lng_emoji_category0 + c)), Stickers::NoneSetId, true, y)); connect(panels.back(), SIGNAL(mousePressed()), this, SLOT(checkPickerHide())); int cnt = _counts[c], rows = (cnt / EmojiPanPerRow) + ((cnt % EmojiPanPerRow) ? 1 : 0); panels.back()->show(); @@ -1352,7 +1352,7 @@ void StickerPanInner::paintStickers(Painter &p, const QRect &r) { tilly = y + st::emojiPanHeader + (rows * st::stickerPanSize.height()); if (r.top() >= tilly) continue; - bool special = (_sets[c].flags & MTPDstickerSet::flag_official); + bool special = (_sets[c].flags & MTPDstickerSet::Flag::f_official); y += st::emojiPanHeader; int32 fromrow = floorclamp(r.y() - y, st::stickerPanSize.height(), 0, rows); @@ -1395,7 +1395,7 @@ void StickerPanInner::paintStickers(Painter &p, const QRect &r) { p.drawPixmapLeft(ppos, width(), sticker->sticker()->img->pix(w, h)); } - if (hover > 0 && _sets[c].id == RecentStickerSetId && _custom.at(index)) { + if (hover > 0 && _sets[c].id == Stickers::RecentSetId && _custom.at(index)) { float64 xHover = _sets[c].hovers[_sets[c].pack.size() + index]; QPoint xPos = pos + QPoint(st::stickerPanSize.width() - st::stickerPanDelete.pxWidth(), 0); @@ -1509,7 +1509,7 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) { } int tab = (_selected / MatrixRowShift), sel = _selected % MatrixRowShift; - if (_sets[tab].id == RecentStickerSetId && sel >= _sets[tab].pack.size() && sel < _sets[tab].pack.size() * 2 && _custom.at(sel - _sets[tab].pack.size())) { + if (_sets[tab].id == Stickers::RecentSetId && sel >= _sets[tab].pack.size() && sel < _sets[tab].pack.size() * 2 && _custom.at(sel - _sets[tab].pack.size())) { clearSelection(true); bool refresh = false; DocumentData *sticker = _sets[tab].pack.at(sel - _sets[tab].pack.size()); @@ -1522,8 +1522,8 @@ void StickerPanInner::mouseReleaseEvent(QMouseEvent *e) { break; } } - StickerSets &sets(cRefStickerSets()); - StickerSets::iterator it = sets.find(CustomStickerSetId); + Stickers::Sets &sets(Global::RefStickerSets()); + auto it = sets.find(Stickers::CustomSetId); if (it != sets.cend()) { for (int32 i = 0, l = it->stickers.size(); i < l; ++i) { if (it->stickers.at(i) == sticker) { @@ -1595,7 +1595,7 @@ void StickerPanInner::clearSelection(bool fast) { _animations.clear(); if (_selected >= 0) { int index = qAbs(_selected), tab = (index / MatrixRowShift), sel = index % MatrixRowShift; - if (index >= 0 && tab < _sets.size() && _sets[tab].id == RecentStickerSetId && sel >= tab * MatrixRowShift + _sets[tab].pack.size()) { + if (index >= 0 && tab < _sets.size() && _sets[tab].id == Stickers::RecentSetId && sel >= tab * MatrixRowShift + _sets[tab].pack.size()) { _sets[tab].hovers[sel] = 0; sel -= _sets[tab].pack.size(); } @@ -1603,7 +1603,7 @@ void StickerPanInner::clearSelection(bool fast) { } if (_pressedSel >= 0) { int index = qAbs(_pressedSel), tab = (index / MatrixRowShift), sel = index % MatrixRowShift; - if (index >= 0 && tab < _sets.size() && _sets[tab].id == RecentStickerSetId && sel >= tab * MatrixRowShift + _sets[tab].pack.size()) { + if (index >= 0 && tab < _sets.size() && _sets[tab].id == Stickers::RecentSetId && sel >= tab * MatrixRowShift + _sets[tab].pack.size()) { _sets[tab].hovers[sel] = 0; sel -= _sets[tab].pack.size(); } @@ -1640,11 +1640,11 @@ void StickerPanInner::hideFinish(bool completely) { void StickerPanInner::refreshStickers() { clearSelection(true); - const StickerSets &sets(cStickerSets()); + const Stickers::Sets &sets(Global::StickerSets()); _sets.clear(); _sets.reserve(sets.size() + 1); refreshRecentStickers(false); - for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) { + for (auto i = Global::StickerSetsOrder().cbegin(), e = Global::StickerSetsOrder().cend(); i != e; ++i) { appendSet(*i); } @@ -1703,7 +1703,7 @@ void StickerPanInner::refreshSavedGifs() { if (_showingInlineItems) { const SavedGifs &saved(cSavedGifs()); if (saved.isEmpty()) { - showStickerSet(RecentStickerSetId); + showStickerSet(Stickers::RecentSetId); return; } else { _inlineRows.reserve(saved.size()); @@ -1828,15 +1828,26 @@ StickerPanInner::InlineRow &StickerPanInner::layoutInlineRow(InlineRow &row, int int32 count = row.items.size(); t_assert(count <= SavedGifsMaxPerRow); + // enumerate items in the order of growing maxWidth() + // for that sort item indices by maxWidth() + int indices[SavedGifsMaxPerRow]; + for (int i = 0; i < count; ++i) { + indices[i] = i; + } + std::sort(indices, indices + count, [&row](int a, int b) -> bool { + return row.items.at(a)->maxWidth() < row.items.at(b)->maxWidth(); + }); + row.height = 0; - int32 availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1); - for (int32 i = 0; i < count; ++i) { - int32 w = sumWidth ? (row.items.at(i)->maxWidth() * availw / sumWidth) : row.items.at(i)->maxWidth(); - int32 actualw = qMax(w, int32(st::inlineResultsMinWidth)); - row.height = qMax(row.height, row.items.at(i)->resizeGetHeight(actualw)); + int availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1); + for (int i = 0; i < count; ++i) { + int index = indices[i]; + int w = sumWidth ? (row.items.at(index)->maxWidth() * availw / sumWidth) : row.items.at(index)->maxWidth(); + int actualw = qMax(w, int(st::inlineResultsMinWidth)); + row.height = qMax(row.height, row.items.at(index)->resizeGetHeight(actualw)); if (sumWidth) { availw -= actualw; - sumWidth -= row.items.at(i)->maxWidth(); + sumWidth -= row.items.at(index)->maxWidth(); } } return row; @@ -1871,7 +1882,7 @@ void StickerPanInner::preloadImages() { } uint64 StickerPanInner::currentSet(int yOffset) const { - if (_showingInlineItems) return NoneStickerSetId; + if (_showingInlineItems) return Stickers::NoneSetId; int y, ytill = 0; for (int i = 0, l = _sets.size(); i < l; ++i) { @@ -1882,7 +1893,7 @@ uint64 StickerPanInner::currentSet(int yOffset) const { return _sets.at(i).id; } } - return _sets.isEmpty() ? RecentStickerSetId : _sets.back().id; + return _sets.isEmpty() ? Stickers::RecentSetId : _sets.back().id; } void StickerPanInner::hideInlineRowsPanel() { @@ -1894,7 +1905,7 @@ void StickerPanInner::hideInlineRowsPanel() { emit scrollToY(0); emit scrollUpdated(); } else { - showStickerSet(RecentStickerSetId); + showStickerSet(Stickers::RecentSetId); } } } @@ -2039,9 +2050,9 @@ bool StickerPanInner::ui_isInlineItemBeingChosen() { } void StickerPanInner::appendSet(uint64 setId) { - const StickerSets &sets(cStickerSets()); - StickerSets::const_iterator it = sets.constFind(setId); - if (it == sets.cend() || (it->flags & MTPDstickerSet::flag_disabled) || it->stickers.isEmpty()) return; + const Stickers::Sets &sets(Global::StickerSets()); + auto it = sets.constFind(setId); + if (it == sets.cend() || (it->flags & MTPDstickerSet::Flag::f_disabled) || it->stickers.isEmpty()) return; StickerPack pack; pack.reserve(it->stickers.size()); @@ -2064,14 +2075,14 @@ void StickerPanInner::refreshRecent() { void StickerPanInner::refreshRecentStickers(bool performResize) { _custom.clear(); clearSelection(true); - StickerSets::const_iterator customIt = cStickerSets().constFind(CustomStickerSetId); - if (cGetRecentStickers().isEmpty() && (customIt == cStickerSets().cend() || customIt->stickers.isEmpty())) { - if (!_sets.isEmpty() && _sets.at(0).id == RecentStickerSetId) { + auto customIt = Global::StickerSets().constFind(Stickers::CustomSetId); + if (cGetRecentStickers().isEmpty() && (customIt == Global::StickerSets().cend() || customIt->stickers.isEmpty())) { + if (!_sets.isEmpty() && _sets.at(0).id == Stickers::RecentSetId) { _sets.pop_front(); } } else { StickerPack recent; - int32 customCnt = (customIt == cStickerSets().cend() ? 0 : customIt->stickers.size()); + int32 customCnt = (customIt == Global::StickerSets().cend() ? 0 : customIt->stickers.size()); QMap recentOnly; recent.reserve(cGetRecentStickers().size() + customCnt); _custom.reserve(cGetRecentStickers().size() + customCnt); @@ -2090,8 +2101,8 @@ void StickerPanInner::refreshRecentStickers(bool performResize) { _custom.push_back(true); } } - if (_sets.isEmpty() || _sets.at(0).id != RecentStickerSetId) { - _sets.push_back(DisplayedSet(RecentStickerSetId, MTPDstickerSet::flag_official, lang(lng_emoji_category0), recent.size() * 2, recent)); + if (_sets.isEmpty() || _sets.at(0).id != Stickers::RecentSetId) { + _sets.push_back(DisplayedSet(Stickers::RecentSetId, MTPDstickerSet::Flag::f_official, lang(lng_emoji_category0), recent.size() * 2, recent)); } else { _sets[0].pack = recent; _sets[0].hovers.resize(recent.size() * 2); @@ -2112,12 +2123,12 @@ void StickerPanInner::refreshRecentStickers(bool performResize) { void StickerPanInner::fillIcons(QList &icons) { icons.clear(); icons.reserve(_sets.size() + 1); - if (!cSavedGifs().isEmpty()) icons.push_back(StickerIcon(NoneStickerSetId)); + if (!cSavedGifs().isEmpty()) icons.push_back(StickerIcon(Stickers::NoneSetId)); if (_sets.isEmpty()) return; int32 i = 0; - if (_sets.at(0).id == RecentStickerSetId) ++i; - if (i > 0) icons.push_back(StickerIcon(RecentStickerSetId)); + if (_sets.at(0).id == Stickers::RecentSetId) ++i; + if (i > 0) icons.push_back(StickerIcon(Stickers::RecentSetId)); for (int32 l = _sets.size(); i < l; ++i) { DocumentData *s = _sets.at(i).pack.at(0); int32 availw = st::rbEmoji.width - 2 * st::stickerIconPadding, availh = st::rbEmoji.height - 2 * st::stickerIconPadding; @@ -2143,7 +2154,7 @@ void StickerPanInner::fillPanels(QVector &panels) { panels.clear(); if (_showingInlineItems) { - panels.push_back(new EmojiPanel(parentWidget(), _showingSavedGifs ? lang(lng_saved_gifs) : _inlineBotTitle, NoneStickerSetId, true, 0)); + panels.push_back(new EmojiPanel(parentWidget(), _showingSavedGifs ? lang(lng_saved_gifs) : _inlineBotTitle, Stickers::NoneSetId, true, 0)); panels.back()->show(); return; } @@ -2153,7 +2164,7 @@ void StickerPanInner::fillPanels(QVector &panels) { int y = 0; panels.reserve(_sets.size()); for (int32 i = 0, l = _sets.size(); i < l; ++i) { - bool special = (_sets.at(i).flags & MTPDstickerSet::flag_official); + bool special = (_sets.at(i).flags & MTPDstickerSet::Flag::f_official); panels.push_back(new EmojiPanel(parentWidget(), _sets.at(i).title, _sets.at(i).id, special, y)); panels.back()->show(); connect(panels.back(), SIGNAL(deleteClicked(quint64)), this, SIGNAL(removing(quint64))); @@ -2260,7 +2271,7 @@ void StickerPanInner::updateSelected() { for (int c = 0, l = _sets.size(); c < l; ++c) { const DisplayedSet &set(_sets.at(c)); int cnt = set.pack.size(); - bool special = (set.flags & MTPDstickerSet::flag_official); + bool special = (set.flags & MTPDstickerSet::Flag::f_official); y = ytill; ytill = y + st::emojiPanHeader + ((cnt / StickerPanPerRow) + ((cnt % StickerPanPerRow) ? 1 : 0)) * st::stickerPanSize.height(); @@ -2271,7 +2282,7 @@ void StickerPanInner::updateSelected() { if (selIndex >= set.pack.size()) { selIndex = -1; } else { - if (set.id == RecentStickerSetId && _custom[selIndex]) { + if (set.id == Stickers::RecentSetId && _custom[selIndex]) { int32 inx = sx - (selIndex % StickerPanPerRow) * st::stickerPanSize.width(), iny = p.y() - y - ((selIndex / StickerPanPerRow) * st::stickerPanSize.height()); if (inx >= st::stickerPanSize.width() - st::stickerPanDelete.pxWidth() && iny < st::stickerPanDelete.pxHeight()) { selIndex += set.pack.size(); @@ -2286,11 +2297,11 @@ void StickerPanInner::updateSelected() { bool startanim = false; int oldSel = _selected, oldSelTab = oldSel / MatrixRowShift, xOldSel = -1, newSel = selIndex, newSelTab = newSel / MatrixRowShift, xNewSel = -1; - if (oldSel >= 0 && oldSelTab < _sets.size() && _sets[oldSelTab].id == RecentStickerSetId && oldSel >= oldSelTab * MatrixRowShift + _sets[oldSelTab].pack.size()) { + if (oldSel >= 0 && oldSelTab < _sets.size() && _sets[oldSelTab].id == Stickers::RecentSetId && oldSel >= oldSelTab * MatrixRowShift + _sets[oldSelTab].pack.size()) { xOldSel = oldSel; oldSel -= _sets[oldSelTab].pack.size(); } - if (newSel >= 0 && newSelTab < _sets.size() && _sets[newSelTab].id == RecentStickerSetId && newSel >= newSelTab * MatrixRowShift + _sets[newSelTab].pack.size()) { + if (newSel >= 0 && newSelTab < _sets.size() && _sets[newSelTab].id == Stickers::RecentSetId && newSel >= newSelTab * MatrixRowShift + _sets[newSelTab].pack.size()) { xNewSel = newSel; newSel -= _sets[newSelTab].pack.size(); } @@ -2390,7 +2401,7 @@ void StickerPanInner::step_selected(uint64 ms, bool timer) { void StickerPanInner::showStickerSet(uint64 setId) { clearSelection(true); - if (setId == NoneStickerSetId) { + if (setId == Stickers::NoneSetId) { bool wasNotShowingGifs = !_showingInlineItems; if (wasNotShowingGifs) { _showingInlineItems = true; @@ -2460,7 +2471,7 @@ EmojiPanel::EmojiPanel(QWidget *parent, const QString &text, uint64 setId, bool , _setId(setId) , _special(special) , _deleteVisible(false) -, _delete(special ? 0 : new IconedButton(this, st::notifyClose)) { // NoneStickerSetId if in emoji +, _delete(special ? 0 : new IconedButton(this, st::notifyClose)) { // Stickers::NoneSetId if in emoji resize(st::emojiPanWidth, st::emojiPanHeader); setMouseTracking(true); setFocusPolicy(Qt::NoFocus); @@ -2484,11 +2495,11 @@ void EmojiPanel::setText(const QString &text) { void EmojiPanel::updateText() { int32 availw = st::emojiPanWidth - st::emojiPanHeaderLeft * 2; if (_deleteVisible) { - if (!_special && _setId != NoneStickerSetId) { + if (!_special && _setId != Stickers::NoneSetId) { availw -= st::notifyClose.icon.pxWidth() + st::emojiPanHeaderLeft; } } else { - QString switchText = lang((_setId != NoneStickerSetId) ? lng_switch_emoji : (cSavedGifs().isEmpty() ? lng_switch_stickers : lng_switch_stickers_gifs)); + QString switchText = lang((_setId != Stickers::NoneSetId) ? lng_switch_emoji : (cSavedGifs().isEmpty() ? lng_switch_stickers : lng_switch_stickers_gifs)); availw -= st::emojiSwitchSkip + st::emojiPanHeaderFont->width(switchText); } _text = st::emojiPanHeaderFont->elided(_fullText, availw); @@ -2781,7 +2792,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) { if (!_icons.isEmpty()) { int32 x = _iconsLeft, i = 0, selxrel = _iconsLeft + _iconSelX.current(), selx = selxrel - _iconsX.current(); for (int32 l = _icons.size(); i < l && !_icons.at(i).sticker; ++i) { - bool gifs = (_icons.at(i).setId == NoneStickerSetId); + bool gifs = (_icons.at(i).setId == Stickers::NoneSetId); if (selxrel != x) { p.drawSpriteLeft(x + st::rbEmojiRecent.imagePos.x(), _iconsTop + st::rbEmojiRecent.imagePos.y(), width(), gifs ? st::savedGifsOver : st::rbEmojiRecent.imageRect); } @@ -3512,9 +3523,9 @@ void EmojiPan::onSwitch() { Notify::clipStopperHidden(ClipStopperSavedGifsPanel); } else { if (cShowingSavedGifs() && cSavedGifs().isEmpty()) { - s_inner.showStickerSet(DefaultStickerSetId); - } else if (!cShowingSavedGifs() && !cSavedGifs().isEmpty() && cStickerSets().isEmpty()) { - s_inner.showStickerSet(NoneStickerSetId); + s_inner.showStickerSet(Stickers::DefaultSetId); + } else if (!cShowingSavedGifs() && !cSavedGifs().isEmpty() && Global::StickerSets().isEmpty()) { + s_inner.showStickerSet(Stickers::NoneSetId); } else { s_inner.updateShowingSavedGifs(); } @@ -3552,8 +3563,8 @@ void EmojiPan::onSwitch() { } void EmojiPan::onRemoveSet(quint64 setId) { - StickerSets::const_iterator it = cStickerSets().constFind(setId); - if (it != cStickerSets().cend() && !(it->flags & MTPDstickerSet::flag_official)) { + auto it = Global::StickerSets().constFind(setId); + if (it != Global::StickerSets().cend() && !(it->flags & MTPDstickerSet::Flag::f_official)) { _removingSetId = it->id; ConfirmBox *box = new ConfirmBox(lng_stickers_remove_pack(lt_sticker_pack, it->title), lang(lng_box_remove)); connect(box, SIGNAL(confirmed()), this, SLOT(onRemoveSetSure())); @@ -3564,8 +3575,8 @@ void EmojiPan::onRemoveSet(quint64 setId) { void EmojiPan::onRemoveSetSure() { Ui::hideLayer(); - StickerSets::iterator it = cRefStickerSets().find(_removingSetId); - if (it != cRefStickerSets().cend() && !(it->flags & MTPDstickerSet::flag_official)) { + auto it = Global::RefStickerSets().find(_removingSetId); + if (it != Global::RefStickerSets().cend() && !(it->flags & MTPDstickerSet::Flag::f_official)) { if (it->id && it->access) { MTP::send(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))); } else if (!it->shortName.isEmpty()) { @@ -3581,9 +3592,9 @@ void EmojiPan::onRemoveSetSure() { ++i; } } - cRefStickerSets().erase(it); - int32 removeIndex = cStickerSetsOrder().indexOf(_removingSetId); - if (removeIndex >= 0) cRefStickerSetsOrder().removeAt(removeIndex); + Global::RefStickerSets().erase(it); + int removeIndex = Global::StickerSetsOrder().indexOf(_removingSetId); + if (removeIndex >= 0) Global::RefStickerSetsOrder().removeAt(removeIndex); refreshStickers(); Local::writeStickers(); if (writeRecent) Local::writeUserSettings(); @@ -3944,8 +3955,8 @@ void MentionsInner::paintEvent(QPaintEvent *e) { second = st::mentionFont->elided(second, unamewidth - firstwidth); } } - user->photo->load(); - p.drawPixmap(st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), user->photo->pixRounded(st::mentionPhotoSize)); + user->loadUserpic(); + user->paintUserpicLeft(p, st::mentionPhotoSize, st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), width()); user->nameText.drawElided(p, 2 * st::mentionPadding.left() + st::mentionPhotoSize, i * st::mentionHeight + st::mentionTop, namewidth); p.setFont(st::mentionFont->f); @@ -3986,10 +3997,8 @@ void MentionsInner::paintEvent(QPaintEvent *e) { if (hasUsername || botStatus == 0 || botStatus == 2) { toHighlight += '@' + user->username; } - if (true || _parent->chat() || botStatus == 0 || botStatus == 2) { - user->photo->load(); - p.drawPixmap(st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), user->photo->pixRounded(st::mentionPhotoSize)); - } + user->loadUserpic(); + user->paintUserpicLeft(p, st::mentionPhotoSize, st::mentionPadding.left(), i * st::mentionHeight + st::mentionPadding.top(), width()); int32 addleft = 0, widthleft = mentionwidth; QString first = (_parent->filter().size() < 2) ? QString() : ('/' + toHighlight.mid(0, _parent->filter().size() - 1)), second = (_parent->filter().size() < 2) ? ('/' + toHighlight) : toHighlight.mid(_parent->filter().size() - 1); @@ -4353,6 +4362,18 @@ bool MentionsDropdown::clearFilteredBotCommands() { return true; } +namespace { + template + inline int indexOfInFirstN(const T &v, const U &elem, int last) { + for (auto b = v.cbegin(), i = b, e = b + qMax(v.size(), last); i != e; ++i) { + if (*i == elem) { + return (i - b); + } + } + return -1; + } +} + void MentionsDropdown::updateFiltered(bool resetScroll) { int32 now = unixtime(), recentInlineBots = 0; MentionRows mrows; @@ -4361,15 +4382,15 @@ void MentionsDropdown::updateFiltered(bool resetScroll) { StickerPack srows; if (_emoji) { QMap setsToRequest; - StickerSets &sets(cRefStickerSets()); - const StickerSetsOrder &order(cStickerSetsOrder()); - for (int32 i = 0, l = order.size(); i < l; ++i) { - StickerSets::iterator it = sets.find(order.at(i)); + Stickers::Sets &sets(Global::RefStickerSets()); + const Stickers::Order &order(Global::StickerSetsOrder()); + for (int i = 0, l = order.size(); i < l; ++i) { + auto it = sets.find(order.at(i)); if (it != sets.cend()) { if (it->emoji.isEmpty()) { setsToRequest.insert(it->id, it->access); - it->flags |= MTPDstickerSet_flag_NOT_LOADED; - } else if (!(it->flags & MTPDstickerSet::flag_disabled)) { + it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; + } else if (!(it->flags & MTPDstickerSet::Flag::f_disabled)) { StickersByEmojiMap::const_iterator i = it->emoji.constFind(emojiGetNoColor(_emoji)); if (i != it->emoji.cend()) { srows += *i; @@ -4413,6 +4434,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) { UserData *user = i.key(); if (user->username.isEmpty()) continue; if (_filter.size() > 1 && (!user->username.startsWith(_filter.midRef(1), Qt::CaseInsensitive) || user->username.size() + 1 == _filter.size())) continue; + if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; ordered.insertMulti(App::onlineForSort(user, now), user); } } @@ -4420,6 +4442,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) { UserData *user = *i; if (user->username.isEmpty()) continue; if (_filter.size() > 1 && (!user->username.startsWith(_filter.midRef(1), Qt::CaseInsensitive) || user->username.size() + 1 == _filter.size())) continue; + if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; mrows.push_back(user); if (!ordered.isEmpty()) { ordered.remove(App::onlineForSort(user, now), user); @@ -4441,6 +4464,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) { UserData *user = *i; if (user->username.isEmpty()) continue; if (_filter.size() > 1 && (!user->username.startsWith(_filter.midRef(1), Qt::CaseInsensitive) || user->username.size() + 1 == _filter.size())) continue; + if (indexOfInFirstN(mrows, user, recentInlineBots) >= 0) continue; mrows.push_back(user); } } @@ -4477,8 +4501,7 @@ void MentionsDropdown::updateFiltered(bool resetScroll) { if (_channel->mgInfo->bots.isEmpty()) { if (!_channel->mgInfo->botStatus && App::api()) App::api()->requestBots(_channel); } else { - for (MegagroupInfo::Bots::const_iterator i = _channel->mgInfo->bots.cbegin(), e = _channel->mgInfo->bots.cend(); i != e; ++i) { - UserData *user = i.key(); + for_const (auto *user, _channel->mgInfo->bots) { if (!user->botInfo) continue; if (!user->botInfo->inited && App::api()) App::api()->requestFullPeer(user); if (user->botInfo->commands.isEmpty()) continue; @@ -4546,6 +4569,7 @@ void MentionsDropdown::rowsUpdated(const MentionRows &mrows, const HashtagRows & _scroll.show(); } recount(resetScroll); + update(); if (hidden) { hide(); showStart(); diff --git a/Telegram/SourceFiles/dropdown.h b/Telegram/SourceFiles/dropdown.h index bacf6149c..f4d18ae30 100644 --- a/Telegram/SourceFiles/dropdown.h +++ b/Telegram/SourceFiles/dropdown.h @@ -420,10 +420,10 @@ private: int32 _top; struct DisplayedSet { - DisplayedSet(uint64 id, int32 flags, const QString &title, int32 hoversSize, const StickerPack &pack = StickerPack()) : id(id), flags(flags), title(title), hovers(hoversSize, 0), pack(pack) { + DisplayedSet(uint64 id, MTPDstickerSet::Flags flags, const QString &title, int32 hoversSize, const StickerPack &pack = StickerPack()) : id(id), flags(flags), title(title), hovers(hoversSize, 0), pack(pack) { } uint64 id; - int32 flags; + MTPDstickerSet::Flags flags; QString title; QVector hovers; StickerPack pack; @@ -482,7 +482,7 @@ class EmojiPanel : public TWidget { public: - EmojiPanel(QWidget *parent, const QString &text, uint64 setId, bool special, int32 wantedY); // NoneStickerSetId if in emoji + EmojiPanel(QWidget *parent, const QString &text, uint64 setId, bool special, int32 wantedY); // Stickers::NoneSetId if in emoji void setText(const QString &text); void setDeleteVisible(bool isVisible); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index eccc5255c..0b9557e3d 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "window.h" #include "mainwidget.h" +#include "application.h" #include "layerwidget.h" #include "lang.h" @@ -143,6 +144,12 @@ namespace Ui { return false; } + void autoplayMediaInlineAsync(const FullMsgId &msgId) { + if (MainWidget *m = App::main()) { + QMetaObject::invokeMethod(m, "ui_autoplayMediaInlineAsync", Qt::QueuedConnection, Q_ARG(qint32, msgId.channel), Q_ARG(qint32, msgId.msg)); + } + } + void showPeerHistory(const PeerId &peer, MsgId msgId, bool back) { if (MainWidget *m = App::main()) m->ui_showPeerHistory(peer, msgId, back); } @@ -197,10 +204,6 @@ namespace Notify { if (MainWidget *m = App::main()) m->notify_clipStopperHidden(type); } - void historyItemResized(const HistoryItem *item, bool scrollToIt) { - if (MainWidget *m = App::main()) m->notify_historyItemResized(item, scrollToIt); - } - void historyItemLayoutChanged(const HistoryItem *item) { if (MainWidget *m = App::main()) m->notify_historyItemLayoutChanged(item); } @@ -209,6 +212,16 @@ namespace Notify { if (MainWidget *m = App::main()) m->notify_automaticLoadSettingsChangedGif(); } + void handlePendingHistoryUpdate() { + if (MainWidget *m = App::main()) { + m->notify_handlePendingHistoryUpdate(); + } + for_const (HistoryItem *item, Global::PendingRepaintItems()) { + Ui::repaintHistoryItem(item); + } + Global::RefPendingRepaintItems().clear(); + } + } #define DefineReadOnlyVar(Namespace, Type, Name) const Type &Name() { \ @@ -226,14 +239,22 @@ void Set##Name(const Type &Name) { \ Namespace##Data->Name = Name; \ } -struct SandboxDataStruct { - QString LangSystemISO; - int32 LangSystem = languageDefault; +namespace Sandbox { - QByteArray LastCrashDump; - ConnectionProxy PreLaunchProxy; -}; -SandboxDataStruct *SandboxData = 0; + namespace internal { + + struct Data { + QString LangSystemISO; + int32 LangSystem = languageDefault; + + QByteArray LastCrashDump; + ConnectionProxy PreLaunchProxy; + }; + + } + +} +Sandbox::internal::Data *SandboxData = 0; uint64 SandboxUserTag = 0; namespace Sandbox { @@ -320,7 +341,7 @@ namespace Sandbox { } void start() { - SandboxData = new SandboxDataStruct(); + SandboxData = new internal::Data(); SandboxData->LangSystemISO = psCurrentLanguage(); if (SandboxData->LangSystemISO.isEmpty()) SandboxData->LangSystemISO = qstr("en"); @@ -349,32 +370,52 @@ namespace Sandbox { } -struct GlobalDataStruct { - uint64 LaunchId = 0; +namespace Global { + namespace internal { - Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout; - bool AdaptiveForWide = true; + struct Data { + uint64 LaunchId = 0; + SingleDelayedCall HandleHistoryUpdate = { App::app(), "call_handleHistoryUpdate" }; - // config - int32 ChatSizeMax = 200; - int32 MegagroupSizeMax = 1000; - int32 ForwardedCountMax = 100; - int32 OnlineUpdatePeriod = 120000; - int32 OfflineBlurTimeout = 5000; - int32 OfflineIdleTimeout = 30000; - int32 OnlineFocusTimeout = 1000; - int32 OnlineCloudTimeout = 300000; - int32 NotifyCloudDelay = 30000; - int32 NotifyDefaultDelay = 1500; - int32 ChatBigSize = 10; - int32 PushChatPeriod = 60000; - int32 PushChatLimit = 2; - int32 SavedGifsLimit = 200; - int32 EditTimeLimit = 172800; + Adaptive::Layout AdaptiveLayout = Adaptive::NormalLayout; + bool AdaptiveForWide = true; - Global::HiddenPinnedMessagesMap HiddenPinnedMessages; -}; -GlobalDataStruct *GlobalData = 0; + int32 DebugLoggingFlags = 0; + + // config + int32 ChatSizeMax = 200; + int32 MegagroupSizeMax = 1000; + int32 ForwardedCountMax = 100; + int32 OnlineUpdatePeriod = 120000; + int32 OfflineBlurTimeout = 5000; + int32 OfflineIdleTimeout = 30000; + int32 OnlineFocusTimeout = 1000; + int32 OnlineCloudTimeout = 300000; + int32 NotifyCloudDelay = 30000; + int32 NotifyDefaultDelay = 1500; + int32 ChatBigSize = 10; + int32 PushChatPeriod = 60000; + int32 PushChatLimit = 2; + int32 SavedGifsLimit = 200; + int32 EditTimeLimit = 172800; + + HiddenPinnedMessagesMap HiddenPinnedMessages; + + PendingItemsMap PendingRepaintItems; + + Stickers::Sets StickerSets; + Stickers::Order StickerSetsOrder; + uint64 LastStickersUpdate = 0; + + MTP::DcOptions DcOptions; + + CircleMasksMap CircleMasks; + }; + + } +} + +Global::internal::Data *GlobalData = 0; namespace Global { @@ -383,7 +424,7 @@ namespace Global { } void start() { - GlobalData = new GlobalDataStruct(); + GlobalData = new internal::Data(); memset_rand(&GlobalData->LaunchId, sizeof(GlobalData->LaunchId)); } @@ -394,10 +435,13 @@ namespace Global { } DefineReadOnlyVar(Global, uint64, LaunchId); + DefineRefVar(Global, SingleDelayedCall, HandleHistoryUpdate); DefineVar(Global, Adaptive::Layout, AdaptiveLayout); DefineVar(Global, bool, AdaptiveForWide); + DefineVar(Global, int32, DebugLoggingFlags); + // config DefineVar(Global, int32, ChatSizeMax); DefineVar(Global, int32, MegagroupSizeMax); @@ -417,4 +461,14 @@ namespace Global { DefineVar(Global, HiddenPinnedMessagesMap, HiddenPinnedMessages); + DefineRefVar(Global, PendingItemsMap, PendingRepaintItems); + + DefineVar(Global, Stickers::Sets, StickerSets); + DefineVar(Global, Stickers::Order, StickerSetsOrder); + DefineVar(Global, uint64, LastStickersUpdate); + + DefineVar(Global, MTP::DcOptions, DcOptions); + + DefineRefVar(Global, CircleMasksMap, CircleMasks); + }; diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index e572f45c1..ba77a20a2 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -53,6 +53,7 @@ namespace Ui { void repaintHistoryItem(const HistoryItem *item); void repaintInlineItem(const LayoutInlineItem *layout); bool isInlineItemVisible(const LayoutInlineItem *reader); + void autoplayMediaInlineAsync(const FullMsgId &msgId); void showPeerHistory(const PeerId &peer, MsgId msgId, bool back = false); inline void showPeerHistory(const PeerData *peer, MsgId msgId, bool back = false) { @@ -68,6 +69,9 @@ namespace Ui { inline void showChatsList() { showPeerHistory(PeerId(0), 0); } + inline void showChatsListAsync() { + showPeerHistoryAsync(PeerId(0), 0); + } bool hideWindowNoQuit(); @@ -90,14 +94,13 @@ namespace Notify { void clipStopperHidden(ClipStopperType type); - void historyItemResized(const HistoryItem *item, bool scrollToIt = false); - inline void historyItemsResized() { - historyItemResized(0); - } void historyItemLayoutChanged(const HistoryItem *item); void automaticLoadSettingsChangedGif(); + // handle pending resize() / paint() on history items + void handlePendingHistoryUpdate(); + }; #define DeclareReadOnlyVar(Type, Name) const Type &Name(); @@ -131,6 +134,30 @@ namespace Adaptive { }; }; +namespace DebugLogging { + enum Flags { + FileLoaderFlag = 0x00000001, + }; +} + +namespace Stickers { + static const uint64 DefaultSetId = 0; // for backward compatibility + static const uint64 CustomSetId = 0xFFFFFFFFFFFFFFFFULL, RecentSetId = 0xFFFFFFFFFFFFFFFEULL; + static const uint64 NoneSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel + struct Set { + Set(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, MTPDstickerSet::Flags flags) : id(id), access(access), title(title), shortName(shortName), count(count), hash(hash), flags(flags) { + } + uint64 id, access; + QString title, shortName; + int32 count, hash; + MTPDstickerSet::Flags flags; + StickerPack stickers; + StickersByEmojiMap emoji; + }; + typedef QMap Sets; + typedef QList Order; +} + namespace Global { bool started(); @@ -138,10 +165,13 @@ namespace Global { void finish(); DeclareReadOnlyVar(uint64, LaunchId); + DeclareRefVar(SingleDelayedCall, HandleHistoryUpdate); DeclareVar(Adaptive::Layout, AdaptiveLayout); DeclareVar(bool, AdaptiveForWide); + DeclareVar(int32, DebugLoggingFlags); + // config DeclareVar(int32, ChatSizeMax); DeclareVar(int32, MegagroupSizeMax); @@ -162,6 +192,18 @@ namespace Global { typedef QMap HiddenPinnedMessagesMap; DeclareVar(HiddenPinnedMessagesMap, HiddenPinnedMessages); + typedef OrderedSet PendingItemsMap; + DeclareRefVar(PendingItemsMap, PendingRepaintItems); + + DeclareVar(Stickers::Sets, StickerSets); + DeclareVar(Stickers::Order, StickerSetsOrder); + DeclareVar(uint64, LastStickersUpdate); + + DeclareVar(MTP::DcOptions, DcOptions); + + typedef QMap CircleMasksMap; + DeclareRefVar(CircleMasksMap, CircleMasks); + }; namespace Adaptive { @@ -175,3 +217,9 @@ namespace Adaptive { return Global::AdaptiveForWide() && (Global::AdaptiveLayout() == WideLayout); } } + +namespace DebugLogging { + inline bool FileLoader() { + return (Global::DebugLoggingFlags() | FileLoaderFlag) != 0; + } +} diff --git a/Telegram/SourceFiles/fileuploader.cpp b/Telegram/SourceFiles/fileuploader.cpp index a9388ad85..e16bdc98d 100644 --- a/Telegram/SourceFiles/fileuploader.cpp +++ b/Telegram/SourceFiles/fileuploader.cpp @@ -103,7 +103,7 @@ void FileUploader::currentFailed() { void FileUploader::killSessions() { for (int i = 0; i < MTPUploadSessionsCount; ++i) { - MTP::stopSession(MTP::upl(i)); + MTP::stopSession(MTP::uplDcId(i)); } } @@ -187,9 +187,9 @@ void FileUploader::sendNext() { } mtpRequestId requestId; if (i->docSize > UseBigFilesFrom) { - requestId = MTP::send(MTPupload_SaveBigFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_int(i->docPartsCount), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::upl(todc)); + requestId = MTP::send(MTPupload_SaveBigFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_int(i->docPartsCount), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); } else { - requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::upl(todc)); + requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(i->id()), MTP_int(i->docSentParts), MTP_string(toSend)), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); } docRequestsSent.insert(requestId, i->docSentParts); dcMap.insert(requestId, todc); @@ -200,7 +200,7 @@ void FileUploader::sendNext() { } else { UploadFileParts::iterator part = parts.begin(); - mtpRequestId requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(partsOfId), MTP_int(part.key()), MTP_string(part.value())), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::upl(todc)); + mtpRequestId requestId = MTP::send(MTPupload_SaveFilePart(MTP_long(partsOfId), MTP_int(part.key()), MTP_string(part.value())), rpcDone(&FileUploader::partLoaded), rpcFail(&FileUploader::partFailed), MTP::uplDcId(todc)); requestsSent.insert(requestId, part.value()); dcMap.insert(requestId, todc); sentSize += part.value().size(); @@ -246,7 +246,7 @@ void FileUploader::clear() { dcMap.clear(); sentSize = 0; for (int32 i = 0; i < MTPUploadSessionsCount; ++i) { - MTP::stopSession(MTP::upl(i)); + MTP::stopSession(MTP::uplDcId(i)); sentSizes[i] = 0; } killSessionsTimer.stop(); diff --git a/Telegram/SourceFiles/gui/animation.cpp b/Telegram/SourceFiles/gui/animation.cpp index 1e9af9fe2..047a3346b 100644 --- a/Telegram/SourceFiles/gui/animation.cpp +++ b/Telegram/SourceFiles/gui/animation.cpp @@ -22,6 +22,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "animation.h" +extern "C" { +#include +#include +#include +#include +} + #include "mainwidget.h" #include "window.h" @@ -245,7 +252,7 @@ ClipReader::ClipReader(const FileLocation &location, const QByteArray &data, Cal _clipManagers.push_back(new ClipReadManager(_clipThreads.back())); _clipThreads.back()->start(); } else { - _threadIndex = int32(MTP::nonce() % _clipThreads.size()); + _threadIndex = int32(rand_value() % _clipThreads.size()); int32 loadLevel = 0x7FFFFFFF; for (int32 i = 0, l = _clipThreads.size(); i < l; ++i) { int32 level = _clipManagers.at(i)->loadLevel(); diff --git a/Telegram/SourceFiles/gui/animation.h b/Telegram/SourceFiles/gui/animation.h index d5d8253d2..cb61a09e0 100644 --- a/Telegram/SourceFiles/gui/animation.h +++ b/Telegram/SourceFiles/gui/animation.h @@ -208,7 +208,7 @@ class AnimationCreator { public: AnimationCreator(AnimationImplementation *ptr) : _ptr(ptr) {} AnimationCreator(const AnimationCreator &other) : _ptr(other.create()) {} - AnimationImplementation *create() const { return exchange(_ptr); } + AnimationImplementation *create() const { return getPointerAndReset(_ptr); } ~AnimationCreator() { deleteAndMark(_ptr); } private: AnimationCreator &operator=(const AnimationCreator &other); diff --git a/Telegram/SourceFiles/gui/filedialog.cpp b/Telegram/SourceFiles/gui/filedialog.cpp index b606613d0..50684f661 100644 --- a/Telegram/SourceFiles/gui/filedialog.cpp +++ b/Telegram/SourceFiles/gui/filedialog.cpp @@ -149,7 +149,7 @@ bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QS cSetDialogLastPath(path); Local::writeUserSettings(); } - + if (res == QDialog::Accepted) { if (multipleFiles > 0) { files = dialog.selectedFiles(); @@ -157,9 +157,9 @@ bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QS files = dialog.selectedFiles().mid(0, 1); } if (multipleFiles >= 0) { -#ifdef Q_OS_WIN +#if defined Q_OS_WIN && !defined Q_OS_WINRT remoteContent = dialog.selectedRemoteContent(); -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT } return true; } diff --git a/Telegram/SourceFiles/gui/flattextarea.cpp b/Telegram/SourceFiles/gui/flattextarea.cpp index 87573907e..2cd77e200 100644 --- a/Telegram/SourceFiles/gui/flattextarea.cpp +++ b/Telegram/SourceFiles/gui/flattextarea.cpp @@ -392,7 +392,7 @@ void FlatTextarea::onMentionHashtagOrBotCommandInsert(QString str) { QString t(fr.text()); for (int i = pos - p; i > 0; --i) { if (t.at(i - 1) == '@' || t.at(i - 1) == '#' || t.at(i - 1) == '/') { - if ((i == pos - p || t.at(i).isLetter() || t.at(i - 1) == '#') && (i < 2 || !(t.at(i - 2).isLetterOrNumber() || t.at(i - 2) == '_'))) { + if ((i == pos - p || (t.at(i - 1) == '/' ? t.at(i).isLetterOrNumber() : t.at(i).isLetter()) || t.at(i - 1) == '#') && (i < 2 || !(t.at(i - 2).isLetterOrNumber() || t.at(i - 2) == '_'))) { c.setPosition(p + i - 1, QTextCursor::MoveAnchor); int till = p + i; for (; (till < e) && (till - p - i + 1 < str.size()); ++till) { diff --git a/Telegram/SourceFiles/gui/images.cpp b/Telegram/SourceFiles/gui/images.cpp index eda121103..de9dbeee6 100644 --- a/Telegram/SourceFiles/gui/images.cpp +++ b/Telegram/SourceFiles/gui/images.cpp @@ -47,6 +47,7 @@ namespace { static const uint64 ColoredCacheSkip = 0x2000000000000000LLU; static const uint64 BlurredColoredCacheSkip = 0x3000000000000000LLU; static const uint64 RoundedCacheSkip = 0x4000000000000000LLU; + static const uint64 CircledCacheSkip = 0x5000000000000000LLU; } StorageImageLocation StorageImageLocation::Null; @@ -106,7 +107,7 @@ const QPixmap &Image::pix(int32 w, int32 h) const { uint64 k = (uint64(w) << 32) | uint64(h); Sizes::const_iterator i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { - QPixmap p(pixNoCache(w, h, true)); + QPixmap p(pixNoCache(w, h, ImagePixSmooth)); if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { @@ -128,7 +129,29 @@ const QPixmap &Image::pixRounded(int32 w, int32 h) const { uint64 k = RoundedCacheSkip | (uint64(w) << 32) | uint64(h); Sizes::const_iterator i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { - QPixmap p(pixNoCache(w, h, true, false, true)); + QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixRounded)); + if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); + i = _sizesCache.insert(k, p); + if (!p.isNull()) { + globalAcquiredSize += int64(p.width()) * p.height() * 4; + } + } + return i.value(); +} + +const QPixmap &Image::pixCircled(int32 w, int32 h) const { + checkload(); + + if (w <= 0 || !width() || !height()) { + w = width(); + } else if (cRetina()) { + w *= cIntRetinaFactor(); + h *= cIntRetinaFactor(); + } + uint64 k = CircledCacheSkip | (uint64(w) << 32) | uint64(h); + Sizes::const_iterator i = _sizesCache.constFind(k); + if (i == _sizesCache.cend()) { + QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixCircled)); if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { @@ -150,7 +173,7 @@ const QPixmap &Image::pixBlurred(int32 w, int32 h) const { uint64 k = BlurredCacheSkip | (uint64(w) << 32) | uint64(h); Sizes::const_iterator i = _sizesCache.constFind(k); if (i == _sizesCache.cend()) { - QPixmap p(pixNoCache(w, h, true, true)); + QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred)); if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { @@ -219,7 +242,7 @@ const QPixmap &Image::pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) co if (i != _sizesCache.cend()) { globalAcquiredSize -= int64(i->width()) * i->height() * 4; } - QPixmap p(pixNoCache(w, h, true, false, true, outerw, outerh)); + QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixRounded, outerw, outerh)); if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { @@ -229,7 +252,7 @@ const QPixmap &Image::pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) co return i.value(); } -const QPixmap &Image::pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 outerh) const { +const QPixmap &Image::pixBlurredSingle(int w, int h, int32 outerw, int32 outerh) const { checkload(); if (w <= 0 || !width() || !height()) { @@ -244,7 +267,7 @@ const QPixmap &Image::pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 out if (i != _sizesCache.cend()) { globalAcquiredSize -= int64(i->width()) * i->height() * 4; } - QPixmap p(pixNoCache(w, h, true, true, true, outerw, outerh)); + QPixmap p(pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred | ImagePixRounded, outerw, outerh)); if (cRetina()) p.setDevicePixelRatio(cRetinaFactor()); i = _sizesCache.insert(k, p); if (!p.isNull()) { @@ -375,6 +398,43 @@ yi += stride; return img; } +const QPixmap &circleMask(int width, int height) { + t_assert(Global::started()); + + uint64 key = uint64(uint32(width)) << 32 | uint64(uint32(height)); + + Global::CircleMasksMap &masks(Global::RefCircleMasks()); + auto i = masks.constFind(key); + if (i == masks.cend()) { + QImage mask(width, height, QImage::Format_ARGB32_Premultiplied); + mask.fill(st::transparent); + { + Painter p(&mask); + p.setRenderHint(QPainter::HighQualityAntialiasing); + p.setCompositionMode(QPainter::CompositionMode_SourceOver); + p.setBrush(st::white); + p.setPen(Qt::NoPen); + p.drawEllipse(0, 0, width, height); + } + mask.setDevicePixelRatio(cRetinaFactor()); + i = masks.insert(key, QPixmap::fromImage(mask)); + } + return i.value(); +} + +void imageCircle(QImage &img) { + t_assert(!img.isNull()); + + img.setDevicePixelRatio(cRetinaFactor()); + img = img.convertToFormat(QImage::Format_ARGB32_Premultiplied); + t_assert(!img.isNull()); + + QPixmap mask = circleMask(img.width(), img.height()); + Painter p(&img); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.drawPixmap(0, 0, mask); +} + void imageRound(QImage &img) { t_assert(!img.isNull()); @@ -435,18 +495,18 @@ QImage imageColored(const style::color &add, QImage img) { return img; } -QPixmap imagePix(QImage img, int32 w, int32 h, bool smooth, bool blurred, bool rounded, int32 outerw, int32 outerh) { +QPixmap imagePix(QImage img, int32 w, int32 h, ImagePixOptions options, int32 outerw, int32 outerh) { t_assert(!img.isNull()); - if (blurred) { + if (options.testFlag(ImagePixBlurred)) { img = imageBlur(img); t_assert(!img.isNull()); } if (w <= 0 || (w == img.width() && (h <= 0 || h == img.height()))) { } else if (h <= 0) { - img = img.scaledToWidth(w, smooth ? Qt::SmoothTransformation : Qt::FastTransformation); + img = img.scaledToWidth(w, options.testFlag(ImagePixSmooth) ? Qt::SmoothTransformation : Qt::FastTransformation); t_assert(!img.isNull()); } else { - img = img.scaled(w, h, Qt::IgnoreAspectRatio, smooth ? Qt::SmoothTransformation : Qt::FastTransformation); + img = img.scaled(w, h, Qt::IgnoreAspectRatio, options.testFlag(ImagePixSmooth) ? Qt::SmoothTransformation : Qt::FastTransformation); t_assert(!img.isNull()); } if (outerw > 0 && outerh > 0) { @@ -467,7 +527,10 @@ QPixmap imagePix(QImage img, int32 w, int32 h, bool smooth, bool blurred, bool r t_assert(!img.isNull()); } } - if (rounded) { + if (options.testFlag(ImagePixCircled)) { + imageCircle(img); + t_assert(!img.isNull()); + } else if (options.testFlag(ImagePixRounded)) { imageRound(img); t_assert(!img.isNull()); } @@ -475,7 +538,7 @@ QPixmap imagePix(QImage img, int32 w, int32 h, bool smooth, bool blurred, bool r return QPixmap::fromImage(img, Qt::ColorOnly); } -QPixmap Image::pixNoCache(int32 w, int32 h, bool smooth, bool blurred, bool rounded, int32 outerw, int32 outerh) const { +QPixmap Image::pixNoCache(int w, int h, ImagePixOptions options, int outerw, int outerh) const { if (!loading()) const_cast(this)->load(); restore(); @@ -483,7 +546,7 @@ QPixmap Image::pixNoCache(int32 w, int32 h, bool smooth, bool blurred, bool roun if (h <= 0 && height() > 0) { h = qRound(width() * w / float64(height())); } - return blank()->pixNoCache(w, h, smooth, blurred, rounded, outerw, outerh); + return blank()->pixNoCache(w, h, options, outerw, outerh); } if (isNull() && outerw > 0 && outerh > 0) { @@ -506,11 +569,15 @@ QPixmap Image::pixNoCache(int32 w, int32 h, bool smooth, bool blurred, bool roun p.fillRect(qMax(0, (outerw - w) / 2), qMax(0, (outerh - h) / 2), qMin(result.width(), w), qMin(result.height(), h), st::white); } - if (rounded) imageRound(result); + if (options.testFlag(ImagePixCircled)) { + imageCircle(result); + } else if (options.testFlag(ImagePixRounded)) { + imageRound(result); + } return QPixmap::fromImage(result, Qt::ColorOnly); } - return imagePix(_data.toImage(), w, h, smooth, blurred, rounded, outerw, outerh); + return imagePix(_data.toImage(), w, h, options, outerw, outerh); } QPixmap Image::pixColoredNoCache(const style::color &add, int32 w, int32 h, bool smooth) const { diff --git a/Telegram/SourceFiles/gui/images.h b/Telegram/SourceFiles/gui/images.h index 63c771379..0622dca27 100644 --- a/Telegram/SourceFiles/gui/images.h +++ b/Telegram/SourceFiles/gui/images.h @@ -107,7 +107,15 @@ inline bool operator!=(const StorageImageLocation &a, const StorageImageLocation return !(a == b); } -QPixmap imagePix(QImage img, int32 w, int32 h, bool smooth, bool blurred, bool rounded, int32 outerw, int32 outerh); +enum ImagePixOption { + ImagePixSmooth = 0x01, + ImagePixBlurred = 0x02, + ImagePixRounded = 0x04, + ImagePixCircled = 0x08, +}; +Q_DECLARE_FLAGS(ImagePixOptions, ImagePixOption); +Q_DECLARE_OPERATORS_FOR_FLAGS(ImagePixOptions); +QPixmap imagePix(QImage img, int w, int h, ImagePixOptions options, int outerw, int outerh); class DelayedStorageImage; @@ -145,12 +153,13 @@ public: const QPixmap &pix(int32 w = 0, int32 h = 0) const; const QPixmap &pixRounded(int32 w = 0, int32 h = 0) const; + const QPixmap &pixCircled(int32 w = 0, int32 h = 0) const; const QPixmap &pixBlurred(int32 w = 0, int32 h = 0) const; const QPixmap &pixColored(const style::color &add, int32 w = 0, int32 h = 0) const; const QPixmap &pixBlurredColored(const style::color &add, int32 w = 0, int32 h = 0) const; const QPixmap &pixSingle(int32 w, int32 h, int32 outerw, int32 outerh) const; const QPixmap &pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 outerh) const; - QPixmap pixNoCache(int32 w = 0, int32 h = 0, bool smooth = false, bool blurred = false, bool rounded = false, int32 outerw = -1, int32 outerh = -1) const; + QPixmap pixNoCache(int w = 0, int h = 0, ImagePixOptions options = 0, int outerw = -1, int outerh = -1) const; QPixmap pixColoredNoCache(const style::color &add, int32 w = 0, int32 h = 0, bool smooth = false) const; QPixmap pixBlurredColoredNoCache(const style::color &add, int32 w, int32 h = 0) const; diff --git a/Telegram/SourceFiles/gui/popupmenu.cpp b/Telegram/SourceFiles/gui/popupmenu.cpp index 38c2d9056..d78746c87 100644 --- a/Telegram/SourceFiles/gui/popupmenu.cpp +++ b/Telegram/SourceFiles/gui/popupmenu.cpp @@ -561,7 +561,7 @@ void PopupTooltip::onShow() { } void PopupTooltip::onWndActiveChanged() { - if (!App::wnd()->windowHandle()->isActive()) { + if (!App::wnd() || !App::wnd()->windowHandle() || !App::wnd()->windowHandle()->isActive()) { PopupTooltip::Hide(); } } diff --git a/Telegram/SourceFiles/gui/text.cpp b/Telegram/SourceFiles/gui/text.cpp index 881aeed1c..f350a1f3e 100644 --- a/Telegram/SourceFiles/gui/text.cpp +++ b/Telegram/SourceFiles/gui/text.cpp @@ -1654,6 +1654,7 @@ public: *_getSymbolUpon = true; return false; } else if (_p) { +#ifndef TDESKTOP_WINRT // temp QTextCharFormat format; QTextItemInt gf(glyphs.mid(glyphsStart, glyphsEnd - glyphsStart), &_e->fnt, engine.layoutData->string.unicode() + itemStart, @@ -1662,7 +1663,7 @@ public: gf.width = itemWidth; gf.justified = false; gf.initWithScriptItem(si); - +#endif // !TDESKTOP_WINRT if (_localFrom + itemStart < _selectedTo && _localFrom + itemEnd > _selectedFrom) { QFixed selX = x, selWidth = itemWidth; if (_localFrom + itemEnd > _selectedTo || _localFrom + itemStart < _selectedFrom) { @@ -1703,7 +1704,9 @@ public: _p->fillRect(QRectF(selX.toReal(), _y + _yDelta, selWidth.toReal(), _fontHeight), _textStyle->selectBg->b); } +#ifndef TDESKTOP_WINRT // temp _p->drawTextItem(QPointF(x.toReal(), textY), gf); +#endif // !TDESKTOP_WINRT } x += itemWidth; @@ -2531,20 +2534,32 @@ Text::Text(style::font font, const QString &text, const TextParseOptions &option } } -Text::Text(const Text &other) : -_minResizeWidth(other._minResizeWidth), _maxWidth(other._maxWidth), -_minHeight(other._minHeight), -_text(other._text), -_font(other._font), -_blocks(other._blocks.size()), -_links(other._links), -_startDir(other._startDir) -{ +Text::Text(const Text &other) +: _minResizeWidth(other._minResizeWidth) +, _maxWidth(other._maxWidth) +, _minHeight(other._minHeight) +, _text(other._text) +, _font(other._font) +, _blocks(other._blocks.size()) +, _links(other._links) +, _startDir(other._startDir) { for (int32 i = 0, l = _blocks.size(); i < l; ++i) { _blocks[i] = other._blocks.at(i)->clone(); } } +Text::Text(Text &&other) +: _minResizeWidth(other._minResizeWidth) +, _maxWidth(other._maxWidth) +, _minHeight(other._minHeight) +, _text(other._text) +, _font(other._font) +, _blocks(other._blocks) +, _links(other._links) +, _startDir(other._startDir) { + other.clearFields(); +} + Text &Text::operator=(const Text &other) { _minResizeWidth = other._minResizeWidth; _maxWidth = other._maxWidth; @@ -2560,10 +2575,23 @@ Text &Text::operator=(const Text &other) { return *this; } +Text &Text::operator=(Text &&other) { + _minResizeWidth = other._minResizeWidth; + _maxWidth = other._maxWidth; + _minHeight = other._minHeight; + _text = other._text; + _font = other._font; + _blocks = other._blocks; + _links = other._links; + _startDir = other._startDir; + other.clearFields(); + return *this; +} + void Text::setText(style::font font, const QString &text, const TextParseOptions &options) { if (!_textStyle) _initDefault(); _font = font; - clean(); + clear(); { TextParser parser(this, text, options); } @@ -2641,7 +2669,7 @@ void Text::recountNaturalSize(bool initial, Qt::LayoutDirection optionsDir) { void Text::setMarkedText(style::font font, const QString &text, const EntitiesInText &entities, const TextParseOptions &options) { if (!_textStyle) _initDefault(); _font = font; - clean(); + clear(); { // QString newText; // utf16 of the text for emoji // newText.reserve(8 * text.size()); @@ -3213,10 +3241,14 @@ EntitiesInText Text::originalEntities() const { return result; } -void Text::clean() { +void Text::clear() { for (TextBlocks::iterator i = _blocks.begin(), e = _blocks.end(); i != e; ++i) { delete *i; } + clearFields(); +} + +void Text::clearFields() { _blocks.clear(); _links.clear(); _maxWidth = _minHeight = 0; @@ -3468,7 +3500,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi if (length) { style::font blockFont = font; if (!flags && lnkIndex) { - // should use textStyle lnkFlags somehow.. not supported + // should use textStyle lnkFlags somehow... not supported } if ((flags & TextBlockFPre) || (flags & TextBlockFCode)) { @@ -4559,6 +4591,7 @@ namespace { case 65359: return QChar(111); case 65363: return QChar(115); case 65367: return QChar(119); + case 1105: return QChar(1077); default: break; } diff --git a/Telegram/SourceFiles/gui/text.h b/Telegram/SourceFiles/gui/text.h index d78f20cf5..7cb1e23a0 100644 --- a/Telegram/SourceFiles/gui/text.h +++ b/Telegram/SourceFiles/gui/text.h @@ -598,7 +598,9 @@ public: Text(int32 minResizeWidth = QFIXED_MAX); Text(style::font font, const QString &text, const TextParseOptions &options = _defaultOptions, int32 minResizeWidth = QFIXED_MAX, bool richText = false); Text(const Text &other); + Text(Text &&other); Text &operator=(const Text &other); + Text &operator=(Text &&other); int32 countWidth(int32 width) const; int32 countHeight(int32 width) const; @@ -686,15 +688,19 @@ public: return true; } - void clean(); + void clear(); ~Text() { - clean(); + clear(); } private: void recountNaturalSize(bool initial, Qt::LayoutDirection optionsDir = Qt::LayoutDirectionAuto); + // clear() deletes all blocks and calls this method + // it is also called from move constructor / assignment operator + void clearFields(); + QFixed _minResizeWidth, _maxWidth; int32 _minHeight; diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index fcf242e6c..1478fe97c 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -75,12 +75,6 @@ namespace { _webpageDescriptionOptions.maxh = st::webPageDescriptionFont->height * 3; } - inline HistoryReply *toHistoryReply(HistoryItem *item) { - return item ? item->toHistoryReply() : 0; - } - inline const HistoryReply *toHistoryReply(const HistoryItem *item) { - return item ? item->toHistoryReply() : 0; - } inline const TextParseOptions &itemTextOptions(HistoryItem *item) { return itemTextOptions(item->history(), item->author()); } @@ -98,11 +92,8 @@ void DialogRow::paint(Painter &p, int32 w, bool act, bool sel, bool onlyBackgrou p.fillRect(fullRect, (act ? st::dlgActiveBG : (sel ? st::dlgHoverBG : st::dlgBG))->b); if (onlyBackground) return; - if (history->peer->migrateTo()) { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, history->peer->migrateTo()->photo->pix(st::dlgPhotoSize)); - } else { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, history->peer->photo->pix(st::dlgPhotoSize)); - } + PeerData *userpicPeer = (history->peer->migrateTo() ? history->peer->migrateTo() : history->peer); + userpicPeer->paintUserpicLeft(p, st::dlgPhotoSize, st::dlgPaddingHor, st::dlgPaddingVer, w); int32 nameleft = st::dlgPaddingHor + st::dlgPhotoSize + st::dlgPhotoPadding; int32 namewidth = w - nameleft - st::dlgPaddingHor; @@ -205,11 +196,8 @@ void FakeDialogRow::paint(Painter &p, int32 w, bool act, bool sel, bool onlyBack if (onlyBackground) return; History *history = _item->history(); - if (history->peer->migrateTo()) { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, history->peer->migrateTo()->photo->pix(st::dlgPhotoSize)); - } else { - p.drawPixmap(st::dlgPaddingHor, st::dlgPaddingVer, history->peer->photo->pix(st::dlgPhotoSize)); - } + PeerData *userpicPeer = (history->peer->migrateTo() ? history->peer->migrateTo() : history->peer); + userpicPeer->paintUserpicLeft(p, st::dlgPhotoSize, st::dlgPaddingHor, st::dlgPaddingVer, w); int32 nameleft = st::dlgPaddingHor + st::dlgPhotoSize + st::dlgPhotoPadding; int32 namewidth = w - nameleft - st::dlgPaddingHor; @@ -274,17 +262,17 @@ History::History(const PeerId &peerId) : width(0), height(0) , unreadCount(0) , inboxReadBefore(1) , outboxReadBefore(1) -, showFrom(0) -, unreadBar(0) +, showFrom(nullptr) +, unreadBar(nullptr) , peer(App::peer(peerId)) , oldLoaded(false) , newLoaded(true) , lastMsg(0) , msgDraft(0) , editDraft(0) -, lastWidth(0) -, lastScrollTop(ScrollMax) -, lastShowAtMsgId(ShowAtUnreadMsgId) +, showAtMsgId(ShowAtUnreadMsgId) +, scrollTopItem(nullptr) +, scrollTopOffset(0) , mute(isNotifyMuted(peer->notify)) , lastKeyboardInited(false) , lastKeyboardUsed(false) @@ -299,8 +287,8 @@ History::History(const PeerId &peerId) : width(0), height(0) if (peer->isChannel() || (peer->isUser() && peer->asUser()->botInfo)) { outboxReadBefore = INT_MAX; } - for (int32 i = 0; i < OverviewCount; ++i) { - overviewCountData[i] = -1; // not loaded yet + for (auto &countData : overviewCountData) { + countData = -1; // not loaded yet } } @@ -315,6 +303,20 @@ void History::clearLastKeyboard() { lastKeyboardFrom = 0; } +bool History::canHaveFromPhotos() const { + if (peer->isUser() && !Adaptive::Wide()) { + return false; + } else if (isChannel() && asChannelHistory()->onlyImportant()) { + return false; + } + return true; +} + +void History::setHasPendingResizedItems() { + _flags |= Flag::f_has_pending_resized_items; + Global::RefHandleHistoryUpdate().call(); +} + bool History::updateTyping(uint64 ms, bool force) { bool changed = force; for (TypingUsers::iterator i = typing.begin(), e = typing.end(); i != e;) { @@ -473,13 +475,9 @@ void ChannelHistory::getSwitchReadyFor(MsgId switchId, MsgId &fixInScrollMsgId, switchMode(); } else { clear(true); - newLoaded = oldLoaded = false; - lastWidth = 0; } } else { clear(true); - newLoaded = oldLoaded = false; - lastWidth = 0; } } else { _otherList.clear(); @@ -494,13 +492,13 @@ void ChannelHistory::insertCollapseItem(MsgId wasMinId) { if (_onlyImportant || isMegagroup()) return; bool insertAfter = false; - for (int32 blockIndex = 1, blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { // skip first date block + for (int32 blockIndex = 0, blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { HistoryBlock *block = blocks.at(blockIndex); for (int32 itemIndex = 0, itemsCount = block->items.size(); itemIndex < itemsCount; ++itemIndex) { HistoryItem *item = block->items.at(itemIndex); if (insertAfter || item->id > wasMinId || (item->id == wasMinId && !item->isImportant())) { - _collapseMessage = new HistoryCollapse(this, block, wasMinId, item->date); - if (!addNewInTheMiddle(regItem(_collapseMessage), blockIndex, itemIndex)) { + _collapseMessage = HistoryCollapse::create((History*)this, wasMinId, item->date); + if (!addNewInTheMiddle(_collapseMessage, blockIndex, itemIndex)) { _collapseMessage = 0; } return; @@ -558,7 +556,7 @@ void ChannelHistory::getRangeDifferenceNext(int32 pts) { if (!App::main() || _rangeDifferenceToId < _rangeDifferenceFromId) return; int32 limit = _rangeDifferenceToId + 1 - _rangeDifferenceFromId; - _rangeDifferenceRequestId = MTP::send(MTPupdates_GetChannelDifference(peer->asChannel()->inputChannel, MTP_channelMessagesFilter(MTP_int(0), MTP_vector(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId)))), MTP_int(pts), MTP_int(limit)), App::main()->rpcDone(&MainWidget::gotRangeDifference, peer->asChannel())); + _rangeDifferenceRequestId = MTP::send(MTPupdates_GetChannelDifference(peer->asChannel()->inputChannel, MTP_channelMessagesFilter(MTP_flags(MTPDchannelMessagesFilter::Flags(0)), MTP_vector(1, MTP_messageRange(MTP_int(_rangeDifferenceFromId), MTP_int(_rangeDifferenceToId)))), MTP_int(pts), MTP_int(limit)), App::main()->rpcDone(&MainWidget::gotRangeDifference, peer->asChannel())); } void ChannelHistory::addNewGroup(const MTPMessageGroup &group) { @@ -569,7 +567,7 @@ void ChannelHistory::addNewGroup(const MTPMessageGroup &group) { _otherNewLoaded = false; } else if (_otherNewLoaded) { if (_otherList.isEmpty() || _otherList.back()->type() != HistoryItemGroup) { - _otherList.push_back(regItem(new HistoryGroup(this, 0, d, _otherList.isEmpty() ? date(d.vdate) : _otherList.back()->date))); + _otherList.push_back(HistoryGroup::create(this, d, _otherList.isEmpty() ? date(d.vdate) : _otherList.back()->date)); } else { static_cast(_otherList.back())->uniteWith(d.vmin_id.v, d.vmax_id.v, d.vcount.v); } @@ -577,29 +575,13 @@ void ChannelHistory::addNewGroup(const MTPMessageGroup &group) { if (onlyImportant()) { if (newLoaded) { - HistoryItem *prev = blocks.isEmpty() ? 0 : blocks.back()->items.back(); - HistoryBlock *to = 0; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - to->y = height; - } else { - to = blocks.back(); - height -= to->height; - } - prev = addMessageGroupAfterPrevToBlock(d, prev, to); - height += to->height; - if (newBlock) { - HistoryBlock *dateBlock = new HistoryBlock(this); - HistoryItem *dayItem = createDayServiceMsg(this, dateBlock, blocks.front()->items.front()->date); - dateBlock->items.push_back(dayItem); - int32 dh = dayItem->resize(width); - dateBlock->height = dh; - for (Blocks::iterator i = blocks.begin(), e = blocks.end(); i != e; ++i) { - (*i)->y += dh; - } - blocks.push_front(dateBlock); // date block CHECK - height += dh; + HistoryBlock *block = blocks.isEmpty() ? pushBackNewBlock() : blocks.back(); + HistoryItem *prev = block->items.isEmpty() ? nullptr : block->items.back(); + + prev = addMessageGroupAfterPrevToBlock(d, prev, block); + if (block->items.isEmpty()) { + blocks.pop_back(); + delete block; } } } else { @@ -612,24 +594,25 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { return _joinedMessage; } - UserData *inviter = (peer->asChannel()->inviter > 0) ? App::userLoaded(peer->asChannel()->inviter) : 0; - if (!inviter) return 0; + UserData *inviter = (peer->asChannel()->inviter > 0) ? App::userLoaded(peer->asChannel()->inviter) : nullptr; + if (!inviter) return nullptr; + + MTPDmessage::Flags flags = 0; + if (peerToUser(inviter->id) == MTP::authedId()) { + unread = false; + } else if (unread) { + flags |= MTPDmessage::Flag::f_unread; + } - if (peerToUser(inviter->id) == MTP::authedId()) unread = false; - int32 flags = (unread ? MTPDmessage::flag_unread : 0); QDateTime inviteDate = peer->asChannel()->inviteDate; if (unread) _maxReadMessageDate = inviteDate; if (isEmpty()) { - HistoryBlock *to = new HistoryBlock(this); - bool newBlock = true; - _joinedMessage = new HistoryJoined(this, to, inviteDate, inviter, flags); - if (!addNewItem(to, newBlock, regItem(_joinedMessage), unread)) { - _joinedMessage = 0; - } + _joinedMessage = HistoryJoined::create(this, inviteDate, inviter, flags); + addNewItem(_joinedMessage, unread); return _joinedMessage; } - HistoryItem *lastSeenDateItem = 0; - for (int32 blockIndex = blocks.size(); blockIndex > 1;) { + + for (int32 blockIndex = blocks.size(); blockIndex > 0;) { HistoryBlock *block = blocks.at(--blockIndex); for (int32 itemIndex = block->items.size(); itemIndex > 0;) { HistoryItem *item = block->items.at(--itemIndex); @@ -638,23 +621,12 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { if (item->date <= inviteDate) { if (peer->isMegagroup() && peer->migrateFrom() && item->isGroupMigrate()) { peer->asChannel()->mgInfo->joinedMessageFound = true; - return 0; + return nullptr; } ++itemIndex; - if (item->date.date() != inviteDate.date()) { - HistoryDateMsg *joinedDateItem = new HistoryDateMsg(this, block, inviteDate.date()); - if (addNewInTheMiddle(regItem(joinedDateItem), blockIndex, itemIndex)) { - ++itemIndex; - } - } - _joinedMessage = new HistoryJoined(this, block, inviteDate, inviter, flags); - if (!addNewInTheMiddle(regItem(_joinedMessage), blockIndex, itemIndex)) { - _joinedMessage = 0; - } - if (lastSeenDateItem && lastSeenDateItem->date.date() == inviteDate.date()) { - lastSeenDateItem->destroy(); - } + _joinedMessage = HistoryJoined::create(this, inviteDate, inviter, flags); + addNewInTheMiddle(_joinedMessage, blockIndex, itemIndex); if (lastMsgDate.isNull() || inviteDate >= lastMsgDate) { setLastMessage(_joinedMessage); if (unread) { @@ -662,77 +634,20 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { } } return _joinedMessage; - } else { - lastSeenDateItem = 0; } - } else if (type == HistoryItemDate) { - lastSeenDateItem = item; } } } // adding new item to new block - int32 addToH = 0, skip = 0; - if (!blocks.isEmpty()) { // remove date block - if (width) addToH = -blocks.front()->height; - HistoryBlock *dateblock = blocks.front(); - blocks.pop_front(); - delete dateblock; - } - HistoryItem *till = blocks.isEmpty() ? 0 : blocks.front()->items.front(); + HistoryBlock *block = pushFrontNewBlock(); - HistoryBlock *block = new HistoryBlock(this); + _joinedMessage = HistoryJoined::create(this, inviteDate, inviter, flags); + addItemToBlock(_joinedMessage, block); + + t_assert(blocks.size() > 1); + blocks.at(1)->items.front()->previousItemChanged(); - _joinedMessage = new HistoryJoined(this, block, inviteDate, inviter, flags); - addItemAfterPrevToBlock(regItem(_joinedMessage), 0, block); - if (till && _joinedMessage && inviteDate.date() != till->date.date()) { - HistoryItem *dayItem = createDayServiceMsg(this, block, till->date); - block->items.push_back(dayItem); - if (width) { - dayItem->y = block->height; - block->height += dayItem->resize(width); - } - } - if (!block->items.isEmpty()) { - blocks.push_front(block); // CHECK - if (width) { - addToH += block->height; - ++skip; - } - } else { - delete block; - } - if (!blocks.isEmpty()) { - HistoryBlock *dateBlock = new HistoryBlock(this); - HistoryItem *dayItem = createDayServiceMsg(this, dateBlock, blocks.front()->items.front()->date); - dateBlock->items.push_back(dayItem); - if (width) { - int32 dh = dayItem->resize(width); - dateBlock->height = dh; - if (skip) { - blocks.front()->y += dh; - } - addToH += dh; - ++skip; - } - blocks.push_front(dateBlock); // date block CHECK - } - if (width && addToH) { - for (Blocks::iterator i = blocks.begin(), e = blocks.end(); i != e; ++i) { - if (skip) { - --skip; - } else { - (*i)->y += addToH; - } - } - height += addToH; - } - if (!lastMsgDate.isNull() && inviteDate >= lastMsgDate) { - setLastMessage(_joinedMessage); - if (unread) { - newItemAdded(_joinedMessage); - } - } return _joinedMessage; } @@ -753,9 +668,9 @@ void ChannelHistory::checkJoinedMessage(bool createUnread) { QDateTime inviteDate = peer->asChannel()->inviteDate; QDateTime firstDate, lastDate; - for (int32 blockIndex = 1, blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { + for (int blockIndex = 0, blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { HistoryBlock *block = blocks.at(blockIndex); - int32 itemIndex = 0, itemsCount = block->items.size(); + int itemIndex = 0, itemsCount = block->items.size(); for (; itemIndex < itemsCount; ++itemIndex) { HistoryItem *item = block->items.at(itemIndex); HistoryItemType type = item->type(); @@ -766,9 +681,9 @@ void ChannelHistory::checkJoinedMessage(bool createUnread) { } if (itemIndex < itemsCount) break; } - for (int32 blockIndex = blocks.size(); blockIndex > 1;) { + for (int blockIndex = blocks.size(); blockIndex > 0;) { HistoryBlock *block = blocks.at(--blockIndex); - int32 itemIndex = block->items.size(); + int itemIndex = block->items.size(); for (; itemIndex > 0;) { HistoryItem *item = block->items.at(--itemIndex); HistoryItemType type = item->type(); @@ -794,9 +709,9 @@ void ChannelHistory::checkJoinedMessage(bool createUnread) { void ChannelHistory::checkMaxReadMessageDate() { if (_maxReadMessageDate.isValid()) return; - for (int32 blockIndex = blocks.size(); blockIndex > 0;) { + for (int blockIndex = blocks.size(); blockIndex > 0;) { HistoryBlock *block = blocks.at(--blockIndex); - for (int32 itemIndex = block->items.size(); itemIndex > 0;) { + for (int itemIndex = block->items.size(); itemIndex > 0;) { HistoryItem *item = block->items.at(--itemIndex); if ((item->isImportant() || isMegagroup()) && !item->unread()) { _maxReadMessageDate = item->date; @@ -840,36 +755,28 @@ HistoryItem *ChannelHistory::addNewToBlocks(const MTPMessage &msg, NewMessageTyp } if (!isImportant && onlyImportant()) { - HistoryItem *item = addToHistory(msg), *prev = isEmpty() ? 0 : blocks.back()->items.back(); - HistoryItem *group = addMessageGroupAfterPrev(item, prev); - if (group && group != prev) { - height += group->height(); + HistoryItem *item = addToHistory(msg), *prev = isEmpty() ? nullptr : blocks.back()->items.back(); + + if (prev && prev->type() == HistoryItemGroup) { + static_cast(prev)->uniteWith(item); + } else { + QDateTime date = prev ? prev->date : item->date; + HistoryBlock *block = prev ? prev->block() : pushBackNewBlock(); + addItemToBlock(HistoryGroup::create(this, item, date), block); } return item; } + // when we are receiving channel dialog rows we get one important and one not important + // message for each history, adding all of them with type == NewMessageLast + // if we get a second (not important) message of this two we need to clear the history + // because a lot of messages in between those two are skipped if (!isImportantFlags && !onlyImportant() && !isEmpty() && type == NewMessageLast) { clear(true); + newLoaded = true; // adding the last message } - HistoryBlock *to = nullptr; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); - } - HistoryItem *item = createItem((type == NewMessageLast) ? nullptr : to, msg, (type == NewMessageUnread)); - if (type == NewMessageLast && item) { - if (!item->detached()) { - t_assert(!newBlock); - return item; - } - item->attach(to); - } - return addNewItem(to, newBlock, item, (type == NewMessageUnread)); + return addNewToLastBlock(msg, type); } void ChannelHistory::addNewToOther(HistoryItem *item, NewMessageType type) { @@ -883,7 +790,7 @@ void ChannelHistory::addNewToOther(HistoryItem *item, NewMessageType type) { } } else { if (_otherList.isEmpty() || _otherList.back()->type() != HistoryItemGroup) { - _otherList.push_back(regItem(new HistoryGroup(this, 0, item, _otherList.isEmpty() ? item->date : _otherList.back()->date))); + _otherList.push_back(HistoryGroup::create(this, item, _otherList.isEmpty() ? item->date : _otherList.back()->date)); } else { static_cast(_otherList.back())->uniteWith(item); } @@ -898,7 +805,7 @@ void ChannelHistory::switchMode() { OtherList savedList; if (!blocks.isEmpty()) { - savedList.reserve(((blocks.size() - 2) * MessagesPerPage + blocks.back()->items.size()) * (onlyImportant() ? 2 : 1)); + savedList.reserve(((blocks.size() - 1) * MessagesPerPage + blocks.back()->items.size()) * (onlyImportant() ? 2 : 1)); for_const (const HistoryBlock *block, blocks) { for_const (HistoryItem *item, block->items) { HistoryItemType itemType = item->type(); @@ -914,25 +821,20 @@ void ChannelHistory::switchMode() { newLoaded = _otherNewLoaded; oldLoaded = _otherOldLoaded; - if (int32 count = _otherList.size()) { - blocks.reserve(qCeil(count / float64(MessagesPerPage)) + 1); - createInitialDateBlock(_otherList.front()->date); + if (int count = _otherList.size()) { + blocks.reserve(qCeil(count / float64(MessagesPerPage))); - HistoryItem *prev = 0; - for (int32 i = 0; i < count;) { - HistoryBlock *block = new HistoryBlock(this); - int32 willAddToBlock = qMin(int32(MessagesPerPage), count - i); + for (int i = 0; i < count;) { + HistoryBlock *block = pushBackNewBlock(); + + int willAddToBlock = qMin(int(MessagesPerPage), count - i); block->items.reserve(willAddToBlock); - for (int32 till = i + willAddToBlock; i < till; ++i) { - HistoryItem *item = _otherList.at(i); - item->attach(block); - prev = addItemAfterPrevToBlock(item, prev, block); - } - blocks.push_back(block); // CHECK - if (width) { - block->y = height; - height += block->height; + for (int till = i + willAddToBlock; i < till; ++i) { + t_assert(_otherList.at(i)->detached()); + addItemToBlock(_otherList.at(i), block); } + + t_assert(!block->items.isEmpty()); } } @@ -942,7 +844,9 @@ void ChannelHistory::switchMode() { _onlyImportant = !_onlyImportant; - lastWidth = 0; + // scroll to the bottom if nothing special is intended + // (like scrolling to the collapse item) + scrollTopItem = nullptr; checkJoinedMessage(); } @@ -989,11 +893,11 @@ HistoryGroup *ChannelHistory::findGroup(MsgId msgId) const { // find message gro } HistoryBlock *ChannelHistory::findGroupBlock(MsgId msgId) const { // find block with message group using binary search - if (isEmpty()) return 0; + if (isEmpty()) return nullptr; - int32 blockIndex = 0; - if (blocks.size() > 1) for (int32 minBlock = 0, maxBlock = blocks.size();;) { - for (int32 startCheckBlock = (minBlock + maxBlock) / 2, checkBlock = startCheckBlock;;) { + int blockIndex = 0; + if (blocks.size() > 1) for (int minBlock = 0, maxBlock = blocks.size();;) { + for (int startCheckBlock = (minBlock + maxBlock) / 2, checkBlock = startCheckBlock;;) { HistoryBlock *block = blocks.at(checkBlock); auto i = block->items.cbegin(), e = block->items.cend(); for (; i != e; ++i) { // out msgs could be a mess in monotonic ids @@ -1049,17 +953,17 @@ HistoryGroup *ChannelHistory::findGroupInOther(MsgId msgId) const { // find mess } } HistoryItem *item = _otherList.at(otherIndex); - if (item->type() != HistoryItemGroup) return 0; + if (item->type() != HistoryItemGroup) return nullptr; + HistoryGroup *result = static_cast(item); - return (result->minId() < msgId && result->maxId() > msgId) ? result : 0; + return (result->minId() < msgId && result->maxId() > msgId) ? result : nullptr; } HistoryItem *ChannelHistory::findPrevItem(HistoryItem *item) const { - if (item->detached()) return 0; - int32 itemIndex = item->block()->items.indexOf(item); - int32 blockIndex = blocks.indexOf(item->block()); - if (itemIndex < 0 || blockIndex < 0) return 0; + if (item->detached()) return nullptr; + int itemIndex = item->indexInBlock(); + int blockIndex = item->block()->indexInHistory(); for (++blockIndex, ++itemIndex; blockIndex > 0;) { --blockIndex; HistoryBlock *block = blocks.at(blockIndex); @@ -1071,14 +975,14 @@ HistoryItem *ChannelHistory::findPrevItem(HistoryItem *item) const { } } } - return 0; + return nullptr; } void ChannelHistory::messageDetached(HistoryItem *msg) { if (_collapseMessage == msg) { - _collapseMessage = 0; + _collapseMessage = nullptr; } else if (_joinedMessage == msg) { - _joinedMessage = 0; + _joinedMessage = nullptr; } } @@ -1118,7 +1022,9 @@ bool DialogsList::del(const PeerId &peerId, DialogRow *replacedBy) { if (i == rowByPeer.cend()) return false; DialogRow *row = i.value(); - emit App::main()->dialogRowReplaced(row, replacedBy); + if (App::main()) { + emit App::main()->dialogRowReplaced(row, replacedBy); + } if (row == current) { current = row->next; @@ -1232,6 +1138,10 @@ void Histories::clear() { for (Map::const_iterator i = map.cbegin(), e = map.cend(); i != e; ++i) { delete i.value(); } + _unreadFull = _unreadMuted = 0; + if (App::wnd()) { + App::wnd()->updateCounter(); + } App::historyClearItems(); typing.clear(); map.clear(); @@ -1299,7 +1209,7 @@ HistoryItem *Histories::addNewMessage(const MTPMessage &msg, NewMessageType type return findOrInsert(peer, 0, 0)->addNewMessage(msg, type); } -HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, bool applyServiceAction) { +HistoryItem *History::createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem) { MsgId msgId = 0; switch (msg.type()) { case mtpc_messageEmpty: msgId = msg.c_messageEmpty().vid.v; break; @@ -1310,18 +1220,11 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo HistoryItem *result = App::histItemById(channelId(), msgId); if (result) { - if (block) { - if (!result->detached()) { - result->detach(); - } - result->attach(block); + if (!result->detached() && detachExistingItem) { + result->detach(); } if (msg.type() == mtpc_message) { result->updateMedia(msg.c_message().has_media() ? (&msg.c_message().vmedia) : 0); - result->initDimensions(); - if (!block) { - Notify::historyItemResized(result); - } if (applyServiceAction) { App::checkSavedGif(result); } @@ -1331,7 +1234,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo switch (msg.type()) { case mtpc_messageEmpty: - result = new HistoryServiceMsg(this, block, msg.c_messageEmpty().vid.v, date(), lang(lng_message_empty)); + result = HistoryService::create(this, msg.c_messageEmpty().vid.v, date(), lang(lng_message_empty)); break; case mtpc_message: { @@ -1383,15 +1286,11 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo QString text(lng_message_unsupported(lt_link, qsl("https://desktop.telegram.org"))); EntitiesInText entities = textParseEntities(text, _historyTextNoMonoOptions.flags); entities.push_front(EntityInText(EntityInTextItalic, 0, text.size())); - result = new HistoryMessage(this, block, m.vid.v, m.vflags.v, m.vvia_bot_id.v, date(m.vdate), m.vfrom_id.v, text, entities); + result = HistoryMessage::create(this, m.vid.v, m.vflags.v, m.vreply_to_msg_id.v, m.vvia_bot_id.v, date(m.vdate), m.vfrom_id.v, text, entities); } else if (badMedia) { - result = new HistoryServiceMsg(this, block, m.vid.v, date(m.vdate), lang(lng_message_empty), m.vflags.v, 0, m.has_from_id() ? m.vfrom_id.v : 0); + result = HistoryService::create(this, m.vid.v, date(m.vdate), lang(lng_message_empty), m.vflags.v, nullptr, m.has_from_id() ? m.vfrom_id.v : 0); } else { - if (m.has_reply_to_msg_id() && m.vreply_to_msg_id.v > 0) { - result = new HistoryReply(this, block, m); - } else { - result = new HistoryMessage(this, block, m); - } + result = HistoryMessage::create(this, m); if (m.has_reply_markup()) { App::feedReplyMarkup(channelId(), msgId, m.vreply_markup); } @@ -1400,7 +1299,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo case mtpc_messageService: { const MTPDmessageService &d(msg.c_messageService()); - result = new HistoryServiceMsg(this, block, d); + result = HistoryService::create(this, d); if (applyServiceAction) { const MTPmessageAction &action(d.vaction); @@ -1504,7 +1403,7 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo } else if (peer->isChannel()) { peer->asChannel()->setPhoto(MTP_chatPhoto(*smallLoc, *bigLoc), photo ? photo->id : 0); } - peer->photo->load(); + peer->loadUserpic(); } } } @@ -1517,15 +1416,15 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo } break; case mtpc_messageActionChatMigrateTo: { - peer->asChat()->flags |= MTPDchat::flag_deactivated; + peer->asChat()->flags |= MTPDchat::Flag::f_deactivated; //const MTPDmessageActionChatMigrateTo &d(action.c_messageActionChatMigrateTo()); - //PeerData *channel = App::peerLoaded(peerFromChannel(d.vchannel_id)); + //PeerData *channel = App::channelLoaded(d.vchannel_id.v); } break; case mtpc_messageActionChannelMigrateFrom: { //const MTPDmessageActionChannelMigrateFrom &d(action.c_messageActionChannelMigrateFrom()); - //PeerData *chat = App::peerLoaded(peerFromChat(d.vchat_id)); + //PeerData *chat = App::chatLoaded(d.vchat_id.v); } break; case mtpc_messageActionPinMessage: { @@ -1543,50 +1442,23 @@ HistoryItem *History::createItem(HistoryBlock *block, const MTPMessage &msg, boo App::checkSavedGif(result); } - return regItem(result); + return result; } -HistoryItem *History::createItemForwarded(HistoryBlock *block, MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *msg) { - return regItem(new HistoryMessage(this, block, id, flags, date, from, msg)); +HistoryItem *History::createItemForwarded(MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *msg) { + return HistoryMessage::create(this, id, flags, date, from, msg); } -HistoryItem *History::createItemDocument(HistoryBlock *block, MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption) { - HistoryItem *result = 0; - - if ((flags & MTPDmessage::flag_reply_to_msg_id) && replyTo > 0) { - result = new HistoryReply(this, block, id, flags, viaBotId, replyTo, date, from, doc, caption); - } else { - result = new HistoryMessage(this, block, id, flags, viaBotId, date, from, doc, caption); - } - - return regItem(result); +HistoryItem *History::createItemDocument(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption) { + return HistoryMessage::create(this, id, flags, replyTo, viaBotId, date, from, doc, caption); } -HistoryItem *History::createItemPhoto(HistoryBlock *block, MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption) { - HistoryItem *result = 0; - - if ((flags & MTPDmessage::flag_reply_to_msg_id) && replyTo > 0) { - result = new HistoryReply(this, block, id, flags, viaBotId, replyTo, date, from, photo, caption); - } else { - result = new HistoryMessage(this, block, id, flags, viaBotId, date, from, photo, caption); - } - - return regItem(result); +HistoryItem *History::createItemPhoto(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption) { + return HistoryMessage::create(this, id, flags, replyTo, viaBotId, date, from, photo, caption); } -HistoryItem *History::addNewService(MsgId msgId, QDateTime date, const QString &text, int32 flags, HistoryMedia *media, bool newMsg) { - HistoryBlock *to = 0; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); - } - - HistoryItem *result = new HistoryServiceMsg(this, to, msgId, date, text, flags, media); - return addNewItem(to, newBlock, regItem(result), newMsg); +HistoryItem *History::addNewService(MsgId msgId, QDateTime date, const QString &text, MTPDmessage::Flags flags, HistoryMedia *media, bool newMsg) { + return addNewItem(HistoryService::create(this, msgId, date, text, flags, media), newMsg); } HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type) { @@ -1604,84 +1476,32 @@ HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type) return item; } - HistoryBlock *to = nullptr; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); + return addNewToLastBlock(msg, type); +} + +HistoryItem *History::addNewToLastBlock(const MTPMessage &msg, NewMessageType type) { + bool applyServiceAction = (type == NewMessageUnread), detachExistingItem = (type != NewMessageLast); + HistoryItem *item = createItem(msg, applyServiceAction, detachExistingItem); + if (!item || !item->detached()) { + return item; } - HistoryItem *item = createItem((type == NewMessageLast) ? nullptr : to, msg, (type == NewMessageUnread)); - if (type == NewMessageLast && item) { - if (!item->detached()) { - t_assert(!newBlock); - return item; - } - item->attach(to); - } - return addNewItem(to, newBlock, item, (type == NewMessageUnread)); + return addNewItem(item, (type == NewMessageUnread)); } HistoryItem *History::addToHistory(const MTPMessage &msg) { - return createItem(nullptr, msg, false); + return createItem(msg, false, false); } -HistoryItem *History::addNewForwarded(MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *item) { - HistoryBlock *to = nullptr; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); - } - return addNewItem(to, newBlock, createItemForwarded(to, id, flags, date, from, item), true); +HistoryItem *History::addNewForwarded(MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *item) { + return addNewItem(createItemForwarded(id, flags, date, from, item), true); } -HistoryItem *History::addNewDocument(MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption) { - HistoryBlock *to = 0; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); - } - return addNewItem(to, newBlock, createItemDocument(to, id, flags, viaBotId, replyTo, date, from, doc, caption), true); +HistoryItem *History::addNewDocument(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption) { + return addNewItem(createItemDocument(id, flags, viaBotId, replyTo, date, from, doc, caption), true); } -HistoryItem *History::addNewPhoto(MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption) { - HistoryBlock *to = 0; - bool newBlock = blocks.isEmpty(); - if (newBlock) { - to = new HistoryBlock(this); - } else { - to = blocks.back(); - t_assert(!to->items.isEmpty()); - t_assert(to->items.back() != nullptr); - } - return addNewItem(to, newBlock, createItemPhoto(to, id, flags, viaBotId, replyTo, date, from, photo, caption), true); -} - -void History::createInitialDateBlock(const QDateTime &date) { - HistoryBlock *dateBlock = new HistoryBlock(this); // date block - HistoryItem *dayItem = createDayServiceMsg(this, dateBlock, date); - dateBlock->items.push_back(dayItem); - if (width) { - dateBlock->height += dayItem->resize(width); - } - - blocks.push_front(dateBlock); - if (width) { - height += dateBlock->height; - for (int32 i = 1, l = blocks.size(); i < l; ++i) { - blocks.at(i)->y += dateBlock->height; - } - } +HistoryItem *History::addNewPhoto(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption) { + return addNewItem(createItemPhoto(id, flags, viaBotId, replyTo, date, from, photo, caption), true); } bool History::addToOverview(MediaOverviewType type, MsgId msgId, AddToOverviewMethod method) { @@ -1727,37 +1547,17 @@ void History::eraseFromOverview(MediaOverviewType type, MsgId msgId) { if (App::wnd()) App::wnd()->mediaOverviewUpdated(peer, type); } -HistoryItem *History::addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *adding, bool newMsg) { - if (!adding) { - if (newBlock) delete to; - return adding; - } +HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) { + t_assert(adding != nullptr); + t_assert(adding->detached()); - if (newBlock) { - createInitialDateBlock(adding->date); + HistoryBlock *block = blocks.isEmpty() ? pushBackNewBlock() : blocks.back(); - to->y = height; - blocks.push_back(to); - } else if (to->items.back()->date.date() != adding->date.date()) { - HistoryItem *dayItem = createDayServiceMsg(this, to, adding->date); - to->items.push_back(dayItem); - if (width) { - dayItem->y = to->height; - - int32 dh = dayItem->resize(width); - to->height += dh; - height += dh; - } - } - to->items.push_back(adding); + adding->attachToBlock(block, block->items.size()); + block->items.push_back(adding); + adding->previousItemChanged(); setLastMessage(adding); - adding->y = to->height; - if (width) { - int32 dh = adding->resize(width); - to->height += dh; - height += dh; - } if (newMsg) { newItemAdded(adding); } @@ -1790,8 +1590,8 @@ HistoryItem *History::addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *a } } if (adding->hasReplyMarkup()) { - int32 markupFlags = App::replyMarkup(channelId(), adding->id).flags; - if (!(markupFlags & MTPDreplyKeyboardMarkup::flag_selective) || adding->mentionsMe()) { + MTPDreplyKeyboardMarkup::Flags markupFlags = App::replyMarkup(channelId(), adding->id).flags; + if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || adding->mentionsMe()) { OrderedSet *markupSenders = 0; if (peer->isChat()) { markupSenders = &peer->asChat()->markupSenders; @@ -1801,7 +1601,7 @@ HistoryItem *History::addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *a if (markupSenders) { markupSenders->insert(adding->from()); } - if (markupFlags & MTPDreplyKeyboardMarkup_flag_ZERO) { // zero markup means replyKeyboardHide + if (markupFlags & MTPDreplyKeyboardMarkup_ClientFlag::f_zero) { // zero markup means replyKeyboardHide if (lastKeyboardFrom == adding->from()->id || (!lastKeyboardInited && !peer->isChat() && !peer->isMegagroup() && !adding->out())) { clearLastKeyboard(); } @@ -1854,7 +1654,7 @@ void History::newItemAdded(HistoryItem *item) { item->from()->asUser()->madeAction(); } if (item->out()) { - if (unreadBar) unreadBar->destroy(); + if (unreadBar) unreadBar->destroyUnreadBar(); if (!item->unread()) { outboxRead(item); } @@ -1869,23 +1669,10 @@ void History::newItemAdded(HistoryItem *item) { } } -HistoryItem *History::addItemAfterPrevToBlock(HistoryItem *item, HistoryItem *prev, HistoryBlock *block) { - if (prev && prev->date.date() != item->date.date()) { - HistoryItem *dayItem = createDayServiceMsg(this, prev->block(), item->date); - prev->block()->items.push_back(dayItem); - if (width) { - dayItem->y = prev->block()->height; - prev->block()->height += dayItem->resize(width); - if (prev->block() != block) { - height += dayItem->height(); - } - } - } +HistoryItem *History::addItemToBlock(HistoryItem *item, HistoryBlock *block) { + item->attachToBlock(block, block->items.size()); block->items.push_back(item); - if (width) { - item->y = block->height; - block->height += item->resize(width); - } + item->previousItemChanged(); return item; } @@ -1894,27 +1681,7 @@ HistoryItem *History::addMessageGroupAfterPrevToBlock(const MTPDmessageGroup &gr static_cast(prev)->uniteWith(group.vmin_id.v, group.vmax_id.v, group.vcount.v); return prev; } - return addItemAfterPrevToBlock(regItem(new HistoryGroup(this, block, group, prev ? prev->date : date(group.vdate))), prev, block); -} - -HistoryItem *History::addMessageGroupAfterPrev(HistoryItem *newItem, HistoryItem *prev) { - if (prev && prev->type() == HistoryItemGroup) { - static_cast(prev)->uniteWith(newItem); - return prev; - } - - QDateTime date = prev ? prev->date : newItem->date; - HistoryBlock *block = prev ? prev->block() : 0; - if (!block) { - createInitialDateBlock(date); - - block = new HistoryBlock(this); - blocks.push_back(block); // CHECK - if (width) { - block->y = height; - } - } - return addItemAfterPrevToBlock(regItem(new HistoryGroup(this, block, newItem, date)), prev, block); + return addItemToBlock(HistoryGroup::create(this, group, prev ? prev->date : date(group.vdate)), block); } void History::addOlderSlice(const QVector &slice, const QVector *collapsed) { @@ -1931,12 +1698,13 @@ void History::addOlderSlice(const QVector &slice, const QVectorconstData() : 0, *groupsIt = groupsBegin, *groupsEnd = (isChannel() && collapsed) ? (groupsBegin + collapsed->size()) : 0; - HistoryItem *oldFirst = nullptr, *last = nullptr; - HistoryBlock *block = new HistoryBlock(this); + HistoryItem *prev = nullptr; + HistoryBlock *block = pushFrontNewBlock(); + block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0)); for (auto i = slice.cend(), e = slice.cbegin(); i != e;) { --i; - HistoryItem *adding = createItem(block, *i, false); + HistoryItem *adding = createItem(*i, false, true); if (!adding) continue; for (; groupsIt != groupsEnd; ++groupsIt) { @@ -1944,138 +1712,119 @@ void History::addOlderSlice(const QVector &slice, const QVectorc_messageGroup()); if (group.vmin_id.v >= adding->id) break; - last = addMessageGroupAfterPrevToBlock(group, last, block); + prev = addMessageGroupAfterPrevToBlock(group, prev, block); } - last = addItemAfterPrevToBlock(adding, last, block); + prev = addItemToBlock(adding, block); } for (; groupsIt != groupsEnd; ++groupsIt) { if (groupsIt->type() != mtpc_messageGroup) continue; const MTPDmessageGroup &group(groupsIt->c_messageGroup()); - last = addMessageGroupAfterPrevToBlock(group, last, block); + prev = addMessageGroupAfterPrevToBlock(group, prev, block); } - if (!blocks.isEmpty()) { - t_assert(blocks.size() > 1); - oldFirst = blocks.at(1)->items.front(); - } - while (oldFirst && last && oldFirst->type() == HistoryItemGroup && last->type() == HistoryItemGroup) { - static_cast(last)->uniteWith(static_cast(oldFirst)); - oldFirst->destroy(); - if (blocks.isEmpty()) { - oldFirst = 0; - } else { - t_assert(blocks.size() > 1); - oldFirst = blocks.at(1)->items.front(); - } - } - if (oldFirst && last && last->date.date() != oldFirst->date.date()) { - HistoryItem *dayItem = createDayServiceMsg(this, block, oldFirst->date); - block->items.push_back(dayItem); - if (width) { - dayItem->y = block->height; - block->height += dayItem->resize(width); - } - } if (block->items.isEmpty()) { - oldLoaded = true; + blocks.pop_front(); delete block; - } else { - if (oldFirst) { - HistoryBlock *initial = blocks.at(0); - blocks[0] = block; - blocks.push_front(initial); - if (width) { - block->y = initial->height; - for (int32 i = 2, l = blocks.size(); i < l; ++i) { - blocks.at(i)->y += block->height; - } - height += block->height; - } - initial->items.at(0)->setDate(block->items.at(0)->date); - } else { - blocks.push_front(block); - if (width) { - height = block->height; - } - createInitialDateBlock(block->items.at(0)->date); - } + block = nullptr; - if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors / lastParticipants - bool channel = isChannel(); - int32 mask = 0; - QList *lastAuthors = 0; - OrderedSet *markupSenders = 0; - if (peer->isChat()) { - lastAuthors = &peer->asChat()->lastAuthors; - markupSenders = &peer->asChat()->markupSenders; - } else if (peer->isMegagroup()) { - lastAuthors = &peer->asChannel()->mgInfo->lastParticipants; - markupSenders = &peer->asChannel()->mgInfo->markupSenders; - } - for (int32 i = block->items.size(); i > 0; --i) { - HistoryItem *item = block->items[i - 1]; - mask |= item->addToOverview(AddToOverviewFront); - if (item->from()->id) { - if (lastAuthors) { // chats - if (item->from()->isUser()) { - if (!lastAuthors->contains(item->from()->asUser())) { - lastAuthors->push_back(item->from()->asUser()); - if (peer->isMegagroup()) { - peer->asChannel()->mgInfo->lastParticipantsStatus |= MegagroupInfo::LastParticipantsAdminsOutdated; - } + oldLoaded = true; + } else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors / lastParticipants + bool channel = isChannel(); + int32 mask = 0; + QList *lastAuthors = 0; + OrderedSet *markupSenders = 0; + if (peer->isChat()) { + lastAuthors = &peer->asChat()->lastAuthors; + markupSenders = &peer->asChat()->markupSenders; + } else if (peer->isMegagroup()) { + lastAuthors = &peer->asChannel()->mgInfo->lastParticipants; + markupSenders = &peer->asChannel()->mgInfo->markupSenders; + } + for (int32 i = block->items.size(); i > 0; --i) { + HistoryItem *item = block->items[i - 1]; + mask |= item->addToOverview(AddToOverviewFront); + if (item->from()->id) { + if (lastAuthors) { // chats + if (item->from()->isUser()) { + if (!lastAuthors->contains(item->from()->asUser())) { + lastAuthors->push_back(item->from()->asUser()); + if (peer->isMegagroup()) { + peer->asChannel()->mgInfo->lastParticipantsStatus |= MegagroupInfo::LastParticipantsAdminsOutdated; } } } } - if (item->author()->id) { - if (markupSenders) { // chats with bots - if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { - int32 markupFlags = App::replyMarkup(channelId(), item->id).flags; - if (!(markupFlags & MTPDreplyKeyboardMarkup::flag_selective) || item->mentionsMe()) { - bool wasKeyboardHide = markupSenders->contains(item->author()); - if (!wasKeyboardHide) { - markupSenders->insert(item->author()); - } - if (!(markupFlags & MTPDreplyKeyboardMarkup_flag_ZERO)) { - if (!lastKeyboardInited) { - bool botNotInChat = false; - if (peer->isChat()) { - botNotInChat = (!peer->canWrite() || !peer->asChat()->participants.isEmpty()) && item->author()->isUser() && !peer->asChat()->participants.contains(item->author()->asUser()); - } else if (peer->isMegagroup()) { - botNotInChat = (!peer->canWrite() || peer->asChannel()->mgInfo->botStatus != 0) && item->author()->isUser() && !peer->asChannel()->mgInfo->bots.contains(item->author()->asUser()); - } - if (wasKeyboardHide || botNotInChat) { - clearLastKeyboard(); - } else { - lastKeyboardInited = true; - lastKeyboardId = item->id; - lastKeyboardFrom = item->author()->id; - lastKeyboardUsed = false; - } + } + if (item->author()->id) { + if (markupSenders) { // chats with bots + if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { + MTPDreplyKeyboardMarkup::Flags markupFlags = App::replyMarkup(channelId(), item->id).flags; + if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || item->mentionsMe()) { + bool wasKeyboardHide = markupSenders->contains(item->author()); + if (!wasKeyboardHide) { + markupSenders->insert(item->author()); + } + if (!(markupFlags & MTPDreplyKeyboardMarkup_ClientFlag::f_zero)) { + if (!lastKeyboardInited) { + bool botNotInChat = false; + if (peer->isChat()) { + botNotInChat = (!peer->canWrite() || !peer->asChat()->participants.isEmpty()) && item->author()->isUser() && !peer->asChat()->participants.contains(item->author()->asUser()); + } else if (peer->isMegagroup()) { + botNotInChat = (!peer->canWrite() || peer->asChannel()->mgInfo->botStatus != 0) && item->author()->isUser() && !peer->asChannel()->mgInfo->bots.contains(item->author()->asUser()); + } + if (wasKeyboardHide || botNotInChat) { + clearLastKeyboard(); + } else { + lastKeyboardInited = true; + lastKeyboardId = item->id; + lastKeyboardFrom = item->author()->id; + lastKeyboardUsed = false; } } } } - } else if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { // conversations with bots - int32 markupFlags = App::replyMarkup(channelId(), item->id).flags; - if (!(markupFlags & MTPDreplyKeyboardMarkup::flag_selective) || item->mentionsMe()) { - if (markupFlags & MTPDreplyKeyboardMarkup_flag_ZERO) { - clearLastKeyboard(); - } else { - lastKeyboardInited = true; - lastKeyboardId = item->id; - lastKeyboardFrom = item->author()->id; - lastKeyboardUsed = false; - } + } + } else if (!lastKeyboardInited && item->hasReplyMarkup() && !item->out()) { // conversations with bots + MTPDreplyKeyboardMarkup::Flags markupFlags = App::replyMarkup(channelId(), item->id).flags; + if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || item->mentionsMe()) { + if (markupFlags & MTPDreplyKeyboardMarkup_ClientFlag::f_zero) { + clearLastKeyboard(); + } else { + lastKeyboardInited = true; + lastKeyboardId = item->id; + lastKeyboardFrom = item->author()->id; + lastKeyboardUsed = false; } } } } - for (int32 t = 0; t < OverviewCount; ++t) { - if ((mask & (1 << t)) && App::wnd()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(t)); - } + } + for (int32 t = 0; t < OverviewCount; ++t) { + if ((mask & (1 << t)) && App::wnd()) App::wnd()->mediaOverviewUpdated(peer, MediaOverviewType(t)); + } + } + + // some checks if there was some message history already + if (block && blocks.size() > 1) { + HistoryItem *last = block->items.back(); // ... item, item, item, last ], [ first, item, item ... + HistoryItem *first = blocks.at(1)->items.front(); + + // we've added a new front block, so previous item for + // the old first item of a first block was changed + first->previousItemChanged(); + + // we've added a new front block, now we check if both + // last message of the first block and first message of + // the second block are groups, if they are - unite them + if (first->type() == HistoryItemGroup && last->type() == HistoryItemGroup) { + static_cast(first)->uniteWith(static_cast(last)); + last->destroy(); + + // last->destroy() could've destroyed this new block + // so we can't rely on this pointer any more + block = nullptr; } } @@ -2099,11 +1848,12 @@ void History::addNewerSlice(const QVector &slice, const QVectoritems.back(); - HistoryBlock *block = new HistoryBlock(this); + HistoryBlock *block = pushBackNewBlock(); + block->items.reserve(slice.size() + (collapsed ? collapsed->size() : 0)); for (auto i = slice.cend(), e = slice.cbegin(); i != e;) { --i; - HistoryItem *adding = createItem(block, *i, false); + HistoryItem *adding = createItem(*i, false, true); if (!adding) continue; for (; groupsIt != groupsEnd; ++groupsIt) { @@ -2114,7 +1864,7 @@ void History::addNewerSlice(const QVector &slice, const QVectortype() != mtpc_messageGroup) continue; @@ -2126,16 +1876,10 @@ void History::addNewerSlice(const QVector &slice, const QVectoritems.isEmpty()) { newLoaded = true; setLastMessage(lastImportantMessage()); + + blocks.pop_back(); delete block; - } else { - blocks.push_back(block); - if (width) { - block->y = height; - height += block->height; - } - if (blocks.size() == 1) { - createInitialDateBlock(block->items.at(0)->date); - } + block = nullptr; } } @@ -2149,11 +1893,9 @@ void History::addNewerSlice(const QVector &slice, const QVectoritems.size(); ++j) { - mask |= b->items[j]->addToOverview(AddToOverviewBack); + for_const (HistoryBlock *block, blocks) { + for_const (HistoryItem *item, block->items) { + mask |= item->addToOverview(AddToOverviewBack); } } for (int32 t = 0; t < OverviewCount; ++t) { @@ -2164,8 +1906,8 @@ void History::addNewerSlice(const QVector &slice, const QVectorcheckJoinedMessage(); } -int32 History::countUnread(MsgId upTo) { - int32 result = 0; +int History::countUnread(MsgId upTo) { + int result = 0; for (auto i = blocks.cend(), e = blocks.cbegin(); i != e;) { --i; for (auto j = (*i)->items.cend(), en = (*i)->items.cbegin(); j != en;) { @@ -2239,27 +1981,29 @@ MsgId History::outboxRead(HistoryItem *wasRead) { } HistoryItem *History::lastImportantMessage() const { - if (isEmpty()) return 0; - bool channel = isChannel(); - for (int32 blockIndex = blocks.size(); blockIndex > 0;) { + if (isEmpty()) { + return nullptr; + } + bool importantOnly = isChannel() && !isMegagroup(); + for (int blockIndex = blocks.size(); blockIndex > 0;) { HistoryBlock *block = blocks.at(--blockIndex); - for (int32 itemIndex = block->items.size(); itemIndex > 0;) { + for (int itemIndex = block->items.size(); itemIndex > 0;) { HistoryItem *item = block->items.at(--itemIndex); - if ((channel && !isMegagroup()) ? item->isImportant() : (item->type() == HistoryItemMsg)) { + if (importantOnly ? item->isImportant() : (item->type() == HistoryItemMsg)) { return item; } } } - return 0; + return nullptr; } -void History::setUnreadCount(int32 newUnreadCount, bool psUpdate) { +void History::setUnreadCount(int newUnreadCount, bool psUpdate) { if (unreadCount != newUnreadCount) { if (newUnreadCount == 1) { if (loadedAtBottom()) showFrom = lastImportantMessage(); inboxReadBefore = qMax(inboxReadBefore, msgIdForRead()); } else if (!newUnreadCount) { - showFrom = 0; + showFrom = nullptr; inboxReadBefore = qMax(inboxReadBefore, msgIdForRead() + 1); } if (inChatList()) { @@ -2276,7 +2020,11 @@ void History::setUnreadCount(int32 newUnreadCount, bool psUpdate) { count += h->unreadCount; } } - unreadBar->setCount(count); + if (count > 0) { + unreadBar->setUnreadBarCount(count); + } else { + unreadBar->setUnreadBarFreezed(); + } } } } @@ -2292,30 +2040,103 @@ void History::setUnreadCount(int32 newUnreadCount, bool psUpdate) { } } -void History::getNextShowFrom(HistoryBlock *block, int32 i) { +void History::getNextShowFrom(HistoryBlock *block, int i) { if (i >= 0) { - int32 l = block->items.size(); + int l = block->items.size(); for (++i; i < l; ++i) { - if (block->items[i]->type() == HistoryItemMsg) { - showFrom = block->items[i]; + if (block->items.at(i)->type() == HistoryItemMsg) { + showFrom = block->items.at(i); return; } } } - int32 j = blocks.indexOf(block), s = blocks.size(); - if (j >= 0) { - for (++j; j < s; ++j) { - block = blocks[j]; - for (int32 i = 0, l = block->items.size(); i < l; ++i) { - if (block->items[i]->type() == HistoryItemMsg) { - showFrom = block->items[i]; - return; - } + for (int j = block->indexInHistory() + 1, s = blocks.size(); j < s; ++j) { + block = blocks.at(j); + for_const (HistoryItem *item, block->items) { + if (item->type() == HistoryItemMsg) { + showFrom = item; + return; } } } - showFrom = 0; + showFrom = nullptr; +} + +void History::countScrollState(int top) { + countScrollTopItem(top); + if (scrollTopItem) { + scrollTopOffset = (top - scrollTopItem->block()->y - scrollTopItem->y); + } +} + +void History::countScrollTopItem(int top) { + if (isEmpty()) { + forgetScrollState(); + return; + } + + int itemIndex = 0, blockIndex = 0, itemTop = 0; + if (scrollTopItem && !scrollTopItem->detached()) { + itemIndex = scrollTopItem->indexInBlock(); + blockIndex = scrollTopItem->block()->indexInHistory(); + itemTop = blocks.at(blockIndex)->y + scrollTopItem->y; + } + if (itemTop > top) { + // go backward through history while we don't find an item that starts above + do { + HistoryBlock *block = blocks.at(blockIndex); + for (--itemIndex; itemIndex >= 0; --itemIndex) { + HistoryItem *item = block->items.at(itemIndex); + itemTop = block->y + item->y; + if (itemTop <= top) { + scrollTopItem = item; + return; + } + } + if (--blockIndex >= 0) { + itemIndex = blocks.at(blockIndex)->items.size(); + } else { + break; + } + } while (true); + + scrollTopItem = blocks.front()->items.front(); + } else { + // go forward through history while we don't find the last item that starts above + for (int blocksCount = blocks.size(); blockIndex < blocksCount; ++blockIndex) { + HistoryBlock *block = blocks.at(blockIndex); + for (int itemsCount = block->items.size(); itemIndex < itemsCount; ++itemIndex) { + HistoryItem *item = block->items.at(itemIndex); + itemTop = block->y + item->y; + if (itemTop > top) { + t_assert(itemIndex > 0 || blockIndex > 0); + if (itemIndex > 0) { + scrollTopItem = block->items.at(itemIndex - 1); + } else { + scrollTopItem = blocks.at(blockIndex - 1)->items.back(); + } + return; + } + } + itemIndex = 0; + } + scrollTopItem = blocks.back()->items.back(); + } +} + +void History::getNextScrollTopItem(HistoryBlock *block, int32 i) { + ++i; + if (i > 0 && i < block->items.size()) { + scrollTopItem = block->items.at(i); + return; + } + int j = block->indexInHistory() + 1; + if (j > 0 && j < blocks.size()) { + scrollTopItem = blocks.at(j)->items.front(); + return; + } + scrollTopItem = nullptr; } void History::addUnreadBar() { @@ -2327,37 +2148,54 @@ void History::addUnreadBar() { count += h->unreadCount; } } - HistoryBlock *block = showFrom->block(); - unreadBar = new HistoryUnreadBar(this, block, count, showFrom->date); - if (!addNewInTheMiddle(regItem(unreadBar), blocks.indexOf(block), block->items.indexOf(showFrom))) { - unreadBar = 0; + showFrom->setUnreadBarCount(count); + unreadBar = showFrom; +} + +void History::destroyUnreadBar() { + if (unreadBar) { + unreadBar->destroyUnreadBar(); } } HistoryItem *History::addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, int32 itemIndex) { - if (blockIndex < 0 || itemIndex < 0 || blockIndex >= blocks.size() || itemIndex > blocks.at(blockIndex)->items.size()) { - delete newItem; - return 0; - } + t_assert(blockIndex >= 0); + t_assert(blockIndex < blocks.size()); + t_assert(itemIndex >= 0); + t_assert(itemIndex <= blocks.at(blockIndex)->items.size()); HistoryBlock *block = blocks.at(blockIndex); - newItem->y = (itemIndex < block->items.size()) ? block->items.at(itemIndex)->y : block->height; - block->items.insert(itemIndex, newItem); - if (width) { - int32 dh = newItem->resize(width), l = block->items.size(); - for (++itemIndex; itemIndex < l; ++itemIndex) { - block->items[itemIndex]->y += dh; - } - block->height += dh; - for (++blockIndex, l = blocks.size(); blockIndex < l; ++blockIndex) { - blocks[blockIndex]->y += dh; - } - height += dh; + newItem->attachToBlock(block, itemIndex); + block->items.insert(itemIndex, newItem); + newItem->previousItemChanged(); + for (int i = itemIndex + 1, l = block->items.size(); i < l; ++i) { + block->items.at(i)->setIndexInBlock(i); } + if (itemIndex + 1 < block->items.size()) { + block->items.at(itemIndex + 1)->previousItemChanged(); + } + return newItem; } +HistoryBlock *History::pushBackNewBlock() { + HistoryBlock *result = new HistoryBlock(this); + result->setIndexInHistory(blocks.size()); + blocks.push_back(result); + return result; +} + +HistoryBlock *History::pushFrontNewBlock() { + HistoryBlock *result = new HistoryBlock(this); + result->setIndexInHistory(0); + blocks.push_front(result); + for (int i = 1, l = blocks.size(); i < l; ++i) { + blocks.at(i)->setIndexInHistory(i); + } + return result; +} + void History::clearNotifications() { notifies.clear(); } @@ -2409,8 +2247,6 @@ void History::getReadyFor(MsgId msgId, MsgId &fixInScrollMsgId, int32 &fixInScro h->getReadyFor(-msgId, fixInScrollMsgId, fixInScrollMsgTop); if (h->isEmpty()) { clear(true); - newLoaded = oldLoaded = false; - lastWidth = 0; } return; } @@ -2421,8 +2257,6 @@ void History::getReadyFor(MsgId msgId, MsgId &fixInScrollMsgId, int32 &fixInScro if (History *h = App::historyLoaded(peer->migrateFrom()->id)) { if (h->unreadCount) { clear(true); - newLoaded = oldLoaded = false; - lastWidth = 0; h->getReadyFor(msgId, fixInScrollMsgId, fixInScrollMsgTop); return; } @@ -2430,9 +2264,9 @@ void History::getReadyFor(MsgId msgId, MsgId &fixInScrollMsgId, int32 &fixInScro } if (!isReadyFor(msgId, fixInScrollMsgId, fixInScrollMsgTop)) { clear(true); - newLoaded = (msgId == ShowAtTheEndMsgId); - oldLoaded = false; - lastWidth = 0; + if (msgId == ShowAtTheEndMsgId) { + newLoaded = true; + } } } @@ -2510,26 +2344,21 @@ MsgId History::msgIdForRead() const { return result; } -int32 History::geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem) { - if (width != newWidth) resizedItem = 0; // recount all items - if (width != newWidth || resizedItem) { - width = newWidth; - int32 y = 0; - for (Blocks::iterator i = blocks.begin(), e = blocks.end(); i != e; ++i) { - HistoryBlock *block = *i; - bool updTransform = ytransform && (*ytransform >= block->y) && (*ytransform < block->y + block->height); - if (updTransform) *ytransform -= block->y; - if (block->y != y) { - block->y = y; - } - y += block->geomResize(newWidth, ytransform, resizedItem); - if (updTransform) { - *ytransform += block->y; - ytransform = 0; - } - } - height = y; +int History::resizeGetHeight(int newWidth) { + bool resizeAllItems = (_flags | Flag::f_pending_resize) || (width != newWidth); + + if (!resizeAllItems && !hasPendingResizedItems()) { + return height; } + _flags &= ~(Flag::f_pending_resize | Flag::f_has_pending_resized_items); + + width = newWidth; + int y = 0; + for_const (HistoryBlock *block, blocks) { + block->y = y; + y += block->resizeGetHeight(newWidth, resizeAllItems); + } + height = y; return height; } @@ -2543,13 +2372,16 @@ const ChannelHistory *History::asChannelHistory() const { void History::clear(bool leaveItems) { if (unreadBar) { - unreadBar->destroy(); + unreadBar = nullptr; } if (showFrom) { - showFrom = 0; + showFrom = nullptr; + } + if (scrollTopItem) { + forgetScrollState(); } if (!leaveItems) { - setLastMessage(0); + setLastMessage(nullptr); } for (int32 i = 0; i < OverviewCount; ++i) { if (!overview[i].isEmpty() || !overviewIds[i].isEmpty()) { @@ -2571,8 +2403,11 @@ void History::clear(bool leaveItems) { } else { setUnreadCount(0); } - height = 0; - oldLoaded = false; + setPendingResize(); + + newLoaded = oldLoaded = false; + forgetScrollState(); + if (peer->isChat()) { peer->asChat()->lastAuthors.clear(); peer->asChat()->markupSenders.clear(); @@ -2601,9 +2436,10 @@ void History::clearOnDestroy() { } QPair History::adjustByPosInChatsList(DialogsIndexed &indexed) { - int32 movedFrom = _chatListLinks[0]->pos * st::dlgHeight; + DialogRow *lnk = mainChatListLink(); + int32 movedFrom = lnk->pos * st::dlgHeight; indexed.adjustByPos(_chatListLinks); - int32 movedTo = _chatListLinks[0]->pos * st::dlgHeight; + int32 movedTo = lnk->pos * st::dlgHeight; return qMakePair(movedFrom, movedTo); } @@ -2615,8 +2451,7 @@ DialogRow *History::addToChatList(DialogsIndexed &indexed) { if (App::wnd()) App::wnd()->updateCounter(); } } - t_assert(!_chatListLinks.isEmpty()); - return _chatListLinks[0]; + return mainChatListLink(); } void History::removeFromChatList(DialogsIndexed &indexed) { @@ -2647,7 +2482,7 @@ void History::addChatListEntryByLetter(QChar letter, DialogRow *row) { void History::updateChatListEntry() const { if (MainWidget *m = App::main()) { if (inChatList()) { - m->dlgUpdated(_chatListLinks[0]); + m->dlgUpdated(mainChatListLink()); } } } @@ -2732,32 +2567,17 @@ void History::changeMsgId(MsgId oldId, MsgId newId) { } } -void History::blockResized(HistoryBlock *block, int32 dh) { - int32 i = blocks.indexOf(block), l = blocks.size(); - if (i >= 0) { - for (++i; i < l; ++i) { - blocks[i]->y -= dh; - } - height -= dh; - } -} - void History::removeBlock(HistoryBlock *block) { - int32 i = blocks.indexOf(block), h = block->height; - if (i >= 0) { - blocks.removeAt(i); - int32 l = blocks.size(); - if (i > 0 && l == 1) { // only fake block with date left - removeBlock(blocks[0]); - height = 0; - } else if (h) { - for (; i < l; ++i) { - blocks[i]->y -= h; - } - height -= h; - } + t_assert(block->items.isEmpty()); + + int index = block->indexInHistory(); + blocks.removeAt(index); + for (int i = index, l = blocks.size(); i < l; ++i) { + blocks.at(i)->setIndexInHistory(i); + } + if (index < blocks.size()) { + blocks.at(index)->items.front()->previousItemChanged(); } - delete block; } History::~History() { @@ -2766,21 +2586,15 @@ History::~History() { deleteAndMark(editDraft); } -int32 HistoryBlock::geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem) { - int32 y = 0; - for_const (HistoryItem *item , items) { - bool updTransform = ytransform && (*ytransform >= item->y) && (*ytransform < item->y + item->height()); - if (updTransform) *ytransform -= item->y; +int HistoryBlock::resizeGetHeight(int newWidth, bool resizeAllItems) { + int y = 0; + for_const (HistoryItem *item, items) { item->y = y; - if (!resizedItem || resizedItem == item) { - y += item->resize(newWidth); + if (resizeAllItems || item->pendingResize()) { + y += item->resizeGetHeight(newWidth); } else { y += item->height(); } - if (updTransform) { - *ytransform += item->y; - ytransform = 0; - } } height = y; return height; @@ -2802,23 +2616,27 @@ void HistoryBlock::clear(bool leaveItems) { } void HistoryBlock::removeItem(HistoryItem *item) { - int32 i = items.indexOf(item), dh = 0; + t_assert(item->block() == this); + + int itemIndex = item->indexInBlock(); if (history->showFrom == item) { - history->getNextShowFrom(this, i); + history->getNextShowFrom(this, itemIndex); } - if (i < 0) { - return; + if (history->unreadBar == item) { + history->unreadBar = nullptr; + } + if (history->scrollTopItem == item) { + history->getNextScrollTopItem(this, itemIndex); } - bool createInitialDate = false; - QDateTime initialDateTime; - int32 myIndex = history->blocks.indexOf(this); - if (myIndex >= 0 && item->type() != HistoryItemDate) { // fix message groups and date items + int blockIndex = indexInHistory(); + if (blockIndex >= 0) { // fix message groups if (item->isImportant()) { // unite message groups around this important message - HistoryGroup *nextGroup = 0, *prevGroup = 0; - HistoryCollapse *nextCollapse = 0; - HistoryItem *prevItem = 0; - for (int32 nextBlock = myIndex, nextIndex = qMin(items.size(), i + 1); nextBlock < history->blocks.size(); ++nextBlock) { + HistoryGroup *nextGroup = nullptr; + HistoryGroup *prevGroup = nullptr; + HistoryCollapse *nextCollapse = nullptr; + HistoryItem *prevItem = nullptr; + for (int nextBlock = blockIndex, nextIndex = qMin(items.size(), itemIndex + 1); nextBlock < history->blocks.size(); ++nextBlock) { HistoryBlock *block = history->blocks.at(nextBlock); for (; nextIndex < block->items.size(); ++nextIndex) { HistoryItem *item = block->items.at(nextIndex); @@ -2838,7 +2656,7 @@ void HistoryBlock::removeItem(HistoryItem *item) { break; } } - for (int32 prevBlock = myIndex + 1, prevIndex = qMax(1, i); prevBlock > 0;) { + for (int prevBlock = blockIndex + 1, prevIndex = qMax(1, itemIndex); prevBlock > 0;) { --prevBlock; HistoryBlock *block = history->blocks.at(prevBlock); if (!prevIndex) prevIndex = block->items.size(); @@ -2866,77 +2684,27 @@ void HistoryBlock::removeItem(HistoryItem *item) { nextCollapse->destroy(); } } + } - // fix date items - HistoryItem *nextItem = (i < items.size() - 1) ? items[i + 1] : ((myIndex < history->blocks.size() - 1) ? history->blocks[myIndex + 1]->items[0] : 0); - if (nextItem && nextItem == history->unreadBar) { // skip unread bar - if (i < items.size() - 2) { - nextItem = items[i + 2]; - } else if (i < items.size() - 1) { - nextItem = ((myIndex < history->blocks.size() - 1) ? history->blocks[myIndex + 1]->items[0] : 0); - } else if (myIndex < history->blocks.size() - 1) { - if (0 < history->blocks[myIndex + 1]->items.size() - 1) { - nextItem = history->blocks[myIndex + 1]->items[1]; - } else if (myIndex < history->blocks.size() - 2) { - nextItem = history->blocks[myIndex + 2]->items[0]; - } else { - nextItem = 0; - } - } else { - nextItem = 0; - } - } - if (!nextItem || nextItem->type() == HistoryItemDate) { // only if there is no next item or it is a date item - HistoryItem *prevItem = (i > 0) ? items[i - 1] : 0; - if (prevItem && prevItem == history->unreadBar) { // skip unread bar - prevItem = (i > 1) ? items[i - 2] : 0; - } - if (prevItem) { - if (prevItem->type() == HistoryItemDate) { - prevItem->destroy(); - --i; - } - } else if (myIndex > 0) { - HistoryBlock *prevBlock = history->blocks[myIndex - 1]; - if (prevBlock->items.isEmpty() || ((myIndex == 1) && (prevBlock->items.size() != 1 || prevBlock->items.front()->type() != HistoryItemDate))) { - LOG(("App Error: Found bad history, with no first date block: %1").arg(history->blocks[0]->items.size())); - } else if (prevBlock->items[prevBlock->items.size() - 1]->type() == HistoryItemDate) { - prevBlock->items[prevBlock->items.size() - 1]->destroy(); - if (nextItem && myIndex == 1) { // destroy next date (for creating initial then) - initialDateTime = nextItem->date; - createInitialDate = true; - nextItem->destroy(); - } - } - } - } - } - // myIndex can be invalid now, because of destroying previous blocks + // itemIndex/blockIndex can be invalid now, because of destroying previous items/blocks + blockIndex = indexInHistory(); + itemIndex = item->indexInBlock(); - dh = item->height(); - items.remove(i); - int32 l = items.size(); - if ((!item->out() || item->isPost()) && item->unread() && history->unreadCount) { - history->setUnreadCount(history->unreadCount - 1); + item->detachFast(); + items.remove(itemIndex); + for (int i = itemIndex, l = items.size(); i < l; ++i) { + items.at(i)->setIndexInBlock(i); } - int32 itemType = item->type(); - if (itemType == HistoryItemUnreadBar) { - if (history->unreadBar == item) { - history->unreadBar = 0; - } - } - if (createInitialDate) { - history->createInitialDateBlock(initialDateTime); - } - History *h = history; - if (l) { - for (; i < l; ++i) { - items[i]->y -= dh; - } - height -= dh; - history->blockResized(this, dh); - } else { + if (items.isEmpty()) { history->removeBlock(this); + } else if (itemIndex < items.size()) { + items.at(itemIndex)->previousItemChanged(); + } else if (blockIndex + 1 < history->blocks.size()) { + history->blocks.at(blockIndex + 1)->items.front()->previousItemChanged(); + } + + if (items.isEmpty()) { + delete this; } } @@ -2946,16 +2714,72 @@ void HistoryDependentItemCallback::call(ChannelData *channel, MsgId msgId) const } } -HistoryItem::HistoryItem(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime msgDate, int32 from) : y(0) +void HistoryMessageUnreadBar::init(int count) { + if (_freezed) return; + _text = lng_unread_bar(lt_count, count); + _width = st::semiboldFont->width(_text); +} + +int HistoryMessageUnreadBar::height() const { + return st::unreadBarHeight; +} + +void HistoryMessageUnreadBar::paint(Painter &p, int y, int w) const { + p.fillRect(0, y + st::lineWidth, w, st::unreadBarHeight - 2 * st::lineWidth, st::unreadBarBG); + p.fillRect(0, y + st::unreadBarHeight - st::lineWidth, w, st::lineWidth, st::unreadBarBorder); + p.setFont(st::unreadBarFont); + p.setPen(st::unreadBarColor); + + int left = st::msgServiceMargin.left(); + int maxwidth = w; + if (Adaptive::Wide()) { + maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); + } + w = maxwidth; + + p.drawText((w - _width) / 2, y + (st::unreadBarHeight - st::lineWidth - st::unreadBarFont->height) / 2 + st::unreadBarFont->ascent, _text); +} + +void HistoryMessageDate::init(const QDateTime &date) { + _text = langDayOfMonthFull(date.date()); + _width = st::msgServiceFont->width(_text); +} + +int HistoryMessageDate::height() const { + return st::msgServiceMargin.top() + st::msgServicePadding.top() + st::msgServiceFont->height + st::msgServicePadding.bottom() + st::msgServiceMargin.bottom(); +} + +void HistoryMessageDate::paint(Painter &p, int y, int w) const { + int left = st::msgServiceMargin.left(); + int maxwidth = w; + if (Adaptive::Wide()) { + maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); + } + w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); + + left += (w - _width - st::msgServicePadding.left() - st::msgServicePadding.right()) / 2; + int height = st::msgServicePadding.top() + st::msgServiceFont->height + st::msgServicePadding.bottom(); + App::roundRect(p, left, y + st::msgServiceMargin.top(), _width + st::msgServicePadding.left() + st::msgServicePadding.left(), height, App::msgServiceBg(), ServiceCorners); + + p.setFont(st::msgServiceFont); + p.setPen(st::msgServiceColor); + p.drawText(left + st::msgServicePadding.left(), y + st::msgServiceMargin.top() + st::msgServicePadding.top() + st::msgServiceFont->ascent, _text); +} + +HistoryItem::HistoryItem(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime msgDate, int32 from) : HistoryElem() +, y(0) , id(msgId) , date(msgDate) , _from(from ? App::user(from) : history->peer) , _history(history) -, _block(block) -, _flags(flags) +, _flags(flags | MTPDmessage_ClientFlag::f_pending_init_dimensions | MTPDmessage_ClientFlag::f_pending_resize) , _authorNameVersion(author()->nameVersion) { } +void HistoryItem::finishCreate() { + App::historyRegItem(this); +} + void HistoryItem::destroy() { bool wasAtBottom = history()->loadedAtBottom(); _history->removeNotification(this); @@ -2973,34 +2797,58 @@ void HistoryItem::destroy() { history()->clearLastKeyboard(); if (App::main()) App::main()->updateBotKeyboard(history()); } + if ((!out() || isPost()) && unread() && history()->unreadCount > 0) { + history()->setUnreadCount(history()->unreadCount - 1); + } delete this; } void HistoryItem::detach() { - if (_history) { - if (_history->unreadBar == this) { - _history->unreadBar = 0; - } - if (_history->isChannel()) { - _history->asChannelHistory()->messageDetached(this); - } - } - if (_block) { - _block->removeItem(this); - detachFast(); - App::historyItemDetached(this); - } else { - if (_history->showFrom == this) { - _history->showFrom = 0; - } - } - if (_history && _history->unreadBar && _history->blocks.back()->items.back() == _history->unreadBar) { - _history->unreadBar->destroy(); + if (detached()) return; + + if (_history->isChannel()) { + _history->asChannelHistory()->messageDetached(this); } + _block->removeItem(this); + App::historyItemDetached(this); + + _history->setPendingResize(); } void HistoryItem::detachFast() { - _block = 0; + _block = nullptr; + _indexInBlock = -1; +} + +void HistoryItem::previousItemChanged() { + if (displayDate()) { + if (!Has()) { + AddComponents(HistoryMessageDate::Bit()); + Get()->init(date); + setPendingInitDimensions(); + } + } else if (Has()) { + RemoveComponents(HistoryMessageDate::Bit()); + setPendingInitDimensions(); + } + + recountAttachToPrevious(); +} + +void HistoryItem::recountAttachToPrevious() { + bool attach = false; + if (!isPost() && !Has() && !Has()) { + if (HistoryItem *prev = previous()) { + attach = !prev->isPost() && !prev->serviceMsg() && prev->from() == from() && qAbs(prev->date.secsTo(date)) < AttachMessageToPreviousSecondsDelta; + } + } + if (attach && !(_flags & MTPDmessage_ClientFlag::f_attach_to_previous)) { + _flags |= MTPDmessage_ClientFlag::f_attach_to_previous; + setPendingInitDimensions(); + } else if (!attach && (_flags & MTPDmessage_ClientFlag::f_attach_to_previous)) { + _flags &= ~MTPDmessage_ClientFlag::f_attach_to_previous; + setPendingInitDimensions(); + } } void HistoryItem::setId(MsgId newId) { @@ -3008,17 +2856,13 @@ void HistoryItem::setId(MsgId newId) { id = newId; } -bool HistoryItem::displayFromPhoto() const { - return (Adaptive::Wide() || (!out() && !history()->peer->isUser())) && !isPost(); -} - bool HistoryItem::canEdit(const QDateTime &cur) const { ChannelData *channel = _history->peer->asChannel(); int32 s = date.secsTo(cur); if (!channel || id < 0 || date.secsTo(cur) >= Global::EditTimeLimit()) return false; if (const HistoryMessage *msg = toHistoryMessage()) { - if (msg->Is() || msg->Is()) return false; + if (msg->Has() || msg->Has()) return false; if (HistoryMedia *media = msg->getMedia()) { HistoryMediaType t = media->type(); @@ -3040,6 +2884,47 @@ bool HistoryItem::canEdit(const QDateTime &cur) const { return false; } +void HistoryItem::destroyUnreadBar() { + if (Has()) { + RemoveComponents(HistoryMessageUnreadBar::Bit()); + setPendingInitDimensions(); + if (_history->unreadBar == this) { + _history->unreadBar = nullptr; + } + + recountAttachToPrevious(); + } +} + +void HistoryItem::setUnreadBarCount(int count) { + if (count > 0) { + HistoryMessageUnreadBar *bar; + if (!Has()) { + AddComponents(HistoryMessageUnreadBar::Bit()); + setPendingInitDimensions(); + + recountAttachToPrevious(); + + bar = Get(); + } else { + bar = Get(); + if (bar->_freezed) { + return; + } + Global::RefPendingRepaintItems().insert(this); + } + bar->init(count); + } else { + destroyUnreadBar(); + } +} + +void HistoryItem::setUnreadBarFreezed() { + if (auto *bar = Get()) { + bar->_freezed = true; + } +} + void HistoryItem::clipCallback(ClipReaderNotification notification) { HistoryMedia *media = getMedia(); if (!media) return; @@ -3062,8 +2947,7 @@ void HistoryItem::clipCallback(ClipReaderNotification notification) { } } if (!stopped) { - initDimensions(); - Notify::historyItemResized(this); + setPendingInitDimensions(); Notify::historyItemLayoutChanged(this); } } break; @@ -3083,14 +2967,6 @@ HistoryItem::~HistoryItem() { } } -HistoryItem *regItem(HistoryItem *item) { - if (item) { - App::historyRegItem(item); - item->initDimensions(); - } - return item; -} - RadialAnimation::RadialAnimation(AnimationCreator creator) : _firstStart(0) , _lastStart(0) @@ -3590,11 +3466,11 @@ void HistoryPhoto::updateFrom(const MTPMessageMedia &media, HistoryItem *parent) } } -void HistoryPhoto::regItem(HistoryItem *item) { +void HistoryPhoto::attachToItem(HistoryItem *item) { App::regPhotoItem(_data, item); } -void HistoryPhoto::unregItem(HistoryItem *item) { +void HistoryPhoto::detachFromItem(HistoryItem *item) { App::unregPhotoItem(_data, item); } @@ -3859,7 +3735,7 @@ void HistoryVideo::updateStatusText(const HistoryItem *parent) const { statusSize = _data->uploadOffset; } else if (_data->loading()) { statusSize = _data->loadOffset(); - } else if (!_data->already().isEmpty()) { + } else if (_data->loaded()) { statusSize = FileStatusSizeLoaded; } else { statusSize = FileStatusSizeReady; @@ -3869,11 +3745,11 @@ void HistoryVideo::updateStatusText(const HistoryItem *parent) const { } } -void HistoryVideo::regItem(HistoryItem *item) { +void HistoryVideo::attachToItem(HistoryItem *item) { App::regDocumentItem(_data, item); } -void HistoryVideo::unregItem(HistoryItem *item) { +void HistoryVideo::detachFromItem(HistoryItem *item) { App::unregDocumentItem(_data, item); } @@ -3906,15 +3782,15 @@ void HistoryDocumentVoice::ensurePlayback(const HistoryDocument *that) const { void HistoryDocumentVoice::checkPlaybackFinished() const { if (_playback && !_playback->_a_progress.animating()) { delete _playback; - _playback = 0; + _playback = nullptr; } } HistoryDocument::HistoryDocument(DocumentData *document, const QString &caption, const HistoryItem *parent) : HistoryFileMedia() -, _parent(0) +, _parent(nullptr) , _data(document) { - create(!caption.isEmpty()); - if (HistoryDocumentNamed *named = Get()) { + createInterfaces(!caption.isEmpty()); + if (auto *named = Get()) { named->_name = documentName(_data); named->_namew = st::semiboldFont->width(named->_name); } @@ -3923,21 +3799,21 @@ HistoryDocument::HistoryDocument(DocumentData *document, const QString &caption, setStatusSize(FileStatusSizeReady); - if (HistoryDocumentCaptioned *captioned = Get()) { + if (auto *captioned = Get()) { captioned->_caption.setText(st::msgFont, caption + parent->skipBlock(), itemTextNoMonoOptions(parent)); } } HistoryDocument::HistoryDocument(const HistoryDocument &other) : HistoryFileMedia() -, Interfaces() -, _parent(0) +, Composer() +, _parent(nullptr) , _data(other._data) { - const HistoryDocumentCaptioned *captioned = other.Get(); - create(captioned != 0); - if (HistoryDocumentNamed *named = Get()) { - if (const HistoryDocumentNamed *oin = other.Get()) { - named->_name = oin->_name; - named->_namew = oin->_namew; + auto *captioned = other.Get(); + createInterfaces(captioned != 0); + if (auto *named = Get()) { + if (auto *othernamed = other.Get()) { + named->_name = othernamed->_name; + named->_namew = othernamed->_namew; } else { named->_name = documentName(_data); named->_namew = st::semiboldFont->width(named->_name); @@ -3953,7 +3829,7 @@ HistoryDocument::HistoryDocument(const HistoryDocument &other) : HistoryFileMedi } } -void HistoryDocument::create(bool caption) { +void HistoryDocument::createInterfaces(bool caption) { uint64 mask = 0; if (_data->voice()) { mask |= HistoryDocumentVoice::Bit(); @@ -3966,8 +3842,8 @@ void HistoryDocument::create(bool caption) { if (caption) { mask |= HistoryDocumentCaptioned::Bit(); } - UpdateInterfaces(mask); - if (HistoryDocumentThumbed *thumbed = Get()) { + UpdateComponents(mask); + if (auto *thumbed = Get()) { thumbed->_linksavel.reset(new DocumentSaveLink(_data)); thumbed->_linkcancell.reset(new DocumentCancelLink(_data)); } @@ -3976,12 +3852,12 @@ void HistoryDocument::create(bool caption) { void HistoryDocument::initDimensions(const HistoryItem *parent) { _parent = parent; - HistoryDocumentCaptioned *captioned = Get(); + auto *captioned = Get(); if (captioned && captioned->_caption.hasSkipBlock()) { captioned->_caption.setSkipBlock(parent->skipBlockWidth(), parent->skipBlockHeight()); } - HistoryDocumentThumbed *thumbed = Get(); + auto *thumbed = Get(); if (thumbed) { _data->thumb->load(); int32 tw = convertScale(_data->thumb->width()), th = convertScale(_data->thumb->height()); @@ -4006,13 +3882,16 @@ void HistoryDocument::initDimensions(const HistoryItem *parent) { _maxw = qMax(_maxw, tleft + documentMaxStatusWidth(_data) + unread + parent->skipBlockWidth() + st::msgPadding.right()); } - if (HistoryDocumentNamed *named = Get()) { + if (auto *named = Get()) { _maxw = qMax(tleft + named->_namew + tright, _maxw); _maxw = qMin(_maxw, int(st::msgMaxWidth)); } if (thumbed) { _minh = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom(); + if (!captioned && parent->Has()) { + _minh += st::msgDateFont->height - st::msgDateDelta.y(); + } } else { _minh = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom(); } @@ -4025,7 +3904,7 @@ void HistoryDocument::initDimensions(const HistoryItem *parent) { } int32 HistoryDocument::resize(int32 width, const HistoryItem *parent) { - HistoryDocumentCaptioned *captioned = Get(); + auto *captioned = Get(); if (!captioned) { return HistoryFileMedia::resize(width, parent); } @@ -4061,7 +3940,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r bool radial = isRadialAnimation(ms); int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0; - if (const HistoryDocumentThumbed *thumbed = Get()) { + if (auto *thumbed = Get()) { nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right(); nametop = st::msgFileThumbNameTop; nameright = st::msgFileThumbPadding.left(); @@ -4169,7 +4048,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r } int32 namewidth = _width - nameleft - nameright; - if (const HistoryDocumentVoice *voice = Get()) { + if (auto *voice = Get()) { const VoiceWaveform *wf = 0; uchar norm_value = 0; if (_data->voice()) { @@ -4228,7 +4107,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r sum_i += bar_count; } } - } else if (const HistoryDocumentNamed *named = Get()) { + } else if (auto *named = Get()) { p.setFont(st::semiboldFont); p.setPen(st::black); if (namewidth < named->_namew) { @@ -4255,7 +4134,7 @@ void HistoryDocument::draw(Painter &p, const HistoryItem *parent, const QRect &r } } - if (const HistoryDocumentCaptioned *captioned = Get()) { + if (auto *captioned = Get()) { p.setPen(st::black); captioned->_caption.draw(p, st::msgPadding.left(), bottom, captionw); } @@ -4270,7 +4149,7 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 bool showPause = updateStatusText(parent); int32 nameleft = 0, nametop = 0, nameright = 0, statustop = 0, linktop = 0, bottom = 0; - if (const HistoryDocumentThumbed *thumbed = Get()) { + if (auto *thumbed = Get()) { nameleft = st::msgFileThumbPadding.left() + st::msgFileThumbSize + st::msgFileThumbPadding.right(); linktop = st::msgFileThumbLinkTop; bottom = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom(); @@ -4299,7 +4178,7 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 } int32 height = _height; - if (const HistoryDocumentCaptioned *captioned = Get()) { + if (auto *captioned = Get()) { if (y >= bottom) { bool inText = false; captioned->_caption.getState(lnk, inText, x - st::msgPadding.left(), y - bottom, _width - st::msgPadding.left() - st::msgPadding.right()); @@ -4316,13 +4195,15 @@ void HistoryDocument::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 const QString HistoryDocument::inDialogsText() const { QString result; - if (Get()) { + if (Has()) { result = lang(lng_in_dlg_audio); + } else if (_data->song()) { + result = lang(lng_in_dlg_audio_file); } else { - const HistoryDocumentNamed *named = Get(); + auto *named = Get(); result = (!named || named->_name.isEmpty()) ? lang(lng_in_dlg_file) : named->_name; } - if (const HistoryDocumentCaptioned *captioned = Get()) { + if (auto *captioned = Get()) { if (!captioned->_caption.isEmpty()) { result.append(' ').append(captioned->_caption.original(0, 0xFFFF, Text::ExpandLinksNone)); } @@ -4331,24 +4212,31 @@ const QString HistoryDocument::inDialogsText() const { } const QString HistoryDocument::inHistoryText() const { - QString result = qsl("[ ") + lang(Get() ? lng_in_dlg_audio : lng_in_dlg_file); - if (const HistoryDocumentNamed *named = Get()) { + QString result; + if (Has()) { + result = lang(lng_in_dlg_audio); + } else if (_data->song()) { + result = lang(lng_in_dlg_audio_file); + } else { + result = lang(lng_in_dlg_file); + } + if (auto *named = Get()) { if (!named->_name.isEmpty()) { result.append(qsl(" : ")).append(named->_name); } } - if (const HistoryDocumentCaptioned *captioned = Get()) { + if (auto *captioned = Get()) { if (!captioned->_caption.isEmpty()) { result.append(qsl(", ")).append(captioned->_caption.original(0, 0xFFFF, Text::ExpandLinksAll)); } } - return result.append(qsl(" ]")); + return qsl("[ ") + result.append(qsl(" ]")); } void HistoryDocument::setStatusSize(int32 newSize, qint64 realDuration) const { int32 duration = _data->song() ? _data->song()->duration : (_data->voice() ? _data->voice()->duration : -1); HistoryFileMedia::setStatusSize(newSize, _data->size, duration, realDuration); - if (const HistoryDocumentThumbed *thumbed = Get()) { + if (auto *thumbed = Get()) { if (_statusSize == FileStatusSizeReady) { thumbed->_link = lang(lng_media_download).toUpper(); } else if (_statusSize == FileStatusSizeLoaded) { @@ -4384,7 +4272,7 @@ bool HistoryDocument::updateStatusText(const HistoryItem *parent) const { } if (playing.msgId == parent->fullId() && !(playingState & AudioPlayerStoppedMask) && playingState != AudioPlayerFinishing) { - if (const HistoryDocumentVoice *voice = Get()) { + if (auto *voice = Get()) { bool was = voice->_playback; voice->ensurePlayback(this); if (!was || playingPosition != voice->_playback->_position) { @@ -4404,7 +4292,7 @@ bool HistoryDocument::updateStatusText(const HistoryItem *parent) const { showPause = (playingState == AudioPlayerPlaying || playingState == AudioPlayerResuming || playingState == AudioPlayerStarting); } else { statusSize = FileStatusSizeLoaded; - if (const HistoryDocumentVoice *voice = Get()) { + if (auto *voice = Get()) { voice->checkPlaybackFinished(); } } @@ -4440,7 +4328,7 @@ bool HistoryDocument::updateStatusText(const HistoryItem *parent) const { } void HistoryDocument::step_voiceProgress(float64 ms, bool timer) { - if (HistoryDocumentVoice *voice = Get()) { + if (auto *voice = Get()) { if (voice->_playback) { float64 dt = ms / (2 * AudioVoiceMsgUpdateView); if (dt >= 1) { @@ -4454,11 +4342,11 @@ void HistoryDocument::step_voiceProgress(float64 ms, bool timer) { } } -void HistoryDocument::regItem(HistoryItem *item) { +void HistoryDocument::attachToItem(HistoryItem *item) { App::regDocumentItem(_data, item); } -void HistoryDocument::unregItem(HistoryItem *item) { +void HistoryDocument::detachFromItem(HistoryItem *item) { App::unregDocumentItem(_data, item); } @@ -4480,12 +4368,12 @@ ImagePtr HistoryDocument::replyPreview() { } HistoryGif::HistoryGif(DocumentData *document, const QString &caption, const HistoryItem *parent) : HistoryFileMedia() -, _parent(0) +, _parent(nullptr) , _data(document) , _thumbw(1) , _thumbh(1) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) -, _gif(0) { +, _gif(nullptr) { setLinks(new GifOpenLink(_data), new GifOpenLink(_data), new DocumentCancelLink(_data)); setStatusSize(FileStatusSizeReady); @@ -4498,12 +4386,12 @@ HistoryGif::HistoryGif(DocumentData *document, const QString &caption, const His } HistoryGif::HistoryGif(const HistoryGif &other) : HistoryFileMedia() -, _parent(0) +, _parent(nullptr) , _data(other._data) , _thumbw(other._thumbw) , _thumbh(other._thumbh) , _caption(other._caption) -, _gif(0) { +, _gif(nullptr) { setLinks(new GifOpenLink(_data), new GifOpenLink(_data), new DocumentCancelLink(_data)); setStatusSize(other._statusSize); @@ -4627,8 +4515,7 @@ void HistoryGif::draw(Painter &p, const HistoryItem *parent, const QRect &r, boo _data->automaticLoad(parent); bool loaded = _data->loaded(), displayLoading = (parent->id < 0) || _data->displayLoading(); if (loaded && !gif() && _gif != BadClipReader && cAutoPlayGif()) { - const_cast(this)->playInline(const_cast(parent)); - if (gif()) _gif->setAutoplay(); + Ui::autoplayMediaInlineAsync(parent->fullId()); } int32 skipx = 0, skipy = 0, width = _width, height = _height; @@ -4804,11 +4691,11 @@ void HistoryGif::updateStatusText(const HistoryItem *parent) const { } } -void HistoryGif::regItem(HistoryItem *item) { +void HistoryGif::attachToItem(HistoryItem *item) { App::regDocumentItem(_data, item); } -void HistoryGif::unregItem(HistoryItem *item) { +void HistoryGif::detachFromItem(HistoryItem *item) { App::unregDocumentItem(_data, item); } @@ -4822,7 +4709,7 @@ ImagePtr HistoryGif::replyPreview() { return _data->makeReplyPreview(); } -bool HistoryGif::playInline(HistoryItem *parent) { +bool HistoryGif::playInline(HistoryItem *parent, bool autoplay) { if (gif()) { stopInline(parent); } else { @@ -4831,6 +4718,7 @@ bool HistoryGif::playInline(HistoryItem *parent) { } _gif = new ClipReader(_data->location(), _data->data(), func(parent, &HistoryItem::clipCallback)); App::regGifItem(_gif, parent); + if (gif()) _gif->setAutoplay(); } return true; } @@ -4842,8 +4730,7 @@ void HistoryGif::stopInline(HistoryItem *parent) { _gif = 0; } - parent->initDimensions(); - Notify::historyItemResized(parent); + parent->setPendingInitDimensions(); Notify::historyItemLayoutChanged(parent); } @@ -4892,7 +4779,7 @@ void HistorySticker::initDimensions(const HistoryItem *parent) { if (_pixh < 1) _pixh = 1; _maxw = qMax(_pixw, int16(st::minPhotoSize)); _minh = qMax(_pixh, int16(st::minPhotoSize)); - if (const HistoryReply *reply = toHistoryReply(parent)) { + if (auto *reply = parent->Get()) { _maxw += st::msgReplyPadding.left() + reply->replyToWidth(); } _height = _minh; @@ -4900,10 +4787,10 @@ void HistorySticker::initDimensions(const HistoryItem *parent) { int32 HistorySticker::resize(int32 width, const HistoryItem *parent) { // return new height _width = qMin(width, _maxw); - if (const HistoryReply *reply = toHistoryReply(parent)) { + if (auto *reply = parent->Get()) { int32 usew = _maxw - st::msgReplyPadding.left() - reply->replyToWidth(); int32 rw = _width - usew - st::msgReplyPadding.left() - st::msgReplyPadding.left() - st::msgReplyPadding.right(); - reply->resizeVia(rw); + reply->resize(rw); } return _height; } @@ -4914,10 +4801,10 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r, _data->checkSticker(); bool loaded = _data->loaded(); - bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost, hovered, pressed; + bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; int32 usew = _maxw, usex = 0; - const HistoryReply *reply = toHistoryReply(parent); + auto *reply = parent->Get(); if (reply) { usew -= st::msgReplyPadding.left() + reply->replyToWidth(); if (isPost) { @@ -4951,7 +4838,11 @@ void HistorySticker::draw(Painter &p, const HistoryItem *parent, const QRect &r, App::roundRect(p, rx, ry, rw, rh, selected ? App::msgServiceSelectBg() : App::msgServiceBg(), selected ? ServiceSelectedCorners : ServiceCorners); - reply->drawReplyTo(p, rx + st::msgReplyPadding.left(), ry, rw - st::msgReplyPadding.left() - st::msgReplyPadding.right(), selected, true); + HistoryMessageReply::PaintFlags flags = 0; + if (selected) { + flags |= HistoryMessageReply::PaintSelected; + } + reply->paint(p, parent, rx + st::msgReplyPadding.left(), ry, rw - st::msgReplyPadding.left() - st::msgReplyPadding.right(), flags); } } } @@ -4962,7 +4853,7 @@ void HistorySticker::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 bool out = parent->out(), isPost = parent->isPost(), outbg = out && !isPost; int32 usew = _maxw, usex = 0; - const HistoryReply *reply = toHistoryReply(parent); + auto *reply = parent->Get(); if (reply) { usew -= reply->replyToWidth(); if (isPost) { @@ -4996,11 +4887,11 @@ const QString HistorySticker::inHistoryText() const { return qsl("[ ") + inDialogsText() + qsl(" ]"); } -void HistorySticker::regItem(HistoryItem *item) { +void HistorySticker::attachToItem(HistoryItem *item) { App::regDocumentItem(_data, item); } -void HistorySticker::unregItem(HistoryItem *item) { +void HistorySticker::detachFromItem(HistoryItem *item) { App::unregDocumentItem(_data, item); } @@ -5052,7 +4943,7 @@ void HistoryContact::initDimensions(const HistoryItem *parent) { _contact = _userId ? App::userLoaded(_userId) : 0; if (_contact) { - _contact->photo->load(); + _contact->loadUserpic(); } if (_contact && _contact->contact > 0) { _linkl.reset(new SendMessageLink(_contact)); @@ -5104,11 +4995,10 @@ void HistoryContact::draw(Painter &p, const HistoryItem *parent, const QRect &r, linktop = st::msgFileThumbLinkTop; QRect rthumb(rtlrect(st::msgFileThumbPadding.left(), st::msgFileThumbPadding.top(), st::msgFileThumbSize, st::msgFileThumbSize, width)); - if (_contact && _contact->photo->loaded()) { - QPixmap thumb = _contact->photo->pixRounded(st::msgFileThumbSize, st::msgFileThumbSize); - p.drawPixmap(rthumb.topLeft(), thumb); + if (_contact) { + _contact->paintUserpic(p, st::msgFileThumbSize, rthumb.x(), rthumb.y()); } else { - p.drawPixmap(rthumb.topLeft(), userDefPhoto(_contact ? _contact->colorIndex : (qAbs(_userId) % UserColorsCount))->pixRounded(st::msgFileThumbSize, st::msgFileThumbSize)); + p.drawPixmap(rthumb.topLeft(), userDefPhoto(qAbs(_userId) % UserColorsCount)->pixCircled(st::msgFileThumbSize, st::msgFileThumbSize)); } if (selected) { App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, SelectedOverlayCorners); @@ -5125,7 +5015,7 @@ void HistoryContact::draw(Painter &p, const HistoryItem *parent, const QRect &r, statustop = st::msgFileStatusTop; QRect inner(rtlrect(st::msgFilePadding.left(), st::msgFilePadding.top(), st::msgFileSize, st::msgFileSize, width)); - p.drawPixmap(inner.topLeft(), userDefPhoto(qAbs(parent->id) % UserColorsCount)->pixRounded(st::msgFileSize, st::msgFileSize)); + p.drawPixmap(inner.topLeft(), userDefPhoto(qAbs(parent->id) % UserColorsCount)->pixCircled(st::msgFileSize, st::msgFileSize)); } int32 namewidth = width - nameleft - nameright; @@ -5165,13 +5055,13 @@ const QString HistoryContact::inHistoryText() const { return qsl("[ ") + lang(lng_in_dlg_contact) + qsl(" : ") + _name.original() + qsl(", ") + _phone + qsl(" ]"); } -void HistoryContact::regItem(HistoryItem *item) { +void HistoryContact::attachToItem(HistoryItem *item) { if (_userId) { App::regSharedContactItem(_userId, item); } } -void HistoryContact::unregItem(HistoryItem *item) { +void HistoryContact::detachFromItem(HistoryItem *item) { if (_userId) { App::unregSharedContactItem(_userId, item); } @@ -5180,9 +5070,9 @@ void HistoryContact::unregItem(HistoryItem *item) { void HistoryContact::updateFrom(const MTPMessageMedia &media, HistoryItem *parent) { if (media.type() == mtpc_messageMediaContact) { if (_userId != media.c_messageMediaContact().vuser_id.v) { - unregItem(parent); + detachFromItem(parent); _userId = media.c_messageMediaContact().vuser_id.v; - regItem(parent); + attachToItem(parent); } } } @@ -5635,14 +5525,14 @@ void HistoryWebPage::linkOut(HistoryItem *parent, const TextLinkPtr &lnk) { } } -void HistoryWebPage::regItem(HistoryItem *item) { +void HistoryWebPage::attachToItem(HistoryItem *item) { App::regWebPageItem(_data, item); - if (_attach) _attach->regItem(item); + if (_attach) _attach->attachToItem(item); } -void HistoryWebPage::unregItem(HistoryItem *item) { +void HistoryWebPage::detachFromItem(HistoryItem *item) { App::unregWebPageItem(_data, item); - if (_attach) _attach->unregItem(item); + if (_attach) _attach->detachFromItem(item); } const QString HistoryWebPage::inDialogsText() const { @@ -5892,7 +5782,7 @@ void HistoryLocation::initDimensions(const HistoryItem *parent) { _minh += st::mediaPadding.top() + st::mediaPadding.bottom(); if (!_title.isEmpty() || !_description.isEmpty()) { _minh += st::webPagePhotoSkip; - if (!parent->Is() && !parent->toHistoryReply()) { + if (!parent->Has() && !parent->Has()) { _minh += st::msgPadding.top(); } } @@ -5932,7 +5822,7 @@ int32 HistoryLocation::resize(int32 width, const HistoryItem *parent) { } if (!_title.isEmpty() || !_description.isEmpty()) { _height += st::webPagePhotoSkip; - if (!parent->Is() && !parent->toHistoryReply()) { + if (!parent->Has() && !parent->Has()) { _height += st::msgPadding.top(); } } @@ -5951,7 +5841,7 @@ void HistoryLocation::draw(Painter &p, const HistoryItem *parent, const QRect &r skipy = st::mediaPadding.top(); if (!_title.isEmpty() || !_description.isEmpty()) { - if (!parent->Is() && !parent->toHistoryReply()) { + if (!parent->Has() && !parent->Has()) { skipy += st::msgPadding.top(); } } @@ -6014,7 +5904,7 @@ void HistoryLocation::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 skipy = st::mediaPadding.top(); if (!_title.isEmpty() || !_description.isEmpty()) { - if (!parent->Is() && !parent->toHistoryReply()) { + if (!parent->Has() && !parent->Has()) { skipy += st::msgPadding.top(); } } @@ -6066,12 +5956,6 @@ void ViaInlineBotLink::onClick(Qt::MouseButton button) const { App::insertBotCommand('@' + _bot->username); } -HistoryMessageVia::HistoryMessageVia(Interfaces *) -: _bot(0) -, _width(0) -, _maxWidth(0) { -} - void HistoryMessageVia::create(int32 userId) { _bot = App::user(peerFromUser(userId)); _maxWidth = st::msgServiceNameFont->width(lng_inline_bot_via(lt_inline_bot, '@' + _bot->username)); @@ -6093,14 +5977,6 @@ void HistoryMessageVia::resize(int32 availw) const { } } -HistoryMessageViews::HistoryMessageViews(Interfaces *) -: _views(0) -, _viewsWidth(0) { -} - -HistoryMessageSigned::HistoryMessageSigned(Interfaces *) { -} - void HistoryMessageSigned::create(UserData *from, const QDateTime &date) { QString time = qsl(", ") + date.toString(cTimeFormat()), name = App::peerName(from); int32 timew = st::msgDateFont->width(time), namew = st::msgDateFont->width(name); @@ -6110,17 +5986,10 @@ void HistoryMessageSigned::create(UserData *from, const QDateTime &date) { _signature.setText(st::msgDateFont, name + time, _textNameOptions); } -int32 HistoryMessageSigned::maxWidth() const { +int HistoryMessageSigned::maxWidth() const { return _signature.maxWidth(); } -HistoryMessageForwarded::HistoryMessageForwarded(Interfaces *) -: _authorOriginal(0) -, _fromOriginal(0) -, _originalId(0) -, _text(1) { -} - void HistoryMessageForwarded::create(const HistoryMessageVia *via) const { QString text; if (_authorOriginal != _fromOriginal) { @@ -6151,12 +6020,150 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const { } } -HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg) : - HistoryItem(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) -, _text(st::msgMinWidth) -, _textWidth(0) -, _textHeight(0) -, _media(0) { +bool HistoryMessageReply::updateData(HistoryMessage *holder, bool force) { + if (!force) { + if (replyToMsg || !replyToMsgId) { + return true; + } + } + if (!replyToMsg) { + replyToMsg = App::histItemById(holder->channelId(), replyToMsgId); + if (replyToMsg) { + App::historyRegDependency(holder, replyToMsg); + } + } + + if (replyToMsg) { + replyToText.setText(st::msgFont, replyToMsg->inReplyText(), _textDlgOptions); + + updateName(); + + replyToLnk = TextLinkPtr(new MessageLink(replyToMsg->history()->peer->id, replyToMsg->id)); + if (!replyToMsg->Has()) { + if (UserData *bot = replyToMsg->viaBot()) { + _replyToVia = new HistoryMessageVia(0); + _replyToVia->create(peerToUser(bot->id)); + } + } + } else if (force) { + replyToMsgId = 0; + } + if (force) { + holder->setPendingInitDimensions(); + } + return (replyToMsg || !replyToMsgId); +} + +void HistoryMessageReply::clearData(HistoryMessage *holder) { + delete _replyToVia; + _replyToVia = nullptr; + if (replyToMsg) { + App::historyUnregDependency(holder, replyToMsg); + replyToMsg = nullptr; + } + replyToMsgId = 0; +} + +void HistoryMessageReply::checkNameUpdate() const { + if (replyToMsg && replyToMsg->author()->nameVersion > replyToVersion) { + updateName(); + } +} + +void HistoryMessageReply::updateName() const { + if (replyToMsg) { + QString name = (_replyToVia && replyToMsg->author()->isUser()) ? replyToMsg->author()->asUser()->firstName : App::peerName(replyToMsg->author()); + replyToName.setText(st::msgServiceNameFont, name, _textNameOptions); + replyToVersion = replyToMsg->author()->nameVersion; + bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; + int32 previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; + int32 w = replyToName.maxWidth(); + if (_replyToVia) { + w += st::msgServiceFont->spacew + _replyToVia->_maxWidth; + } + + _maxReplyWidth = previewSkip + qMax(w, qMin(replyToText.maxWidth(), int32(st::maxSignatureSize))); + } else { + _maxReplyWidth = st::msgDateFont->width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message)); + } + _maxReplyWidth = st::msgReplyPadding.left() + st::msgReplyBarSkip + _maxReplyWidth + st::msgReplyPadding.right(); +} + +void HistoryMessageReply::resize(int width) const { + if (_replyToVia) { + bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; + int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; + _replyToVia->resize(width - st::msgReplyBarSkip - previewSkip - replyToName.maxWidth() - st::msgServiceFont->spacew); + } +} + +void HistoryMessageReply::itemRemoved(HistoryMessage *holder, HistoryItem *removed) { + if (replyToMsg == removed) { + clearData(holder); + holder->setPendingInitDimensions(); + } +} + +void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, int y, int w, PaintFlags flags) const { + bool selected = (flags & PaintSelected), outbg = holder->hasOutLayout(); + + style::color bar; + if (flags & PaintInBubble) { + bar = ((flags & PaintSelected) ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); + } else { + bar = st::white; + } + QRect rbar(rtlrect(x + st::msgReplyBarPos.x(), y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.width(), st::msgReplyBarSize.height(), w + 2 * x)); + p.fillRect(rbar, bar); + + if (w > st::msgReplyBarSkip) { + if (replyToMsg) { + bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; + int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; + + if (hasPreview) { + ImagePtr replyPreview = replyToMsg->getMedia()->replyPreview(); + if (!replyPreview->isNull()) { + QRect to(rtlrect(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height(), w + 2 * x)); + p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height())); + if (selected) { + App::roundRect(p, to, textstyleCurrent()->selectOverlay, SelectedOverlayCorners); + } + } + } + if (w > st::msgReplyBarSkip + previewSkip) { + if (flags & PaintInBubble) { + p.setPen(selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); + } else { + p.setPen(st::white); + } + replyToName.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top(), w - st::msgReplyBarSkip - previewSkip, w + 2 * x); + if (_replyToVia && w > st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew) { + p.setFont(st::msgServiceFont); + p.drawText(x + st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew, y + st::msgReplyPadding.top() + st::msgServiceFont->ascent, _replyToVia->_text); + } + + HistoryMessage *replyToAsMsg = replyToMsg->toHistoryMessage(); + if (!(flags & PaintInBubble)) { + } else if ((replyToAsMsg && replyToAsMsg->emptyText()) || replyToMsg->serviceMsg()) { + style::color date(outbg ? (selected ? st::msgOutDateFgSelected : st::msgOutDateFg) : (selected ? st::msgInDateFgSelected : st::msgInDateFg)); + p.setPen(date); + } else { + p.setPen(st::msgColor); + } + replyToText.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top() + st::msgServiceNameFont->height, w - st::msgReplyBarSkip - previewSkip, w + 2 * x); + } + } else { + p.setFont(st::msgDateFont); + style::color date(outbg ? (selected ? st::msgOutDateFgSelected : st::msgOutDateFg) : (selected ? st::msgInDateFgSelected : st::msgInDateFg)); + p.setPen((flags & PaintInBubble) ? date : st::white); + p.drawTextLeft(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2, w + 2 * x, st::msgDateFont->elided(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message), w - st::msgReplyBarSkip)); + } + } +} + +HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg) +: HistoryItem(history, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) { PeerId authorOriginalId = 0, fromOriginalId = 0; MsgId originalId = 0; if (msg.has_fwd_from() && msg.vfwd_from.type() == mtpc_messageFwdHeader) { @@ -6167,69 +6174,66 @@ HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, const MTPD if (f.has_channel_post()) originalId = f.vchannel_post.v; } } - create(msg.has_via_bot_id() ? msg.vvia_bot_id.v : 0, msg.has_views() ? msg.vviews.v : -1, authorOriginalId, fromOriginalId, originalId); + MsgId replyTo = msg.has_reply_to_msg_id() ? msg.vreply_to_msg_id.v : 0; + int32 viaBotId = msg.has_via_bot_id() ? msg.vvia_bot_id.v : 0; + int views = msg.has_views() ? msg.vviews.v : -1; + createInterfaces(replyTo, viaBotId, views, authorOriginalId, fromOriginalId, originalId); QString text(textClean(qs(msg.vmessage))); initMedia(msg.has_media() ? (&msg.vmedia) : 0, text); setText(text, msg.has_entities() ? entitiesFromMTP(msg.ventities.c_vector().v) : EntitiesInText()); } -HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *fwd) -: HistoryItem(history, block, id, newForwardedFlags(history->peer, from, fwd) | flags, date, from) -, _text(st::msgMinWidth) -, _textWidth(0) -, _textHeight(0) -, _media(0) { +HistoryMessage::HistoryMessage(History *history, MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *fwd) +: HistoryItem(history, id, newForwardedFlags(history->peer, from, fwd) | flags, date, from) { UserData *fwdViaBot = fwd->viaBot(); int32 viaBotId = fwdViaBot ? peerToUser(fwdViaBot->id) : 0; - int32 fwdViewsCount = fwd->viewsCount(), views = (fwdViewsCount > 0) ? fwdViewsCount : (isPost() ? 1 : -1); - create(viaBotId, views, fwd->authorOriginal()->id, fwd->fromOriginal()->id, fwd->authorOriginal()->isChannel() ? fwd->id : 0); + int fwdViewsCount = fwd->viewsCount(), views = (fwdViewsCount > 0) ? fwdViewsCount : (isPost() ? 1 : -1); + MsgId replyTo = 0; + createInterfaces(replyTo, viaBotId, views, fwd->authorOriginal()->id, fwd->fromOriginal()->id, fwd->authorOriginal()->isChannel() ? fwd->id : 0); if (HistoryMedia *mediaOriginal = fwd->getMedia()) { _media = mediaOriginal->clone(); - _media->regItem(this); + _media->attachToItem(this); } setText(fwd->originalText(), fwd->originalEntities()); } -HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId id, int32 flags, int32 viaBotId, QDateTime date, int32 from, const QString &msg, const EntitiesInText &entities) - : HistoryItem(history, block, id, flags, date, (flags & MTPDmessage::flag_from_id) ? from : 0) - , _text(st::msgMinWidth) - , _textWidth(0) - , _textHeight(0) - , _media(0) { - create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1); +HistoryMessage::HistoryMessage(History *history, MsgId id, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, const QString &msg, const EntitiesInText &entities) +: HistoryItem(history, id, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) { + createInterfacesHelper(flags, replyTo, viaBotId); setText(msg, entities); } -HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, QDateTime date, int32 from, DocumentData *doc, const QString &caption) : -HistoryItem(history, block, msgId, flags, date, (flags & MTPDmessage::flag_from_id) ? from : 0) -, _text(st::msgMinWidth) -, _textWidth(0) -, _textHeight(0) -, _media(0) { - create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1); +HistoryMessage::HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, DocumentData *doc, const QString &caption) +: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) { + createInterfacesHelper(flags, replyTo, viaBotId); initMediaFromDocument(doc, caption); setText(QString(), EntitiesInText()); } -HistoryMessage::HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, QDateTime date, int32 from, PhotoData *photo, const QString &caption) : -HistoryItem(history, block, msgId, flags, date, (flags & MTPDmessage::flag_from_id) ? from : 0) -, _text(st::msgMinWidth) -, _textWidth(0) -, _textHeight(0) -, _media(0) { - create((flags & MTPDmessage::flag_via_bot_id) ? viaBotId : 0, isPost() ? 1 : -1); +HistoryMessage::HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, PhotoData *photo, const QString &caption) +: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) { + createInterfacesHelper(flags, replyTo, viaBotId); _media = new HistoryPhoto(photo, caption, this); - _media->regItem(this); + _media->attachToItem(this); setText(QString(), EntitiesInText()); } -void HistoryMessage::create(int32 viaBotId, int32 viewsCount, const PeerId &authorIdOriginal, const PeerId &fromIdOriginal, MsgId originalId) { +void HistoryMessage::createInterfacesHelper(MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId) { + if (!(flags & MTPDmessage::Flag::f_via_bot_id)) viaBotId = 0; + if (!(flags & MTPDmessage::Flag::f_reply_to_msg_id)) replyTo = 0; + createInterfaces(replyTo, viaBotId, isPost() ? 1 : -1); +} + +void HistoryMessage::createInterfaces(MsgId replyTo, int32 viaBotId, int32 viewsCount, const PeerId &authorIdOriginal, const PeerId &fromIdOriginal, MsgId originalId) { uint64 mask = 0; + if (replyTo) { + mask |= HistoryMessageReply::Bit(); + } if (viaBotId) { mask |= HistoryMessageVia::Bit(); } @@ -6242,17 +6246,23 @@ void HistoryMessage::create(int32 viaBotId, int32 viewsCount, const PeerId &auth if (authorIdOriginal && fromIdOriginal) { mask |= HistoryMessageForwarded::Bit(); } - UpdateInterfaces(mask); - if (HistoryMessageVia *via = Get()) { + UpdateComponents(mask); + if (auto *reply = Get()) { + reply->replyToMsgId = replyTo; + if (!reply->updateData(this) && App::api()) { + App::api()->requestMessageData(history()->peer->asChannel(), replyTo, new HistoryDependentItemCallback(fullId())); + } + } + if (auto *via = Get()) { via->create(viaBotId); } - if (HistoryMessageViews *views = Get()) { + if (auto *views = Get()) { views->_views = viewsCount; } - if (HistoryMessageSigned *msgsigned = Get()) { + if (auto *msgsigned = Get()) { msgsigned->create(_from->asUser(), date); } - if (HistoryMessageForwarded *fwd = Get()) { + if (auto *fwd = Get()) { fwd->_authorOriginal = App::peer(authorIdOriginal); fwd->_fromOriginal = App::peer(fromIdOriginal); fwd->_originalId = originalId; @@ -6280,13 +6290,13 @@ QString formatViewsCount(int32 views) { } void HistoryMessage::initTime() { - if (HistoryMessageSigned *msgsigned = Get()) { + if (auto *msgsigned = Get()) { _timeWidth = msgsigned->maxWidth(); } else { _timeText = date.toString(cTimeFormat()); _timeWidth = st::msgDateFont->width(_timeText); } - if (HistoryMessageViews *views = Get()) { + if (auto *views = Get()) { views->_viewsText = (views->_views >= 0) ? formatViewsCount(views->_views) : QString(); views->_viewsWidth = views->_viewsText.isEmpty() ? 0 : st::msgDateFont->width(views->_viewsText); } @@ -6337,7 +6347,7 @@ void HistoryMessage::initMedia(const MTPMessageMedia *media, QString ¤tTex } } break; }; - if (_media) _media->regItem(this); + if (_media) _media->attachToItem(this); } void HistoryMessage::initMediaFromDocument(DocumentData *doc, const QString &caption) { @@ -6350,7 +6360,7 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc, const QString &cap } else { _media = new HistoryDocument(doc, caption, this); } - _media->regItem(this); + _media->attachToItem(this); } int32 HistoryMessage::plainMaxWidth() const { @@ -6358,9 +6368,10 @@ int32 HistoryMessage::plainMaxWidth() const { } void HistoryMessage::initDimensions() { + auto *reply = Get(); if (drawBubble()) { - HistoryMessageForwarded *fwd = Get(); - HistoryMessageVia *via = Get(); + auto fwd = Get(); + auto via = Get(); if (fwd) { fwd->create(via); } @@ -6416,6 +6427,16 @@ void HistoryMessage::initDimensions() { _maxw = _media->maxWidth(); _minh = _media->minHeight(); } + if (reply) { + reply->updateName(); + if (!_media) { + int replyw = st::msgPadding.left() + reply->_maxReplyWidth - st::msgReplyPadding.left() - st::msgReplyPadding.right() + st::msgPadding.right(); + if (reply->_replyToVia) { + replyw += st::msgServiceFont->spacew + reply->_replyToVia->_maxWidth; + } + if (replyw > _maxw) _maxw = replyw; + } + } } void HistoryMessage::countPositionAndSize(int32 &left, int32 &width) const { @@ -6425,7 +6446,7 @@ void HistoryMessage::countPositionAndSize(int32 &left, int32 &width) const { } left = (!isPost() && out() && !Adaptive::Wide()) ? st::msgMargin.right() : st::msgMargin.left(); - if (displayFromPhoto()) { + if (hasFromPhoto()) { left += st::msgPhotoSkip; // } else if (!Adaptive::Wide() && !out() && !fromChannel() && st::msgPhotoSkip - (hmaxwidth - hwidth) > 0) { // left += st::msgPhotoSkip - (hmaxwidth - hwidth); @@ -6442,8 +6463,8 @@ void HistoryMessage::countPositionAndSize(int32 &left, int32 &width) const { void HistoryMessage::fromNameUpdated(int32 width) const { _authorNameVersion = author()->nameVersion; - if (!Is()) { - if (const HistoryMessageVia *via = Get()) { + if (!Has()) { + if (auto *via = Get()) { via->resize(width - st::msgPadding.left() - st::msgPadding.right() - author()->nameText.maxWidth() - st::msgServiceFont->spacew); } } @@ -6491,7 +6512,7 @@ QString HistoryMessage::selectedText(uint32 selection) const { uint16 selectedTo = (selection == FullSelection) ? 0xFFFF : (selection & 0xFFFF); result = _text.original(selectedFrom, selectedTo, Text::ExpandLinksAll); } - if (const HistoryMessageForwarded *fwd = Get()) { + if (auto *fwd = Get()) { if (selection == FullSelection) { QString fwdinfo = fwd->_text.original(0, 0xFFFF, Text::ExpandLinksAll), wrapped; wrapped.reserve(fwdinfo.size() + 4 + result.size()); @@ -6499,6 +6520,14 @@ QString HistoryMessage::selectedText(uint32 selection) const { result = wrapped; } } + if (auto *reply = Get()) { + if (selection == FullSelection && reply->replyToMsg) { + QString wrapped; + wrapped.reserve(lang(lng_in_reply_to).size() + reply->replyToMsg->author()->name.size() + 4 + result.size()); + wrapped.append('[').append(lang(lng_in_reply_to)).append(' ').append(reply->replyToMsg->author()->name).append(qsl("]\n")).append(result); + result = wrapped; + } + } return result; } @@ -6516,8 +6545,10 @@ void HistoryMessage::setMedia(const MTPMessageMedia *media) { bool mediaWasDisplayed = false; if (_media) { mediaWasDisplayed = _media->isDisplayed(); + + _media->detachFromItem(this); delete _media; - _media = 0; + _media = nullptr; } QString t; initMedia(media, t); @@ -6543,7 +6574,7 @@ void HistoryMessage::setText(const QString &text, const EntitiesInText &entities for (int32 i = 0, l = entities.size(); i != l; ++i) { if (entities.at(i).type == EntityInTextUrl || entities.at(i).type == EntityInTextCustomUrl || entities.at(i).type == EntityInTextEmail) { - _flags |= MTPDmessage_flag_HAS_TEXT_LINKS; + _flags |= MTPDmessage_ClientFlag::f_has_text_links; break; } } @@ -6592,7 +6623,7 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width } dateX += HistoryMessage::timeLeft(); - if (const HistoryMessageSigned *msgsigned = Get()) { + if (auto *msgsigned = Get()) { msgsigned->_signature.drawElided(p, dateX, dateY, _timeWidth); } else { p.drawText(dateX, dateY + st::msgDateFont->ascent, _timeText); @@ -6600,7 +6631,7 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width QPoint iconPos; const QRect *iconRect = 0; - if (const HistoryMessageViews *views = Get()) { + if (auto *views = Get()) { iconPos = QPoint(infoRight - infoW + st::msgViewsPos.x(), infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y()); if (id > 0) { if (outbg) { @@ -6638,8 +6669,8 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width } } -void HistoryMessage::setViewsCount(int32 count, bool reinit) { - HistoryMessageViews *views = Get(); +void HistoryMessage::setViewsCount(int32 count) { + auto *views = Get(); if (!views || views->_views == count || (count >= 0 && views->_views > count)) return; int32 was = views->_viewsWidth; @@ -6654,10 +6685,7 @@ void HistoryMessage::setViewsCount(int32 count, bool reinit) { _textWidth = 0; _textHeight = 0; } - if (reinit) { - initDimensions(); - Notify::historyItemResized(this); - } + setPendingInitDimensions(); } } @@ -6672,15 +6700,28 @@ void HistoryMessage::setId(MsgId newId) { _textWidth = 0; _textHeight = 0; } - initDimensions(); - Notify::historyItemResized(this); + setPendingInitDimensions(); } } void HistoryMessage::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { bool outbg = out() && !isPost(), bubble = drawBubble(), selected = (selection == FullSelection); - textstyleSet(&(outbg ? st::outTextStyle : st::inTextStyle)); + int left = 0, width = 0, height = _height; + countPositionAndSize(left, width); + if (width < 1) return; + + int dateh = 0, unreadbarh = 0; + if (auto *date = Get()) { + dateh = date->height(); + date->paint(p, 0, _history->width); + } + if (auto *unreadbar = Get()) { + unreadbarh = unreadbar->height(); + p.translate(0, dateh); + unreadbar->paint(p, 0, _history->width); + p.translate(0, -dateh); + } uint64 animms = App::main() ? App::main()->animActiveTimeStart(this) : 0; if (animms > 0 && animms <= ms) { @@ -6688,31 +6729,38 @@ void HistoryMessage::draw(Painter &p, const QRect &r, uint32 selection, uint64 m if (animms > st::activeFadeInDuration + st::activeFadeOutDuration) { App::main()->stopAnimActive(); } else { + int skiph = marginTop() - marginBottom(); + float64 dt = (animms > st::activeFadeInDuration) ? (1 - (animms - st::activeFadeInDuration) / float64(st::activeFadeOutDuration)) : (animms / float64(st::activeFadeInDuration)); float64 o = p.opacity(); p.setOpacity(o * dt); - p.fillRect(0, 0, _history->width, _height, textstyleCurrent()->selectOverlay->b); + p.fillRect(0, skiph, _history->width, height - skiph, textstyleCurrent()->selectOverlay->b); p.setOpacity(o); } } - int32 left = 0, width = 0; - countPositionAndSize(left, width); + textstyleSet(&(outbg ? st::outTextStyle : st::inTextStyle)); - if (displayFromPhoto()) { - int32 photoleft = left + ((outbg && !Adaptive::Wide()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip)); - p.drawPixmap(photoleft, _height - st::msgMargin.bottom() - st::msgPhotoSize, author()->photo->pixRounded(st::msgPhotoSize)); + //if (displayFromPhoto()) { + // int photoleft = left + ((outbg && !Adaptive::Wide()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip)); + // int phototop = marginTop(); + // author()->paintUserpic(p, st::msgPhotoSize, photoleft, phototop); + //} + + auto *reply = Get(); + if (reply) { + reply->checkNameUpdate(); } - if (width < 1) return; if (bubble) { - const HistoryMessageForwarded *fwd = Get(); - const HistoryMessageVia *via = Get(); + auto *fwd = Get(); + auto *via = Get(); if (displayFromName() && author()->nameVersion > _authorNameVersion) { fromNameUpdated(width); } - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); + int32 top = marginTop(); + QRect r(left, top, width, height - top - marginBottom()); style::color bg(selected ? (outbg ? st::msgOutBgSelected : st::msgInBgSelected) : (outbg ? st::msgOutBg : st::msgInBg)); style::color sh(selected ? (outbg ? st::msgOutShadowSelected : st::msgInShadowSelected) : (outbg ? st::msgOutShadow : st::msgInShadow)); @@ -6735,14 +6783,22 @@ void HistoryMessage::draw(Painter &p, const QRect &r, uint32 selection, uint64 m } QRect trect(r.marginsAdded(-st::msgPadding)); - drawMessageText(p, trect, selection); + + paintForwardedInfo(p, trect, selected); + paintReplyInfo(p, trect, selected); + paintViaBotIdInfo(p, trect, selected); + + p.setPen(st::msgColor); + p.setFont(st::msgFont); + uint16 selectedFrom = selected ? 0 : ((selection >> 16) & 0xFFFF); + uint16 selectedTo = selected ? 0 : (selection & 0xFFFF); + _text.draw(p, trect.x(), trect.y(), trect.width(), style::al_left, 0, -1, selectedFrom, selectedTo); if (_media && _media->isDisplayed()) { - p.save(); - int32 top = _height - st::msgMargin.bottom() - _media->height(); + int32 top = height - marginBottom() - _media->height(); p.translate(left, top); _media->draw(p, this, r.translated(-left, -top), selected, ms); - p.restore(); + p.translate(-left, -top); if (!_media->customInfoLayout()) { HistoryMessage::drawInfo(p, r.x() + r.width(), r.y() + r.height(), 2 * r.x() + r.width(), selected, InfoDisplayDefault); } @@ -6750,48 +6806,61 @@ void HistoryMessage::draw(Painter &p, const QRect &r, uint32 selection, uint64 m HistoryMessage::drawInfo(p, r.x() + r.width(), r.y() + r.height(), 2 * r.x() + r.width(), selected, InfoDisplayDefault); } } else { - p.save(); - int32 top = st::msgMargin.top(); + int32 top = marginTop(); p.translate(left, top); _media->draw(p, this, r.translated(-left, -top), selected, ms); - p.restore(); + p.translate(-left, -top); } textstyleRestore(); } -void HistoryMessage::drawMessageText(Painter &p, QRect trect, uint32 selection) const { +void HistoryMessage::paintForwardedInfo(Painter &p, QRect &trect, bool selected) const { if (displayForwardedFrom()) { style::font serviceFont(st::msgServiceFont), serviceName(st::msgServiceNameFont); - bool outbg = out() && !isPost(); - p.setPen((selection == FullSelection) ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); + p.setPen(selected ? (hasOutLayout() ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (hasOutLayout() ? st::msgOutServiceFg : st::msgInServiceFg)); p.setFont(serviceFont); - const HistoryMessageForwarded *fwd = Get(); + auto *fwd = Get(); bool breakEverywhere = (fwd->_text.countHeight(trect.width()) > 2 * serviceFont->height); - textstyleSet(&((selection == FullSelection) ? (outbg ? st::outFwdTextStyleSelected : st::inFwdTextStyleSelected) : (outbg ? st::outFwdTextStyle : st::inFwdTextStyle))); + textstyleSet(&(selected ? (hasOutLayout() ? st::outFwdTextStyleSelected : st::inFwdTextStyleSelected) : (hasOutLayout() ? st::outFwdTextStyle : st::inFwdTextStyle))); fwd->_text.drawElided(p, trect.x(), trect.y(), trect.width(), 2, style::al_left, 0, -1, 0, breakEverywhere); - textstyleSet(&(outbg ? st::outTextStyle : st::inTextStyle)); + textstyleSet(&(hasOutLayout() ? st::outTextStyle : st::inTextStyle)); trect.setY(trect.y() + (((fwd->_text.maxWidth() > trect.width()) ? 2 : 1) * serviceFont->height)); } +} - bool outbg = out() && !isPost(), selected = (selection == FullSelection); - if (!displayFromName() && !Is()) { - if (const HistoryMessageVia *via = Get()) { +void HistoryMessage::paintReplyInfo(Painter &p, QRect &trect, bool selected) const { + if (auto *reply = Get()) { + int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + + HistoryMessageReply::PaintFlags flags = HistoryMessageReply::PaintInBubble; + if (selected) { + flags |= HistoryMessageReply::PaintSelected; + } + reply->paint(p, this, trect.x(), trect.y(), trect.width(), flags); + + trect.setY(trect.y() + h); + } +} + +void HistoryMessage::paintViaBotIdInfo(Painter &p, QRect &trect, bool selected) const { + if (!displayFromName() && !Has()) { + if (auto *via = Get()) { p.setFont(st::msgServiceNameFont); - p.setPen(selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); + p.setPen(selected ? (hasOutLayout() ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (hasOutLayout() ? st::msgOutServiceFg : st::msgInServiceFg)); p.drawTextLeft(trect.left(), trect.top(), _history->width, via->_text); trect.setY(trect.y() + st::msgServiceNameFont->height); } } +} - p.setPen(st::msgColor); - p.setFont(st::msgFont); - uint16 selectedFrom = (selection == FullSelection) ? 0 : (selection >> 16) & 0xFFFF; - uint16 selectedTo = (selection == FullSelection) ? 0 : selection & 0xFFFF; - _text.draw(p, trect.x(), trect.y(), trect.width(), style::al_left, 0, -1, selectedFrom, selectedTo); +void HistoryMessage::dependencyItemRemoved(HistoryItem *dependency) { + if (auto *reply = Get()) { + reply->itemRemoved(this, dependency); + } } void HistoryMessage::destroy() { @@ -6799,7 +6868,7 @@ void HistoryMessage::destroy() { HistoryItem::destroy(); } -int32 HistoryMessage::resize(int32 width) { +int HistoryMessage::resizeGetHeight_(int width) { if (width < st::msgMinWidth) return _height; width -= st::msgMargin.left() + st::msgMargin.right(); @@ -6809,8 +6878,9 @@ int32 HistoryMessage::resize(int32 width) { width = st::msgMaxWidth; } if (drawBubble()) { - HistoryMessageForwarded *fwd = Get(); - HistoryMessageVia *via = Get(); + auto *fwd = Get(); + auto *reply = Get(); + auto *via = Get(); bool media = (_media && _media->isDisplayed()); if (width >= _maxw) { @@ -6863,23 +6933,33 @@ int32 HistoryMessage::resize(int32 width) { _height += fwdheight; } } + + if (reply) { + if (emptyText() && !displayFromName() && !Has()) { + _height += st::msgPadding.top() + st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaHeaderSkip; + } else { + _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + } + reply->resize(width - st::msgPadding.left() - st::msgPadding.right()); + } } else { _height = _media->resize(width, this); } - _height += st::msgMargin.top() + st::msgMargin.bottom(); + _height += marginTop() + marginBottom(); return _height; } bool HistoryMessage::hasPoint(int32 x, int32 y) const { - int32 left = 0, width = 0; + int left = 0, width = 0, height = _height; countPositionAndSize(left, width); if (width < 1) return false; if (drawBubble()) { - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); + int top = marginTop(); + QRect r(left, top, width, height - top - marginBottom()); return r.contains(x, y); } else { - return _media->hasPoint(x - left, y - st::msgMargin.top(), this); + return _media->hasPoint(x - left, y - marginTop(), this); } } @@ -6904,38 +6984,40 @@ void HistoryMessage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 lnk = TextLinkPtr(); state = HistoryDefaultCursorState; - int32 left = 0, width = 0; + int left = 0, width = 0, height = _height; countPositionAndSize(left, width); - if (displayFromPhoto()) { - int32 photoleft = left + ((!isPost() && out() && !Adaptive::Wide()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip)); - if (x >= photoleft && x < photoleft + st::msgPhotoSize && y >= _height - st::msgMargin.bottom() - st::msgPhotoSize && y < _height - st::msgMargin.bottom()) { - lnk = author()->lnk; - return; - } - } + //if (displayFromPhoto()) { + // int32 photoleft = left + ((!isPost() && out() && !Adaptive::Wide()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip)); + // if (x >= photoleft && x < photoleft + st::msgPhotoSize && y >= marginTop() && y < height - marginBottom()) { + // lnk = author()->lnk; + // return; + // } + //} if (width < 1) return; if (drawBubble()) { - const HistoryMessageForwarded *fwd = Get(); - const HistoryMessageVia *via = Get(); + auto *fwd = Get(); + auto *via = Get(); + auto *reply = Get(); - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (displayFromName()) { // from user left name - if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + st::msgNameFont->height) { - if (x >= r.left() + st::msgPadding.left() && x < r.left() + r.width() - st::msgPadding.right() && x < r.left() + st::msgPadding.left() + author()->nameText.maxWidth()) { + int top = marginTop(); + QRect r(left, top, width, height - top - marginBottom()); + QRect trect(r.marginsAdded(-st::msgPadding)); + if (displayFromName()) { + if (y >= trect.top() && y < trect.top() + st::msgNameFont->height) { + if (x >= trect.left() && x < trect.left() + trect.width() && x < trect.left() + author()->nameText.maxWidth()) { lnk = author()->lnk; return; } - if (via && !fwd && x >= r.left() + st::msgPadding.left() + author()->nameText.maxWidth() + st::msgServiceFont->spacew && x < r.left() + st::msgPadding.left() + author()->nameText.maxWidth() + st::msgServiceFont->spacew + via->_width) { + if (via && !fwd && x >= trect.left() + author()->nameText.maxWidth() + st::msgServiceFont->spacew && x < trect.left() + author()->nameText.maxWidth() + st::msgServiceFont->spacew + via->_width) { lnk = via->_lnk; return; } } - r.setTop(r.top() + st::msgNameFont->height); + trect.setTop(trect.top() + st::msgNameFont->height); } if (displayForwardedFrom()) { - QRect trect(r.marginsAdded(-st::msgPadding)); int32 fwdheight = ((fwd->_text.maxWidth() > trect.width()) ? 2 : 1) * st::semiboldFont->height; if (y >= trect.top() && y < trect.top() + fwdheight) { bool inText = false; @@ -6948,57 +7030,57 @@ void HistoryMessage::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 } return; } - y -= fwdheight; - r.setHeight(r.height() - fwdheight); + trect.setTop(trect.top() + fwdheight); } - getStateFromMessageText(lnk, state, x, y, r); - } else { - _media->getState(lnk, state, x - left, y - st::msgMargin.top(), this); - } -} - -void HistoryMessage::getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const { - bool inDate = false; - - QRect trect(r.marginsAdded(-st::msgPadding)); - - const HistoryMessageForwarded *fwd = Get(); - if (!displayFromName() && !fwd) { - if (const HistoryMessageVia *via = Get()) { + if (via && !displayFromName() && !displayForwardedFrom()) { if (x >= trect.left() && y >= trect.top() && y < trect.top() + st::msgNameFont->height && x < trect.left() + via->_width) { lnk = via->_lnk; return; } trect.setTop(trect.top() + st::msgNameFont->height); } - } + if (reply) { + int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + if (y >= trect.top() && y < trect.top() + h) { + if (reply->replyToMsg && y >= trect.top() + st::msgReplyPadding.top() && y < trect.top() + st::msgReplyPadding.top() + st::msgReplyBarSize.height() && x >= trect.left() && x < trect.left() + trect.width()) { + lnk = reply->replyToLink(); + } + return; + } + trect.setTop(trect.top() + h); + } - TextLinkPtr medialnk; - if (_media && _media->isDisplayed()) { - if (!_media->customInfoLayout()) { + bool inDate = false; + + TextLinkPtr medialnk; + if (_media && _media->isDisplayed()) { + if (!_media->customInfoLayout()) { + inDate = HistoryMessage::pointInTime(r.x() + r.width(), r.y() + r.height(), x, y, InfoDisplayDefault); + } + if (y >= r.bottom() - _media->height() && y < r.bottom()) { + _media->getState(lnk, state, x - r.left(), y - (r.bottom() - _media->height()), this); + if (inDate) state = HistoryInDateCursorState; + return; + } + trect.setBottom(trect.bottom() - _media->height()); + } else { inDate = HistoryMessage::pointInTime(r.x() + r.width(), r.y() + r.height(), x, y, InfoDisplayDefault); } - if (y >= r.bottom() - _media->height() && y < r.bottom()) { - _media->getState(lnk, state, x - r.left(), y - (r.bottom() - _media->height()), this); - if (inDate) state = HistoryInDateCursorState; - return; + + textstyleSet(&((out() && !isPost()) ? st::outTextStyle : st::inTextStyle)); + bool inText = false; + _text.getState(lnk, inText, x - trect.x(), y - trect.y(), trect.width()); + textstyleRestore(); + + if (inDate) { + state = HistoryInDateCursorState; + } else if (inText) { + state = HistoryInTextCursorState; + } else { + state = HistoryDefaultCursorState; } - trect.setBottom(trect.bottom() - _media->height()); } else { - inDate = HistoryMessage::pointInTime(r.x() + r.width(), r.y() + r.height(), x, y, InfoDisplayDefault); - } - - textstyleSet(&((out() && !isPost()) ? st::outTextStyle : st::inTextStyle)); - bool inText = false; - _text.getState(lnk, inText, x - trect.x(), y - trect.y(), trect.width()); - textstyleRestore(); - - if (inDate) { - state = HistoryInDateCursorState; - } else if (inText) { - state = HistoryInTextCursorState; - } else { - state = HistoryDefaultCursorState; + _media->getState(lnk, state, x - left, y - marginTop(), this); } } @@ -7006,25 +7088,31 @@ void HistoryMessage::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, symbol = 0; after = false; upon = false; + if (drawBubble()) { - int32 left = 0, width = 0; + int left = 0, width = 0, height = _height; countPositionAndSize(left, width); if (width < 1) return; - const HistoryMessageForwarded *fwd = Get(); - const HistoryMessageVia *via = Get(); + auto *fwd = Get(); + auto *via = Get(); + auto *reply = Get(); - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (displayFromName()) { // from user left name - r.setTop(r.top() + st::msgNameFont->height); - } else if (via && !fwd) { - r.setTop(r.top() + st::msgNameFont->height); - } + int top = marginTop(); + QRect r(left, top, width, height - top - marginBottom()); QRect trect(r.marginsAdded(-st::msgPadding)); + if (displayFromName()) { + trect.setTop(trect.top() + st::msgNameFont->height); + } else if (via && !fwd) { + trect.setTop(trect.top() + st::msgNameFont->height); + } if (displayForwardedFrom()) { int32 fwdheight = ((fwd->_text.maxWidth() > trect.width()) ? 2 : 1) * st::semiboldFont->height; - y -= fwdheight; - r.setHeight(r.height() - fwdheight); + trect.setTop(trect.top() + fwdheight); + } + if (reply) { + int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); + trect.setTop(trect.top() + h); } if (_media && _media->isDisplayed()) { trect.setBottom(trect.bottom() - _media->height()); @@ -7064,352 +7152,32 @@ QString HistoryMessage::notificationHeader() const { QString HistoryMessage::notificationText() const { QString msg(inDialogsText()); - if (msg.size() > 0xFF) msg = msg.mid(0, 0xFF) + qsl(".."); + if (msg.size() > 0xFF) msg = msg.mid(0, 0xFF) + qsl("..."); return msg; } +bool HistoryMessage::displayFromPhoto() const { + return hasFromPhoto() && !isAttachedToPrevious(); +} + +bool HistoryMessage::hasFromPhoto() const { + return (Adaptive::Wide() || (!out() && !history()->peer->isUser())) && !isPost(); +} + HistoryMessage::~HistoryMessage() { if (_media) { - _media->unregItem(this); + _media->detachFromItem(this); deleteAndMark(_media); } - if (_flags & MTPDmessage::flag_reply_markup) { + if (auto *reply = Get()) { + reply->clearData(this); + } + if (_flags & MTPDmessage::Flag::f_reply_markup) { App::clearReplyMarkup(channelId(), id); } } -HistoryReply::HistoryReply(History *history, HistoryBlock *block, const MTPDmessage &msg) : HistoryMessage(history, block, msg) -, replyToMsgId(msg.vreply_to_msg_id.v) -, replyToMsg(0) -, replyToVersion(0) -, _maxReplyWidth(0) -, _replyToVia(0) { - if (!updateReplyTo() && App::api()) { - App::api()->requestMessageData(history->peer->asChannel(), replyToMsgId, new HistoryDependentItemCallback(fullId())); - } -} - -HistoryReply::HistoryReply(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption) -: HistoryMessage(history, block, msgId, flags, viaBotId, date, from, doc, caption) -, replyToMsgId(replyTo) -, replyToMsg(0) -, replyToVersion(0) -, _maxReplyWidth(0) -, _replyToVia(0) { - if (!updateReplyTo() && App::api()) { - App::api()->requestMessageData(history->peer->asChannel(), replyToMsgId, new HistoryDependentItemCallback(fullId())); - } -} - -HistoryReply::HistoryReply(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption) -: HistoryMessage(history, block, msgId, flags, viaBotId, date, from, photo, caption) -, replyToMsgId(replyTo) -, replyToMsg(0) -, replyToVersion(0) -, _maxReplyWidth(0) -, _replyToVia(0) { - if (!updateReplyTo() && App::api()) { - App::api()->requestMessageData(history->peer->asChannel(), replyToMsgId, new HistoryDependentItemCallback(fullId())); - } - replyToNameUpdated(); -} - -QString HistoryReply::selectedText(uint32 selection) const { - if (selection != FullSelection || !replyToMsg) return HistoryMessage::selectedText(selection); - QString result, original = HistoryMessage::selectedText(selection); - result.reserve(lang(lng_in_reply_to).size() + replyToMsg->author()->name.size() + 4 + original.size()); - result.append('[').append(lang(lng_in_reply_to)).append(' ').append(replyToMsg->author()->name).append(qsl("]\n")).append(original); - return result; -} - -void HistoryReply::initDimensions() { - replyToNameUpdated(); - HistoryMessage::initDimensions(); - if (!_media) { - int32 replyw = st::msgPadding.left() + _maxReplyWidth - st::msgReplyPadding.left() - st::msgReplyPadding.right() + st::msgPadding.right(); - if (_replyToVia) { - replyw += st::msgServiceFont->spacew + _replyToVia->_maxWidth; - } - if (replyw > _maxw) _maxw = replyw; - } -} - -bool HistoryReply::updateReplyTo(bool force) { - if (!force) { - if (replyToMsg || !replyToMsgId) { - return true; - } - } - if (!replyToMsg) { - replyToMsg = App::histItemById(channelId(), replyToMsgId); - if (replyToMsg) { - App::historyRegDependency(this, replyToMsg); - } - } - - if (replyToMsg) { - replyToText.setText(st::msgFont, replyToMsg->inReplyText(), _textDlgOptions); - - replyToNameUpdated(); - - replyToLnk = TextLinkPtr(new MessageLink(replyToMsg->history()->peer->id, replyToMsg->id)); - if (!replyToMsg->Is()) { - if (UserData *bot = replyToMsg->viaBot()) { - _replyToVia = new HistoryMessageVia(0); - _replyToVia->create(peerToUser(bot->id)); - } - } - } else if (force) { - replyToMsgId = 0; - } - if (force) { - initDimensions(); - Notify::historyItemResized(this); - } - return (replyToMsg || !replyToMsgId); -} - -void HistoryReply::replyToNameUpdated() const { - if (replyToMsg) { - QString name = (_replyToVia && replyToMsg->author()->isUser()) ? replyToMsg->author()->asUser()->firstName : App::peerName(replyToMsg->author()); - replyToName.setText(st::msgServiceNameFont, name, _textNameOptions); - replyToVersion = replyToMsg->author()->nameVersion; - bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; - int32 previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; - int32 w = replyToName.maxWidth(); - if (_replyToVia) { - w += st::msgServiceFont->spacew + _replyToVia->_maxWidth; - } - - _maxReplyWidth = previewSkip + qMax(w, qMin(replyToText.maxWidth(), int32(st::maxSignatureSize))); - } else { - _maxReplyWidth = st::msgDateFont->width(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message)); - } - _maxReplyWidth = st::msgReplyPadding.left() + st::msgReplyBarSkip + _maxReplyWidth + st::msgReplyPadding.right(); -} - -int32 HistoryReply::replyToWidth() const { - return _maxReplyWidth; -} - -TextLinkPtr HistoryReply::replyToLink() const { - return replyToLnk; -} - -MsgId HistoryReply::replyToId() const { - return replyToMsgId; -} - -HistoryItem *HistoryReply::replyToMessage() const { - return replyToMsg; -} - -void HistoryReply::dependencyItemRemoved(HistoryItem *dependency) { - if (replyToMsg == dependency) { - delete _replyToVia; - _replyToVia = 0; - - replyToMsg = nullptr; - replyToMsgId = 0; - initDimensions(); - } -} - -void HistoryReply::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { - if (replyToMsg && replyToMsg->author()->nameVersion > replyToVersion) { - replyToNameUpdated(); - } - HistoryMessage::draw(p, r, selection, ms); -} - -void HistoryReply::drawReplyTo(Painter &p, int32 x, int32 y, int32 w, bool selected, bool likeService) const { - style::color bar; - bool outbg = out() && !isPost(); - if (likeService) { - bar = st::white; - } else { - bar = (selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor)); - } - QRect rbar(rtlrect(x + st::msgReplyBarPos.x(), y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.width(), st::msgReplyBarSize.height(), w + 2 * x)); - p.fillRect(rbar, bar); - - if (w > st::msgReplyBarSkip) { - if (replyToMsg) { - bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; - int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; - - if (hasPreview) { - ImagePtr replyPreview = replyToMsg->getMedia()->replyPreview(); - if (!replyPreview->isNull()) { - QRect to(rtlrect(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + st::msgReplyBarPos.y(), st::msgReplyBarSize.height(), st::msgReplyBarSize.height(), w + 2 * x)); - p.drawPixmap(to.x(), to.y(), replyPreview->pixSingle(replyPreview->width() / cIntRetinaFactor(), replyPreview->height() / cIntRetinaFactor(), to.width(), to.height())); - if (selected) { - App::roundRect(p, to, textstyleCurrent()->selectOverlay, SelectedOverlayCorners); - } - } - } - if (w > st::msgReplyBarSkip + previewSkip) { - if (likeService) { - p.setPen(st::white); - } else { - p.setPen(selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg)); - } - replyToName.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top(), w - st::msgReplyBarSkip - previewSkip, w + 2 * x); - if (_replyToVia && w > st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew) { - p.setFont(st::msgServiceFont); - p.drawText(x + st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew, y + st::msgReplyPadding.top() + st::msgServiceFont->ascent, _replyToVia->_text); - } - - HistoryMessage *replyToAsMsg = replyToMsg->toHistoryMessage(); - if (likeService) { - } else if ((replyToAsMsg && replyToAsMsg->emptyText()) || replyToMsg->serviceMsg()) { - style::color date(outbg ? (selected ? st::msgOutDateFgSelected : st::msgOutDateFg) : (selected ? st::msgInDateFgSelected : st::msgInDateFg)); - p.setPen(date); - } else { - p.setPen(st::msgColor); - } - replyToText.drawLeftElided(p, x + st::msgReplyBarSkip + previewSkip, y + st::msgReplyPadding.top() + st::msgServiceNameFont->height, w - st::msgReplyBarSkip - previewSkip, w + 2 * x); - } - } else { - p.setFont(st::msgDateFont); - style::color date(outbg ? (selected ? st::msgOutDateFgSelected : st::msgOutDateFg) : (selected ? st::msgInDateFgSelected : st::msgInDateFg)); - p.setPen(likeService ? st::white : date); - p.drawTextLeft(x + st::msgReplyBarSkip, y + st::msgReplyPadding.top() + (st::msgReplyBarSize.height() - st::msgDateFont->height) / 2, w + 2 * x, st::msgDateFont->elided(lang(replyToMsgId ? lng_profile_loading : lng_deleted_message), w - st::msgReplyBarSkip)); - } - } -} - -void HistoryReply::drawMessageText(Painter &p, QRect trect, uint32 selection) const { - int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - - drawReplyTo(p, trect.x(), trect.y(), trect.width(), (selection == FullSelection)); - - trect.setY(trect.y() + h); - HistoryMessage::drawMessageText(p, trect, selection); -} - -int32 HistoryReply::resize(int32 width) { - HistoryMessage::resize(width); - - if (drawBubble()) { - if (emptyText() && !displayFromName() && !Is()) { - _height += st::msgPadding.top() + st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom() + st::mediaHeaderSkip; - } else { - _height += st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - } - if (_replyToVia) { - bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; - int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; - _replyToVia->resize(width - st::msgPadding.left() - st::msgPadding.right() - st::msgReplyBarSkip + previewSkip + replyToName.maxWidth() + st::msgServiceFont->spacew); - } - } - return _height; -} - -void HistoryReply::resizeVia(int32 w) const { - if (!_replyToVia) return; - - bool hasPreview = replyToMsg->getMedia() ? replyToMsg->getMedia()->hasReplyPreview() : false; - int previewSkip = hasPreview ? (st::msgReplyBarSize.height() + st::msgReplyBarSkip - st::msgReplyBarSize.width() - st::msgReplyBarPos.x()) : 0; - _replyToVia->resize(w - st::msgReplyBarSkip - previewSkip - replyToName.maxWidth() - st::msgServiceFont->spacew); -} - -bool HistoryReply::hasPoint(int32 x, int32 y) const { - if (drawBubble()) { - int32 left = 0, width = 0; - countPositionAndSize(left, width); - if (width < 1) return false; - - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - return r.contains(x, y); - } - return HistoryMessage::hasPoint(x, y); -} - -void HistoryReply::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const { - lnk = TextLinkPtr(); - state = HistoryDefaultCursorState; - - if (drawBubble()) { - int32 left = 0, width = 0; - countPositionAndSize(left, width); - if (displayFromPhoto()) { - int32 photoleft = left + ((!isPost() && out()) ? (width + (st::msgPhotoSkip - st::msgPhotoSize)) : (-st::msgPhotoSkip)); - if (x >= photoleft && x < photoleft + st::msgPhotoSize) { - return HistoryMessage::getState(lnk, state, x, y); - } - } - if (width < 1) return; - - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (displayFromName()) { - style::font nameFont(st::msgNameFont); - if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { - return HistoryMessage::getState(lnk, state, x, y); - } - r.setTop(r.top() + nameFont->height); - } - QRect trect(r.marginsAdded(-st::msgPadding)); - - int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - if (y >= trect.top() && y < trect.top() + h) { - if (replyToMsg && y >= trect.top() + st::msgReplyPadding.top() && y < trect.top() + st::msgReplyPadding.top() + st::msgReplyBarSize.height() && x >= trect.left() && x < trect.left() + trect.width()) { - lnk = replyToLnk; - } - return; - } - y -= h; - } - return HistoryMessage::getState(lnk, state, x, y); -} - -void HistoryReply::getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const { - int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - - QRect realr(r); - realr.setHeight(r.height() - h); - HistoryMessage::getStateFromMessageText(lnk, state, x, y, realr); -} - -void HistoryReply::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { - symbol = 0; - after = false; - upon = false; - - if (drawBubble()) { - int32 left = 0, width = 0; - countPositionAndSize(left, width); - if (width < 1) return; - - QRect r(left, st::msgMargin.top(), width, _height - st::msgMargin.top() - st::msgMargin.bottom()); - if (displayFromName()) { - style::font nameFont(st::msgNameFont); - if (y >= r.top() + st::msgPadding.top() && y < r.top() + st::msgPadding.top() + nameFont->height) { - return HistoryMessage::getSymbol(symbol, after, upon, x, y); - } - r.setTop(r.top() + nameFont->height); - } - QRect trect(r.marginsAdded(-st::msgPadding)); - - int32 h = st::msgReplyPadding.top() + st::msgReplyBarSize.height() + st::msgReplyPadding.bottom(); - y -= h; - } - return HistoryMessage::getSymbol(symbol, after, upon, x, y); -} - -HistoryReply::~HistoryReply() { - if (replyToMsg) { - App::historyUnregDependency(this, replyToMsg); - } - deleteAndMark(_replyToVia); -} - -HistoryServicePinned::HistoryServicePinned(Interfaces *) -: msgId(0) -, msg(0) { -} - -void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { +void HistoryService::setMessageByAction(const MTPmessageAction &action) { QList links; LangString text = lang(lng_message_empty); QString from = textcmdLink(1, _from->name); @@ -7504,6 +7272,7 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { const MTPDmessageActionChatEditPhoto &d(action.c_messageActionChatEditPhoto()); if (d.vphoto.type() == mtpc_photo) { _media = new HistoryPhoto(history()->peer, d.vphoto.c_photo(), st::msgServicePhotoWidth); + _media->attachToItem(this); } text = isPost() ? lang(lng_action_changed_photo_channel) : lng_action_changed_photo(lt_from, from); } break; @@ -7514,9 +7283,9 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { } break; case mtpc_messageActionChatMigrateTo: { - _flags |= MTPDmessage_flag_IS_GROUP_MIGRATE; + _flags |= MTPDmessage_ClientFlag::f_is_group_migrate; const MTPDmessageActionChatMigrateTo &d(action.c_messageActionChatMigrateTo()); - if (true/*PeerData *channel = App::peerLoaded(peerFromChannel(d.vchannel_id))*/) { + if (true/*PeerData *channel = App::channelLoaded(d.vchannel_id.v)*/) { text = lang(lng_action_group_migrate); } else { text = lang(lng_contacts_loading); @@ -7524,9 +7293,9 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { } break; case mtpc_messageActionChannelMigrateFrom: { - _flags |= MTPDmessage_flag_IS_GROUP_MIGRATE; + _flags |= MTPDmessage_ClientFlag::f_is_group_migrate; const MTPDmessageActionChannelMigrateFrom &d(action.c_messageActionChannelMigrateFrom()); - if (true/*PeerData *chat = App::peerLoaded(peerFromChannel(d.vchat_id))*/) { + if (true/*PeerData *chat = App::chatLoaded(d.vchat_id.v)*/) { text = lang(lng_action_group_migrate); } else { text = lang(lng_contacts_loading); @@ -7535,7 +7304,7 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { case mtpc_messageActionPinMessage: { if (updatePinnedText(&from, &text)) { - HistoryServicePinned *pinned = Get(); + auto *pinned = Get(); t_assert(pinned != nullptr); links.push_back(pinned->lnk); @@ -7556,8 +7325,8 @@ void HistoryServiceMsg::setMessageByAction(const MTPmessageAction &action) { } } -bool HistoryServiceMsg::updatePinned(bool force) { - HistoryServicePinned *pinned = Get(); +bool HistoryService::updatePinned(bool force) { + auto *pinned = Get(); t_assert(pinned != nullptr); if (!force) { @@ -7587,8 +7356,7 @@ bool HistoryServiceMsg::updatePinned(bool force) { updatePinnedText(); } if (force) { - initDimensions(); - Notify::historyItemResized(this); + setPendingInitDimensions(); if (gotDependencyItem && App::wnd()) { App::wnd()->notifySettingGot(); } @@ -7596,7 +7364,7 @@ bool HistoryServiceMsg::updatePinned(bool force) { return (pinned->msg || !pinned->msgId); } -bool HistoryServiceMsg::updatePinnedText(const QString *pfrom, QString *ptext) { +bool HistoryService::updatePinnedText(const QString *pfrom, QString *ptext) { bool result = false; QString from, text; if (pfrom) { @@ -7606,7 +7374,7 @@ bool HistoryServiceMsg::updatePinnedText(const QString *pfrom, QString *ptext) { } TextLinkPtr second; - HistoryServicePinned *pinned = Get(); + auto *pinned = Get(); if (pinned && pinned->msg) { HistoryMedia *media = pinned->msg->getMedia(); QString mediaText; @@ -7634,7 +7402,7 @@ bool HistoryServiceMsg::updatePinnedText(const QString *pfrom, QString *ptext) { } } if (!limit && cutat + 5 < size) { - original = original.mid(0, cutat) + qstr(".."); + original = original.mid(0, cutat) + qstr("..."); } text = lng_action_pinned_message(lt_from, from, lt_text, textcmdLink(2, original)); } else { @@ -7668,12 +7436,10 @@ bool HistoryServiceMsg::updatePinnedText(const QString *pfrom, QString *ptext) { return result; } -HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg) : - HistoryItem(history, block, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) -, _text(st::msgMinWidth) -, _media(0) { +HistoryService::HistoryService(History *history, const MTPDmessageService &msg) : + HistoryItem(history, msg.vid.v, mtpCastFlags(msg.vflags.v), ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) { if (msg.has_reply_to_msg_id()) { - UpdateInterfaces(HistoryServicePinned::Bit()); + UpdateComponents(HistoryServicePinned::Bit()); MsgId pinnedMsgId = Get()->msgId = msg.vreply_to_msg_id.v; if (!updatePinned() && App::api()) { App::api()->requestMessageData(history->peer->asChannel(), pinnedMsgId, new HistoryDependentItemCallback(fullId())); @@ -7682,78 +7448,91 @@ HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, cons setMessageByAction(msg.vaction); } -HistoryServiceMsg::HistoryServiceMsg(History *history, HistoryBlock *block, MsgId msgId, QDateTime date, const QString &msg, int32 flags, HistoryMedia *media, int32 from) : - HistoryItem(history, block, msgId, flags, date, from) +HistoryService::HistoryService(History *history, MsgId msgId, QDateTime date, const QString &msg, MTPDmessage::Flags flags, HistoryMedia *media, int32 from) : + HistoryItem(history, msgId, flags, date, from) , _text(st::msgServiceFont, msg, _historySrvOptions, st::dlgMinWidth) , _media(media) { } -void HistoryServiceMsg::initDimensions() { +void HistoryService::initDimensions() { _maxw = _text.maxWidth() + st::msgServicePadding.left() + st::msgServicePadding.right(); _minh = _text.minHeight(); if (_media) _media->initDimensions(this); } -void HistoryServiceMsg::countPositionAndSize(int32 &left, int32 &width) const { +void HistoryService::countPositionAndSize(int32 &left, int32 &width) const { left = st::msgServiceMargin.left(); int32 maxwidth = _history->width; if (Adaptive::Wide()) { - maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip)); + maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); } width = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left(); } -QString HistoryServiceMsg::selectedText(uint32 selection) const { +QString HistoryService::selectedText(uint32 selection) const { uint16 selectedFrom = (selection == FullSelection) ? 0 : (selection >> 16) & 0xFFFF; uint16 selectedTo = (selection == FullSelection) ? 0xFFFF : (selection & 0xFFFF); return _text.original(selectedFrom, selectedTo); } -QString HistoryServiceMsg::inDialogsText() const { +QString HistoryService::inDialogsText() const { return _text.original(0, 0xFFFF, Text::ExpandLinksNone); } -QString HistoryServiceMsg::inReplyText() const { - QString result = HistoryServiceMsg::inDialogsText(); +QString HistoryService::inReplyText() const { + QString result = HistoryService::inDialogsText(); return result.trimmed().startsWith(author()->name) ? result.trimmed().mid(author()->name.size()).trimmed() : result; } -void HistoryServiceMsg::setServiceText(const QString &text) { +void HistoryService::setServiceText(const QString &text) { textstyleSet(&st::serviceTextStyle); _text.setText(st::msgServiceFont, text, _historySrvOptions); textstyleRestore(); initDimensions(); } -void HistoryServiceMsg::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { +void HistoryService::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { + int left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins + countPositionAndSize(left, width); + if (width < 1) return; + + int dateh = 0, unreadbarh = 0; + if (auto *date = Get()) { + dateh = date->height(); + date->paint(p, 0, _history->width); + p.translate(0, dateh); + height -= dateh; + } + if (auto *unreadbar = Get()) { + unreadbarh = unreadbar->height(); + unreadbar->paint(p, 0, _history->width); + p.translate(0, unreadbarh); + height -= unreadbarh; + } + uint64 animms = App::main() ? App::main()->animActiveTimeStart(this) : 0; if (animms > 0 && animms <= ms) { animms = ms - animms; if (animms > st::activeFadeInDuration + st::activeFadeOutDuration) { App::main()->stopAnimActive(); } else { + int skiph = st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); + textstyleSet(&st::inTextStyle); float64 dt = (animms > st::activeFadeInDuration) ? (1 - (animms - st::activeFadeInDuration) / float64(st::activeFadeOutDuration)) : (animms / float64(st::activeFadeInDuration)); float64 o = p.opacity(); p.setOpacity(o * dt); - p.fillRect(0, 0, _history->width, _height, textstyleCurrent()->selectOverlay->b); + p.fillRect(0, skiph, _history->width, _height - skiph, textstyleCurrent()->selectOverlay->b); p.setOpacity(o); } } - textstyleSet(&st::serviceTextStyle); - - int32 left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins - countPositionAndSize(left, width); - if (width < 1) return; - if (_media) { height -= st::msgServiceMargin.top() + _media->height(); - p.save(); int32 left = st::msgServiceMargin.left() + (width - _media->maxWidth()) / 2, top = st::msgServiceMargin.top() + height + st::msgServiceMargin.top(); p.translate(left, top); _media->draw(p, this, r.translated(-left, -top), selection == FullSelection, ms); - p.restore(); + p.translate(-left, -top); } QRect trect(QRect(left, st::msgServiceMargin.top(), width, height).marginsAdded(-st::msgServicePadding)); @@ -7764,19 +7543,26 @@ void HistoryServiceMsg::draw(Painter &p, const QRect &r, uint32 selection, uint6 } App::roundRect(p, left, st::msgServiceMargin.top(), width, height, App::msgServiceBg(), (selection == FullSelection) ? ServiceSelectedCorners : ServiceCorners); + textstyleSet(&st::serviceTextStyle); + p.setBrush(Qt::NoBrush); - p.setPen(st::msgServiceColor->p); - p.setFont(st::msgServiceFont->f); + p.setPen(st::msgServiceColor); + p.setFont(st::msgServiceFont); uint16 selectedFrom = (selection == FullSelection) ? 0 : (selection >> 16) & 0xFFFF; uint16 selectedTo = (selection == FullSelection) ? 0 : selection & 0xFFFF; _text.draw(p, trect.x(), trect.y(), trect.width(), Qt::AlignCenter, 0, -1, selectedFrom, selectedTo); + textstyleRestore(); + + if (int skiph = dateh + unreadbarh) { + p.translate(0, -skiph); + } } -int32 HistoryServiceMsg::resize(int32 width) { +int32 HistoryService::resizeGetHeight_(int32 width) { int32 maxwidth = _history->width; if (Adaptive::Wide()) { - maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip)); + maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); } if (width > maxwidth) width = maxwidth; width -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins @@ -7798,28 +7584,52 @@ int32 HistoryServiceMsg::resize(int32 width) { if (_media) { _height += st::msgServiceMargin.top() + _media->resize(_media->currentWidth(), this); } + _height += displayedDateHeight(); + if (auto *unreadbar = Get()) { + _height += unreadbar->height(); + } return _height; } -bool HistoryServiceMsg::hasPoint(int32 x, int32 y) const { - int32 left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins +bool HistoryService::hasPoint(int32 x, int32 y) const { + int left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins countPositionAndSize(left, width); if (width < 1) return false; + if (int dateh = displayedDateHeight()) { + y -= dateh; + height -= dateh; + } + if (auto *unreadbar = Get()) { + int unreadbarh = unreadbar->height(); + y -= unreadbarh; + height -= unreadbarh; + } + if (_media) { height -= st::msgServiceMargin.top() + _media->height(); } return QRect(left, st::msgServiceMargin.top(), width, height).contains(x, y); } -void HistoryServiceMsg::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const { +void HistoryService::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const { lnk = TextLinkPtr(); state = HistoryDefaultCursorState; - int32 left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins + int left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins countPositionAndSize(left, width); if (width < 1) return; + if (int dateh = displayedDateHeight()) { + y -= dateh; + height -= dateh; + } + if (auto *unreadbar = Get()) { + int unreadbarh = unreadbar->height(); + y -= unreadbarh; + height -= unreadbarh; + } + if (_media) { height -= st::msgServiceMargin.top() + _media->height(); } @@ -7835,15 +7645,25 @@ void HistoryServiceMsg::getState(TextLinkPtr &lnk, HistoryCursorState &state, in } } -void HistoryServiceMsg::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { +void HistoryService::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { symbol = 0; after = false; upon = false; - int32 left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins + int left = 0, width = 0, height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); // two small margins countPositionAndSize(left, width); if (width < 1) return; + if (int dateh = displayedDateHeight()) { + y -= dateh; + height -= dateh; + } + if (auto *unreadbar = Get()) { + int unreadbarh = unreadbar->height(); + y -= unreadbarh; + height -= unreadbarh; + } + if (_media) { height -= st::msgServiceMargin.top() + _media->height(); } @@ -7853,7 +7673,7 @@ void HistoryServiceMsg::getSymbol(uint16 &symbol, bool &after, bool &upon, int32 textstyleRestore(); } -void HistoryServiceMsg::drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const { +void HistoryService::drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const { if (cacheFor != this) { cacheFor = this; cache.setText(st::dlgHistFont, inDialogsText(), _textDlgOptions); @@ -7863,48 +7683,42 @@ void HistoryServiceMsg::drawInDialog(Painter &p, const QRect &r, bool act, const cache.drawElided(p, tr.left(), tr.top(), tr.width(), tr.height() / st::dlgHistFont->height); } -QString HistoryServiceMsg::notificationText() const { +QString HistoryService::notificationText() const { QString msg = _text.original(); - if (msg.size() > 0xFF) msg = msg.mid(0, 0xFF) + qsl(".."); + if (msg.size() > 0xFF) msg = msg.mid(0, 0xFF) + qsl("..."); return msg; } -HistoryMedia *HistoryServiceMsg::getMedia(bool inOverview) const { +HistoryMedia *HistoryService::getMedia(bool inOverview) const { return inOverview ? 0 : _media; } -HistoryServiceMsg::~HistoryServiceMsg() { +HistoryService::~HistoryService() { if (auto pinned = Get()) { if (pinned->msg) { App::historyUnregDependency(this, pinned->msg); } } - deleteAndMark(_media); -} - -HistoryDateMsg::HistoryDateMsg(History *history, HistoryBlock *block, const QDate &date) : -HistoryServiceMsg(history, block, clientMsgId(), QDateTime(date), langDayOfMonthFull(date)) { -} - -void HistoryDateMsg::setDate(const QDateTime &date) { - if (this->date.date() != date.date()) { - setServiceText(langDayOfMonthFull(date.date())); + if (_media) { + _media->detachFromItem(this); + deleteAndMark(_media); } - HistoryServiceMsg::setDate(date); } -HistoryItem *createDayServiceMsg(History *history, HistoryBlock *block, QDateTime date) { - return regItem(new HistoryDateMsg(history, block, date.date())); +HistoryGroup::HistoryGroup(History *history, const MTPDmessageGroup &group, const QDateTime &date) + : HistoryService(history, clientMsgId(), date, lng_channel_comments_count(lt_count, group.vcount.v)/* + qsl(" (%1 ... %2)").arg(group.vmin_id.v).arg(group.vmax_id.v)*/) + , _minId(group.vmin_id.v) + , _maxId(group.vmax_id.v) + , _count(group.vcount.v) + , _lnk(new CommentsLink(this)) { } -HistoryGroup::HistoryGroup(History *history, HistoryBlock *block, const MTPDmessageGroup &group, const QDateTime &date) : -HistoryServiceMsg(history, block, clientMsgId(), date, lng_channel_comments_count(lt_count, group.vcount.v)/* + qsl(" (%1 .. %2)").arg(group.vmin_id.v).arg(group.vmax_id.v)*/), -_minId(group.vmin_id.v), _maxId(group.vmax_id.v), _count(group.vcount.v), _lnk(new CommentsLink(this)) { -} - -HistoryGroup::HistoryGroup(History *history, HistoryBlock *block, HistoryItem *newItem, const QDateTime &date) : -HistoryServiceMsg(history, block, clientMsgId(), date, lng_channel_comments_count(lt_count, 1)/* + qsl(" (%1 .. %2)").arg(newItem->id - 1).arg(newItem->id + 1)*/), -_minId(newItem->id - 1), _maxId(newItem->id + 1), _count(1), _lnk(new CommentsLink(this)) { +HistoryGroup::HistoryGroup(History *history, HistoryItem *newItem, const QDateTime &date) + : HistoryService(history, clientMsgId(), date, lng_channel_comments_count(lt_count, 1)/* + qsl(" (%1 ... %2)").arg(newItem->id - 1).arg(newItem->id + 1)*/) + , _minId(newItem->id - 1) + , _maxId(newItem->id + 1) + , _count(1) + , _lnk(new CommentsLink(this)) { } void HistoryGroup::getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const { @@ -7966,12 +7780,12 @@ bool HistoryGroup::decrementCount() { } void HistoryGroup::updateText() { - setServiceText(lng_channel_comments_count(lt_count, _count)/* + qsl(" (%1 .. %2)").arg(_minId).arg(_maxId)*/); + setServiceText(lng_channel_comments_count(lt_count, _count)/* + qsl(" (%1 ... %2)").arg(_minId).arg(_maxId)*/); } -HistoryCollapse::HistoryCollapse(History *history, HistoryBlock *block, MsgId wasMinId, const QDateTime &date) : -HistoryServiceMsg(history, block, clientMsgId(), date, qsl("-")), -_wasMinId(wasMinId) { +HistoryCollapse::HistoryCollapse(History *history, MsgId wasMinId, const QDateTime &date) + : HistoryService(history, clientMsgId(), date, qsl("-")) + , _wasMinId(wasMinId) { } void HistoryCollapse::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { @@ -7982,8 +7796,8 @@ void HistoryCollapse::getState(TextLinkPtr &lnk, HistoryCursorState &state, int3 state = HistoryDefaultCursorState; } -HistoryJoined::HistoryJoined(History *history, HistoryBlock *block, const QDateTime &inviteDate, UserData *inviter, int32 flags) : -HistoryServiceMsg(history, block, clientMsgId(), inviteDate, QString(), flags) { +HistoryJoined::HistoryJoined(History *history, const QDateTime &inviteDate, UserData *inviter, MTPDmessage::Flags flags) + : HistoryService(history, clientMsgId(), inviteDate, QString(), flags) { textstyleSet(&st::serviceTextStyle); if (peerToUser(inviter->id) == MTP::authedId()) { _text.setText(st::msgServiceFont, lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined), _historySrvOptions); @@ -7993,40 +7807,3 @@ HistoryServiceMsg(history, block, clientMsgId(), inviteDate, QString(), flags) { } textstyleRestore(); } - -HistoryUnreadBar::HistoryUnreadBar(History *history, HistoryBlock *block, int32 count, const QDateTime &date) : HistoryItem(history, block, clientMsgId(), 0, date, 0), freezed(false) { - setCount(count); - initDimensions(); -} - -void HistoryUnreadBar::initDimensions() { - _maxw = st::msgPadding.left() + st::msgPadding.right() + 1; - _minh = st::unreadBarHeight; -} - -void HistoryUnreadBar::setCount(int32 count) { - if (!count) freezed = true; - if (freezed) return; - text = lng_unread_bar(lt_count, count); -} - -void HistoryUnreadBar::draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const { - p.fillRect(0, st::lineWidth, _history->width, st::unreadBarHeight - 2 * st::lineWidth, st::unreadBarBG->b); - p.fillRect(0, st::unreadBarHeight - st::lineWidth, _history->width, st::lineWidth, st::unreadBarBorder->b); - p.setFont(st::unreadBarFont->f); - p.setPen(st::unreadBarColor->p); - p.drawText(QRect(0, 0, _history->width, st::unreadBarHeight - st::lineWidth), text, style::al_center); -} - -int32 HistoryUnreadBar::resize(int32 width) { - _height = st::unreadBarHeight; - return _height; -} - -void HistoryUnreadBar::drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const { -} - -QString HistoryUnreadBar::notificationText() const { - return QString(); -} - diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 0363da799..497dd1060 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -56,7 +56,6 @@ public: } HistoryItem *addNewMessage(const MTPMessage &msg, NewMessageType type); - // HistoryItem *addToBack(const MTPgeoChatMessage &msg, bool newMsg = true); typedef QMap TypingHistories; // when typing in this history started TypingHistories typing; @@ -208,7 +207,6 @@ struct HistoryEditDraft : public HistoryDraft { class HistoryMedia; class HistoryMessage; -class HistoryUnreadBar; enum AddToOverviewMethod { AddToOverviewNew, // when new message is added to history @@ -222,6 +220,9 @@ class History { public: History(const PeerId &peerId); + History(const History &) = delete; + History &operator=(const History &) = delete; + ChannelId channelId() const { return peerToChannel(peer->id); } @@ -238,22 +239,15 @@ public: return blocks.isEmpty(); } void clear(bool leaveItems = false); - void blockResized(HistoryBlock *block, int32 dh); - void removeBlock(HistoryBlock *block); virtual ~History(); - HistoryItem *createItem(HistoryBlock *block, const MTPMessage &msg, bool applyServiceAction); - HistoryItem *createItemForwarded(HistoryBlock *block, MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *msg); - HistoryItem *createItemDocument(HistoryBlock *block, MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption); - HistoryItem *createItemPhoto(HistoryBlock *block, MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption); - - HistoryItem *addNewService(MsgId msgId, QDateTime date, const QString &text, int32 flags = 0, HistoryMedia *media = 0, bool newMsg = true); + HistoryItem *addNewService(MsgId msgId, QDateTime date, const QString &text, MTPDmessage::Flags flags = 0, HistoryMedia *media = 0, bool newMsg = true); HistoryItem *addNewMessage(const MTPMessage &msg, NewMessageType type); HistoryItem *addToHistory(const MTPMessage &msg); - HistoryItem *addNewForwarded(MsgId id, int32 flags, QDateTime date, int32 from, HistoryMessage *item); - HistoryItem *addNewDocument(MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption); - HistoryItem *addNewPhoto(MsgId id, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption); + HistoryItem *addNewForwarded(MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *item); + HistoryItem *addNewDocument(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption); + HistoryItem *addNewPhoto(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption); void addOlderSlice(const QVector &slice, const QVector *collapsed); void addNewerSlice(const QVector &slice, const QVector *collapsed); @@ -263,7 +257,7 @@ public: void newItemAdded(HistoryItem *item); void unregTyping(UserData *from); - int32 countUnread(MsgId upTo); + int countUnread(MsgId upTo); void updateShowFrom(); MsgId inboxRead(MsgId upTo); MsgId inboxRead(HistoryItem *wasRead); @@ -272,10 +266,11 @@ public: HistoryItem *lastImportantMessage() const; - void setUnreadCount(int32 newUnreadCount, bool psUpdate = true); + void setUnreadCount(int newUnreadCount, bool psUpdate = true); void setMute(bool newMute); - void getNextShowFrom(HistoryBlock *block, int32 i); + void getNextShowFrom(HistoryBlock *block, int i); void addUnreadBar(); + void destroyUnreadBar(); void clearNotifications(); bool loadedAtBottom() const; // last message is in the list @@ -297,8 +292,7 @@ public: return !_chatListLinks.isEmpty(); } int32 posInChatList() const { - t_assert(inChatList()); - return _chatListLinks[0]->pos; + return mainChatListLink()->pos; } DialogRow *addToChatList(DialogsIndexed &indexed); void removeFromChatList(DialogsIndexed &indexed); @@ -310,7 +304,7 @@ public: MsgId maxMsgId() const; MsgId msgIdForRead() const; - int32 geomResize(int32 newWidth, int32 *ytransform = 0, const HistoryItem *resizedItem = 0); // return new size + int resizeGetHeight(int newWidth); void removeNotification(HistoryItem *item) { if (!notifies.isEmpty()) { @@ -337,17 +331,30 @@ public: if (!notifies.isEmpty() && notifies.back() == item) notifies.pop_back(); } + bool hasPendingResizedItems() const { + return _flags & Flag::f_has_pending_resized_items; + } + void setHasPendingResizedItems(); + void setPendingResize() { + _flags |= Flag::f_pending_resize; + setHasPendingResizedItems(); + } + void paintDialog(Painter &p, int32 w, bool sel) const; bool updateTyping(uint64 ms, bool force = false); void clearLastKeyboard(); + // optimization for userpics displayed on the left + // if this returns false there is no need to even try to handle them + bool canHaveFromPhotos() const; + typedef QList Blocks; Blocks blocks; int32 width, height, msgCount, unreadCount; int32 inboxReadBefore, outboxReadBefore; HistoryItem *showFrom; - HistoryUnreadBar *unreadBar; + HistoryItem *unreadBar; PeerData *peer; bool oldLoaded, newLoaded; @@ -371,8 +378,38 @@ public: editDraft = draft; } - int32 lastWidth, lastScrollTop; - MsgId lastShowAtMsgId; + // some fields below are a property of a currently displayed instance of this + // conversation history not a property of the conversation history itself +public: + // we save the last showAtMsgId to restore the state when switching + // between different conversation histories + MsgId showAtMsgId; + + // we save a pointer of the history item at the top of the displayed window + // together with an offset from the window top to the top of this message + // resulting scrollTop = top(scrollTopItem) + scrollTopOffset + HistoryItem *scrollTopItem; + int scrollTopOffset; + void forgetScrollState() { + scrollTopItem = nullptr; + } + + // find the correct scrollTopItem and scrollTopOffset using given top + // of the displayed window relative to the history start coord + void countScrollState(int top); + +protected: + // when this item is destroyed scrollTopItem just points to the next one + // and scrollTopOffset remains the same + // if we are at the bottom of the window scrollTopItem == nullptr and + // scrollTopOffset is undefined + void getNextScrollTopItem(HistoryBlock *block, int32 i); + + // helper method for countScrollState(int top) + void countScrollTopItem(int top); + +public: + bool mute; bool lastKeyboardInited, lastKeyboardUsed; @@ -431,31 +468,59 @@ public: protected: void clearOnDestroy(); + HistoryItem *addNewToLastBlock(const MTPMessage &msg, NewMessageType type); private: + enum Flag { + f_has_pending_resized_items = (1 << 0), + f_pending_resize = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + Q_DECL_CONSTEXPR friend inline QFlags operator|(Flags::enum_type f1, Flags::enum_type f2) Q_DECL_NOTHROW { + return QFlags(f1) | f2; + } + Q_DECL_CONSTEXPR friend inline QFlags operator|(Flags::enum_type f1, QFlags f2) Q_DECL_NOTHROW { + return f2 | f1; + } + Flags _flags; + ChatListLinksMap _chatListLinks; + DialogRow *mainChatListLink() const { + auto it = _chatListLinks.constFind(0); + t_assert(it != _chatListLinks.cend()); + return it.value(); + } uint64 _sortKeyInChatList; // like ((unixtime) << 32) | (incremented counter) typedef QMap MediaOverviewIds; MediaOverviewIds overviewIds[OverviewCount]; int32 overviewCountData[OverviewCount]; // -1 - not loaded, 0 - all loaded, > 0 - count, but not all loaded - void clearBlocks(bool leaveItems); - friend class HistoryBlock; friend class ChannelHistory; - void createInitialDateBlock(const QDateTime &date); - HistoryItem *addItemAfterPrevToBlock(HistoryItem *item, HistoryItem *prev, HistoryBlock *block); - HistoryItem *addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, int32 itemIndex); - HistoryItem *addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *adding, bool newMsg); - HistoryItem *addMessageGroupAfterPrevToBlock(const MTPDmessageGroup &group, HistoryItem *prev, HistoryBlock *block); - HistoryItem *addMessageGroupAfterPrev(HistoryItem *newItem, HistoryItem *prev); + // this method just removes a block from the blocks list + // when the last item from this block was detached and + // calls the required previousItemChanged() + void removeBlock(HistoryBlock *block); - History(const History &) = delete; - History &operator=(const History &) = delete; -}; + void clearBlocks(bool leaveItems); + + HistoryItem *createItem(const MTPMessage &msg, bool applyServiceAction, bool detachExistingItem); + HistoryItem *createItemForwarded(MsgId id, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *msg); + HistoryItem *createItemDocument(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption); + HistoryItem *createItemPhoto(MsgId id, MTPDmessage::Flags flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption); + + HistoryItem *addItemToBlock(HistoryItem *item, HistoryBlock *block); + HistoryItem *addNewItem(HistoryItem *adding, bool newMsg); + HistoryItem *addMessageGroupAfterPrevToBlock(const MTPDmessageGroup &group, HistoryItem *prev, HistoryBlock *block); + HistoryItem *addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex, int32 itemIndex); + + HistoryBlock *pushBackNewBlock(); + HistoryBlock *pushFrontNewBlock(); + + }; class HistoryGroup; class HistoryCollapse; @@ -809,9 +874,12 @@ struct DialogsIndexed { class HistoryBlock { public: - HistoryBlock(History *hist) : y(0), height(0), history(hist) { + HistoryBlock(History *hist) : y(0), height(0), history(hist), _indexInHistory(-1) { } + HistoryBlock(const HistoryBlock &) = delete; + HistoryBlock &operator=(const HistoryBlock &) = delete; + typedef QVector Items; Items items; @@ -821,12 +889,29 @@ public: } void removeItem(HistoryItem *item); - int32 geomResize(int32 newWidth, int32 *ytransform, const HistoryItem *resizedItem); // return new size + int resizeGetHeight(int newWidth, bool resizeAllItems); int32 y, height; History *history; - HistoryBlock(const HistoryBlock &) = delete; - HistoryBlock &operator=(const HistoryBlock &) = delete; + HistoryBlock *previous() const { + t_assert(_indexInHistory >= 0); + + return (_indexInHistory > 0) ? history->blocks.at(_indexInHistory - 1) : nullptr; + } + void setIndexInHistory(int index) { + _indexInHistory = index; + } + int indexInHistory() const { + t_assert(_indexInHistory >= 0); + t_assert(history->blocks.at(_indexInHistory) == this); + + return _indexInHistory; + } + +protected: + + int _indexInHistory; + }; class HistoryElem { @@ -855,7 +940,6 @@ protected: }; -class HistoryReply; // dynamic_cast optimize class HistoryMessage; // dynamic_cast optimize enum HistoryCursorState { @@ -870,56 +954,115 @@ enum InfoDisplayType { InfoDisplayOverImage, }; -inline bool isImportantChannelMessage(MsgId id, int32 flags) { // client-side important msgs always has_views or has_from_id - return (flags & MTPDmessage::flag_out) || (flags & MTPDmessage::flag_mentioned) || (flags & MTPDmessage::flag_post); +inline bool isImportantChannelMessage(MsgId id, MTPDmessage::Flags flags) { // client-side important msgs always has_views or has_from_id + return (flags & MTPDmessage::Flag::f_out) || (flags & MTPDmessage::Flag::f_mentioned) || (flags & MTPDmessage::Flag::f_post); } enum HistoryItemType { HistoryItemMsg = 0, - HistoryItemDate, - HistoryItemUnreadBar, HistoryItemGroup, HistoryItemCollapse, HistoryItemJoined }; -struct HistoryMessageVia : public BasicInterface { - HistoryMessageVia(Interfaces *); +struct HistoryMessageVia : public BaseComponent { + HistoryMessageVia(Composer*) { + } void create(int32 userId); void resize(int32 availw) const; - UserData *_bot; + UserData *_bot = nullptr; mutable QString _text; - mutable int32 _width, _maxWidth; + mutable int _width = 0; + mutable int _maxWidth = 0; TextLinkPtr _lnk; }; -struct HistoryMessageViews : public BasicInterface { - HistoryMessageViews(Interfaces *); +struct HistoryMessageViews : public BaseComponent { + HistoryMessageViews(Composer*) { + } QString _viewsText; - int32 _views, _viewsWidth; + int _views = 0; + int _viewsWidth = 0; }; -struct HistoryMessageSigned : public BasicInterface { - HistoryMessageSigned(Interfaces *); +struct HistoryMessageSigned : public BaseComponent { + HistoryMessageSigned(Composer*) { + } void create(UserData *from, const QDateTime &date); - int32 maxWidth() const; + int maxWidth() const; Text _signature; }; -struct HistoryMessageForwarded : public BasicInterface { - HistoryMessageForwarded(Interfaces *); +struct HistoryMessageForwarded : public BaseComponent { + HistoryMessageForwarded(Composer*) { + } void create(const HistoryMessageVia *via) const; - bool display(bool hasVia) const; - PeerData *_authorOriginal, *_fromOriginal; - MsgId _originalId; - mutable Text _text; + PeerData *_authorOriginal = nullptr; + PeerData *_fromOriginal = nullptr; + MsgId _originalId = 0; + mutable Text _text = { 1 }; }; +struct HistoryMessageReply : public BaseComponent { + HistoryMessageReply(Composer*) { + } + HistoryMessageReply &operator=(HistoryMessageReply &&other) { + replyToMsgId = other.replyToMsgId; + std::swap(replyToMsg, other.replyToMsg); + replyToLnk = std11::move(other.replyToLnk); + replyToName = std11::move(other.replyToName); + replyToText = std11::move(other.replyToText); + replyToVersion = other.replyToVersion; + _maxReplyWidth = other._maxReplyWidth; + std::swap(_replyToVia, other._replyToVia); + return *this; + } + ~HistoryMessageReply() { + // clearData() should be called by holder + t_assert(replyToMsg == nullptr); + t_assert(_replyToVia == nullptr); + } + bool updateData(HistoryMessage *holder, bool force = false); + void clearData(HistoryMessage *holder); // must be called before destructor + + void checkNameUpdate() const; + void updateName() const; + void resize(int width) const; + void itemRemoved(HistoryMessage *holder, HistoryItem *removed); + + enum PaintFlag { + PaintInBubble = 0x01, + PaintSelected = 0x02, + }; + Q_DECLARE_FLAGS(PaintFlags, PaintFlag); + void paint(Painter &p, const HistoryItem *holder, int x, int y, int w, PaintFlags flags) const; + + MsgId replyToId() const { + return replyToMsgId; + } + int replyToWidth() const { + return _maxReplyWidth; + } + TextLinkPtr replyToLink() const { + return replyToLnk; + } + + MsgId replyToMsgId = 0; + HistoryItem *replyToMsg = nullptr; + TextLinkPtr replyToLnk; + mutable Text replyToName, replyToText; + mutable int replyToVersion = 0; + mutable int _maxReplyWidth = 0; + HistoryMessageVia *_replyToVia = nullptr; + int toWidth = 0; +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(HistoryMessageReply::PaintFlags); + class HistoryDependentItemCallback : public SharedCallback2 { public: HistoryDependentItemCallback(FullMsgId dependent) : _dependent(dependent) { @@ -931,14 +1074,59 @@ private: }; +// any HistoryItem can have this Interface for +// displaying the day mark above the message +struct HistoryMessageDate : public BaseComponent { + HistoryMessageDate(Composer*) { + } + void init(const QDateTime &date); + + int height() const; + void paint(Painter &p, int y, int w) const; + + QString _text; + int _width = 0; +}; + +// any HistoryItem can have this Interface for +// displaying the unread messages bar above the message +struct HistoryMessageUnreadBar : public BaseComponent { + HistoryMessageUnreadBar(Composer*) { + } + void init(int count); + + int height() const; + void paint(Painter &p, int y, int w) const; + + QString _text; + int _width = 0; + + // if unread bar is freezed the new messages do not + // increment the counter displayed by this bar + // + // it happens when we've opened the conversation and + // we've seen the bar and new messages are marked as read + // as soon as they are added to the chat history + bool _freezed = false; +}; + class HistoryMedia; -class HistoryItem : public HistoryElem, public Interfaces { +class HistoryItem : public HistoryElem, public Composer { public: - HistoryItem(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime msgDate, int32 from); + HistoryItem(const HistoryItem &) = delete; + HistoryItem &operator=(const HistoryItem &) = delete; - virtual void initDimensions() = 0; - virtual int32 resize(int32 width) = 0; // return new height + int resizeGetHeight(int width) { + if (_flags & MTPDmessage_ClientFlag::f_pending_init_dimensions) { + _flags &= ~MTPDmessage_ClientFlag::f_pending_init_dimensions; + initDimensions(); + } + if (_flags & MTPDmessage_ClientFlag::f_pending_resize) { + _flags &= ~MTPDmessage_ClientFlag::f_pending_resize; + } + return resizeGetHeight_(width); + } virtual void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const = 0; virtual void dependencyItemRemoved(HistoryItem *dependency) { @@ -953,8 +1141,11 @@ public: return true; } - virtual UserData *viaBot() const { - return 0; + UserData *viaBot() const { + if (const HistoryMessageVia *via = Get()) { + return via->_bot; + } + return nullptr; } History *history() const { @@ -975,11 +1166,36 @@ public: bool detached() const { return !_block; } - void attach(HistoryBlock *block) { + void attachToBlock(HistoryBlock *block, int index) { + t_assert(_block == nullptr); + t_assert(_indexInBlock < 0); + t_assert(block != nullptr); + t_assert(index >= 0); + _block = block; + _indexInBlock = index; + if (pendingResize()) { + _history->setHasPendingResizedItems(); + } + } + void setIndexInBlock(int index) { + t_assert(_block != nullptr); + t_assert(index >= 0); + + _indexInBlock = index; + } + int indexInBlock() const { + if (_indexInBlock >= 0) { + t_assert(_block != nullptr); + t_assert(_block->items.at(_indexInBlock) == this); + } else if (_block != nullptr) { + t_assert(_indexInBlock >= 0); + t_assert(_block->items.at(_indexInBlock) == this); + } + return _indexInBlock; } bool out() const { - return _flags & MTPDmessage::flag_out; + return _flags & MTPDmessage::Flag::f_out; } bool unread() const { if (out() && id > 0 && id < _history->outboxReadBefore) return false; @@ -989,31 +1205,31 @@ public: } if (history()->peer->isSelf()) return false; // messages from myself are always read if (out() && history()->peer->migrateTo()) return false; // outgoing messages in converted chats are always read - return (_flags & MTPDmessage::flag_unread); + return (_flags & MTPDmessage::Flag::f_unread); } bool mentionsMe() const { - return _flags & MTPDmessage::flag_mentioned; + return _flags & MTPDmessage::Flag::f_mentioned; } bool isMediaUnread() const { - return (_flags & MTPDmessage::flag_media_unread) && (channelId() == NoChannel); + return (_flags & MTPDmessage::Flag::f_media_unread) && (channelId() == NoChannel); } void markMediaRead() { - _flags &= ~MTPDmessage::flag_media_unread; + _flags &= ~MTPDmessage::Flag::f_media_unread; } bool hasReplyMarkup() const { - return _flags & MTPDmessage::flag_reply_markup; + return _flags & MTPDmessage::Flag::f_reply_markup; } bool hasTextLinks() const { - return _flags & MTPDmessage_flag_HAS_TEXT_LINKS; + return _flags & MTPDmessage_ClientFlag::f_has_text_links; } bool isGroupMigrate() const { - return _flags & MTPDmessage_flag_IS_GROUP_MIGRATE; + return _flags & MTPDmessage_ClientFlag::f_is_group_migrate; } bool hasViews() const { - return _flags & MTPDmessage::flag_views; + return _flags & MTPDmessage::Flag::f_views; } bool isPost() const { - return _flags & MTPDmessage::flag_post; + return _flags & MTPDmessage::Flag::f_post; } bool isImportant() const { return _history->isChannel() && isImportantChannelMessage(id, _flags); @@ -1022,7 +1238,10 @@ public: return (id > 0) && (!history()->isChannel() || history()->isMegagroup() || isPost()); } bool isSilent() const { - return _flags & MTPDmessage::flag_silent; + return _flags & MTPDmessage::Flag::f_silent; + } + bool hasOutLayout() const { + return out() && !isPost(); } virtual int32 viewsCount() const { return hasViews() ? 1 : -1; @@ -1064,6 +1283,7 @@ public: virtual bool hasBubble() const { return false; } + virtual void previousItemChanged(); virtual QString selectedText(uint32 selection) const { return qsl("[-]"); @@ -1077,12 +1297,9 @@ public: virtual void drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const { } - virtual void setViewsCount(int32 count, bool reinit = true) { + virtual void setViewsCount(int32 count) { } virtual void setId(MsgId newId); - virtual void setDate(const QDateTime &date) { // for date items - this->date = date; - } virtual void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const = 0; virtual QString notificationHeader() const { return QString(); @@ -1091,7 +1308,7 @@ public: bool canDelete() const { ChannelData *channel = _history->peer->asChannel(); - if (!channel) return !(_flags & MTPDmessage_flag_IS_GROUP_MIGRATE); + if (!channel) return !(_flags & MTPDmessage_ClientFlag::f_is_group_migrate); if (id == 1) return false; if (channel->amCreator()) return true; @@ -1109,7 +1326,7 @@ public: bool canEdit(const QDateTime &cur) const; bool suggestBanReportDeleteAll() const { - auto channel = history()->peer->asChannel(); + ChannelData *channel = history()->peer->asChannel(); if (!channel || (!channel->amEditor() && !channel->amCreator())) return false; return !isPost() && !out() && from()->isUser() && toHistoryMessage(); } @@ -1176,10 +1393,10 @@ public: virtual const HistoryMessage *toHistoryMessage() const { // dynamic_cast optimize return 0; } - virtual HistoryReply *toHistoryReply() { // dynamic_cast optimize - return 0; - } - virtual const HistoryReply *toHistoryReply() const { // dynamic_cast optimize + MsgId replyToId() const { + if (auto *reply = Get()) { + return reply->replyToId(); + } return 0; } @@ -1189,7 +1406,6 @@ public: PeerData *author() const { return isPost() ? history()->peer : _from; } - bool displayFromPhoto() const; PeerData *fromOriginal() const { if (const HistoryMessageForwarded *fwd = Get()) { @@ -1204,21 +1420,125 @@ public: return author(); } + // count > 0 - creates the unread bar if necessary and + // sets unread messages count if bar is not freezed yet + // count <= 0 - destroys the unread bar + void setUnreadBarCount(int count); + void destroyUnreadBar(); + + // marks the unread bar as freezed so that unread + // messages count will not change for this bar + // when the new messages arrive in this chat history + void setUnreadBarFreezed(); + + bool pendingResize() const { + return _flags & MTPDmessage_ClientFlag::f_pending_resize; + } + void setPendingResize() { + _flags |= MTPDmessage_ClientFlag::f_pending_resize; + if (!detached()) { + _history->setHasPendingResizedItems(); + } + } + bool pendingInitDimensions() const { + return _flags & MTPDmessage_ClientFlag::f_pending_init_dimensions; + } + void setPendingInitDimensions() { + _flags |= MTPDmessage_ClientFlag::f_pending_init_dimensions; + setPendingResize(); + } + + int displayedDateHeight() const { + if (auto *date = Get()) { + return date->height(); + } + return 0; + } + int marginTop() const { + int result = 0; + if (isAttachedToPrevious()) { + result += st::msgMarginTopAttached; + } else { + result += st::msgMargin.top(); + } + result += displayedDateHeight(); + if (auto *unreadbar = Get()) { + result += unreadbar->height(); + } + return result; + } + int marginBottom() const { + return st::msgMargin.bottom(); + } + bool isAttachedToPrevious() const { + return _flags & MTPDmessage_ClientFlag::f_attach_to_previous; + } + void clipCallback(ClipReaderNotification notification); virtual ~HistoryItem(); protected: + HistoryItem(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime msgDate, int32 from); + + // to completely create history item we need to call + // a virtual method, it can not be done from constructor + virtual void finishCreate(); + + // called from resizeGetHeight() when MTPDmessage_ClientFlag::f_pending_init_dimensions is set + virtual void initDimensions() = 0; + + virtual int resizeGetHeight_(int width) = 0; + PeerData *_from; History *_history; - HistoryBlock *_block; - int32 _flags; + HistoryBlock *_block = nullptr; + int _indexInBlock = -1; + MTPDmessage::Flags _flags; mutable int32 _authorNameVersion; - HistoryItem(const HistoryItem &) = delete; - HistoryItem &operator=(const HistoryItem &) = delete; + HistoryItem *previous() const { + if (_block && _indexInBlock >= 0) { + if (_indexInBlock > 0) return _block->items.at(_indexInBlock - 1); + if (HistoryBlock *previousBlock = _block->previous()) { + return previousBlock->items.back(); + } + } + return nullptr; + } + + // this should be used only in previousItemChanged() + // to add required bits to the Interfaces mask + // after that always use Has() + bool displayDate() const { + if (HistoryItem *prev = previous()) { + return prev->date.date().day() != date.date().day(); + } + return true; + } + + // this should be used only in previousItemChanged() or when + // HistoryMessageDate or HistoryMessageUnreadBar bit is changed in the Interfaces mask + // then the result should be cached in a client side flag MTPDmessage_ClientFlag::f_attach_to_previous + void recountAttachToPrevious(); + +}; + +// make all the constructors in HistoryItem children protected +// and wrapped with a static create() call with the same args +// so that history item can not be created directly, without +// calling a virtual finishCreate() method +template +class HistoryItemInstantiated { +public: + template + static T *_create(Args ... args) { + T *result = new T(args ...); + result->finishCreate(); + return result; + } }; class MessageLink : public ITextLink { @@ -1254,8 +1574,6 @@ private: HistoryItem *_item; }; -HistoryItem *regItem(HistoryItem *item); - class RadialAnimation { public: @@ -1332,16 +1650,19 @@ public: return 0; } - virtual bool playInline(HistoryItem *item) { + bool playInline(HistoryItem *item/*, bool autoplay = false*/) { + return playInline(item, false); + } + virtual bool playInline(HistoryItem *item, bool autoplay) { return false; } virtual void stopInline(HistoryItem *item) { } - virtual void regItem(HistoryItem *item) { + virtual void attachToItem(HistoryItem *item) { } - virtual void unregItem(HistoryItem *item) { + virtual void detachFromItem(HistoryItem *item) { } virtual void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) { @@ -1473,58 +1794,58 @@ public: HistoryPhoto(PeerData *chat, const MTPDphoto &photo, int32 width = 0); HistoryPhoto(const HistoryPhoto &other); void init(); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypePhoto; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryPhoto(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; PhotoData *photo() const { return _data; } - void updateFrom(const MTPMessageMedia &media, HistoryItem *parent); + void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) override; - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - bool hasReplyPreview() const { + bool hasReplyPreview() const override { return !_data->thumb->isNull(); } - ImagePtr replyPreview(); + ImagePtr replyPreview() override; - QString getCaption() const { + QString getCaption() const override { return _caption.original(); } - bool needsBubble(const HistoryItem *parent) const { - return !_caption.isEmpty() || parent->Is() || parent->toHistoryReply() || parent->viaBot(); + bool needsBubble(const HistoryItem *parent) const override { + return !_caption.isEmpty() || parent->Has() || parent->Has() || parent->viaBot(); } - bool customInfoLayout() const { + bool customInfoLayout() const override { return _caption.isEmpty(); } - bool hideFromName() const { + bool hideFromName() const override { return true; } protected: - float64 dataProgress() const { + float64 dataProgress() const override { return _data->progress(); } - bool dataFinished() const { + bool dataFinished() const override { return !_data->loading() && !_data->uploading(); } - bool dataLoaded() const { + bool dataLoaded() const override { return _data->loaded(); } @@ -1540,60 +1861,60 @@ public: HistoryVideo(DocumentData *document, const QString &caption, const HistoryItem *parent); HistoryVideo(const HistoryVideo &other); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypeVideo; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryVideo(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - DocumentData *getDocument() { + DocumentData *getDocument() override { return _data; } - bool uploading() const { + bool uploading() const override { return _data->uploading(); } - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - bool hasReplyPreview() const { + bool hasReplyPreview() const override { return !_data->thumb->isNull(); } - ImagePtr replyPreview(); + ImagePtr replyPreview() override; - QString getCaption() const { + QString getCaption() const override { return _caption.original(); } - bool needsBubble(const HistoryItem *parent) const { - return !_caption.isEmpty() || parent->Is() || parent->toHistoryReply() || parent->viaBot(); + bool needsBubble(const HistoryItem *parent) const override { + return !_caption.isEmpty() || parent->Has() || parent->Has() || parent->viaBot(); } - bool customInfoLayout() const { + bool customInfoLayout() const override { return _caption.isEmpty(); } - bool hideFromName() const { + bool hideFromName() const override { return true; } protected: - float64 dataProgress() const { + float64 dataProgress() const override { return _data->progress(); } - bool dataFinished() const { + bool dataFinished() const override { return !_data->loading() && !_data->uploading(); } - bool dataLoaded() const { + bool dataLoaded() const override { return _data->loaded(); } @@ -1607,25 +1928,25 @@ private: }; -struct HistoryDocumentThumbed : public BasicInterface { - HistoryDocumentThumbed(Interfaces *interfaces) : _thumbw(0), _linkw(0) { +struct HistoryDocumentThumbed : public BaseComponent { + HistoryDocumentThumbed(Composer*) { } TextLinkPtr _linksavel, _linkcancell; - int32 _thumbw; + int _thumbw = 0; - mutable int32 _linkw; + mutable int _linkw = 0; mutable QString _link; }; -struct HistoryDocumentCaptioned : public BasicInterface { - HistoryDocumentCaptioned(Interfaces *interfaces) : _caption(st::msgFileMinWidth - st::msgPadding.left() - st::msgPadding.right()) { +struct HistoryDocumentCaptioned : public BaseComponent { + HistoryDocumentCaptioned(Composer*) : _caption(st::msgFileMinWidth - st::msgPadding.left() - st::msgPadding.right()) { } Text _caption; }; -struct HistoryDocumentNamed : public BasicInterface { - HistoryDocumentNamed(Interfaces *interfaces) : _namew(0) { +struct HistoryDocumentNamed : public BaseComponent { + HistoryDocumentNamed(Composer*) { } QString _name; - int32 _namew; + int _namew = 0; }; class HistoryDocument; struct HistoryDocumentVoicePlayback { @@ -1635,72 +1956,76 @@ struct HistoryDocumentVoicePlayback { anim::fvalue a_progress; Animation _a_progress; }; -struct HistoryDocumentVoice : public BasicInterface { - HistoryDocumentVoice(Interfaces *that) : _playback(0) { +struct HistoryDocumentVoice : public BaseComponent { + HistoryDocumentVoice(Composer*) { + } + HistoryDocumentVoice &operator=(HistoryDocumentVoice &&other) { + std::swap(_playback, other._playback); + return *this; } ~HistoryDocumentVoice() { deleteAndMark(_playback); } void ensurePlayback(const HistoryDocument *interfaces) const; void checkPlaybackFinished() const; - mutable HistoryDocumentVoicePlayback *_playback; + mutable HistoryDocumentVoicePlayback *_playback = nullptr; }; -class HistoryDocument : public HistoryFileMedia, public Interfaces { +class HistoryDocument : public HistoryFileMedia, public Composer { public: HistoryDocument(DocumentData *document, const QString &caption, const HistoryItem *parent); HistoryDocument(const HistoryDocument &other); - HistoryMediaType type() const { + HistoryMediaType type() const override { return _data->voice() ? MediaTypeVoiceFile : (_data->song() ? MediaTypeMusicFile : MediaTypeFile); } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryDocument(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - bool uploading() const { + bool uploading() const override { return _data->uploading(); } - DocumentData *getDocument() { + DocumentData *getDocument() override { return _data; } - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - void updateFrom(const MTPMessageMedia &media, HistoryItem *parent); + void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) override; - bool hasReplyPreview() const { + bool hasReplyPreview() const override { return !_data->thumb->isNull(); } - ImagePtr replyPreview(); + ImagePtr replyPreview() override; - QString getCaption() const { + QString getCaption() const override { if (const HistoryDocumentCaptioned *captioned = Get()) { return captioned->_caption.original(); } return QString(); } - bool needsBubble(const HistoryItem *parent) const { + bool needsBubble(const HistoryItem *parent) const override { return true; } - bool customInfoLayout() const { + bool customInfoLayout() const override { return false; } - QMargins bubbleMargins() const { + QMargins bubbleMargins() const override { return Get() ? QMargins(st::msgFileThumbPadding.left(), st::msgFileThumbPadding.top(), st::msgFileThumbPadding.left(), st::msgFileThumbPadding.bottom()) : st::msgPadding; } - bool hideForwardedFrom() const { + bool hideForwardedFrom() const override { return _data->song(); } @@ -1708,19 +2033,19 @@ public: protected: - float64 dataProgress() const { + float64 dataProgress() const override { return _data->progress(); } - bool dataFinished() const { + bool dataFinished() const override { return !_data->loading() && !_data->uploading(); } - bool dataLoaded() const { + bool dataLoaded() const override { return _data->loaded(); } private: - void create(bool caption); + void createInterfaces(bool caption); const HistoryItem *_parent; DocumentData *_data; @@ -1734,56 +2059,56 @@ public: HistoryGif(DocumentData *document, const QString &caption, const HistoryItem *parent); HistoryGif(const HistoryGif &other); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypeGif; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryGif(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - bool uploading() const { + bool uploading() const override { return _data->uploading(); } - DocumentData *getDocument() { + DocumentData *getDocument() override { return _data; } - ClipReader *getClipReader() { + ClipReader *getClipReader() override { return gif(); } - bool playInline(HistoryItem *item); - void stopInline(HistoryItem *item); + bool playInline(HistoryItem *item, bool autoplay) override; + void stopInline(HistoryItem *item) override; - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - void updateFrom(const MTPMessageMedia &media, HistoryItem *parent); + void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) override; - bool hasReplyPreview() const { + bool hasReplyPreview() const override { return !_data->thumb->isNull(); } - ImagePtr replyPreview(); + ImagePtr replyPreview() override; - QString getCaption() const { + QString getCaption() const override { return _caption.original(); } - bool needsBubble(const HistoryItem *parent) const { - return !_caption.isEmpty() || parent->Is() || parent->toHistoryReply() || parent->viaBot(); + bool needsBubble(const HistoryItem *parent) const override { + return !_caption.isEmpty() || parent->Has() || parent->Has() || parent->viaBot(); } - bool customInfoLayout() const { + bool customInfoLayout() const override { return _caption.isEmpty(); } - bool hideFromName() const { + bool hideFromName() const override { return true; } @@ -1791,9 +2116,9 @@ public: protected: - float64 dataProgress() const; - bool dataFinished() const; - bool dataLoaded() const; + float64 dataProgress() const override; + bool dataFinished() const override; + bool dataLoaded() const override; private: @@ -1804,10 +2129,10 @@ private: ClipReader *_gif; ClipReader *gif() { - return (_gif == BadClipReader) ? 0 : _gif; + return (_gif == BadClipReader) ? nullptr : _gif; } const ClipReader *gif() const { - return (_gif == BadClipReader) ? 0 : _gif; + return (_gif == BadClipReader) ? nullptr : _gif; } void setStatusSize(int32 newSize) const; @@ -1819,35 +2144,35 @@ class HistorySticker : public HistoryMedia { public: HistorySticker(DocumentData *document); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypeSticker; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistorySticker(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - DocumentData *getDocument() { + DocumentData *getDocument() override { return _data; } - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - void updateFrom(const MTPMessageMedia &media, HistoryItem *parent); + void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) override; - bool needsBubble(const HistoryItem *parent) const { + bool needsBubble(const HistoryItem *parent) const override { return false; } - bool customInfoLayout() const { + bool customInfoLayout() const override { return true; } @@ -1883,30 +2208,30 @@ class HistoryContact : public HistoryMedia { public: HistoryContact(int32 userId, const QString &first, const QString &last, const QString &phone); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypeContact; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryContact(_userId, _fname, _lname, _phone); } - void initDimensions(const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - void updateFrom(const MTPMessageMedia &media, HistoryItem *parent); + void updateFrom(const MTPMessageMedia &media, HistoryItem *parent) override; - bool needsBubble(const HistoryItem *parent) const { + bool needsBubble(const HistoryItem *parent) const override { return true; } - bool customInfoLayout() const { + bool customInfoLayout() const override { return false; } @@ -1939,57 +2264,57 @@ public: HistoryWebPage(WebPageData *data); HistoryWebPage(const HistoryWebPage &other); - HistoryMediaType type() const { + HistoryMediaType type() const override { return MediaTypeWebPage; } - HistoryMedia *clone() const { + HistoryMedia *clone() const override { return new HistoryWebPage(*this); } - void initDimensions(const HistoryItem *parent); - int32 resize(int32 width, const HistoryItem *parent); + void initDimensions(const HistoryItem *parent) override; + int32 resize(int32 width, const HistoryItem *parent) override; - void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const; + void draw(Painter &p, const HistoryItem *parent, const QRect &r, bool selected, uint64 ms) const override; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const HistoryItem *parent) const override; - const QString inDialogsText() const; - const QString inHistoryText() const; + const QString inDialogsText() const override; + const QString inHistoryText() const override; - void linkOver(HistoryItem *parent, const TextLinkPtr &lnk); - void linkOut(HistoryItem *parent, const TextLinkPtr &lnk); + void linkOver(HistoryItem *parent, const TextLinkPtr &lnk) override; + void linkOut(HistoryItem *parent, const TextLinkPtr &lnk) override; - bool isDisplayed() const { + bool isDisplayed() const override { return !_data->pendingTill; } - DocumentData *getDocument() { + DocumentData *getDocument() override { return _attach ? _attach->getDocument() : 0; } - ClipReader *getClipReader() { + ClipReader *getClipReader() override { return _attach ? _attach->getClipReader() : 0; } - bool playInline(HistoryItem *item) { - return _attach ? _attach->playInline(item) : false; + bool playInline(HistoryItem *item, bool autoplay) override { + return _attach ? _attach->playInline(item, autoplay) : false; } - void stopInline(HistoryItem *item) { + void stopInline(HistoryItem *item) override { if (_attach) _attach->stopInline(item); } - void regItem(HistoryItem *item); - void unregItem(HistoryItem *item); + void attachToItem(HistoryItem *item) override; + void detachFromItem(HistoryItem *item) override; - bool hasReplyPreview() const { + bool hasReplyPreview() const override { return (_data->photo && !_data->photo->thumb->isNull()) || (_data->doc && !_data->doc->thumb->isNull()); } - ImagePtr replyPreview(); + ImagePtr replyPreview() override; WebPageData *webpage() { return _data; } - bool needsBubble(const HistoryItem *parent) const { + bool needsBubble(const HistoryItem *parent) const override { return true; } - bool customInfoLayout() const { + bool customInfoLayout() const override { return false; } @@ -2084,7 +2409,7 @@ public: } bool needsBubble(const HistoryItem *parent) const { - return !_title.isEmpty() || !_description.isEmpty() || parent->Is() || parent->toHistoryReply() || parent->viaBot(); + return !_title.isEmpty() || !_description.isEmpty() || parent->Has() || parent->Has() || parent->viaBot(); } bool customInfoLayout() const { return true; @@ -2113,28 +2438,30 @@ private: }; -class HistoryMessage : public HistoryItem { +class HistoryMessage : public HistoryItem, private HistoryItemInstantiated { public: - HistoryMessage(History *history, HistoryBlock *block, const MTPDmessage &msg); - HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, QDateTime date, int32 from, HistoryMessage *fwd); // local forwarded - HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, QDateTime date, int32 from, const QString &msg, const EntitiesInText &entities); // local message - HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, QDateTime date, int32 from, DocumentData *doc, const QString &caption); // local document - HistoryMessage(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, QDateTime date, int32 from, PhotoData *photo, const QString &caption); // local photo + static HistoryMessage *create(History *history, const MTPDmessage &msg) { + return _create(history, msg); + } + static HistoryMessage *create(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *fwd) { + return _create(history, msgId, flags, date, from, fwd); + } + static HistoryMessage *create(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, const QString &msg, const EntitiesInText &entities) { + return _create(history, msgId, flags, replyTo, viaBotId, date, from, msg, entities); + } + static HistoryMessage *create(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, DocumentData *doc, const QString &caption) { + return _create(history, msgId, flags, replyTo, viaBotId, date, from, doc, caption); + } + static HistoryMessage *create(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, PhotoData *photo, const QString &caption) { + return _create(history, msgId, flags, replyTo, viaBotId, date, from, photo, caption); + } void initTime(); void initMedia(const MTPMessageMedia *media, QString ¤tText); void initMediaFromDocument(DocumentData *doc, const QString &caption); - void initDimensions(); void fromNameUpdated(int32 width) const; - virtual UserData *viaBot() const { - if (const HistoryMessageVia *via = Get()) { - return via->_bot; - } - return 0; - } - int32 plainMaxWidth() const; void countPositionAndSize(int32 &left, int32 &width) const; @@ -2144,67 +2471,69 @@ public: bool drawBubble() const { return _media ? (!emptyText() || _media->needsBubble(this)) : true; } - bool hasBubble() const { + bool hasBubble() const override { return drawBubble(); } bool displayFromName() const { - return hasFromName() && (!emptyText() || !_media || !_media->isDisplayed() || toHistoryReply() || Is() || viaBot() || !_media->hideFromName()); + if (!hasFromName()) return false; + if (isAttachedToPrevious()) return false; + + return (!emptyText() || !_media || !_media->isDisplayed() || Has() || Has() || viaBot() || !_media->hideFromName()); } bool uploading() const { return _media && _media->uploading(); } - void drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const; - void setViewsCount(int32 count, bool reinit = true); - void setId(MsgId newId); - void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const; + void drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const override; + void setViewsCount(int32 count) override; + void setId(MsgId newId) override; + void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const override; - virtual void drawMessageText(Painter &p, QRect trect, uint32 selection) const; + void dependencyItemRemoved(HistoryItem *dependency) override; - void destroy(); + void destroy() override; - int32 resize(int32 width); - bool hasPoint(int32 x, int32 y) const; - bool pointInTime(int32 right, int32 bottom, int32 x, int32 y, InfoDisplayType type) const; + bool hasPoint(int32 x, int32 y) const override; + bool pointInTime(int32 right, int32 bottom, int32 x, int32 y, InfoDisplayType type) const override; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; - virtual void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const; + void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const override; - void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const; - uint32 adjustSelection(uint16 from, uint16 to, TextSelectType type) const { + void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const override; + uint32 adjustSelection(uint16 from, uint16 to, TextSelectType type) const override { return _text.adjustSelection(from, to, type); } - void linkOver(const TextLinkPtr &lnk) { + void linkOver(const TextLinkPtr &lnk) override { if (_media) _media->linkOver(this, lnk); } - void linkOut(const TextLinkPtr &lnk) { + void linkOut(const TextLinkPtr &lnk) override { if (_media) _media->linkOut(this, lnk); } - void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const; - QString notificationHeader() const; - QString notificationText() const; + void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const override; + QString notificationHeader() const override; + QString notificationText() const override; - void updateMedia(const MTPMessageMedia *media, bool edited = false) { + void updateMedia(const MTPMessageMedia *media, bool edited = false) override { if (!edited && media && _media && _media->type() != MediaTypeWebPage) { _media->updateFrom(*media, this); } else { setMedia(media); } + setPendingInitDimensions(); } - int32 addToOverview(AddToOverviewMethod method); + int32 addToOverview(AddToOverviewMethod method) override; void eraseFromOverview(); - QString selectedText(uint32 selection) const; - QString inDialogsText() const; - HistoryMedia *getMedia(bool inOverview = false) const; + QString selectedText(uint32 selection) const override; + QString inDialogsText() const override; + HistoryMedia *getMedia(bool inOverview = false) const override; void setMedia(const MTPMessageMedia *media); - void setText(const QString &text, const EntitiesInText &entities); - QString originalText() const; - EntitiesInText originalEntities() const; - bool textHasLinks(); + void setText(const QString &text, const EntitiesInText &entities) override; + QString originalText() const override; + EntitiesInText originalEntities() const override; + bool textHasLinks() override; - int32 infoWidth() const { + int32 infoWidth() const override { int32 result = _timeWidth; if (const HistoryMessageViews *views = Get()) { result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth(); @@ -2216,7 +2545,7 @@ public: } return result; } - int32 timeLeft() const { + int32 timeLeft() const override { int32 result = 0; if (const HistoryMessageViews *views = Get()) { result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth(); @@ -2225,123 +2554,102 @@ public: } return result; } - int32 timeWidth() const { + int32 timeWidth() const override { return _timeWidth; } - int32 viewsCount() const { + int32 viewsCount() const override { if (const HistoryMessageViews *views = Get()) { return views->_views; } return HistoryItem::viewsCount(); } - HistoryMessage *toHistoryMessage() { // dynamic_cast optimize + bool updateDependencyItem() override { + if (auto *reply = Get()) { + return reply->updateData(this, true); + } + return true; + } + MsgId dependencyMsgId() const override { + return replyToId(); + } + + HistoryMessage *toHistoryMessage() override { // dynamic_cast optimize return this; } - const HistoryMessage *toHistoryMessage() const { // dynamic_cast optimize + const HistoryMessage *toHistoryMessage() const override { // dynamic_cast optimize return this; } + // hasFromPhoto() returns true even if we don't display the photo + // but we need to skip a place at the left side for this photo + bool displayFromPhoto() const; + bool hasFromPhoto() const; + ~HistoryMessage(); protected: - void create(int32 viaBotId, int32 viewsCount, const PeerId &authorIdOriginal = 0, const PeerId &fromIdOriginal = 0, MsgId originalId = 0); + HistoryMessage(History *history, const MTPDmessage &msg); + HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, int32 from, HistoryMessage *fwd); // local forwarded + HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, const QString &msg, const EntitiesInText &entities); // local message + HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, DocumentData *doc, const QString &caption); // local document + HistoryMessage(History *history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, QDateTime date, int32 from, PhotoData *photo, const QString &caption); // local photo + friend class HistoryItemInstantiated; + + void initDimensions() override; + int resizeGetHeight_(int width) override; bool displayForwardedFrom() const { if (const HistoryMessageForwarded *fwd = Get()) { - return Is() || !_media || !_media->isDisplayed() || fwd->_authorOriginal->isChannel() || !_media->hideForwardedFrom(); + return Has() || !_media || !_media->isDisplayed() || fwd->_authorOriginal->isChannel() || !_media->hideForwardedFrom(); } return false; } - void paintForwardedInfo(Painter &p, int32 x, int32 y, int32 w, bool selected) const; - Text _text; + void paintForwardedInfo(Painter &p, QRect &trect, bool selected) const; + void paintReplyInfo(Painter &p, QRect &trect, bool selected) const; - int32 _textWidth, _textHeight; + // this method draws "via @bot" if it is not painted in forwarded info or in from name + void paintViaBotIdInfo(Painter &p, QRect &trect, bool selected) const; - HistoryMedia *_media; + Text _text = { int(st::msgMinWidth) }; + + int _textWidth = 0; + int _textHeight = 0; + + HistoryMedia *_media = nullptr; QString _timeText; - int32 _timeWidth; + int _timeWidth = 0; + + void createInterfacesHelper(MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId); + void createInterfaces(MsgId replyTo, int32 viaBotId, int32 viewsCount, const PeerId &authorIdOriginal = 0, const PeerId &fromIdOriginal = 0, MsgId originalId = 0); }; -class HistoryReply : public HistoryMessage { -public: - - HistoryReply(History *history, HistoryBlock *block, const MTPDmessage &msg); - HistoryReply(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, DocumentData *doc, const QString &caption); - HistoryReply(History *history, HistoryBlock *block, MsgId msgId, int32 flags, int32 viaBotId, MsgId replyTo, QDateTime date, int32 from, PhotoData *photo, const QString &caption); - - void initDimensions() override; - - bool updateDependencyItem() override { - return updateReplyTo(true); +inline MTPDmessage::Flags newMessageFlags(PeerData *p) { + MTPDmessage::Flags result = 0; + if (!p->isSelf()) { + result |= MTPDmessage::Flag::f_out; + if (p->isChat() || (p->isUser() && !p->asUser()->botInfo)) { + result |= MTPDmessage::Flag::f_unread; + } } - MsgId dependencyMsgId() const override { - return replyToId(); - } - int32 replyToWidth() const; - - TextLinkPtr replyToLink() const; - - MsgId replyToId() const; - HistoryItem *replyToMessage() const; - void dependencyItemRemoved(HistoryItem *dependency) override; - - void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const override; - void drawReplyTo(Painter &p, int32 x, int32 y, int32 w, bool selected, bool likeService = false) const; - void drawMessageText(Painter &p, QRect trect, uint32 selection) const override; - int32 resize(int32 width) override; - void resizeVia(int32 w) const; - bool hasPoint(int32 x, int32 y) const override; - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const override; - void getStateFromMessageText(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y, const QRect &r) const override; - void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const override; - - PeerData *replyTo() const { - return replyToMsg ? replyToMsg->author() : 0; - } - QString selectedText(uint32 selection) const override; - - HistoryReply *toHistoryReply() override { // dynamic_cast optimize - return this; - } - const HistoryReply *toHistoryReply() const override { // dynamic_cast optimize - return this; - } - - ~HistoryReply(); - -protected: - - bool updateReplyTo(bool force = false); - void replyToNameUpdated() const; - - MsgId replyToMsgId; - HistoryItem *replyToMsg; - TextLinkPtr replyToLnk; - mutable Text replyToName, replyToText; - mutable int32 replyToVersion; - mutable int32 _maxReplyWidth; - HistoryMessageVia *_replyToVia; - int32 toWidth; - -}; - -inline int32 newMessageFlags(PeerData *p) { - return p->isSelf() ? 0 : (((p->isChat() || (p->isUser() && !p->asUser()->botInfo)) ? MTPDmessage::flag_unread : 0) | MTPDmessage::flag_out); + return result; } -inline int32 newForwardedFlags(PeerData *p, int32 from, HistoryMessage *fwd) { - int32 result = newMessageFlags(p) | (from ? MTPDmessage::flag_from_id : 0); - if (fwd->Is()) { - result |= MTPDmessage::flag_via_bot_id; +inline MTPDmessage::Flags newForwardedFlags(PeerData *p, int32 from, HistoryMessage *fwd) { + MTPDmessage::Flags result = newMessageFlags(p); + if (from) { + result |= MTPDmessage::Flag::f_from_id; + } + if (fwd->Has()) { + result |= MTPDmessage::Flag::f_via_bot_id; } if (!p->isChannel()) { if (HistoryMedia *media = fwd->getMedia()) { if (media->type() == MediaTypeVoiceFile) { - result |= MTPDmessage::flag_media_unread; + result |= MTPDmessage::Flag::f_media_unread; // } else if (media->type() == MediaTypeVideo) { // result |= MTPDmessage::flag_media_unread; } @@ -2350,21 +2658,24 @@ inline int32 newForwardedFlags(PeerData *p, int32 from, HistoryMessage *fwd) { return result; } -struct HistoryServicePinned : public BasicInterface { - HistoryServicePinned(Interfaces *); +struct HistoryServicePinned : public BaseComponent { + HistoryServicePinned(Composer*) { + } - MsgId msgId; - HistoryItem *msg; + MsgId msgId = 0; + HistoryItem *msg = nullptr; TextLinkPtr lnk; }; -class HistoryServiceMsg : public HistoryItem { +class HistoryService : public HistoryItem, private HistoryItemInstantiated { public: - HistoryServiceMsg(History *history, HistoryBlock *block, const MTPDmessageService &msg); - HistoryServiceMsg(History *history, HistoryBlock *block, MsgId msgId, QDateTime date, const QString &msg, int32 flags = 0, HistoryMedia *media = 0, int32 from = 0); - - void initDimensions() override; + static HistoryService *create(History *history, const MTPDmessageService &msg) { + return _create(history, msg); + } + static HistoryService *create(History *history, MsgId msgId, QDateTime date, const QString &msg, MTPDmessage::Flags flags = 0, HistoryMedia *media = 0, int32 from = 0) { + return _create(history, msgId, date, msg, flags, media, from); + } bool updateDependencyItem() override { return updatePinned(true); @@ -2385,7 +2696,6 @@ public: void countPositionAndSize(int32 &left, int32 &width) const; void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const override; - int32 resize(int32 width) override; bool hasPoint(int32 x, int32 y) const override; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const override; void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const override; @@ -2417,47 +2727,37 @@ public: void setServiceText(const QString &text); - ~HistoryServiceMsg(); + ~HistoryService(); protected: + HistoryService(History *history, const MTPDmessageService &msg); + HistoryService(History *history, MsgId msgId, QDateTime date, const QString &msg, MTPDmessage::Flags flags = 0, HistoryMedia *media = 0, int32 from = 0); + friend class HistoryItemInstantiated; + + void initDimensions() override; + int resizeGetHeight_(int width) override; + void setMessageByAction(const MTPmessageAction &action); bool updatePinned(bool force = false); bool updatePinnedText(const QString *pfrom = nullptr, QString *ptext = nullptr); - Text _text; - HistoryMedia *_media; + Text _text = { int(st::msgMinWidth) }; + HistoryMedia *_media = nullptr; int32 _textWidth, _textHeight; }; -class HistoryDateMsg : public HistoryServiceMsg { +class HistoryGroup : public HistoryService, private HistoryItemInstantiated { public: - HistoryDateMsg(History *history, HistoryBlock *block, const QDate &date); - void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const { - lnk = TextLinkPtr(); - state = HistoryDefaultCursorState; + static HistoryGroup *create(History *history, const MTPDmessageGroup &group, const QDateTime &date) { + return _create(history, group, date); } - void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { - symbol = 0xFFFF; - after = false; - upon = false; + static HistoryGroup *create(History *history, HistoryItem *newItem, const QDateTime &date) { + return _create(history, newItem, date); } - void setDate(const QDateTime &date); - QString selectedText(uint32 selection) const { - return QString(); - } - HistoryItemType type() const { - return HistoryItemDate; - } -}; -class HistoryGroup : public HistoryServiceMsg { -public: - - HistoryGroup(History *history, HistoryBlock *block, const MTPDmessageGroup &group, const QDateTime &date); - HistoryGroup(History *history, HistoryBlock *block, HistoryItem *newItem, const QDateTime &date); void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { symbol = 0xFFFF; @@ -2487,6 +2787,13 @@ public: return _maxId; } +protected: + + HistoryGroup(History *history, const MTPDmessageGroup &group, const QDateTime &date); + HistoryGroup(History *history, HistoryItem *newItem, const QDateTime &date); + using HistoryItemInstantiated::_create; + friend class HistoryItemInstantiated; + private: MsgId _minId, _maxId; int32 _count; @@ -2497,10 +2804,13 @@ private: }; -class HistoryCollapse : public HistoryServiceMsg { +class HistoryCollapse : public HistoryService, private HistoryItemInstantiated { public: - HistoryCollapse(History *history, HistoryBlock *block, MsgId wasMinId, const QDateTime &date); + static HistoryCollapse *create(History *history, MsgId wasMinId, const QDateTime &date) { + return _create(history, wasMinId, date); + } + void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const; void getState(TextLinkPtr &lnk, HistoryCursorState &state, int32 x, int32 y) const; void getSymbol(uint16 &symbol, bool &after, bool &upon, int32 x, int32 y) const { @@ -2518,46 +2828,32 @@ public: return _wasMinId; } +protected: + + HistoryCollapse(History *history, MsgId wasMinId, const QDateTime &date); + using HistoryItemInstantiated::_create; + friend class HistoryItemInstantiated; + private: MsgId _wasMinId; }; -class HistoryJoined : public HistoryServiceMsg { +class HistoryJoined : public HistoryService, private HistoryItemInstantiated { public: - HistoryJoined(History *history, HistoryBlock *block, const QDateTime &date, UserData *from, int32 flags); + static HistoryJoined *create(History *history, const QDateTime &date, UserData *from, MTPDmessage::Flags flags) { + return _create(history, date, from, flags); + } + HistoryItemType type() const { return HistoryItemJoined; } -}; - -HistoryItem *createDayServiceMsg(History *history, HistoryBlock *block, QDateTime date); - -class HistoryUnreadBar : public HistoryItem { -public: - - HistoryUnreadBar(History *history, HistoryBlock *block, int32 count, const QDateTime &date); - - void initDimensions(); - - void setCount(int32 count); - - void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const; - int32 resize(int32 width); - - void drawInDialog(Painter &p, const QRect &r, bool act, const HistoryItem *&cacheFor, Text &cache) const; - QString notificationText() const; - - QString selectedText(uint32 selection) const { - return QString(); - } - HistoryItemType type() const { - return HistoryItemUnreadBar; - } protected: - QString text; - bool freezed; + HistoryJoined(History *history, const QDateTime &date, UserData *from, MTPDmessage::Flags flags); + using HistoryItemInstantiated::_create; + friend class HistoryItemInstantiated; + }; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 1b4f4c4ed..902fe59c5 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -38,41 +38,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org // flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html -HistoryInner::HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : TWidget(0) +HistoryInner::HistoryInner(HistoryWidget *historyWidget, ScrollArea *scroll, History *history) : TWidget(nullptr) , _peer(history->peer) -, _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : 0) +, _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : nullptr) , _history(history) -, _historyOffset(0) -, _historySkipHeight(0) -, _botInfo(history->peer->isUser() ? history->peer->asUser()->botInfo : 0) -, _botDescWidth(0) -, _botDescHeight(0) +, _botInfo(history->peer->isUser() ? history->peer->asUser()->botInfo : nullptr) , _widget(historyWidget) -, _scroll(scroll) -, _curHistory(0) -, _curBlock(0) -, _curItem(0) -, _firstLoading(false) -, _cursor(style::cur_default) -, _dragAction(NoDrag) -, _dragSelType(TextSelectLetters) -, _dragItem(0) -, _dragCursorState(HistoryDefaultCursorState) -, _dragWasInactive(false) -, _dragSelFrom(0) -, _dragSelTo(0) -, _dragSelecting(false) -, _wasSelectedText(false) -, _touchScroll(false) -, _touchSelect(false) -, _touchInProgress(false) -, _touchScrollState(TouchScrollManual) -, _touchPrevPosValid(false) -, _touchWaitingAcceleration(false) -, _touchSpeedTime(0) -, _touchAccelerationTime(0) -, _touchTime(0) -, _menu(0) { +, _scroll(scroll) { connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update())); _touchSelectTimer.setSingleShot(true); @@ -122,6 +94,104 @@ void HistoryInner::repaintItem(const HistoryItem *item) { } } +namespace { + // helper binary search for an item in a list that is not completely below the given bottom of the visible area + // is applied once for blocks list in a history and once for items list in the found block + template + int binarySearchBlocksOrItems(const T &list, int bottom) { + int start = 0, end = list.size(); + while (end - start > 1) { + int middle = (start + end) / 2; + if (list.at(middle)->y >= bottom) { + end = middle; + } else { + start = middle; + } + } + return start; + } +} + +template +void HistoryInner::enumerateUserpicsInHistory(History *h, int htop, Method method) { + // no displayed messages in this history + if (htop < 0 || h->isEmpty() || !h->canHaveFromPhotos() || _visibleAreaBottom <= htop) { + return; + } + + // find and remember the bottom of an attached messages pack + // -1 means we didn't find an attached to previous message yet + int lowestAttachedItemBottom = -1; + + // binary search for blockIndex of the first block that is not completely below the visible area + int blockIndex = binarySearchBlocksOrItems(h->blocks, _visibleAreaBottom - htop); + + // binary search for itemIndex of the first item that is not completely below the visible area + HistoryBlock *block = h->blocks.at(blockIndex); + int blocktop = htop + block->y; + int itemIndex = binarySearchBlocksOrItems(block->items, _visibleAreaBottom - blocktop); + + while (true) { + while (itemIndex >= 0) { + HistoryItem *item = block->items.at(itemIndex--); + int itemtop = blocktop + item->y; + int itembottom = itemtop + item->height(); + + // binary search should've skipped all the items that are below the visible area + t_assert(itemtop < _visibleAreaBottom); + + // skip all service messages + if (HistoryMessage *message = item->toHistoryMessage()) { + if (lowestAttachedItemBottom < 0 && message->isAttachedToPrevious()) { + lowestAttachedItemBottom = itembottom - message->marginBottom(); + } + + // draw userpic for all messages that have it and for those who are not showing it + // because of their attachment to the previous message if they are top-most visible + if (message->displayFromPhoto() || (message->hasFromPhoto() && itemtop <= _visibleAreaTop)) { + if (lowestAttachedItemBottom < 0) { + lowestAttachedItemBottom = itembottom - message->marginBottom(); + } + // attach userpic to the top of the visible area with the same margin as it is from the left side + int userpicTop = qMax(itemtop + message->marginTop(), _visibleAreaTop + st::msgMargin.left()); + + // do not let the userpic go below the attached messages pack bottom line + userpicTop = qMin(userpicTop, lowestAttachedItemBottom - int(st::msgPhotoSize)); + + // call the template callback function that was passed + // and return if it finished everything it needed + if (!method(message, userpicTop)) { + return; + } + } + + // forget the found bottom of the pack, search for the next one from scratch + if (!message->isAttachedToPrevious()) { + lowestAttachedItemBottom = -1; + } + } + + // skip all the items that are above the visible area + if (itemtop <= _visibleAreaTop) { + return; + } + } + + // skip all the rest blocks that are above the visible area + if (blocktop <= _visibleAreaTop) { + return; + } + + if (--blockIndex < 0) { + return; + } else { + block = h->blocks.at(blockIndex); + blocktop = htop + block->y; + itemIndex = block->items.size() - 1; + } + } +} + void HistoryInner::paintEvent(QPaintEvent *e) { if (App::wnd() && App::wnd()->contentOverlapped(this, e)) return; @@ -252,6 +322,19 @@ void HistoryInner::paintEvent(QPaintEvent *e) { item = block->items[iItem]; } p.restore(); + + enumerateUserpics([&p, &r](HistoryMessage *message, int userpicTop) -> bool { + // stop the enumeration if the userpic is above the painted rect + if (userpicTop + st::msgPhotoSize <= r.top()) { + return false; + } + + // paint the userpic if it intersects the painted rect + if (userpicTop < r.top() + r.height()) { + message->from()->paintUserpicLeft(p, st::msgPhotoSize, st::msgMargin.left(), userpicTop, message->history()->width); + } + return true; + }); } } } @@ -657,10 +740,10 @@ void HistoryInner::onDragExec() { mimeData->setData(qsl("application/x-td-forward-pressed"), "1"); } if (lnkDocument) { - QString already = static_cast(textlnkDown().data())->document()->already(true); - if (!already.isEmpty()) { + QString filepath = static_cast(textlnkDown().data())->document()->filepath(DocumentData::FilePathResolveChecked); + if (!filepath.isEmpty()) { QList urls; - urls.push_back(QUrl::fromLocalFile(already)); + urls.push_back(QUrl::fromLocalFile(filepath)); mimeData->setUrls(urls); } } @@ -865,7 +948,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { PhotoLink *lnkPhoto = dynamic_cast(_contextMenuLnk.data()); DocumentLink *lnkDocument = dynamic_cast(_contextMenuLnk.data()); bool lnkIsVideo = lnkDocument ? lnkDocument->document()->isVideo() : false; - bool lnkIsAudio = lnkDocument ? (lnkDocument->document()->voice() != 0) : false; + bool lnkIsAudio = lnkDocument ? (lnkDocument->document()->voice() != nullptr) : false; + bool lnkIsSong = lnkDocument ? (lnkDocument->document()->song() != nullptr) : false; if (lnkPhoto || lnkDocument) { if (isUponSelected > 0) { _menu->addAction(lang(lng_context_copy_selected), this, SLOT(copySelectedText()))->setEnabled(true); @@ -892,10 +976,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (lnkDocument && lnkDocument->document()->loaded() && lnkDocument->document()->isGifv()) { _menu->addAction(lang(lng_context_save_gif), this, SLOT(saveContextGif()))->setEnabled(true); } - if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) { + if (lnkDocument && !lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked).isEmpty()) { _menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true); } - _menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true); + _menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : (lnkIsSong ? lng_context_save_audio_file : lng_context_save_file))), this, SLOT(saveContextFile()))->setEnabled(true); } } if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) { @@ -926,8 +1010,6 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { bool canForward = (item && item->type() == HistoryItemMsg) && (item->id > 0) && !item->serviceMsg(); HistoryMessage *msg = dynamic_cast(item); - HistoryServiceMsg *srv = dynamic_cast(item); - if (isUponSelected > 0) { _menu->addAction(lang(lng_context_copy_selected), this, SLOT(copySelectedText()))->setEnabled(true); if (item && item->id > 0 && isUponSelected != 2) { @@ -976,7 +1058,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (doc->isGifv()) { _menu->addAction(lang(lng_context_save_gif), this, SLOT(saveContextGif()))->setEnabled(true); } - if (!doc->already(true).isEmpty()) { + if (!doc->filepath(DocumentData::FilePathResolveChecked).isEmpty()) { _menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true); } _menu->addAction(lang(lng_context_save_file), this, SLOT(saveContextFile()))->setEnabled(true); @@ -1101,17 +1183,19 @@ void HistoryInner::cancelContextDownload() { } void HistoryInner::showContextInFolder() { - QString already; + QString filepath; if (DocumentLink *lnkDocument = dynamic_cast(_contextMenuLnk.data())) { - already = lnkDocument->document()->already(true); + filepath = lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked); } else if (HistoryItem *item = App::contextItem()) { if (HistoryMedia *media = item->getMedia()) { if (DocumentData *doc = media->getDocument()) { - already = doc->already(true); + filepath = doc->filepath(DocumentData::FilePathResolveChecked); } } } - if (!already.isEmpty()) psShowInFolder(already); + if (!filepath.isEmpty()) { + psShowInFolder(filepath); + } } void HistoryInner::saveContextFile() { @@ -1209,47 +1293,37 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) { } } -int32 HistoryInner::recountHeight(const HistoryItem *resizedItem) { - int32 htop = historyTop(), mtop = migratedTop(); - int32 st1 = (htop >= 0) ? (_history->lastScrollTop - htop) : -1, st2 = (_migrated && mtop >= 0) ? (_history->lastScrollTop - mtop) : -1; +void HistoryInner::recountHeight() { + int htop = historyTop(), mtop = migratedTop(); - int32 ph = _scroll->height(), minadd = 0; - int32 wasYSkip = ph - historyHeight() - st::historyPadding; + int ph = _scroll->height(), minadd = 0; + int wasYSkip = ph - historyHeight() - st::historyPadding; if (_botInfo && !_botInfo->text.isEmpty()) { minadd = st::msgMargin.top() + st::msgMargin.bottom() + st::msgPadding.top() + st::msgPadding.bottom() + st::msgNameFont->height + st::botDescSkip + _botDescHeight; } if (wasYSkip < minadd) wasYSkip = minadd; - if (resizedItem) { - if (resizedItem->history() == _history) { - _history->geomResize(_scroll->width(), &st1, resizedItem); - } else if (_migrated && resizedItem->history() == _migrated) { - _migrated->geomResize(_scroll->width(), &st2, resizedItem); - } - } else { - _history->geomResize(_scroll->width(), &st1, resizedItem); - if (_migrated) { - _migrated->geomResize(_scroll->width(), &st2, resizedItem); - } + _history->resizeGetHeight(_scroll->width()); + if (_migrated) { + _migrated->resizeGetHeight(_scroll->width()); } - int32 skip = 0; - if (_migrated) { // check first messages of _history - maybe no need to display them + + // with migrated history we perhaps do not need to display first _history message + // (if last _migrated message and first _history message are both isGroupMigrate) + // or at least we don't need to display first _history date (just skip it by height) + _historySkipHeight = 0; + if (_migrated) { if (!_migrated->isEmpty() && !_history->isEmpty() && _migrated->loadedAtBottom() && _history->loadedAtTop()) { if (_migrated->blocks.back()->items.back()->date.date() == _history->blocks.front()->items.front()->date.date()) { - skip += _history->blocks.front()->items.front()->height(); - if (_migrated->blocks.back()->items.back()->isGroupMigrate() && _history->blocks.front()->items.size() == 1 && _history->blocks.size() > 1 && _history->blocks.at(1)->items.front()->isGroupMigrate()) { - skip += _history->blocks.at(1)->items.at(0)->height(); + if (_migrated->blocks.back()->items.back()->isGroupMigrate() && _history->blocks.front()->items.front()->isGroupMigrate()) { + _historySkipHeight += _history->blocks.front()->items.front()->height(); + } else { + _historySkipHeight += _history->blocks.front()->items.front()->displayedDateHeight(); } } - if (skip > migratedTop() + _migrated->height) { - skip = migratedTop() + _migrated->height; // should not happen, just check.. we need historyTop() >= 0 - } } } - if (skip != _historySkipHeight) { - if (st1 >= 0) st1 -= (skip - _historySkipHeight); - _historySkipHeight = skip; - } + updateBotInfo(false); if (_botInfo && !_botInfo->text.isEmpty()) { int32 tw = _scroll->width() - st::msgMargin.left() - st::msgMargin.right(); @@ -1262,7 +1336,11 @@ int32 HistoryInner::recountHeight(const HistoryItem *resizedItem) { _botDescHeight = _botInfo->text.countHeight(_botDescWidth); int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botDescHeight + st::msgPadding.bottom() + st::msgMargin.bottom(); - int32 descAtX = (_scroll->width() - _botDescWidth) / 2 - st::msgPadding.left(); + int32 descMaxWidth = _scroll->width(); + if (Adaptive::Wide()) { + descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); + } + int32 descAtX = (descMaxWidth - _botDescWidth) / 2 - st::msgPadding.left(); int32 descAtY = qMin(_historyOffset - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top(); _botDescRect = QRect(descAtX, descAtY, _botDescWidth + st::msgPadding.left() + st::msgPadding.right(), descH - st::msgMargin.top() - st::msgMargin.bottom()); @@ -1277,7 +1355,13 @@ int32 HistoryInner::recountHeight(const HistoryItem *resizedItem) { } if (newYSkip < minadd) newYSkip = minadd; - return ((st1 >= 0 || st2 < 0) ? (st1 + htop) : (st2 + mtop)) + (newYSkip - wasYSkip); + if (newYSkip != wasYSkip) { + if (_history->scrollTopItem) { + _history->scrollTopOffset += (newYSkip - wasYSkip); + } else if (_migrated && _migrated->scrollTopItem) { + _migrated->scrollTopOffset += (newYSkip - wasYSkip); + } + } } void HistoryInner::updateBotInfo(bool recount) { @@ -1358,6 +1442,41 @@ HistoryItem *HistoryInner::atTopImportantMsg(int32 top, int32 height, int32 &bot return 0; } +void HistoryInner::visibleAreaUpdated(int top, int bottom) { + _visibleAreaTop = top; + _visibleAreaBottom = bottom; + + // if history has pending resize events we should not update scrollTopItem + if (_history->hasPendingResizedItems()) { + return; + } else if (_migrated && _migrated->hasPendingResizedItems()) { + return; + } + + if (bottom >= historyHeight()) { + _history->forgetScrollState(); + if (_migrated) { + _migrated->forgetScrollState(); + } + } else { + int htop = historyTop(), mtop = migratedTop(); + if ((htop >= 0 && top >= htop) || mtop < 0) { + _history->countScrollState(top - htop); + if (_migrated) { + _migrated->forgetScrollState(); + } + } else if (mtop >= 0 && top >= mtop) { + _history->forgetScrollState(); + _migrated->countScrollState(top - mtop); + } else { + _history->countScrollState(top - htop); + if (_migrated) { + _migrated->forgetScrollState(); + } + } + } +} + void HistoryInner::updateSize() { int32 ph = _scroll->height(), minadd = 0; int32 newYSkip = ph - historyHeight() - st::historyPadding; @@ -1368,7 +1487,11 @@ void HistoryInner::updateSize() { if (_botDescHeight > 0) { int32 descH = st::msgMargin.top() + st::msgPadding.top() + st::msgNameFont->height + st::botDescSkip + _botDescHeight + st::msgPadding.bottom() + st::msgMargin.bottom(); - int32 descAtX = (_scroll->width() - _botDescWidth) / 2 - st::msgPadding.left(); + int32 descMaxWidth = _scroll->width(); + if (Adaptive::Wide()) { + descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left())); + } + int32 descAtX = (descMaxWidth - _botDescWidth) / 2 - st::msgPadding.left(); int32 descAtY = qMin(newYSkip - descH, qMax(0, (_scroll->height() - descH) / 2)) + st::msgMargin.top(); _botDescRect = QRect(descAtX, descAtY, _botDescWidth + st::msgPadding.left() + st::msgPadding.right(), descH - st::msgMargin.top() - st::msgMargin.bottom()); @@ -1433,59 +1556,59 @@ void HistoryInner::adjustCurrent(int32 y, History *history) const { _curBlock = history->blocks.size() - 1; _curItem = 0; } - while (history->blocks[_curBlock]->y > y && _curBlock > 0) { + while (history->blocks.at(_curBlock)->y > y && _curBlock > 0) { --_curBlock; _curItem = 0; } - while (history->blocks[_curBlock]->y + history->blocks[_curBlock]->height <= y && _curBlock + 1 < history->blocks.size()) { + while (history->blocks.at(_curBlock)->y + history->blocks.at(_curBlock)->height <= y && _curBlock + 1 < history->blocks.size()) { ++_curBlock; _curItem = 0; } - HistoryBlock *block = history->blocks[_curBlock]; + HistoryBlock *block = history->blocks.at(_curBlock); if (_curItem >= block->items.size()) { _curItem = block->items.size() - 1; } - int32 by = block->y; - while (block->items[_curItem]->y + by > y && _curItem > 0) { + int by = block->y; + while (block->items.at(_curItem)->y + by > y && _curItem > 0) { --_curItem; } - while (block->items[_curItem]->y + block->items[_curItem]->height() + by <= y && _curItem + 1 < block->items.size()) { + while (block->items.at(_curItem)->y + block->items.at(_curItem)->height() + by <= y && _curItem + 1 < block->items.size()) { ++_curItem; } } HistoryItem *HistoryInner::prevItem(HistoryItem *item) { - if (!item) return 0; + if (!item || item->detached()) return nullptr; + HistoryBlock *block = item->block(); - int32 blockIndex = item->history()->blocks.indexOf(block), itemIndex = block->items.indexOf(item); - if (blockIndex < 0 || itemIndex < 0) return 0; + int blockIndex = block->indexInHistory(), itemIndex = item->indexInBlock(); if (itemIndex > 0) { - return block->items[itemIndex - 1]; + return block->items.at(itemIndex - 1); } if (blockIndex > 0) { - return item->history()->blocks[blockIndex - 1]->items.back(); + return item->history()->blocks.at(blockIndex - 1)->items.back(); } if (item->history() == _history && _migrated && _history->loadedAtTop() && !_migrated->isEmpty() && _migrated->loadedAtBottom()) { return _migrated->blocks.back()->items.back(); } - return 0; + return nullptr; } HistoryItem *HistoryInner::nextItem(HistoryItem *item) { - if (!item) return 0; + if (!item || item->detached()) return nullptr; + HistoryBlock *block = item->block(); - int32 blockIndex = item->history()->blocks.indexOf(block), itemIndex = block->items.indexOf(item); - if (blockIndex < 0 || itemIndex < 0) return 0; + int blockIndex = block->indexInHistory(), itemIndex = item->indexInBlock(); if (itemIndex + 1 < block->items.size()) { - return block->items[itemIndex + 1]; + return block->items.at(itemIndex + 1); } if (blockIndex + 1 < item->history()->blocks.size()) { - return item->history()->blocks[blockIndex + 1]->items.front(); + return item->history()->blocks.at(blockIndex + 1)->items.front(); } if (item->history() == _migrated && _history && _migrated->loadedAtBottom() && _history->loadedAtTop() && !_history->isEmpty()) { return _history->blocks.front()->items.front(); } - return 0; + return nullptr; } bool HistoryInner::canCopySelected() const { @@ -1599,6 +1722,25 @@ void HistoryInner::onUpdateSelected() { } } else if (item) { item->getState(lnk, cursorState, m.x(), m.y()); + if (!lnk && m.x() >= st::msgMargin.left() && m.x() < st::msgMargin.left() + st::msgPhotoSize) { + if (HistoryMessage *msg = item->toHistoryMessage()) { + if (msg->hasFromPhoto()) { + enumerateUserpics([&lnk, msg, &point](HistoryMessage *message, int userpicTop) -> bool { + // stop enumeration if the userpic is above our point + if (userpicTop + st::msgPhotoSize <= point.y()) { + return false; + } + + // stop enumeration if we've found a userpic under the cursor + if (point.y() >= userpicTop && point.y() < userpicTop + st::msgPhotoSize) { + lnk = message->from()->lnk; + return false; + } + return true; + }); + } + } + } } if (lnk != textlnkOver()) { lnkChanged = true; @@ -1670,22 +1812,22 @@ void HistoryInner::onUpdateSelected() { HistoryItem *dragSelFrom = _dragItem, *dragSelTo = item; if (!dragSelFrom->hasPoint(_dragStartPos.x(), _dragStartPos.y())) { // maybe exclude dragSelFrom if (selectingDown) { - if (_dragStartPos.y() >= dragSelFrom->height() - st::msgMargin.bottom() || ((item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance()))) { + if (_dragStartPos.y() >= dragSelFrom->height() - dragSelFrom->marginBottom() || ((item == dragSelFrom) && (m.y() < _dragStartPos.y() + QApplication::startDragDistance() || m.y() < dragSelFrom->marginTop()))) { dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : nextItem(dragSelFrom); } } else { - if (_dragStartPos.y() < st::msgMargin.top() || ((item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance()))) { + if (_dragStartPos.y() < dragSelFrom->marginTop() || ((item == dragSelFrom) && (m.y() >= _dragStartPos.y() - QApplication::startDragDistance() || m.y() >= dragSelFrom->height() - dragSelFrom->marginBottom()))) { dragSelFrom = (dragSelFrom == dragSelTo) ? 0 : prevItem(dragSelFrom); } } } if (_dragItem != item) { // maybe exclude dragSelTo if (selectingDown) { - if (m.y() < st::msgMargin.top()) { + if (m.y() < dragSelTo->marginTop()) { dragSelTo = (dragSelFrom == dragSelTo) ? 0 : prevItem(dragSelTo); } } else { - if (m.y() >= dragSelTo->height() - st::msgMargin.bottom()) { + if (m.y() >= dragSelTo->height() - dragSelTo->marginBottom()) { dragSelTo = (dragSelFrom == dragSelTo) ? 0 : nextItem(dragSelTo); } } @@ -1744,8 +1886,8 @@ void HistoryInner::updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dr update(); } -int32 HistoryInner::historyHeight() const { - int32 result = 0; +int HistoryInner::historyHeight() const { + int result = 0; if (!_history || _history->isEmpty()) { result += _migrated ? _migrated->height : 0; } else { @@ -1754,25 +1896,38 @@ int32 HistoryInner::historyHeight() const { return result; } -int32 HistoryInner::migratedTop() const { +int HistoryInner::historyScrollTop() const { + int htop = historyTop(), mtop = migratedTop(); + if (htop >= 0 && _history->scrollTopItem) { + t_assert(!_history->scrollTopItem->detached()); + return htop + _history->scrollTopItem->block()->y + _history->scrollTopItem->y + _history->scrollTopOffset; + } + if (mtop >= 0 && _migrated->scrollTopItem) { + t_assert(!_migrated->scrollTopItem->detached()); + return mtop + _migrated->scrollTopItem->block()->y + _migrated->scrollTopItem->y + _migrated->scrollTopOffset; + } + return ScrollMax; +} + +int HistoryInner::migratedTop() const { return (_migrated && !_migrated->isEmpty()) ? _historyOffset : -1; } -int32 HistoryInner::historyTop() const { - int32 mig = migratedTop(); +int HistoryInner::historyTop() const { + int mig = migratedTop(); return (_history && !_history->isEmpty()) ? (mig >= 0 ? (mig + _migrated->height - _historySkipHeight) : _historyOffset) : -1; } -int32 HistoryInner::historyDrawTop() const { - int32 his = historyTop(); +int HistoryInner::historyDrawTop() const { + int his = historyTop(); return (his >= 0) ? (his + _historySkipHeight) : -1; } -int32 HistoryInner::itemTop(const HistoryItem *item) const { // -1 if should not be visible, -2 if bad history() +int HistoryInner::itemTop(const HistoryItem *item) const { // -1 if should not be visible, -2 if bad history() if (!item) return -2; if (item->detached()) return -1; - int32 top = (item->history() == _history) ? historyTop() : (item->history() == _migrated ? migratedTop() : -2); + int top = (item->history() == _history) ? historyTop() : (item->history() == _migrated ? migratedTop() : -2); return (top < 0) ? top : (top + item->y + item->block()->y); } @@ -1828,8 +1983,8 @@ void HistoryInner::applyDragSelection(SelectedItems *toItems) const { toItems->clear(); } if (_dragSelecting) { - int32 fromblock = _dragSelFrom->history()->blocks.indexOf(_dragSelFrom->block()), fromitem = _dragSelFrom->block()->items.indexOf(_dragSelFrom); - int32 toblock = _dragSelTo->history()->blocks.indexOf(_dragSelTo->block()), toitem = _dragSelTo->block()->items.indexOf(_dragSelTo); + int32 fromblock = _dragSelFrom->block()->indexInHistory(), fromitem = _dragSelFrom->indexInBlock(); + int32 toblock = _dragSelTo->block()->indexInHistory(), toitem = _dragSelTo->indexInBlock(); if (_migrated) { if (_dragSelFrom->history() == _migrated) { if (_dragSelTo->history() == _migrated) { @@ -2145,9 +2300,9 @@ bool BotKeyboard::updateMarkup(HistoryItem *to) { clearSelection(); _btns.clear(); const ReplyMarkup &markup(App::replyMarkup(to->channelId(), to->id)); - _forceReply = markup.flags & MTPDreplyKeyboardMarkup_flag_FORCE_REPLY; - _maximizeSize = !(markup.flags & MTPDreplyKeyboardMarkup::flag_resize); - _singleUse = _forceReply || (markup.flags & MTPDreplyKeyboardMarkup::flag_single_use); + _forceReply = markup.flags & MTPDreplyKeyboardMarkup_ClientFlag::f_force_reply; + _maximizeSize = !(markup.flags & MTPDreplyKeyboardMarkup::Flag::f_resize); + _singleUse = _forceReply || (markup.flags & MTPDreplyKeyboardMarkup::Flag::f_single_use); const ReplyMarkup::Commands &commands(markup.commands); if (!commands.isEmpty()) { @@ -2639,52 +2794,17 @@ QPoint SilentToggle::tooltipPos() const { } HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) -, _replyToId(0) -, _replyToNameVersion(0) -, _editMsgId(0) -, _replyEditMsg(0) , _fieldBarCancel(this, st::replyCancel) -, _pinnedBar(0) -, _saveEditMsgRequestId(0) -, _reportSpamStatus(dbiprsUnknown) -, _reportSpamSettingRequestId(ReportSpamRequestNeeded) -, _previewData(0) -, _previewRequest(0) -, _previewCancelled(false) -, _replyForwardPressed(false) -, _replyReturn(0) -, _stickersUpdateRequest(0) -, _savedGifsUpdateRequest(0) -, _peer(0) -, _clearPeer(0) -, _channel(NoChannel) -, _showAtMsgId(0) -, _fixedInScrollMsgId(0) -, _fixedInScrollMsgTop(0) -, _firstLoadRequest(0), _preloadRequest(0), _preloadDownRequest(0) -, _delayedShowAtMsgId(-1) -, _delayedShowAtRequest(0) -, _activeAnimMsgId(0) , _scroll(this, st::historyScroll, false) -, _list(0) -, _migrated(0) -, _history(0) -, _histInited(false) -, _lastScroll(0) -, _lastScrolled(0) , _toHistoryEnd(this, st::historyToEnd) , _collapseComments(this) , _attachMention(this) -, _inlineBot(0) -, _inlineBotResolveRequestId(0) , _reportSpamPanel(this) , _send(this, lang(lng_send_button), st::btnSend) , _unblock(this, lang(lng_unblock_button), st::btnUnblock) , _botStart(this, lang(lng_bot_start), st::btnSend) , _joinChannel(this, lang(lng_channel_join), st::btnSend) , _muteUnmute(this, lang(lng_channel_mute), st::btnSend) -, _unblockRequest(0) -, _reportSpamRequest(0) , _attachDocument(this, st::btnAttachDocument) , _attachPhoto(this, st::btnAttachPhoto) , _attachEmoji(this, st::btnAttachEmoji) @@ -2693,48 +2813,26 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) , _cmdStart(this, st::btnBotCmdStart) , _broadcast(this, QString(), true, st::broadcastToggle) , _silent(this) -, _cmdStartShown(false) , _field(this, st::taMsgField, lang(lng_message_ph)) , _a_record(animation(this, &HistoryWidget::step_record)) , _a_recording(animation(this, &HistoryWidget::step_recording)) -, _recording(false) -, _inRecord(false) -, _inField(false) -, _inReplyEdit(false) -, _inPinnedMsg(false) -, a_recordingLevel(0, 0) -, _recordingSamples(0) -, a_recordOver(0, 0) -, a_recordDown(0, 0) , a_recordCancel(st::recordCancel->c, st::recordCancel->c) , _recordCancelWidth(st::recordFont->width(lang(lng_record_cancel))) -, _kbShown(false) -, _kbReplyTo(0) , _kbScroll(this, st::botKbScroll) -, _keyboard() , _attachType(this) , _emojiPan(this) -, _attachDrag(DragStateNone) , _attachDragDocument(this) , _attachDragPhoto(this) , _fileLoader(this, FileLoaderQueueStopTimeout) -, _textUpdateEventsFlags(TextUpdateEventsSaveDraft | TextUpdateEventsSendTyping) -, _serviceImageCacheSize(0) -, _confirmWithTextId(0) -, _titlePeerTextWidth(0) , _a_show(animation(this, &HistoryWidget::step_show)) -, _scrollDelta(0) -, _saveDraftStart(0) -, _saveDraftText(false) , _sideShadow(this, st::shadowColor) -, _topShadow(this, st::shadowColor) -, _inGrab(false) { +, _topShadow(this, st::shadowColor) { _scroll.setFocusPolicy(Qt::NoFocus); setAcceptDrops(true); connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(updateField())); - connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onListScroll())); + connect(&_scroll, SIGNAL(scrolled()), this, SLOT(onScroll())); connect(&_reportSpamPanel, SIGNAL(reportClicked()), this, SLOT(onReportSpamClicked())); connect(&_reportSpamPanel, SIGNAL(hideClicked()), this, SLOT(onReportSpamHide())); connect(&_reportSpamPanel, SIGNAL(clearClicked()), this, SLOT(onReportSpamClear())); @@ -2758,7 +2856,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent) connect(&_field, SIGNAL(changed()), this, SLOT(onTextChange())); connect(&_field, SIGNAL(spacedReturnedPasted()), this, SLOT(onPreviewParse())); connect(&_field, SIGNAL(linksChanged()), this, SLOT(onPreviewCheck())); - connect(App::wnd()->windowHandle(), SIGNAL(visibleChanged(bool)), this, SLOT(onVisibleChanged())); + connect(App::wnd()->windowHandle(), SIGNAL(visibleChanged(bool)), this, SLOT(onWindowVisibleChanged())); connect(&_scrollTimer, SIGNAL(timeout()), this, SLOT(onScrollTimer())); connect(&_emojiPan, SIGNAL(emojiSelected(EmojiPtr)), &_field, SLOT(onEmojiInsert(EmojiPtr))); connect(&_emojiPan, SIGNAL(stickerSelected(DocumentData*)), this, SLOT(onStickerSend(DocumentData*))); @@ -3180,7 +3278,7 @@ void HistoryWidget::onRecordUpdate(quint16 level, qint32 samples) { } void HistoryWidget::updateStickers() { - if (!cLastStickersUpdate() || getms(true) >= cLastStickersUpdate() + StickersUpdateTimeout) { + if (!Global::LastStickersUpdate() || getms(true) >= Global::LastStickersUpdate() + StickersUpdateTimeout) { if (!_stickersUpdateRequest) { _stickersUpdateRequest = MTP::send(MTPmessages_GetAllStickers(MTP_int(Local::countStickersHash(true))), rpcDone(&HistoryWidget::stickersGot), rpcFail(&HistoryWidget::stickersFailed)); } @@ -3238,10 +3336,6 @@ void HistoryWidget::notify_clipStopperHidden(ClipStopperType type) { if (_list) _list->update(); } -void HistoryWidget::notify_historyItemResized(const HistoryItem *row, bool scrollToIt) { - updateListSize(false, false, { ScrollChangeNone, 0 }, row, scrollToIt); -} - void HistoryWidget::cmd_search() { if (!inFocusChain() || !_peer) return; @@ -3263,7 +3357,7 @@ void HistoryWidget::cmd_previous_chat() { } void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { - cSetLastStickersUpdate(getms(true)); + Global::SetLastStickersUpdate(getms(true)); _stickersUpdateRequest = 0; if (stickers.type() != mtpc_messages_allStickers) return; @@ -3271,21 +3365,21 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { const QVector &d_sets(d.vsets.c_vector().v); - StickerSetsOrder &setsOrder(cRefStickerSetsOrder()); + Stickers::Order &setsOrder(Global::RefStickerSetsOrder()); setsOrder.clear(); - StickerSets &sets(cRefStickerSets()); + Stickers::Sets &sets(Global::RefStickerSets()); QMap setsToRequest; - for (StickerSets::iterator i = sets.begin(), e = sets.end(); i != e; ++i) { + for (auto i = sets.begin(), e = sets.end(); i != e; ++i) { i->access = 0; // mark for removing } - for (int32 i = 0, l = d_sets.size(); i != l; ++i) { + for (int i = 0, l = d_sets.size(); i != l; ++i) { if (d_sets.at(i).type() == mtpc_stickerSet) { const MTPDstickerSet &set(d_sets.at(i).c_stickerSet()); - StickerSets::iterator it = sets.find(set.vid.v); + auto it = sets.find(set.vid.v); QString title = stickerSetTitle(set); if (it == sets.cend()) { - it = sets.insert(set.vid.v, StickerSet(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | MTPDstickerSet_flag_NOT_LOADED)); + it = sets.insert(set.vid.v, Stickers::Set(set.vid.v, set.vaccess_hash.v, title, qs(set.vshort_name), set.vcount.v, set.vhash.v, set.vflags.v | MTPDstickerSet_ClientFlag::f_not_loaded)); } else { it->access = set.vaccess_hash.v; it->title = title; @@ -3294,12 +3388,12 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { if (it->count != set.vcount.v || it->hash != set.vhash.v || it->emoji.isEmpty()) { it->count = set.vcount.v; it->hash = set.vhash.v; - it->flags |= MTPDstickerSet_flag_NOT_LOADED; // need to request this set + it->flags |= MTPDstickerSet_ClientFlag::f_not_loaded; // need to request this set } } - if (!(it->flags & MTPDstickerSet::flag_disabled) || (it->flags & MTPDstickerSet::flag_official)) { + if (!(it->flags & MTPDstickerSet::Flag::f_disabled) || (it->flags & MTPDstickerSet::Flag::f_official)) { setsOrder.push_back(set.vid.v); - if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_flag_NOT_LOADED)) { + if (it->stickers.isEmpty() || (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)) { setsToRequest.insert(set.vid.v, set.vaccess_hash.v); } } @@ -3307,8 +3401,8 @@ void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) { } bool writeRecent = false; RecentStickerPack &recent(cGetRecentStickers()); - for (StickerSets::iterator it = sets.begin(), e = sets.end(); it != e;) { - if (it->id == CustomStickerSetId || it->access != 0) { + for (Stickers::Sets::iterator it = sets.begin(), e = sets.end(); it != e;) { + if (it->id == Stickers::CustomSetId || it->access != 0) { ++it; } else { for (RecentStickerPack::iterator i = recent.begin(); i != recent.cend();) { @@ -3345,7 +3439,7 @@ bool HistoryWidget::stickersFailed(const RPCError &error) { LOG(("App Fail: Failed to get stickers!")); - cSetLastStickersUpdate(getms(true)); + Global::SetLastStickersUpdate(getms(true)); _stickersUpdateRequest = 0; return true; } @@ -3525,7 +3619,10 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re if (_history) { if (_peer->id == peerId && !reload) { - _history->lastWidth = 0; + _history->forgetScrollState(); + if (_migrated) { + _migrated->forgetScrollState(); + } bool wasOnlyImportant = _history->isChannel() ? _history->asChannelHistory()->onlyImportant() : true; @@ -3591,24 +3688,11 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re writeDrafts(&_history->msgDraft, &_history->editDraft); - if (_scroll.scrollTop() + 1 <= _scroll.scrollTopMax()) { - _history->lastWidth = _list->width(); - _history->lastShowAtMsgId = _showAtMsgId; - } else { - _history->lastWidth = 0; - _history->lastShowAtMsgId = ShowAtUnreadMsgId; - } - _history->lastScrollTop = _scroll.scrollTop(); - if (_history->unreadBar) { - _history->unreadBar->destroy(); - } - if (_migrated && _migrated->unreadBar) { - _migrated->unreadBar->destroy(); - } - if (_pinnedBar) { - destroyPinnedBar(); - } - _history = _migrated = 0; + _history->showAtMsgId = _showAtMsgId; + + destroyUnreadBar(); + if (_pinnedBar) destroyPinnedBar(); + _history = _migrated = nullptr; updateBotKeyboard(); } @@ -3621,7 +3705,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re _fieldBarCancel.hide(); if (_list) _list->deleteLater(); - _list = 0; + _list = nullptr; _scroll.takeWidget(); updateTopBarSelection(); @@ -3678,11 +3762,14 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re } if (_showAtMsgId == ShowAtUnreadMsgId) { - if (_history->lastWidth) { - _showAtMsgId = _history->lastShowAtMsgId; + if (_history->scrollTopItem) { + _showAtMsgId = _history->showAtMsgId; } } else { - _history->lastWidth = 0; + _history->forgetScrollState(); + if (_migrated) { + _migrated->forgetScrollState(); + } } _list = new HistoryInner(this, &_scroll, _history); @@ -3694,7 +3781,7 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re _updateHistoryItems.stop(); pinnedMsgVisibilityUpdated(); - if (_history->lastWidth || _history->isReadyFor(_showAtMsgId, _fixedInScrollMsgId, _fixedInScrollMsgTop)) { + if (_history->scrollTopItem || (_migrated && _migrated->scrollTopItem) || _history->isReadyFor(_showAtMsgId, _fixedInScrollMsgId, _fixedInScrollMsgTop)) { _fixedInScrollMsgId = 0; _fixedInScrollMsgTop = 0; historyLoaded(); @@ -3775,7 +3862,7 @@ void HistoryWidget::updateNotifySettings() { _muteUnmute.setText(lang(_history->mute ? lng_channel_unmute : lng_channel_mute)); if (_peer->notify != UnknownNotifySettings) { - _silent.setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::flag_silent)); + _silent.setChecked(_peer->notify != EmptyNotifySettings && (_peer->notify->flags & MTPDpeerNotifySettings::Flag::f_silent)); if (_silent.isHidden() && hasSilentToggle()) { updateControlsVisibility(); } @@ -3925,9 +4012,9 @@ void HistoryWidget::updateControlsVisibility() { _pinnedBar->cancel.show(); _pinnedBar->shadow.show(); } - if (_firstLoadRequest) { + if (_firstLoadRequest && !_scroll.isHidden()) { _scroll.hide(); - } else { + } else if (!_firstLoadRequest && _scroll.isHidden()) { _scroll.show(); } if (_reportSpamStatus == dbiprsShowButton || _reportSpamStatus == dbiprsReportSent) { @@ -4130,12 +4217,17 @@ void HistoryWidget::updateMouseTracking() { setMouseTracking(trackMouse); } +void HistoryWidget::destroyUnreadBar() { + if (_history) _history->destroyUnreadBar(); + if (_migrated) _migrated->destroyUnreadBar(); +} + void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { if (App::wnd()->historyIsActive()) { if (_history == history) { historyWasRead(); if (_scroll.scrollTop() + 1 > _scroll.scrollTopMax()) { - if (history->unreadBar) history->unreadBar->destroy(); + destroyUnreadBar(); } } else { App::wnd()->notifySchedule(history, item); @@ -4144,8 +4236,7 @@ void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { } else { if (_history == history) { if (_scroll.scrollTop() + 1 > _scroll.scrollTopMax()) { - if (history->unreadBar) history->unreadBar->destroy(); - if (_migrated && _migrated->unreadBar) _migrated->unreadBar->destroy(); + destroyUnreadBar(); } } App::wnd()->notifySchedule(history, item); @@ -4154,7 +4245,10 @@ void HistoryWidget::newUnreadMsg(History *history, HistoryItem *item) { } void HistoryWidget::historyToDown(History *history) { - history->lastScrollTop = ScrollMax; + history->forgetScrollState(); + if (History *migrated = App::historyLoaded(history->peer->migrateFrom())) { + migrated->forgetScrollState(); + } if (history == _history) { _scroll.scrollToY(_scroll.scrollTopMax()); } @@ -4243,7 +4337,7 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages if (_preloadRequest == requestId) { addMessagesToFront(peer, *histList, histCollapsed); _preloadRequest = 0; - onListScroll(); + preloadHistoryIfNeeded(); if (_reportSpamStatus == dbiprsUnknown) { updateReportSpamStatus(); if (_reportSpamStatus != dbiprsUnknown) updateControlsVisibility(); @@ -4251,7 +4345,7 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages } else if (_preloadDownRequest == requestId) { addMessagesToBack(peer, *histList, histCollapsed); _preloadDownRequest = 0; - onListScroll(); + preloadHistoryIfNeeded(); if (_history->loadedAtBottom() && App::wnd()) App::wnd()->checkHistoryActivation(); } else if (_firstLoadRequest == requestId) { if (toMigrated) { @@ -4330,12 +4424,7 @@ void HistoryWidget::messagesReceived(PeerData *peer, const MTPmessages_Messages void HistoryWidget::historyLoaded() { countHistoryShowFrom(); - if (_history->unreadBar) { - _history->unreadBar->destroy(); - } - if (_migrated && _migrated->unreadBar) { - _migrated->unreadBar->destroy(); - } + destroyUnreadBar(); doneShow(); } @@ -4533,8 +4622,20 @@ void HistoryWidget::delayedShowAt(MsgId showAtMsgId) { } } -void HistoryWidget::onListScroll() { +void HistoryWidget::onScroll() { App::checkImageCacheSize(); + preloadHistoryIfNeeded(); + visibleAreaUpdated(); +} + +void HistoryWidget::visibleAreaUpdated() { + if (_list && !_scroll.isHidden()) { + int st = _scroll.scrollTop(); + _list->visibleAreaUpdated(st, st + _scroll.height()); + } +} + +void HistoryWidget::preloadHistoryIfNeeded() { if (_firstLoadRequest || _scroll.isHidden() || !_peer) return; updateToEndVisibility(); @@ -4567,8 +4668,8 @@ void HistoryWidget::onListScroll() { } } -void HistoryWidget::onVisibleChanged() { - QTimer::singleShot(0, this, SLOT(onListScroll())); +void HistoryWidget::onWindowVisibleChanged() { + QTimer::singleShot(0, this, SLOT(preloadHistoryIfNeeded())); } void HistoryWidget::onHistoryToEnd() { @@ -4616,15 +4717,15 @@ void HistoryWidget::saveEditMsg() { return; } - int32 sendFlags = 0; + MTPchannels_EditMessage::Flags sendFlags = 0; if (webPageId == CancelledWebPageId) { - sendFlags |= MTPmessages_SendMessage::flag_no_webpage; + sendFlags |= MTPchannels_EditMessage::Flag::f_no_webpage; } MTPVector localEntities = linksToMTP(sendingEntities), sentEntities = linksToMTP(sendingEntities, true); if (!sentEntities.c_vector().v.isEmpty()) { - sendFlags |= MTPmessages_SendMessage::flag_entities; + sendFlags |= MTPchannels_EditMessage::Flag::f_entities; } - _saveEditMsgRequestId = MTP::send(MTPchannels_EditMessage(MTP_int(sendFlags), _history->peer->asChannel()->inputChannel, MTP_int(_editMsgId), MTP_string(sendingText), sentEntities), rpcDone(&HistoryWidget::saveEditMsgDone, _history), rpcFail(&HistoryWidget::saveEditMsgFail, _history)); + _saveEditMsgRequestId = MTP::send(MTPchannels_EditMessage(MTP_flags(sendFlags), _history->peer->asChannel()->inputChannel, MTP_int(_editMsgId), MTP_string(sendingText), sentEntities), rpcDone(&HistoryWidget::saveEditMsgDone, _history), rpcFail(&HistoryWidget::saveEditMsgFail, _history)); } void HistoryWidget::saveEditMsgDone(History *history, const MTPUpdates &updates, mtpRequestId req) { @@ -4736,7 +4837,7 @@ void HistoryWidget::onBotStart() { if (token.isEmpty()) { sendBotCommand(qsl("/start"), 0); } else { - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); MTP::send(MTPmessages_StartBot(_peer->asUser()->inputUser, MTP_inputPeerEmpty(), MTP_long(randomId), MTP_string(token)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::addParticipantFail, _peer->asUser())); _peer->asUser()->botInfo->startToken = QString(); @@ -4797,39 +4898,39 @@ void HistoryWidget::onShareContact(const PeerId &peer, UserData *contact) { void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, int32 userId) { History *h = App::history(peer); - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); FullMsgId newId(peerToChannel(peer), clientMsgId()); App::main()->readServerHistory(h, false); fastShowAtEnd(h); PeerData *p = App::peer(peer); - int32 flags = newMessageFlags(p) | MTPDmessage::flag_media; // unread, out + MTPDmessage::Flags flags = newMessageFlags(p) | MTPDmessage::Flag::f_media; // unread, out bool lastKeyboardUsed = lastForceReplyReplied(FullMsgId(peerToChannel(peer), replyTo)); - int32 sendFlags = 0; + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyTo) { - flags |= MTPDmessage::flag_reply_to_msg_id; - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + flags |= MTPDmessage::Flag::f_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = p->isChannel() && !p->isMegagroup() && p->asChannel()->canPublish() && (p->asChannel()->isBroadcast() || _broadcast.checked()); bool showFromName = !channelPost || p->asChannel()->addsSignature(); bool silentPost = channelPost && _silent.checked(); if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } - h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(peer), MTPnullFwdHeader, MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); - h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, h->sendRequestId); + h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(peer), MTPnullFwdHeader, MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, h->sendRequestId); App::historyRegRandom(randomId, newId); @@ -4954,7 +5055,7 @@ void HistoryWidget::doneShow() { updateBotKeyboard(); updateControlsVisibility(); updateListSize(true); - onListScroll(); + preloadHistoryIfNeeded(); if (App::wnd()) { App::wnd()->checkHistoryActivation(); App::wnd()->setInnerFocus(); @@ -5828,30 +5929,30 @@ void HistoryWidget::confirmSendFile(const FileLoadResultPtr &file, bool ctrlShif fastShowAtEnd(h); - int32 flags = newMessageFlags(h->peer) | MTPDmessage::flag_media; // unread, out - if (file->to.replyTo) flags |= MTPDmessage::flag_reply_to_msg_id; + MTPDmessage::Flags flags = newMessageFlags(h->peer) | MTPDmessage::Flag::f_media; // unread, out + if (file->to.replyTo) flags |= MTPDmessage::Flag::f_reply_to_msg_id; bool channelPost = h->peer->isChannel() && !h->peer->isMegagroup() && h->peer->asChannel()->canPublish() && (h->peer->asChannel()->isBroadcast() || file->to.broadcast); bool showFromName = !channelPost || h->peer->asChannel()->addsSignature(); bool silentPost = channelPost && file->to.silent; if (channelPost) { - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - flags |= MTPDmessage::flag_silent; + flags |= MTPDmessage::Flag::f_silent; } if (file->type == PreparePhoto) { - h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(file->photo, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(file->photo, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); } else if (file->type == PrepareDocument) { - h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); } else if (file->type == PrepareAudio) { if (!h->peer->isChannel()) { - flags |= MTPDmessage::flag_media_unread; + flags |= MTPDmessage::Flag::f_media_unread; } - h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + h->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(file->to.peer), MTPnullFwdHeader, MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); } if (_peer && file->to.peer == _peer->id) { @@ -5893,25 +5994,25 @@ void HistoryWidget::onPhotoUploaded(const FullMsgId &newId, bool silent, const M if (!MTP::authedId()) return; HistoryItem *item = App::histItemById(newId); if (item) { - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); App::historyRegRandom(randomId, newId); History *hist = item->history(); - MsgId replyTo = item->toHistoryReply() ? item->toHistoryReply()->replyToId() : 0; - int32 sendFlags = 0; + MsgId replyTo = item->replyToId(); + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyTo) { - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = hist->peer->isChannel() && !hist->peer->isMegagroup() && hist->peer->asChannel()->canPublish() && item->isPost(); bool silentPost = channelPost && silent; if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString(); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedPhoto(file, MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); } } @@ -5931,9 +6032,9 @@ namespace { } else if (document->type == StickerDocument && document->sticker()) { attributes.push_back(MTP_documentAttributeSticker(MTP_string(document->sticker()->alt), document->sticker()->set)); } else if (document->type == SongDocument && document->song()) { - attributes.push_back(MTP_documentAttributeAudio(MTP_int(MTPDdocumentAttributeAudio::flag_title | MTPDdocumentAttributeAudio::flag_performer), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring())); + attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_title | MTPDdocumentAttributeAudio::Flag::f_performer), MTP_int(document->song()->duration), MTP_string(document->song()->title), MTP_string(document->song()->performer), MTPstring())); } else if (document->type == VoiceDocument && document->voice()) { - attributes.push_back(MTP_documentAttributeAudio(MTP_int(MTPDdocumentAttributeAudio::flag_voice | MTPDdocumentAttributeAudio::flag_waveform), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(document->voice()->waveform)))); + attributes.push_back(MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(document->voice()->duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(document->voice()->waveform)))); } return MTP_vector(attributes); } @@ -5945,25 +6046,25 @@ void HistoryWidget::onDocumentUploaded(const FullMsgId &newId, bool silent, cons if (item) { DocumentData *document = item->getMedia() ? item->getMedia()->getDocument() : 0; if (document) { - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); App::historyRegRandom(randomId, newId); History *hist = item->history(); - MsgId replyTo = item->toHistoryReply() ? item->toHistoryReply()->replyToId() : 0; - int32 sendFlags = 0; + MsgId replyTo = item->replyToId(); + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyTo) { - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = hist->peer->isChannel() && !hist->peer->isMegagroup() && hist->peer->asChannel()->canPublish() && item->isPost(); bool silentPost = channelPost && silent; if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString(); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedDocument(file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedDocument(file, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); } } } @@ -5974,25 +6075,25 @@ void HistoryWidget::onThumbDocumentUploaded(const FullMsgId &newId, bool silent, if (item) { DocumentData *document = item->getMedia() ? item->getMedia()->getDocument() : 0; if (document) { - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); App::historyRegRandom(randomId, newId); History *hist = item->history(); - MsgId replyTo = item->toHistoryReply() ? item->toHistoryReply()->replyToId() : 0; - int32 sendFlags = 0; + MsgId replyTo = item->replyToId(); + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyTo) { - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = hist->peer->isChannel() && !hist->peer->isMegagroup() && hist->peer->asChannel()->canPublish() && item->isPost(); bool silentPost = channelPost && silent; if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } QString caption = item->getMedia() ? item->getMedia()->getCaption() : QString(); - hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedThumbDocument(file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), item->history()->peer->input, MTP_int(replyTo), MTP_inputMediaUploadedThumbDocument(file, thumb, MTP_string(document->mime), _composeDocumentAttributes(document), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); } } } @@ -6184,6 +6285,13 @@ void HistoryWidget::notify_automaticLoadSettingsChangedGif() { _emojiPan.notify_automaticLoadSettingsChangedGif(); } +void HistoryWidget::notify_handlePendingHistoryUpdate() { + if (_history && _history->hasPendingResizedItems()) { + updateListSize(); + _list->update(); + } +} + void HistoryWidget::resizeEvent(QResizeEvent *e) { _reportSpamPanel.resize(width(), _reportSpamPanel.height()); @@ -6200,12 +6308,14 @@ void HistoryWidget::resizeEvent(QResizeEvent *e) { if (_pinnedBar) { if (_scroll.y() != st::replyHeight) { _scroll.move(0, st::replyHeight); + _reportSpamPanel.move(0, st::replyHeight); _attachMention.setBoundings(_scroll.geometry()); } _pinnedBar->cancel.move(width() - _pinnedBar->cancel.width(), 0); _pinnedBar->shadow.setGeometry(0, st::replyHeight, width(), st::lineWidth); } else if (_scroll.y() != 0) { _scroll.move(0, 0); + _reportSpamPanel.move(0, 0); _attachMention.setBoundings(_scroll.geometry()); } @@ -6299,14 +6409,13 @@ MsgId HistoryWidget::replyToId() const { return _replyToId ? _replyToId : (_kbReplyTo ? _kbReplyTo->id : 0); } -void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollChange &change, const HistoryItem *resizedItem, bool scrollToIt) { +void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollChange &change) { if (!_history || (initial && _histInited) || (!initial && !_histInited)) return; - if (_firstLoadRequest) { - if (resizedItem) _list->recountHeight(resizedItem); + if (_firstLoadRequest || _a_show.animating()) { return; // scrollTopMax etc are not working after recountHeight() } - int32 newScrollHeight = height(); + int newScrollHeight = height(); if (isBlocked() || isBotStart() || isJoinChannel() || isMuteUnmute()) { newScrollHeight -= _unblock.height(); } else { @@ -6326,45 +6435,42 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh bool wasAtBottom = _scroll.scrollTop() + 1 > _scroll.scrollTopMax(), needResize = _scroll.width() != width() || _scroll.height() != newScrollHeight; if (needResize) { _scroll.resize(width(), newScrollHeight); + // on initial updateListSize we didn't put the _scroll.scrollTop correctly yet + // so visibleAreaUpdated() call will erase it with the new (undefined) value + if (!initial) { + visibleAreaUpdated(); + } + _attachMention.setBoundings(_scroll.geometry()); _toHistoryEnd.move((width() - _toHistoryEnd.width()) / 2, _scroll.y() + _scroll.height() - _toHistoryEnd.height() - st::historyToEndSkip); updateCollapseCommentsVisibility(); } - if (!initial) { - _history->lastScrollTop = _scroll.scrollTop(); - } - int32 newSt = _list->recountHeight(resizedItem); + _list->recountHeight(); + bool washidden = _scroll.isHidden(); if (washidden) { _scroll.show(); } _list->updateSize(); - int32 historyTop = _list->historyTop(), migratedTop = _list->migratedTop(); - if (resizedItem && !resizedItem->detached() && scrollToIt) { - int32 resizedTop = _list->itemTop(resizedItem); - if (resizedTop >= 0) { - if (newSt + _scroll.height() < resizedTop + resizedItem->height()) { - newSt = resizedTop + resizedItem->height() - _scroll.height(); - } - if (newSt > resizedTop) { - newSt = resizedTop; - } - wasAtBottom = false; - } - } if (washidden) { _scroll.hide(); } if ((!initial && !wasAtBottom) || (loadedDown && (!_history->showFrom || _history->unreadBar || _history->loadedAtBottom()) && (!_migrated || !_migrated->showFrom || _migrated->unreadBar || _history->loadedAtBottom()))) { - int32 addToY = 0; + int addToY = 0; if (change.type == ScrollChangeAdd) { addToY = change.value; } else if (change.type == ScrollChangeOldHistoryHeight) { addToY = _list->historyHeight() - change.value; } - _scroll.scrollToY(newSt + addToY); + int toY = _list->historyScrollTop() + addToY; + if (toY > _scroll.scrollTopMax()) toY = _scroll.scrollTopMax(); + if (_scroll.scrollTop() == toY) { + visibleAreaUpdated(); + } else { + _scroll.scrollToY(toY); + } return; } @@ -6373,9 +6479,8 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh } int32 toY = ScrollMax; - if (initial && _history->lastWidth) { - toY = newSt; - _history->lastWidth = 0; + if (initial && (_history->scrollTopItem || (_migrated && _migrated->scrollTopItem))) { + toY = _list->historyScrollTop(); } else if (initial && _migrated && _showAtMsgId < 0 && -_showAtMsgId < ServerMaxMsgId) { HistoryItem *item = App::histItemById(0, -_showAtMsgId); int32 iy = _list->itemTop(item); @@ -6468,14 +6573,19 @@ void HistoryWidget::updateListSize(bool initial, bool loadedDown, const ScrollCh } } else { } - _scroll.scrollToY(toY); + if (toY > _scroll.scrollTopMax()) toY = _scroll.scrollTopMax(); + if (_scroll.scrollTop() == toY) { + visibleAreaUpdated(); + } else { + _scroll.scrollToY(toY); + } } void HistoryWidget::addMessagesToFront(PeerData *peer, const QVector &messages, const QVector *collapsed) { int oldH = _list->historyHeight(); _list->messagesReceived(peer, messages, collapsed); if (!_firstLoadRequest) { - updateListSize(false, false, { ScrollChangeOldHistoryHeight, oldH }); + updateListSize(); if (_animActiveTimer.isActive() && _activeAnimMsgId > 0 && _migrated && !_migrated->isEmpty() && _migrated->loadedAtBottom() && _migrated->blocks.back()->items.back()->isGroupMigrate() && _list->historyTop() != _list->historyDrawTop() && _history) { HistoryItem *animActiveItem = App::histItemById(_history->channelId(), _activeAnimMsgId); if (animActiveItem && animActiveItem->isGroupMigrate()) { @@ -6690,34 +6800,34 @@ void HistoryWidget::onInlineResultSend(InlineResult *result, UserData *bot) { App::main()->readServerHistory(_history, false); fastShowAtEnd(_history); - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); FullMsgId newId(_channel, clientMsgId()); bool lastKeyboardUsed = lastForceReplyReplied(); bool out = !_peer->isSelf(), unread = !_peer->isSelf(); - int32 flags = newMessageFlags(_peer) | MTPDmessage::flag_media; // unread, out - int32 sendFlags = 0; + MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out + MTPmessages_SendInlineBotResult::Flags sendFlags = 0; if (replyToId()) { - flags |= MTPDmessage::flag_reply_to_msg_id; - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + flags |= MTPDmessage::Flag::f_reply_to_msg_id; + sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_reply_to_msg_id; } bool channelPost = _peer->isChannel() && !_peer->isMegagroup() && _peer->asChannel()->canPublish() && (_peer->asChannel()->isBroadcast() || _broadcast.checked()); bool showFromName = !channelPost || _peer->asChannel()->addsSignature(); bool silentPost = channelPost && _silent.checked(); if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendInlineBotResult::Flag::f_silent; } if (bot) { - flags |= MTPDmessage::flag_via_bot_id; + flags |= MTPDmessage::Flag::f_via_bot_id; } if (result->message.isEmpty()) { @@ -6740,12 +6850,12 @@ void HistoryWidget::onInlineResultSend(InlineResult *result, UserData *bot) { th = 90; } thumbSize = MTP_photoSize(MTP_string(""), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(tw), MTP_int(th), MTP_int(0)); - thumb = result->thumb->pixNoCache(tw, th, true, false, false); + thumb = result->thumb->pixNoCache(tw, th, ImagePixSmooth); } else { tw = th = 0; thumbSize = MTP_photoSizeEmpty(MTP_string("")); } - uint64 docId = MTP::nonce(); + uint64 docId = rand_value(); QVector attributes(1, MTP_documentAttributeFilename(MTP_string((result->content_type == qstr("video/mp4") ? "animation.gif.mp4" : "animation.gif")))); attributes.push_back(MTP_documentAttributeAnimated()); attributes.push_back(MTP_documentAttributeVideo(MTP_int(result->duration), MTP_int(result->width), MTP_int(result->height))); @@ -6754,7 +6864,7 @@ void HistoryWidget::onInlineResultSend(InlineResult *result, UserData *bot) { App::feedDocument(document, thumb); } Local::writeStickerImage(mediaKey(DocumentFileLocation, MTP::maindc(), docId), result->data()); - _history->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(document, MTP_string(result->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + _history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(document, MTP_string(result->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); } else if (result->type == qstr("photo")) { QImage fileThumb(result->thumb->pix().toImage()); @@ -6769,20 +6879,17 @@ void HistoryWidget::onInlineResultSend(InlineResult *result, UserData *bot) { photoSizes.push_back(MTP_photoSize(MTP_string("x"), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(result->width), MTP_int(result->height), MTP_int(0))); - uint64 photoId = MTP::nonce(); + uint64 photoId = rand_value(); PhotoData *ph = App::photoSet(photoId, 0, 0, unixtime(), thumbPtr, ImagePtr(medium.width(), medium.height()), ImagePtr(result->width, result->height)); MTPPhoto photo = MTP_photo(MTP_long(photoId), MTP_long(0), MTP_int(ph->date), MTP_vector(photoSizes)); - _history->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(photo, MTP_string(result->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); + _history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(photo, MTP_string(result->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1), MTPint()), NewMessageUnread); } } else { - flags |= MTPDmessage::flag_entities; - if (result->noWebPage) { - sendFlags |= MTPmessages_SendMessage::flag_no_webpage; - } - _history->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(result->message), MTP_messageMediaEmpty(), MTPnullMarkup, linksToMTP(result->entities), MTP_int(1), MTPint()), NewMessageUnread); + flags |= MTPDmessage::Flag::f_entities; + _history->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(_history->peer->id), MTPnullFwdHeader, MTP_int(bot ? peerToUser(bot->id) : 0), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(result->message), MTP_messageMediaEmpty(), MTPnullMarkup, linksToMTP(result->entities), MTP_int(1), MTPint()), NewMessageUnread); } - _history->sendRequestId = MTP::send(MTPmessages_SendInlineBotResult(MTP_int(sendFlags), _peer->input, MTP_int(replyToId()), MTP_long(randomId), MTP_long(result->queryId), MTP_string(result->id)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); + _history->sendRequestId = MTP::send(MTPmessages_SendInlineBotResult(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_long(randomId), MTP_long(result->queryId), MTP_string(result->id)), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); App::main()->finishForwarding(_history, _broadcast.checked(), _silent.checked()); cancelReply(lastKeyboardUsed); @@ -6880,7 +6987,7 @@ bool HistoryWidget::pinnedMsgVisibilityUpdated() { } else if (_pinnedBar->msgId != pinnedMsgId) { _pinnedBar->msgId = pinnedMsgId; _pinnedBar->msg = 0; - _pinnedBar->text.clean(); + _pinnedBar->text.clear(); updatePinnedBar(); update(); } @@ -6914,35 +7021,35 @@ void HistoryWidget::sendExistingDocument(DocumentData *doc, const QString &capti App::main()->readServerHistory(_history, false); fastShowAtEnd(_history); - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); FullMsgId newId(_channel, clientMsgId()); bool lastKeyboardUsed = lastForceReplyReplied(); bool out = !_peer->isSelf(), unread = !_peer->isSelf(); - int32 flags = newMessageFlags(_peer) | MTPDmessage::flag_media; // unread, out - int32 sendFlags = 0; + MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyToId()) { - flags |= MTPDmessage::flag_reply_to_msg_id; - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + flags |= MTPDmessage::Flag::f_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = _peer->isChannel() && !_peer->isMegagroup() && _peer->asChannel()->canPublish() && (_peer->asChannel()->isBroadcast() || _broadcast.checked()); bool showFromName = !channelPost || _peer->asChannel()->addsSignature(); bool silentPost = channelPost && _silent.checked(); if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } _history->addNewDocument(newId.msg, flags, 0, replyToId(), date(MTP_int(unixtime())), showFromName ? MTP::authedId() : 0, doc, caption); - _history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaDocument(MTP_inputDocument(MTP_long(doc->id), MTP_long(doc->access)), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); + _history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaDocument(MTP_inputDocument(MTP_long(doc->id), MTP_long(doc->access)), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); App::main()->finishForwarding(_history, _broadcast.checked(), _silent.checked()); cancelReply(lastKeyboardUsed); @@ -6970,35 +7077,35 @@ void HistoryWidget::sendExistingPhoto(PhotoData *photo, const QString &caption) App::main()->readServerHistory(_history, false); fastShowAtEnd(_history); - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); FullMsgId newId(_channel, clientMsgId()); bool lastKeyboardUsed = lastForceReplyReplied(); bool out = !_peer->isSelf(), unread = !_peer->isSelf(); - int32 flags = newMessageFlags(_peer) | MTPDmessage::flag_media; // unread, out - int32 sendFlags = 0; + MTPDmessage::Flags flags = newMessageFlags(_peer) | MTPDmessage::Flag::f_media; // unread, out + MTPmessages_SendMedia::Flags sendFlags = 0; if (replyToId()) { - flags |= MTPDmessage::flag_reply_to_msg_id; - sendFlags |= MTPmessages_SendMedia::flag_reply_to_msg_id; + flags |= MTPDmessage::Flag::f_reply_to_msg_id; + sendFlags |= MTPmessages_SendMedia::Flag::f_reply_to_msg_id; } bool channelPost = _peer->isChannel() && !_peer->isMegagroup() && _peer->asChannel()->canPublish() && (_peer->asChannel()->isBroadcast() || _broadcast.checked()); bool showFromName = !channelPost || _peer->asChannel()->addsSignature(); bool silentPost = channelPost && _silent.checked(); if (channelPost) { - sendFlags |= MTPmessages_SendMedia::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_SendMedia::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_SendMedia::flag_silent; + sendFlags |= MTPmessages_SendMedia::Flag::f_silent; } _history->addNewPhoto(newId.msg, flags, 0, replyToId(), date(MTP_int(unixtime())), showFromName ? MTP::authedId() : 0, photo, caption); - _history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaPhoto(MTP_inputPhoto(MTP_long(photo->id), MTP_long(photo->access)), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); + _history->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_flags(sendFlags), _peer->input, MTP_int(replyToId()), MTP_inputMediaPhoto(MTP_inputPhoto(MTP_long(photo->id), MTP_long(photo->access)), MTP_string(caption)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, _history->sendRequestId); App::main()->finishForwarding(_history, _broadcast.checked(), _silent.checked()); cancelReply(lastKeyboardUsed); @@ -7030,8 +7137,8 @@ void HistoryWidget::onReplyToMessage() { if (!to || to->id <= 0 || !_canSendMessages) return; if (to->history() == _migrated) { - if (to->isGroupMigrate() && _history->blocks.size() > 1 && _history->blocks.at(1)->items.front()->isGroupMigrate() && _history != _migrated) { - App::contextItem(_history->blocks.at(1)->items.front()); + if (to->isGroupMigrate() && !_history->isEmpty() && _history->blocks.front()->items.front()->isGroupMigrate() && _history != _migrated) { + App::contextItem(_history->blocks.front()->items.front()); onReplyToMessage(); App::contextItem(to); } else { @@ -7149,7 +7256,8 @@ void HistoryWidget::onUnpinMessageSure() { } Ui::hideLayer(); - MTP::send(MTPchannels_UpdatePinnedMessage(MTP_int(0), _peer->asChannel()->inputChannel, MTP_int(0)), rpcDone(&HistoryWidget::unpinDone)); + MTPchannels_UpdatePinnedMessage::Flags flags = 0; + MTP::send(MTPchannels_UpdatePinnedMessage(MTP_flags(flags), _peer->asChannel()->inputChannel, MTP_int(0)), rpcDone(&HistoryWidget::unpinDone)); } void HistoryWidget::unpinDone(const MTPUpdates &updates) { @@ -7429,7 +7537,6 @@ void HistoryWidget::onCancel() { } void HistoryWidget::onFullPeerUpdated(PeerData *data) { - int32 newScrollTop = _scroll.scrollTop(); if (_list && data == _peer) { bool newCanSendMessages = canSendMessages(_peer); if (newCanSendMessages != _canSendMessages) { @@ -7441,9 +7548,7 @@ void HistoryWidget::onFullPeerUpdated(PeerData *data) { } onCheckMentionDropdown(); updateReportSpamStatus(); - int32 lh = _list->height(), st = _scroll.scrollTop(); _list->updateBotInfo(); - newScrollTop = st + _list->height() - lh; } if (updateCmdStartShown()) { updateControlsVisibility(); @@ -7453,13 +7558,6 @@ void HistoryWidget::onFullPeerUpdated(PeerData *data) { updateControlsVisibility(); resizeEvent(0); } - if (newScrollTop != _scroll.scrollTop()) { - if (_scroll.isVisible()) { - _scroll.scrollToY(newScrollTop); - } else { - _history->lastScrollTop = newScrollTop; - } - } } void HistoryWidget::peerUpdated(PeerData *data) { @@ -7469,6 +7567,12 @@ void HistoryWidget::peerUpdated(PeerData *data) { QTimer::singleShot(ReloadChannelMembersTimeout, App::api(), SLOT(delayedRequestParticipantsCount())); return; } + QString restriction = _peer->restrictionReason(); + if (!restriction.isEmpty()) { + Ui::showChatsList(); + Ui::showLayer(new InformBox(restriction)); + return; + } bool resize = false; if (pinnedMsgVisibilityUpdated()) { resize = true; @@ -7539,7 +7643,6 @@ void HistoryWidget::onDeleteSelectedSure() { for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { i.value()->destroy(); } - Notify::historyItemsResized(); Ui::hideLayer(); for (QMap >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) { @@ -7561,7 +7664,6 @@ void HistoryWidget::onDeleteContextSure() { App::main()->checkPeerHistory(h->peer); } - Notify::historyItemsResized(); Ui::hideLayer(); if (wasOnServer) { @@ -7920,6 +8022,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) { drawPinnedBar(p); } if (_scroll.isHidden()) { + p.setClipRect(_scroll.geometry()); QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9); p.drawPixmap(dogPos, *cChatDogImage()); } diff --git a/Telegram/SourceFiles/historywidget.h b/Telegram/SourceFiles/historywidget.h index 1ee9fc014..5eabc4ffb 100644 --- a/Telegram/SourceFiles/historywidget.h +++ b/Telegram/SourceFiles/historywidget.h @@ -66,7 +66,7 @@ public: void touchScrollUpdated(const QPoint &screenPos); QPoint mapMouseToItem(QPoint p, HistoryItem *item); - int32 recountHeight(const HistoryItem *resizedItem); + void recountHeight(); void updateSize(); void repaintItem(const HistoryItem *item); @@ -88,11 +88,15 @@ public: HistoryItem *atTopImportantMsg(int32 top, int32 height, int32 &bottomUnderScrollTop) const; - int32 historyHeight() const; - int32 migratedTop() const; - int32 historyTop() const; - int32 historyDrawTop() const; - int32 itemTop(const HistoryItem *item) const; // -1 if should not be visible, -2 if bad history() + // updates history->scrollTopItem/scrollTopOffset + void visibleAreaUpdated(int top, int bottom); + + int historyHeight() const; + int historyScrollTop() const; + int migratedTop() const; + int historyTop() const; + int historyDrawTop() const; + int itemTop(const HistoryItem *item) const; // -1 if should not be visible, -2 if bad history() void notifyIsBotChanged(); void notifyMigrateUpdated(); @@ -135,22 +139,30 @@ private: HistoryItem *nextItem(HistoryItem *item); void updateDragSelection(HistoryItem *dragSelFrom, HistoryItem *dragSelTo, bool dragSelecting, bool force = false); - PeerData *_peer; - History *_migrated, *_history; - int32 _historyOffset, _historySkipHeight; // height of first date and first sys msg + PeerData *_peer = nullptr; + History *_migrated = nullptr; + History *_history = nullptr; + int _historyOffset = 0; - BotInfo *_botInfo; - int32 _botDescWidth, _botDescHeight; + // with migrated history we perhaps do not need to display first _history message + // (if last _migrated message and first _history message are both isGroupMigrate) + // or at least we don't need to display first _history date (just skip it by height) + int _historySkipHeight = 0; + + BotInfo *_botInfo = nullptr; + int _botDescWidth = 0; + int _botDescHeight = 0; QRect _botDescRect; - HistoryWidget *_widget; - ScrollArea *_scroll; - mutable History *_curHistory; - mutable int32 _curBlock, _curItem; + HistoryWidget *_widget = nullptr; + ScrollArea *_scroll = nullptr; + mutable History *_curHistory = nullptr; + mutable int _curBlock = 0; + mutable int _curItem = 0; - bool _firstLoading; + bool _firstLoading = false; - Qt::CursorShape _cursor; + style::cursor _cursor = style::cur_default; typedef QMap SelectedItems; SelectedItems _selected; void applyDragSelection(); @@ -164,34 +176,60 @@ private: PrepareSelect = 0x03, Selecting = 0x04, }; - DragAction _dragAction; - TextSelectType _dragSelType; + DragAction _dragAction = NoDrag; + TextSelectType _dragSelType = TextSelectLetters; QPoint _dragStartPos, _dragPos; - HistoryItem *_dragItem; - HistoryCursorState _dragCursorState; - uint16 _dragSymbol; - bool _dragWasInactive; + HistoryItem *_dragItem = nullptr; + HistoryCursorState _dragCursorState = HistoryDefaultCursorState; + uint16 _dragSymbol = 0; + bool _dragWasInactive = false; QPoint _trippleClickPoint; QTimer _trippleClickTimer; TextLinkPtr _contextMenuLnk; - HistoryItem *_dragSelFrom, *_dragSelTo; - bool _dragSelecting; - bool _wasSelectedText; // was some text selected in current drag action + HistoryItem *_dragSelFrom = nullptr; + HistoryItem *_dragSelTo = nullptr; + bool _dragSelecting = false; + bool _wasSelectedText = false; // was some text selected in current drag action - bool _touchScroll, _touchSelect, _touchInProgress; + // scroll by touch support (at least Windows Surface tablets) + bool _touchScroll = false; + bool _touchSelect = false; + bool _touchInProgress = false; QPoint _touchStart, _touchPrevPos, _touchPos; QTimer _touchSelectTimer; - TouchScrollState _touchScrollState; - bool _touchPrevPosValid, _touchWaitingAcceleration; + TouchScrollState _touchScrollState = TouchScrollManual; + bool _touchPrevPosValid = false; + bool _touchWaitingAcceleration = false; QPoint _touchSpeed; - uint64 _touchSpeedTime, _touchAccelerationTime, _touchTime; + uint64 _touchSpeedTime = 0; + uint64 _touchAccelerationTime = 0; + uint64 _touchTime = 0; QTimer _touchScrollTimer; - PopupMenu *_menu; + // context menu + PopupMenu *_menu = nullptr; + + // save visible area coords for painting / pressing userpics + int _visibleAreaTop = 0; + int _visibleAreaBottom = 0; + + // this function finds all userpics on the left that are displayed and calls template method + // for each found userpic (from the bottom to the top) in the passed history with passed top offset + // + // method has "bool (*Method)(HistoryMessage *message, int userpicTop)" signature + // if it returns false the enumeration stops immidiately + template + void enumerateUserpicsInHistory(History *h, int htop, Method method); + + template + void enumerateUserpics(Method method) { + enumerateUserpicsInHistory(_history, historyTop(), method); + enumerateUserpicsInHistory(_migrated, migratedTop(), method); + } }; @@ -589,13 +627,13 @@ public: bool ui_isInlineItemBeingChosen(); void notify_historyItemLayoutChanged(const HistoryItem *item); - void notify_automaticLoadSettingsChangedGif(); void notify_botCommandsChanged(UserData *user); void notify_inlineBotRequesting(bool requesting); void notify_userIsBotChanged(UserData *user); void notify_migrateUpdated(PeerData *peer); void notify_clipStopperHidden(ClipStopperType type); - void notify_historyItemResized(const HistoryItem *item, bool scrollToIt); + void notify_automaticLoadSettingsChangedGif(); + void notify_handlePendingHistoryUpdate(); void cmd_search(); void cmd_next_chat(); @@ -646,7 +684,7 @@ public slots: void onReportSpamHide(); void onReportSpamClear(); - void onListScroll(); + void onScroll(); void onHistoryToEnd(); void onCollapseComments(); void onSend(bool ctrlShiftEnter = false, MsgId replyTo = -1); @@ -676,7 +714,7 @@ public slots: void onPhotoSend(PhotoData *photo); void onInlineResultSend(InlineResult *result, UserData *bot); - void onVisibleChanged(); + void onWindowVisibleChanged(); void deleteMessage(); void forwardMessage(); @@ -709,16 +747,20 @@ public slots: void onUpdateHistoryItems(); + // checks if we are too close to the top or to the bottom + // in the scroll area and preloads history if needed + void preloadHistoryIfNeeded(); + private: - MsgId _replyToId; + MsgId _replyToId = 0; Text _replyToName; - int32 _replyToNameVersion; + int _replyToNameVersion = 0; void updateReplyToName(); - MsgId _editMsgId; + MsgId _editMsgId = 0; - HistoryItem *_replyEditMsg; + HistoryItem *_replyEditMsg = nullptr; Text _replyEditMsgText; IconedButton _fieldBarCancel; @@ -727,13 +769,13 @@ private: struct PinnedBar { PinnedBar(MsgId msgId, HistoryWidget *parent); - MsgId msgId; - HistoryItem *msg; + MsgId msgId = 0; + HistoryItem *msg = nullptr; Text text; IconedButton cancel; PlainShadow shadow; }; - PinnedBar *_pinnedBar; + PinnedBar *_pinnedBar = nullptr; void updatePinnedBar(bool force = false); bool pinnedMsgVisibilityUpdated(); void destroyPinnedBar(); @@ -754,32 +796,36 @@ private: void updateMouseTracking(); - mtpRequestId _saveEditMsgRequestId; + // destroys _history and _migrated unread bars + void destroyUnreadBar(); + + mtpRequestId _saveEditMsgRequestId = 0; void saveEditMsg(); void saveEditMsgDone(History *history, const MTPUpdates &updates, mtpRequestId req); bool saveEditMsgFail(History *history, const RPCError &error, mtpRequestId req); - DBIPeerReportSpamStatus _reportSpamStatus; - mtpRequestId _reportSpamSettingRequestId; static const mtpRequestId ReportSpamRequestNeeded = -1; + DBIPeerReportSpamStatus _reportSpamStatus = dbiprsUnknown; + mtpRequestId _reportSpamSettingRequestId = ReportSpamRequestNeeded; void updateReportSpamStatus(); void requestReportSpamSetting(); void reportSpamSettingDone(const MTPPeerSettings &result, mtpRequestId req); bool reportSpamSettingFail(const RPCError &error, mtpRequestId req); QString _previewLinks; - WebPageData *_previewData; + WebPageData *_previewData = nullptr; typedef QMap PreviewCache; PreviewCache _previewCache; - mtpRequestId _previewRequest; - Text _previewTitle, _previewDescription; + mtpRequestId _previewRequest = 0; + Text _previewTitle; + Text _previewDescription; SingleTimer _previewTimer; - bool _previewCancelled; + bool _previewCancelled = false; void gotPreview(QString links, const MTPMessageMedia &media, mtpRequestId req); - bool _replyForwardPressed; + bool _replyForwardPressed = false; - HistoryItem *_replyReturn; + HistoryItem *_replyReturn = nullptr; QList _replyReturns; bool messagesFailed(const RPCError &error, mtpRequestId requestId); @@ -795,7 +841,7 @@ private: ScrollChangeType type; int value; }; - void updateListSize(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 }, const HistoryItem *resizedItem = 0, bool scrollToIt = false); + void updateListSize(bool initial = false, bool loadedDown = false, const ScrollChange &change = { ScrollChangeNone, 0 }); void saveGifDone(DocumentData *doc, const MTPBool &result); @@ -811,11 +857,11 @@ private: void countHistoryShowFrom(); - mtpRequestId _stickersUpdateRequest; + mtpRequestId _stickersUpdateRequest = 0; void stickersGot(const MTPmessages_AllStickers &stickers); bool stickersFailed(const RPCError &error); - mtpRequestId _savedGifsUpdateRequest; + mtpRequestId _savedGifsUpdateRequest = 0; void savedGifsGot(const MTPmessages_SavedGifs &gifs); bool savedGifsFailed(const RPCError &error); @@ -827,39 +873,51 @@ private: void updateDragAreas(); + // when scroll position or scroll area size changed this method + // updates the boundings of the visible area in HistoryInner + void visibleAreaUpdated(); + bool readyToForward() const; bool hasBroadcastToggle() const; bool hasSilentToggle() const; - PeerData *_peer, *_clearPeer; // cache _peer in _clearPeer when showing clear history box - ChannelId _channel; - bool _canSendMessages; - MsgId _showAtMsgId, _fixedInScrollMsgId; - int32 _fixedInScrollMsgTop; + PeerData *_peer = nullptr; - mtpRequestId _firstLoadRequest, _preloadRequest, _preloadDownRequest; + // cache current _peer in _clearPeer when showing clear history box + PeerData *_clearPeer = nullptr; - MsgId _delayedShowAtMsgId; - mtpRequestId _delayedShowAtRequest; + ChannelId _channel = NoChannel; + bool _canSendMessages = false; + MsgId _showAtMsgId = ShowAtUnreadMsgId; + MsgId _fixedInScrollMsgId = 0; + int32 _fixedInScrollMsgTop = 0; - MsgId _activeAnimMsgId; + mtpRequestId _firstLoadRequest = 0; + mtpRequestId _preloadRequest = 0; + mtpRequestId _preloadDownRequest = 0; + + MsgId _delayedShowAtMsgId = -1; // wtf? + mtpRequestId _delayedShowAtRequest = 0; + + MsgId _activeAnimMsgId = 0; ScrollArea _scroll; - HistoryInner *_list; - History *_migrated, *_history; - bool _histInited; // initial updateListSize() called + HistoryInner *_list = nullptr; + History *_migrated = nullptr; + History *_history = nullptr; + bool _histInited = false; // initial updateListSize() called - int32 _lastScroll; - uint64 _lastScrolled; + int32 _lastScroll = 0; + uint64 _lastScrolled = 0; QTimer _updateHistoryItems; // gifs optimization IconedButton _toHistoryEnd; CollapseButton _collapseComments; MentionsDropdown _attachMention; - UserData *_inlineBot; + UserData *_inlineBot = nullptr; QString _inlineBotUsername; - mtpRequestId _inlineBotResolveRequestId; + mtpRequestId _inlineBotResolveRequestId = 0; void inlineBotResolveDone(const MTPcontacts_ResolvedPeer &result); bool inlineBotResolveFail(QString name, const RPCError &error); @@ -872,46 +930,52 @@ private: ReportSpamPanel _reportSpamPanel; FlatButton _send, _unblock, _botStart, _joinChannel, _muteUnmute; - mtpRequestId _unblockRequest, _reportSpamRequest; + mtpRequestId _unblockRequest = 0; + mtpRequestId _reportSpamRequest = 0; IconedButton _attachDocument, _attachPhoto; EmojiButton _attachEmoji; IconedButton _kbShow, _kbHide, _cmdStart; FlatCheckbox _broadcast; SilentToggle _silent; - bool _cmdStartShown; + bool _cmdStartShown = false; MessageField _field; Animation _a_record, _a_recording; - bool _recording, _inRecord, _inField, _inReplyEdit, _inPinnedMsg; - anim::ivalue a_recordingLevel; - int32 _recordingSamples; - anim::fvalue a_recordOver, a_recordDown; + bool _recording = false; + bool _inRecord = false; + bool _inField = false; + bool _inReplyEdit = false; + bool _inPinnedMsg = false; + anim::ivalue a_recordingLevel = { 0, 0 }; + int32 _recordingSamples = 0; + anim::fvalue a_recordOver = { 0, 0 }; + anim::fvalue a_recordDown = { 0, 0 }; anim::cvalue a_recordCancel; int32 _recordCancelWidth; bool kbWasHidden() const; - bool _kbShown; - HistoryItem *_kbReplyTo; + bool _kbShown = false; + HistoryItem *_kbReplyTo = nullptr; ScrollArea _kbScroll; BotKeyboard _keyboard; Dropdown _attachType; EmojiPan _emojiPan; - DragState _attachDrag; + DragState _attachDrag = DragStateNone; DragArea _attachDragDocument, _attachDragPhoto; int32 _selCount; // < 0 - text selected, focus list, not _field TaskQueue _fileLoader; - int32 _textUpdateEventsFlags; + int32 _textUpdateEventsFlags = (TextUpdateEventsSaveDraft | TextUpdateEventsSendTyping); - int64 _serviceImageCacheSize; + int64 _serviceImageCacheSize = 0; QString _confirmSource; - uint64 _confirmWithTextId; + uint64 _confirmWithTextId = 0; QString _titlePeerText; - int32 _titlePeerTextWidth; + int32 _titlePeerTextWidth = 0; Animation _a_show; QPixmap _cacheUnder, _cacheOver, _cacheTopBarUnder, _cacheTopBarOver; @@ -919,20 +983,20 @@ private: anim::fvalue a_shadow; QTimer _scrollTimer; - int32 _scrollDelta; + int32 _scrollDelta = 0; QTimer _animActiveTimer; - float64 _animActiveStart; + float64 _animActiveStart = 0; QMap, mtpRequestId> _sendActionRequests; QTimer _sendActionStopTimer; - uint64 _saveDraftStart; - bool _saveDraftText; + uint64 _saveDraftStart = 0; + bool _saveDraftText = false; QTimer _saveDraftTimer; PlainShadow _sideShadow, _topShadow; - bool _inGrab; + bool _inGrab = false; }; diff --git a/Telegram/SourceFiles/intro/introcode.cpp b/Telegram/SourceFiles/intro/introcode.cpp index 35f2540ea..225161d2f 100644 --- a/Telegram/SourceFiles/intro/introcode.cpp +++ b/Telegram/SourceFiles/intro/introcode.cpp @@ -25,7 +25,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" #include "intro/introcode.h" -#include "intro/intro.h" +#include "intro/introsignup.h" +#include "intro/intropwdcheck.h" CodeInput::CodeInput(QWidget *parent, const style::flatInput &st, const QString &ph) : FlatInput(parent, st, ph) { } @@ -72,7 +73,7 @@ void CodeInput::correctValue(const QString &was, QString &now) { if (strict) emit codeEntered(); } -IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent) +IntroCode::IntroCode(IntroWidget *parent) : IntroStep(parent) , a_errorAlpha(0) , _a_error(animation(this, &IntroCode::step_error)) , next(this, lang(lng_intro_next), st::btnIntroNext) @@ -80,11 +81,10 @@ IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent) , _noTelegramCode(this, lang(lng_code_no_telegram), st::introLink) , _noTelegramCodeRequestId(0) , code(this, st::inpIntroCode, lang(lng_code_ph)) -, waitTillCall(intro()->getCallTimeout()) { - setVisible(false); +, sentRequest(0) +, callStatus(intro()->getCallStatus()) { setGeometry(parent->innerRect()); - connect(&next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource))); connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitCode())); connect(&code, SIGNAL(changed()), this, SLOT(onInputChange())); connect(&callTimer, SIGNAL(timeout()), this, SLOT(onSendCall())); @@ -92,6 +92,12 @@ IntroCode::IntroCode(IntroWidget *parent) : IntroStage(parent) connect(&_noTelegramCode, SIGNAL(clicked()), this, SLOT(onNoTelegramCode())); updateDescText(); + + if (!intro()->codeByTelegram()) { + if (callStatus.type == IntroWidget::CallWaiting) { + callTimer.start(1000); + } + } } void IntroCode::updateDescText() { @@ -101,8 +107,8 @@ void IntroCode::updateDescText() { callTimer.stop(); } else { _noTelegramCode.hide(); - waitTillCall = intro()->getCallTimeout(); - if (!callTimer.isActive()) { + callStatus = intro()->getCallStatus(); + if (callStatus.type == IntroWidget::CallWaiting && !callTimer.isActive()) { callTimer.start(1000); } } @@ -125,15 +131,27 @@ void IntroCode::paintEvent(QPaintEvent *e) { } if (codeByTelegram) { } else { - QString callText = lang(lng_code_calling); - if (waitTillCall >= 3600) { - callText = lng_code_call(lt_minutes, qsl("%1:%2").arg(waitTillCall / 3600).arg((waitTillCall / 60) % 60, 2, 10, QChar('0')), lt_seconds, qsl("%1").arg(waitTillCall % 60, 2, 10, QChar('0'))); - } else if (waitTillCall > 0) { - callText = lng_code_call(lt_minutes, QString::number(waitTillCall / 60), lt_seconds, qsl("%1").arg(waitTillCall % 60, 2, 10, QChar('0'))); - } else if (waitTillCall < 0) { + QString callText; + switch (callStatus.type) { + case IntroWidget::CallWaiting: { + if (callStatus.timeout >= 3600) { + callText = lng_code_call(lt_minutes, qsl("%1:%2").arg(callStatus.timeout / 3600).arg((callStatus.timeout / 60) % 60, 2, 10, QChar('0')), lt_seconds, qsl("%1").arg(callStatus.timeout % 60, 2, 10, QChar('0'))); + } else { + callText = lng_code_call(lt_minutes, QString::number(callStatus.timeout / 60), lt_seconds, qsl("%1").arg(callStatus.timeout % 60, 2, 10, QChar('0'))); + } + } break; + + case IntroWidget::CallCalling: { + callText = lang(lng_code_calling); + } break; + + case IntroWidget::CallCalled: { callText = lang(lng_code_called); + } break; + } + if (!callText.isEmpty()) { + p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center); } - p.drawText(QRect(textRect.left(), code.y() + code.height() + st::introCallSkip, st::introTextSize.width(), st::introErrHeight), callText, style::al_center); } if (_a_error.animating() || error.length()) { p.setOpacity(a_errorAlpha.current()); @@ -172,7 +190,7 @@ void IntroCode::step_error(float64 ms, bool timer) { _a_error.stop(); a_errorAlpha.finish(); if (!a_errorAlpha.current()) { - error = ""; + error.clear(); } } else { a_errorAlpha.update(dt, st::introErrFunc); @@ -181,30 +199,29 @@ void IntroCode::step_error(float64 ms, bool timer) { } void IntroCode::activate() { - waitTillCall = intro()->getCallTimeout(); - if (!intro()->codeByTelegram()) { - callTimer.start(1000); - } - error = ""; - a_errorAlpha = anim::fvalue(0); - sentCode = QString(); - show(); - code.setDisabled(false); + IntroStep::activate(); code.setFocus(); } -void IntroCode::prepareShow() { +void IntroCode::finished() { + IntroStep::finished(); + error.clear(); + a_errorAlpha = anim::fvalue(0); + + sentCode.clear(); + code.setDisabled(false); + + callTimer.stop(); code.setText(QString()); + rpcClear(); +} + +void IntroCode::cancelled() { if (sentRequest) { MTP::cancel(sentRequest); sentRequest = 0; } -} - -void IntroCode::deactivate() { - callTimer.stop(); - hide(); - code.clearFocus(); + MTP::send(MTPauth_CancelCode(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash()))); } void IntroCode::stopCheck() { @@ -218,9 +235,9 @@ void IntroCode::onCheckRequest() { if (leftms >= 1000) { if (sentRequest) { MTP::cancel(sentRequest); - sentCode = ""; + sentRequest = 0; + sentCode.clear(); } - sentRequest = 0; if (!code.isEnabled()) { code.setDisabled(false); code.setFocus(); @@ -234,6 +251,7 @@ void IntroCode::onCheckRequest() { void IntroCode::codeSubmitDone(const MTPauth_Authorization &result) { stopCheck(); + sentRequest = 0; code.setDisabled(false); const MTPDauth_authorization &d(result.c_auth_authorization()); if (d.vuser.type() != mtpc_user || !d.vuser.c_user().is_self()) { // wtf? @@ -246,10 +264,11 @@ void IntroCode::codeSubmitDone(const MTPauth_Authorization &result) { bool IntroCode::codeSubmitFail(const RPCError &error) { stopCheck(); + sentRequest = 0; code.setDisabled(false); const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID" || err == "PHONE_CODE_EXPIRED") { // show error - onBack(); + intro()->onBack(); return true; } else if (err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID") { showError(lang(lng_bad_code)); @@ -257,7 +276,7 @@ bool IntroCode::codeSubmitFail(const RPCError &error) { return true; } else if (err == "PHONE_NUMBER_UNOCCUPIED") { // success, need to signUp intro()->setCode(sentCode); - intro()->onIntroNext(); + intro()->replaceStep(new IntroSignup(intro())); return true; } else if (err == "SESSION_PASSWORD_NEEDED") { intro()->setCode(sentCode); @@ -280,27 +299,34 @@ bool IntroCode::codeSubmitFail(const RPCError &error) { } void IntroCode::onInputChange() { - showError(""); + showError(QString()); if (code.text().length() == 5) onSubmitCode(); } void IntroCode::onSendCall() { - if (!--waitTillCall) { - callTimer.stop(); - MTP::send(MTPauth_SendCall(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::callDone)); + if (callStatus.type == IntroWidget::CallWaiting) { + if (--callStatus.timeout <= 0) { + callStatus.type = IntroWidget::CallCalling; + callTimer.stop(); + MTP::send(MTPauth_ResendCode(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::callDone)); + } else { + intro()->setCallStatus(callStatus); + } } update(); } -void IntroCode::callDone(const MTPBool &v) { - if (!waitTillCall) { - waitTillCall = -1; +void IntroCode::callDone(const MTPauth_SentCode &v) { + if (callStatus.type == IntroWidget::CallCalling) { + callStatus.type = IntroWidget::CallCalled; + intro()->setCallStatus(callStatus); update(); } } void IntroCode::gotPassword(const MTPaccount_Password &result) { stopCheck(); + sentRequest = 0; code.setDisabled(false); switch (result.type()) { case mtpc_account_noPassword: // should not happen @@ -312,18 +338,18 @@ void IntroCode::gotPassword(const MTPaccount_Password &result) { intro()->setPwdSalt(qba(d.vcurrent_salt)); intro()->setHasRecovery(mtpIsTrue(d.vhas_recovery)); intro()->setPwdHint(qs(d.vhint)); - intro()->onIntroNext(); + intro()->replaceStep(new IntroPwdCheck(intro())); } break; } } -void IntroCode::onSubmitCode(bool force) { - if (!force && (code.text() == sentCode || !code.isEnabled())) return; +void IntroCode::onSubmitCode() { + if (sentRequest) return; code.setDisabled(true); setFocus(); - showError(""); + showError(QString()); checkRequest.start(1000); @@ -336,10 +362,27 @@ void IntroCode::onSubmitCode(bool force) { void IntroCode::onNoTelegramCode() { if (_noTelegramCodeRequestId) return; - _noTelegramCodeRequestId = MTP::send(MTPauth_SendSms(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::noTelegramCodeDone), rpcFail(&IntroCode::noTelegramCodeFail)); + _noTelegramCodeRequestId = MTP::send(MTPauth_ResendCode(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash())), rpcDone(&IntroCode::noTelegramCodeDone), rpcFail(&IntroCode::noTelegramCodeFail)); } -void IntroCode::noTelegramCodeDone(const MTPBool &result) { +void IntroCode::noTelegramCodeDone(const MTPauth_SentCode &result) { + if (result.type() != mtpc_auth_sentCode) { + showError(lang(lng_server_error)); + return; + } + + const MTPDauth_sentCode &d(result.c_auth_sentCode()); + switch (d.vtype.type()) { + case mtpc_auth_sentCodeTypeApp: intro()->setCodeByTelegram(true); + case mtpc_auth_sentCodeTypeSms: + case mtpc_auth_sentCodeTypeCall: intro()->setCodeByTelegram(false); + case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break; + } + if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) { + intro()->setCallStatus({ IntroWidget::CallWaiting, d.has_timeout() ? d.vtimeout.v : 60 }); + } else { + intro()->setCallStatus({ IntroWidget::CallDisabled, 0 }); + } intro()->setCodeByTelegram(false); updateDescText(); } @@ -359,10 +402,6 @@ bool IntroCode::noTelegramCodeFail(const RPCError &error) { return false; } -void IntroCode::onNext() { +void IntroCode::onSubmit() { onSubmitCode(); } - -void IntroCode::onBack() { - intro()->onIntroBack(); -} diff --git a/Telegram/SourceFiles/intro/introcode.h b/Telegram/SourceFiles/intro/introcode.h index 174cb7c2b..8b88ab303 100644 --- a/Telegram/SourceFiles/intro/introcode.h +++ b/Telegram/SourceFiles/intro/introcode.h @@ -23,9 +23,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include #include "gui/flatbutton.h" #include "gui/flatinput.h" -#include "intro.h" +#include "intro/introwidget.h" -class CodeInput : public FlatInput { +class CodeInput final : public FlatInput { Q_OBJECT public: @@ -42,27 +42,25 @@ protected: }; -class IntroCode : public IntroStage, public RPCSender { +class IntroCode final : public IntroStep { Q_OBJECT public: IntroCode(IntroWidget *parent); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; void step_error(float64 ms, bool timer); - void activate(); - void prepareShow(); - void deactivate(); - void onNext(); - void onBack(); - - bool hasBack() const { + bool hasBack() const override { return true; } + void activate() override; + void finished() override; + void cancelled() override; + void onSubmit() override; void codeSubmitDone(const MTPauth_Authorization &result); bool codeSubmitFail(const RPCError &error); @@ -71,7 +69,7 @@ public: public slots: - void onSubmitCode(bool force = false); + void onSubmitCode(); void onNoTelegramCode(); void onInputChange(); void onSendCall(); @@ -80,7 +78,7 @@ public slots: private: void showError(const QString &err); - void callDone(const MTPBool &v); + void callDone(const MTPauth_SentCode &v); void gotPassword(const MTPaccount_Password &result); void stopCheck(); @@ -96,14 +94,14 @@ private: mtpRequestId _noTelegramCodeRequestId; QRect textRect; - void noTelegramCodeDone(const MTPBool &result); + void noTelegramCodeDone(const MTPauth_SentCode &result); bool noTelegramCodeFail(const RPCError &result); CodeInput code; QString sentCode; mtpRequestId sentRequest; QTimer callTimer; - int32 waitTillCall; + IntroWidget::CallStatus callStatus; QTimer checkRequest; }; diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 482e47811..f915ab3a7 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -25,7 +25,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" #include "intro/introphone.h" -#include "intro/intro.h" +#include "intro/introcode.h" namespace { class SignUpLink : public ITextLink { @@ -45,7 +45,7 @@ namespace { }; } -IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent) +IntroPhone::IntroPhone(IntroWidget *parent) : IntroStep(parent) , a_errorAlpha(0) , _a_error(animation(this, &IntroPhone::step_error)) , changed(false) @@ -54,11 +54,11 @@ IntroPhone::IntroPhone(IntroWidget *parent) : IntroStage(parent) , phone(this, st::inpIntroPhone) , code(this, st::inpIntroCountryCode) , _signup(this, lng_phone_notreg(lt_signup_start, textcmdStartLink(1), lt_signup_end, textcmdStopLink()), st::introErrLabel, st::introErrLabelTextStyle) -, _showSignup(false) { +, _showSignup(false) +, sentRequest(0) { setVisible(false); setGeometry(parent->innerRect()); - connect(&next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource))); connect(&next, SIGNAL(clicked()), this, SLOT(onSubmitPhone())); connect(&phone, SIGNAL(voidBackspace(QKeyEvent*)), &code, SLOT(startErasing(QKeyEvent*))); connect(&country, SIGNAL(codeChanged(const QString &)), &code, SLOT(codeSelected(const QString &))); @@ -145,7 +145,7 @@ void IntroPhone::step_error(float64 ms, bool timer) { _a_error.stop(); a_errorAlpha.finish(); if (!a_errorAlpha.current()) { - error = ""; + error.clear(); _signup.hide(); } else if (!error.isEmpty() && _showSignup) { _signup.show(); @@ -164,7 +164,7 @@ void IntroPhone::countryChanged() { void IntroPhone::onInputChange() { changed = true; - showError(""); + showError(QString()); } void IntroPhone::disableAll() { @@ -183,8 +183,8 @@ void IntroPhone::enableAll(bool failed) { if (failed) phone.setFocus(); } -void IntroPhone::onSubmitPhone(bool force) { - if (!force && !next.isEnabled()) return; +void IntroPhone::onSubmitPhone() { + if (sentRequest || isHidden()) return; if (!App::isValidPhone(fullNumber())) { showError(lang(lng_bad_phone)); @@ -193,7 +193,7 @@ void IntroPhone::onSubmitPhone(bool force) { } disableAll(); - showError(""); + showError(QString()); checkRequest.start(1000); @@ -226,45 +226,58 @@ void IntroPhone::phoneCheckDone(const MTPauth_CheckedPhone &result) { const MTPDauth_checkedPhone &d(result.c_auth_checkedPhone()); if (mtpIsTrue(d.vphone_registered)) { disableAll(); - showError(""); + showError(QString()); checkRequest.start(1000); - sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(5), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); + MTPauth_SendCode::Flags flags = 0; + sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } else { showError(lang(lng_bad_phone_noreg), true); enableAll(true); + sentRequest = 0; } } void IntroPhone::phoneSubmitDone(const MTPauth_SentCode &result) { stopCheck(); - enableAll(false); + sentRequest = 0; + enableAll(true); - if (result.type() == mtpc_auth_sentCode) { - const MTPDauth_sentCode &d(result.c_auth_sentCode()); - intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), mtpIsTrue(d.vphone_registered)); - intro()->setCallTimeout(d.vsend_call_timeout.v); - } else if (result.type() == mtpc_auth_sentAppCode) { - const MTPDauth_sentAppCode &d(result.c_auth_sentAppCode()); - intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), mtpIsTrue(d.vphone_registered)); - intro()->setCallTimeout(d.vsend_call_timeout.v); - intro()->setCodeByTelegram(true); + if (result.type() != mtpc_auth_sentCode) { + showError(lang(lng_server_error)); + return; } - intro()->onIntroNext(); + + const MTPDauth_sentCode &d(result.c_auth_sentCode()); + switch (d.vtype.type()) { + case mtpc_auth_sentCodeTypeApp: intro()->setCodeByTelegram(true); break; + case mtpc_auth_sentCodeTypeSms: + case mtpc_auth_sentCodeTypeCall: intro()->setCodeByTelegram(false); break; + case mtpc_auth_sentCodeTypeFlashCall: LOG(("Error: should not be flashcall!")); break; + } + intro()->setPhone(sentPhone, d.vphone_code_hash.c_string().v.c_str(), d.is_phone_registered()); + if (d.has_next_type() && d.vnext_type.type() == mtpc_auth_codeTypeCall) { + intro()->setCallStatus({ IntroWidget::CallWaiting, d.has_timeout() ? d.vtimeout.v : 60 }); + } else { + intro()->setCallStatus({ IntroWidget::CallDisabled, 0 }); + } + intro()->nextStep(new IntroCode(intro())); } void IntroPhone::toSignUp() { disableAll(); - showError(""); + showError(QString()); checkRequest.start(1000); - sentRequest = MTP::send(MTPauth_SendCode(MTP_string(sentPhone), MTP_int(0), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); + MTPauth_SendCode::Flags flags = 0; + sentRequest = MTP::send(MTPauth_SendCode(MTP_flags(flags), MTP_string(sentPhone), MTPBool(), MTP_int(ApiId), MTP_string(ApiHash), MTP_string(Sandbox::LangSystemISO())), rpcDone(&IntroPhone::phoneSubmitDone), rpcFail(&IntroPhone::phoneSubmitFail)); } bool IntroPhone::phoneSubmitFail(const RPCError &error) { stopCheck(); + sentRequest = 0; const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID") { // show error showError(lang(lng_bad_phone)); @@ -293,21 +306,27 @@ void IntroPhone::selectCountry(const QString &c) { } void IntroPhone::activate() { - error = ""; + IntroStep::activate(); + phone.setFocus(); +} + +void IntroPhone::finished() { + IntroStep::finished(); + checkRequest.stop(); + rpcClear(); + + error.clear(); a_errorAlpha = anim::fvalue(0); - show(); enableAll(true); } -void IntroPhone::deactivate() { - checkRequest.stop(); - hide(); - phone.clearFocus(); +void IntroPhone::cancelled() { + if (sentRequest) { + MTP::cancel(sentRequest); + sentRequest = 0; + } } -void IntroPhone::onNext() { +void IntroPhone::onSubmit() { onSubmitPhone(); } - -void IntroPhone::onBack() { -} diff --git a/Telegram/SourceFiles/intro/introphone.h b/Telegram/SourceFiles/intro/introphone.h index 3a4357112..d129b05f8 100644 --- a/Telegram/SourceFiles/intro/introphone.h +++ b/Telegram/SourceFiles/intro/introphone.h @@ -23,26 +23,26 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include #include "gui/flatbutton.h" #include "gui/countryinput.h" -#include "intro.h" +#include "intro/introwidget.h" -class IntroPhone : public IntroStage, public RPCSender { +class IntroPhone final : public IntroStep { Q_OBJECT public: IntroPhone(IntroWidget *parent); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; void step_error(float64 ms, bool timer); void selectCountry(const QString &country); - void activate(); - void deactivate(); - void onNext(); - void onBack(); + void activate() override; + void finished() override; + void cancelled() override; + void onSubmit() override; void phoneCheckDone(const MTPauth_CheckedPhone &result); void phoneSubmitDone(const MTPauth_SentCode &result); @@ -54,7 +54,7 @@ public slots: void countryChanged(); void onInputChange(); - void onSubmitPhone(bool force = false); + void onSubmitPhone(); void onCheckRequest(); private: diff --git a/Telegram/SourceFiles/intro/intropwdcheck.cpp b/Telegram/SourceFiles/intro/intropwdcheck.cpp index 9e4ba5acd..da5927ec8 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.cpp +++ b/Telegram/SourceFiles/intro/intropwdcheck.cpp @@ -19,6 +19,8 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" +#include "intro/intropwdcheck.h" + #include "lang.h" #include "style.h" @@ -27,10 +29,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" -#include "intro/intropwdcheck.h" -#include "intro/intro.h" +#include "intro/introsignup.h" -IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStage(parent) +IntroPwdCheck::IntroPwdCheck(IntroWidget *parent) : IntroStep(parent) , a_errorAlpha(0) , _a_error(animation(this, &IntroPwdCheck::step_error)) , _next(this, lang(lng_intro_submit), st::btnIntroNext) @@ -130,7 +131,7 @@ void IntroPwdCheck::step_error(float64 ms, bool timer) { _a_error.stop(); a_errorAlpha.finish(); if (!a_errorAlpha.current()) { - error = ""; + error.clear(); } } else { a_errorAlpha.update(dt, st::introErrFunc); @@ -139,7 +140,7 @@ void IntroPwdCheck::step_error(float64 ms, bool timer) { } void IntroPwdCheck::activate() { - show(); + IntroStep::activate(); if (_pwdField.isHidden()) { _codeField.setFocus(); } else { @@ -147,8 +148,11 @@ void IntroPwdCheck::activate() { } } -void IntroPwdCheck::deactivate() { - hide(); +void IntroPwdCheck::cancelled() { + if (sentRequest) { + MTP::cancel(sentRequest); + sentRequest = 0; + } } void IntroPwdCheck::stopCheck() { @@ -202,7 +206,7 @@ bool IntroPwdCheck::pwdSubmitFail(const RPCError &error) { _pwdField.notaBene(); return true; } else if (err == "PASSWORD_EMPTY") { - intro()->onIntroBack(); + intro()->onBack(); } else if (mtpIsFlood(error)) { showError(lang(lng_flood_error)); _pwdField.notaBene(); @@ -224,7 +228,7 @@ bool IntroPwdCheck::codeSubmitFail(const RPCError &error) { _codeField.setDisabled(false); const QString &err = error.type(); if (err == "PASSWORD_EMPTY") { - intro()->onIntroBack(); + intro()->onBack(); return true; } else if (err == "PASSWORD_RECOVERY_NA") { recoverStartFail(error); @@ -265,7 +269,7 @@ bool IntroPwdCheck::recoverStartFail(const RPCError &error) { _codeField.hide(); _pwdField.setFocus(); update(); - showError(""); + showError(QString()); return true; } @@ -275,7 +279,7 @@ void IntroPwdCheck::onToRecover() { MTP::cancel(sentRequest); sentRequest = 0; } - showError(""); + showError(QString()); _toRecover.hide(); _toPassword.show(); _pwdField.hide(); @@ -335,11 +339,11 @@ bool IntroPwdCheck::deleteFail(const RPCError &error) { void IntroPwdCheck::deleteDone(const MTPBool &v) { Ui::hideLayer(); - intro()->onIntroNext(); + intro()->replaceStep(new IntroSignup(intro())); } void IntroPwdCheck::onInputChange() { - showError(""); + showError(QString()); } void IntroPwdCheck::onSubmitPwd(bool force) { @@ -359,7 +363,7 @@ void IntroPwdCheck::onSubmitPwd(bool force) { _pwdField.setDisabled(true); setFocus(); - showError(""); + showError(QString()); QByteArray pwdData = _salt + _pwdField.text().toUtf8() + _salt, pwdHash(32, Qt::Uninitialized); hashSha256(pwdData.constData(), pwdData.size(), pwdHash.data()); @@ -367,9 +371,6 @@ void IntroPwdCheck::onSubmitPwd(bool force) { } } -void IntroPwdCheck::onNext() { +void IntroPwdCheck::onSubmit() { onSubmitPwd(); } - -void IntroPwdCheck::onBack() { -} diff --git a/Telegram/SourceFiles/intro/intropwdcheck.h b/Telegram/SourceFiles/intro/intropwdcheck.h index 9a0d1c1f6..43e4b3953 100644 --- a/Telegram/SourceFiles/intro/intropwdcheck.h +++ b/Telegram/SourceFiles/intro/intropwdcheck.h @@ -23,24 +23,23 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include #include "gui/flatbutton.h" #include "gui/flatinput.h" -#include "intro.h" +#include "intro/introwidget.h" -class IntroPwdCheck final : public IntroStage, public RPCSender { +class IntroPwdCheck final : public IntroStep { Q_OBJECT public: IntroPwdCheck(IntroWidget *parent); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; void step_error(float64 ms, bool timer); - void activate(); - void deactivate(); - void onNext(); - void onBack(); + void activate() override; + void cancelled() override; + void onSubmit() override; void pwdSubmitDone(bool recover, const MTPauth_Authorization &result); bool pwdSubmitFail(const RPCError &error); diff --git a/Telegram/SourceFiles/intro/introsignup.cpp b/Telegram/SourceFiles/intro/introsignup.cpp index 78d01ffb6..590231727 100644 --- a/Telegram/SourceFiles/intro/introsignup.cpp +++ b/Telegram/SourceFiles/intro/introsignup.cpp @@ -28,9 +28,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" #include "intro/introsignup.h" -#include "intro/intro.h" -IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent) +IntroSignup::IntroSignup(IntroWidget *parent) : IntroStep(parent) , a_errorAlpha(0) , a_photoOver(0) , _a_error(animation(this, &IntroSignup::step_error)) @@ -38,6 +37,7 @@ IntroSignup::IntroSignup(IntroWidget *parent) : IntroStage(parent) , next(this, lang(lng_intro_finish), st::btnIntroNext) , first(this, st::inpIntroName, lang(lng_signup_firstname)) , last(this, st::inpIntroName, lang(lng_signup_lastname)) +, sentRequest(0) , _invertOrder(langFirstNameGoesSecond()) { setVisible(false); setGeometry(parent->innerRect()); @@ -180,7 +180,7 @@ void IntroSignup::step_error(float64 ms, bool timer) { _a_error.stop(); a_errorAlpha.finish(); if (!a_errorAlpha.current()) { - error = ""; + error.clear(); } } else { a_errorAlpha.update(dt, st::introErrFunc); @@ -201,7 +201,7 @@ void IntroSignup::step_photo(float64 ms, bool timer) { } void IntroSignup::activate() { - show(); + IntroStep::activate(); if (_invertOrder) { last.setFocus(); } else { @@ -209,8 +209,11 @@ void IntroSignup::activate() { } } -void IntroSignup::deactivate() { - hide(); +void IntroSignup::cancelled() { + if (sentRequest) { + MTP::cancel(sentRequest); + sentRequest = 0; + } } void IntroSignup::stopCheck() { @@ -264,7 +267,7 @@ bool IntroSignup::nameSubmitFail(const RPCError &error) { last.setDisabled(false); const QString &err = error.type(); if (err == "PHONE_NUMBER_INVALID" || err == "PHONE_CODE_EXPIRED" || err == "PHONE_CODE_EMPTY" || err == "PHONE_CODE_INVALID" || err == "PHONE_NUMBER_OCCUPIED") { - intro()->onIntroBack(); + intro()->onBack(); return true; } else if (err == "FIRSTNAME_INVALID") { showError(lang(lng_bad_name)); @@ -297,7 +300,7 @@ bool IntroSignup::nameSubmitFail(const RPCError &error) { } void IntroSignup::onInputChange() { - showError(""); + showError(QString()); } void IntroSignup::onSubmitName(bool force) { @@ -324,16 +327,13 @@ void IntroSignup::onSubmitName(bool force) { last.setDisabled(true); setFocus(); - showError(""); + showError(QString()); firstName = first.text().trimmed(); lastName = last.text().trimmed(); sentRequest = MTP::send(MTPauth_SignUp(MTP_string(intro()->getPhone()), MTP_string(intro()->getPhoneHash()), MTP_string(intro()->getCode()), MTP_string(firstName), MTP_string(lastName)), rpcDone(&IntroSignup::nameSubmitDone), rpcFail(&IntroSignup::nameSubmitFail)); } -void IntroSignup::onNext() { +void IntroSignup::onSubmit() { onSubmitName(); } - -void IntroSignup::onBack() { -} diff --git a/Telegram/SourceFiles/intro/introsignup.h b/Telegram/SourceFiles/intro/introsignup.h index 4a9f7df3e..c7be7d7fe 100644 --- a/Telegram/SourceFiles/intro/introsignup.h +++ b/Telegram/SourceFiles/intro/introsignup.h @@ -23,27 +23,26 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include #include "gui/flatbutton.h" #include "gui/flatinput.h" -#include "intro.h" +#include "intro/introwidget.h" -class IntroSignup : public IntroStage, public RPCSender { +class IntroSignup final : public IntroStep { Q_OBJECT public: IntroSignup(IntroWidget *parent); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void mousePressEvent(QMouseEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; + void mouseMoveEvent(QMouseEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; void step_error(float64 ms, bool timer); void step_photo(float64 ms, bool timer); - void activate(); - void deactivate(); - void onNext(); - void onBack(); + void activate() override; + void cancelled() override; + void onSubmit() override; void nameSubmitDone(const MTPauth_Authorization &result); bool nameSubmitFail(const RPCError &error); diff --git a/Telegram/SourceFiles/intro/introsteps.cpp b/Telegram/SourceFiles/intro/introstart.cpp similarity index 77% rename from Telegram/SourceFiles/intro/introsteps.cpp rename to Telegram/SourceFiles/intro/introstart.cpp index d55c7ccad..fa900a45e 100644 --- a/Telegram/SourceFiles/intro/introsteps.cpp +++ b/Telegram/SourceFiles/intro/introstart.cpp @@ -24,16 +24,15 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "application.h" -#include "intro/introsteps.h" -#include "intro/intro.h" +#include "intro/introstart.h" +#include "intro/introphone.h" #include "langloaderplain.h" -IntroSteps::IntroSteps(IntroWidget *parent) : IntroStage(parent), -_intro(this, lang(lng_intro), st::introLabel, st::introLabelTextStyle), -_changeLang(this, QString()), -_next(this, lang(lng_start_msgs), st::btnIntroNext) { - +IntroStart::IntroStart(IntroWidget *parent) : IntroStep(parent) +, _intro(this, lang(lng_intro), st::introLabel, st::introLabelTextStyle) +, _changeLang(this, QString()) +, _next(this, lang(lng_start_msgs), st::btnIntroNext) { _changeLang.hide(); if (cLang() == languageDefault) { int32 l = Sandbox::LangSystem(); @@ -56,15 +55,14 @@ _next(this, lang(lng_start_msgs), st::btnIntroNext) { setGeometry(parent->innerRect()); - connect(&_next, SIGNAL(stateChanged(int, ButtonStateChangeSource)), parent, SLOT(onDoneStateChanged(int, ButtonStateChangeSource))); - connect(&_next, SIGNAL(clicked()), parent, SLOT(onIntroNext())); + connect(&_next, SIGNAL(clicked()), parent, SLOT(onStepSubmit())); connect(&_changeLang, SIGNAL(clicked()), parent, SLOT(onChangeLang())); setMouseTracking(true); } -void IntroSteps::paintEvent(QPaintEvent *e) { +void IntroStart::paintEvent(QPaintEvent *e) { bool trivial = (rect() == e->rect()); QPainter p(this); @@ -80,7 +78,7 @@ void IntroSteps::paintEvent(QPaintEvent *e) { p.drawPixmap(QPoint((width() - st::aboutIcon.pxWidth()) / 2, hy - st::introIconSkip - st::aboutIcon.pxHeight()), App::sprite(), st::aboutIcon); } -void IntroSteps::resizeEvent(QResizeEvent *e) { +void IntroStart::resizeEvent(QResizeEvent *e) { if (e->oldSize().width() != width()) { _next.move((width() - _next.width()) / 2, st::introBtnTop); _intro.move((width() - _intro.width()) / 2, _next.y() - _intro.height() - st::introSkip); @@ -88,17 +86,6 @@ void IntroSteps::resizeEvent(QResizeEvent *e) { } } -void IntroSteps::activate() { - show(); -} - -void IntroSteps::deactivate() { - hide(); -} - -void IntroSteps::onNext() { - intro()->onIntroNext(); -} - -void IntroSteps::onBack() { +void IntroStart::onSubmit() { + intro()->nextStep(new IntroPhone(intro())); } diff --git a/Telegram/SourceFiles/intro/introsteps.h b/Telegram/SourceFiles/intro/introstart.h similarity index 79% rename from Telegram/SourceFiles/intro/introsteps.h rename to Telegram/SourceFiles/intro/introstart.h index e554f11fb..8bd86075d 100644 --- a/Telegram/SourceFiles/intro/introsteps.h +++ b/Telegram/SourceFiles/intro/introstart.h @@ -20,21 +20,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -#include "gui/flatbutton.h" -#include "intro.h" +#include "intro/introwidget.h" -class IntroSteps : public IntroStage { +class IntroStart final : public IntroStep { public: - IntroSteps(IntroWidget *parent); + IntroStart(IntroWidget *parent); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; - void activate(); - void deactivate(); - void onNext(); - void onBack(); + void onSubmit() override; private: diff --git a/Telegram/SourceFiles/intro/intro.cpp b/Telegram/SourceFiles/intro/introwidget.cpp similarity index 68% rename from Telegram/SourceFiles/intro/intro.cpp rename to Telegram/SourceFiles/intro/introwidget.cpp index ec2c1bafd..8c7055b86 100644 --- a/Telegram/SourceFiles/intro/intro.cpp +++ b/Telegram/SourceFiles/intro/introwidget.cpp @@ -24,8 +24,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "localstorage.h" -#include "intro/intro.h" -#include "intro/introsteps.h" +#include "intro/introwidget.h" +#include "intro/introstart.h" #include "intro/introphone.h" #include "intro/introcode.h" #include "intro/introsignup.h" @@ -52,20 +52,13 @@ namespace { } } -IntroWidget::IntroWidget(Window *window) : TWidget(window) +IntroWidget::IntroWidget(QWidget *parent) : TWidget(parent) , _langChangeTo(0) , _a_stage(animation(this, &IntroWidget::step_stage)) , _cacheHideIndex(0) , _cacheShowIndex(0) , _a_show(animation(this, &IntroWidget::step_show)) -, steps(new IntroSteps(this)) -, phone(0) -, code(0) -, signup(0) -, pwdcheck(0) -, current(0) -, moving(0) -, _callTimeout(60) +, _callStatus({ CallDisabled, 0 }) , _registered(false) , _hasRecovery(false) , _codeByTelegram(false) @@ -74,7 +67,7 @@ IntroWidget::IntroWidget(Window *window) : TWidget(window) , _backTo(0) { setGeometry(QRect(0, st::titleHeight, App::wnd()->width(), App::wnd()->height() - st::titleHeight)); - connect(&_back, SIGNAL(clicked()), this, SLOT(onIntroBack())); + connect(&_back, SIGNAL(clicked()), this, SLOT(onBack())); _back.hide(); countryForReg = psCurrentCountry(); @@ -82,11 +75,10 @@ IntroWidget::IntroWidget(Window *window) : TWidget(window) MTP::send(MTPhelp_GetNearestDc(), rpcDone(gotNearestDC)); signalEmitOn = this; - stages[0] = steps; - memset(stages + 1, 0, sizeof(QWidget*) * 3); + _stepHistory.push_back(new IntroStart(this)); _back.raise(); - connect(window, SIGNAL(resized(const QSize&)), this, SLOT(onParentResize(const QSize&))); + connect(parent, SIGNAL(resized(const QSize&)), this, SLOT(onParentResize(const QSize&))); show(); setFocus(); @@ -112,92 +104,77 @@ void IntroWidget::onParentResize(const QSize &newSize) { resize(newSize); } -void IntroWidget::onIntroBack() { - if (!current) return; - moving = (current == 4) ? -2 : -1; - prepareMove(); +void IntroWidget::onStepSubmit() { + step()->onSubmit(); } -void IntroWidget::onIntroNext() { - if (!createNext()) return; - moving = 1; - prepareMove(); +void IntroWidget::onBack() { + historyMove(MoveBack); } -bool IntroWidget::createNext() { - if (current == sizeof(stages) / sizeof(stages[0]) - 1) return false; - if (!stages[current + 1]) { - switch (current) { - case 0: stages[current + 1] = phone = new IntroPhone(this); break; - case 1: stages[current + 1] = code = new IntroCode(this); break; - case 2: - if (_pwdSalt.isEmpty()) { - if (signup) delete signup; - stages[current + 1] = signup = new IntroSignup(this); - } else { - stages[current + 1] = pwdcheck = new IntroPwdCheck(this); - } - break; - case 3: stages[current + 1] = signup = new IntroSignup(this); break; - } - } - _back.raise(); - return true; -} +void IntroWidget::historyMove(MoveType type) { + if (_a_stage.animating()) return; + + t_assert(_stepHistory.size() > 1); -void IntroWidget::prepareMove() { if (App::app()) App::app()->mtpPause(); - if (_cacheHide.isNull() || _cacheHideIndex != current) makeHideCache(); + switch (type) { + case MoveBack: { + _cacheHide = grabStep(); - stages[current + moving]->prepareShow(); - if (_cacheShow.isNull() || _cacheShowIndex != current + moving) makeShowCache(); + IntroStep *back = step(); + _backFrom = back->hasBack() ? 1 : 0; + _stepHistory.pop_back(); + back->cancelled(); + delete back; + } break; - int32 m = (moving > 0) ? 1 : -1; + case MoveForward: { + _cacheHide = grabStep(1); + _backFrom = step(1)->hasBack() ? 1 : 0; + step(1)->finished(); + } break; + + case MoveReplace: { + _cacheHide = grabStep(1); + IntroStep *replaced = step(1); + _backFrom = replaced->hasBack() ? 1 : 0; + _stepHistory.removeAt(_stepHistory.size() - 2); + replaced->finished(); + delete replaced; + } break; + } + + _cacheShow = grabStep(); + _backTo = step()->hasBack() ? 1 : 0; + + int32 m = (type == MoveBack) ? -1 : 1; a_coordHide = anim::ivalue(0, -m * st::introSlideShift); a_opacityHide = anim::fvalue(1, 0); a_coordShow = anim::ivalue(m * st::introSlideShift, 0); a_opacityShow = anim::fvalue(0, 1); _a_stage.start(); - _backTo = stages[current + moving]->hasBack() ? 1 : 0; - _backFrom = stages[current]->hasBack() ? 1 : 0; _a_stage.step(); if (_backFrom > 0 || _backTo > 0) { _back.show(); } else { _back.hide(); } - stages[current]->deactivate(); - stages[current + moving]->hide(); + step()->hide(); } -void IntroWidget::onDoneStateChanged(int oldState, ButtonStateChangeSource source) { - if (_a_stage.animating()) return; - if (source == ButtonByPress) { - if (oldState & Button::StateDown) { - _cacheHide = QPixmap(); - } else { - makeHideCache(); - } - } else if (source == ButtonByHover && current != 2) { - if (!createNext()) return; - if (!_cacheShow) makeShowCache(current + 1); - } +void IntroWidget::pushStep(IntroStep *step, MoveType type) { + _stepHistory.push_back(step); + _back.raise(); + _stepHistory.back()->hide(); + + historyMove(type); } -void IntroWidget::makeHideCache(int stage) { - if (stage < 0) stage = current; - int w = st::introSize.width(), h = st::introSize.height(); - _cacheHide = myGrab(stages[stage], QRect(st::introSlideShift, 0, w, h)); - _cacheHideIndex = stage; -} - -void IntroWidget::makeShowCache(int stage) { - if (stage < 0) stage = current + moving; - int w = st::introSize.width(), h = st::introSize.height(); - _cacheShow = myGrab(stages[stage], QRect(st::introSlideShift, 0, w, h)); - _cacheShowIndex = stage; +QPixmap IntroWidget::grabStep(int skip) { + return myGrab(step(skip), QRect(st::introSlideShift, 0, st::introSize.width(), st::introSize.height())); } void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) { @@ -206,8 +183,8 @@ void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) { (back ? _cacheOver : _cacheUnder) = bgAnimCache; _a_show.stop(); - stages[current]->show(); - if (stages[current]->hasBack()) { + step()->show(); + if (step()->hasBack()) { _back.setOpacity(1); _back.show(); } else { @@ -215,8 +192,7 @@ void IntroWidget::animShow(const QPixmap &bgAnimCache, bool back) { } (back ? _cacheUnder : _cacheOver) = myGrab(this); - stages[current]->deactivate(); - stages[current]->hide(); + step()->hide(); _back.hide(); a_coordUnder = back ? anim::ivalue(-qFloor(st::slideShift * width()), 0) : anim::ivalue(0, -qFloor(st::slideShift * width())); @@ -239,9 +215,8 @@ void IntroWidget::step_show(float64 ms, bool timer) { _cacheUnder = _cacheOver = QPixmap(); setFocus(); - stages[current]->show(); - stages[current]->activate(); - if (stages[current]->hasBack()) { + step()->activate(); + if (step()->hasBack()) { _back.setOpacity(1); _back.show(); } @@ -269,11 +244,9 @@ void IntroWidget::step_stage(float64 ms, bool timer) { _cacheHide = _cacheShow = QPixmap(); - current += moving; - moving = 0; setFocus(); - stages[current]->activate(); - if (!stages[current]->hasBack()) { + step()->activate(); + if (!step()->hasBack()) { _back.hide(); } if (App::app()) App::app()->mtpUnpause(); @@ -312,9 +285,9 @@ void IntroWidget::paintEvent(QPaintEvent *e) { p.drawPixmap(QRect(a_coordOver.current() - st::slideShadow.pxWidth(), 0, st::slideShadow.pxWidth(), height()), App::sprite(), st::slideShadow); } else if (_a_stage.animating()) { p.setOpacity(a_opacityHide.current()); - p.drawPixmap(stages[current]->x() + st::introSlideShift + a_coordHide.current(), stages[current]->y(), _cacheHide); + p.drawPixmap(step()->x() + st::introSlideShift + a_coordHide.current(), step()->y(), _cacheHide); p.setOpacity(a_opacityShow.current()); - p.drawPixmap(stages[current + moving]->x() + st::introSlideShift + a_coordShow.current(), stages[current + moving]->y(), _cacheShow); + p.drawPixmap(step()->x() + st::introSlideShift + a_coordShow.current(), step()->y(), _cacheShow); } } @@ -339,11 +312,6 @@ void IntroWidget::setCode(const QString &code) { void IntroWidget::setPwdSalt(const QByteArray &salt) { _pwdSalt = salt; - delete signup; - delete pwdcheck; - stages[3] = stages[4] = 0; - signup = 0; - pwdcheck = 0; } void IntroWidget::setHasRecovery(bool has) { @@ -356,11 +324,10 @@ void IntroWidget::setPwdHint(const QString &hint) { void IntroWidget::setCodeByTelegram(bool byTelegram) { _codeByTelegram = byTelegram; - if (code) code->updateDescText(); } -void IntroWidget::setCallTimeout(int32 callTimeout) { - _callTimeout = callTimeout; +void IntroWidget::setCallStatus(const CallStatus &status) { + _callStatus = status; } const QString &IntroWidget::getPhone() const { @@ -375,8 +342,8 @@ const QString &IntroWidget::getCode() const { return _code; } -int32 IntroWidget::getCallTimeout() const { - return _callTimeout; +const IntroWidget::CallStatus &IntroWidget::getCallStatus() const { + return _callStatus; } const QByteArray &IntroWidget::getPwdSalt() const { @@ -397,15 +364,9 @@ bool IntroWidget::codeByTelegram() const { void IntroWidget::resizeEvent(QResizeEvent *e) { QRect r(innerRect()); - if (steps) steps->setGeometry(r); - if (phone) phone->setGeometry(r); - if (code) code->setGeometry(r); - if (signup) signup->setGeometry(r); - if (pwdcheck) pwdcheck->setGeometry(r); -} - -void IntroWidget::mousePressEvent(QMouseEvent *e) { - + for (IntroStep *step : _stepHistory) { + step->setGeometry(r); + } } void IntroWidget::finish(const MTPUser &user, const QImage &photo) { @@ -419,9 +380,11 @@ void IntroWidget::keyPressEvent(QKeyEvent *e) { if (_a_show.animating() || _a_stage.animating()) return; if (e->key() == Qt::Key_Escape) { - stages[current]->onBack(); + if (step()->hasBack()) { + onBack(); + } } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return || e->key() == Qt::Key_Space) { - stages[current]->onNext(); + onStepSubmit(); } } @@ -429,17 +392,16 @@ void IntroWidget::updateAdaptiveLayout() { } void IntroWidget::rpcClear() { - if (phone) phone->rpcClear(); - if (code) code->rpcClear(); - if (signup) signup->rpcClear(); - if (pwdcheck) pwdcheck->rpcClear(); + for (IntroStep *step : _stepHistory) { + step->rpcClear(); + } } IntroWidget::~IntroWidget() { - delete steps; - delete phone; - delete code; - delete signup; - delete pwdcheck; + while (!_stepHistory.isEmpty()) { + IntroStep *back = _stepHistory.back(); + _stepHistory.pop_back(); + delete back; + } if (App::wnd()) App::wnd()->noIntro(this); } diff --git a/Telegram/SourceFiles/intro/intro.h b/Telegram/SourceFiles/intro/introwidget.h similarity index 65% rename from Telegram/SourceFiles/intro/intro.h rename to Telegram/SourceFiles/intro/introwidget.h index bec0f7eb0..7aafd5593 100644 --- a/Telegram/SourceFiles/intro/intro.h +++ b/Telegram/SourceFiles/intro/introwidget.h @@ -20,26 +20,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -class Window; -class IntroSteps; -class IntroPhone; -class IntroCode; -class IntroSignup; -class IntroPwdCheck; -class IntroStage; -class Text; - +class IntroStep; class IntroWidget final : public TWidget { Q_OBJECT public: - IntroWidget(Window *window); + IntroWidget(QWidget *window); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *e); - void mousePressEvent(QMouseEvent *e); - void keyPressEvent(QKeyEvent *e); + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; + void keyPressEvent(QKeyEvent *e) override; void updateAdaptiveLayout(); @@ -52,9 +43,19 @@ public: QRect innerRect() const; QString currentCountry() const; + enum CallStatusType { + CallWaiting, + CallCalling, + CallCalled, + CallDisabled, + }; + struct CallStatus { + CallStatusType type; + int timeout; + }; void setPhone(const QString &phone, const QString &phone_hash, bool registered); void setCode(const QString &code); - void setCallTimeout(int32 callTimeout); + void setCallStatus(const CallStatus &status); void setPwdSalt(const QByteArray &salt); void setHasRecovery(bool hasRecovery); void setPwdHint(const QString &hint); @@ -63,7 +64,7 @@ public: const QString &getPhone() const; const QString &getPhoneHash() const; const QString &getCode() const; - int32 getCallTimeout() const; + const CallStatus &getCallStatus() const; const QByteArray &getPwdSalt() const; bool getHasRecovery() const; const QString &getPwdHint() const; @@ -74,13 +75,19 @@ public: void rpcClear(); void langChangeTo(int32 langId); - ~IntroWidget(); + void nextStep(IntroStep *step) { + pushStep(step, MoveForward); + } + void replaceStep(IntroStep *step) { + pushStep(step, MoveReplace); + } + + ~IntroWidget() override; public slots: - void onIntroNext(); - void onIntroBack(); - void onDoneStateChanged(int oldState, ButtonStateChangeSource source); + void onStepSubmit(); + void onBack(); void onParentResize(const QSize &newSize); void onChangeLang(); @@ -90,12 +97,9 @@ signals: private: - void makeHideCache(int stage = -1); - void makeShowCache(int stage = -1); - void prepareMove(); - bool createNext(); + QPixmap grabStep(int skip = 0); - int32 _langChangeTo; + int _langChangeTo; Animation _a_stage; QPixmap _cacheHide, _cacheShow; @@ -108,16 +112,21 @@ private: anim::ivalue a_coordUnder, a_coordOver; anim::fvalue a_shadow; - IntroSteps *steps; - IntroPhone *phone; - IntroCode *code; - IntroSignup *signup; - IntroPwdCheck *pwdcheck; - IntroStage *stages[5]; - int current, moving; + QVector _stepHistory; + IntroStep *step(int skip = 0) { + t_assert(_stepHistory.size() + skip > 0); + return _stepHistory.at(_stepHistory.size() - skip - 1); + } + enum MoveType { + MoveBack, + MoveForward, + MoveReplace, + }; + void historyMove(MoveType type); + void pushStep(IntroStep *step, MoveType type); QString _phone, _phone_hash; - int32 _callTimeout; + CallStatus _callStatus; bool _registered; QString _code; @@ -133,26 +142,31 @@ private: }; -class IntroStage : public TWidget { +class IntroStep : public TWidget, public RPCSender { public: - IntroStage(IntroWidget *parent) : TWidget(parent) { + IntroStep(IntroWidget *parent) : TWidget(parent) { } - virtual void activate() = 0; // show and activate - virtual void prepareShow() { - } - virtual void deactivate() = 0; // deactivate and hide - virtual void onNext() = 0; - virtual void onBack() = 0; virtual bool hasBack() const { return false; } + virtual void activate() { + show(); + } + virtual void cancelled() { + } + virtual void finished() { + hide(); + } + virtual void onSubmit() = 0; protected: IntroWidget *intro() { - return qobject_cast(parent()); + IntroWidget *result = qobject_cast(parentWidget()); + t_assert(result != nullptr); + return result; } }; diff --git a/Telegram/SourceFiles/langs/lang_de.strings b/Telegram/SourceFiles/langs/lang_de.strings index 3e247d1c5..a89dc41e8 100644 --- a/Telegram/SourceFiles/langs/lang_de.strings +++ b/Telegram/SourceFiles/langs/lang_de.strings @@ -87,7 +87,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_continue" = "Weiter"; "lng_close" = "Schließen"; "lng_connecting" = "Verbinde..."; -"lng_reconnecting" = "Neu verbinden {count:jetzt|in # s|in # s}.."; +"lng_reconnecting" = "Neu verbinden {count:jetzt|in # s|in # s}..."; "lng_reconnecting_try_now" = "Jetzt versuchen"; "lng_status_service_notifications" = "Servicemeldungen"; @@ -108,7 +108,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_status_lastseen_date" = "zuletzt gesehen am {date}"; "lng_status_lastseen_date_time" = "zuletzt gesehen am {date} um {time}"; "lng_status_online" = "online"; -"lng_status_connecting" = "verbinden.."; +"lng_status_connecting" = "verbinden..."; "lng_chat_status_unaccessible" = "Gruppe ist nicht verfügbar"; "lng_chat_status_members" = "{count:keine Mitglieder|# Mitglied|# Mitglieder}"; @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "Diese Nachricht wurde gelöscht"; "lng_edit_too_long" = "Der Text ist leider zu lang"; "lng_edit_message" = "Nachricht bearbeiten"; -"lng_edit_message_text" = "Neuer Text.."; +"lng_edit_message_text" = "Neuer Text..."; "lng_deleted" = "Gelöschter Kontakt"; "lng_deleted_message" = "Gelöschte Nachricht"; "lng_pinned_message" = "Angeheftete Nachricht"; @@ -162,7 +162,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_code_telegram" = "Bitte den Code eingeben, den du in der\nzuvor benutzen [b]Telegram[/b]-App erhalten hast."; "lng_code_no_telegram" = "Code per SMS senden"; "lng_code_call" = "Telegram ruft dich an in {minutes}:{seconds}"; -"lng_code_calling" = "Telegram ruft dich an.."; +"lng_code_calling" = "Telegram ruft dich an..."; "lng_code_called" = "Telegram ruft dich gerade an."; "lng_bad_phone" = "Falsche Nummer, bitte erneut versuchen."; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "Kanalname"; "lng_no_contacts" = "Du hast keine Kontakte"; "lng_no_chats" = "Noch keine Chats"; -"lng_contacts_loading" = "Lade.."; +"lng_contacts_loading" = "Lade..."; "lng_contacts_not_found" = "Keine Kontakte gefunden"; "lng_dlg_search_chat" = "In diesem Chat suchen"; "lng_dlg_search_channel" = "In diesem Kanal suchen"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Speichern"; "lng_settings_upload" = "Profilbild festlegen"; "lng_settings_crop_profile" = "Sichtbaren Bereich für Bild wählen"; -"lng_settings_uploading_photo" = "Bild wird geladen.."; +"lng_settings_uploading_photo" = "Bild wird geladen..."; "lng_username_title" = "Benutzername"; "lng_username_about" = "Wähle einen (optionalen) öffentlichen \nBenutzernamen, wenn du von anderen \ngefunden werden willst, ohne, dass sie \ndeine Nummer kennen müssen.\n\nErlaubt sind a-z, 0-9 und Unterstriche. \nDie Mindestlänge beträgt 5 Zeichen."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "Auto-Updates"; "lng_settings_current_version" = "Version {version}"; "lng_settings_check_now" = "Auf Updates prüfen"; -"lng_settings_update_checking" = "Prüfe auf Updates.."; +"lng_settings_update_checking" = "Prüfe auf Updates..."; "lng_settings_latest_installed" = "Aktuellste Version bereits installiert"; -"lng_settings_downloading" = "Update wird geladen {ready} / {total} MB.."; +"lng_settings_downloading" = "Update wird geladen {ready} / {total} MB..."; "lng_settings_update_ready" = "Neue Version kann installiert werden"; "lng_settings_update_now" = "Jetzt neustarten"; "lng_settings_update_fail" = "Konnte nicht auf Updates prüfen :("; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "Download konnte nicht gestartet werden. Das kann am eingestellten Speicherort liegen.\n\nDu kannst den Speicherort in den Einstellungen ändern."; "lng_download_path_settings" = "Einstellungen"; "lng_download_finish_failed" = "Datei konnte nicht geladen werden.\n\nErneut versuchen?"; -"lng_download_path_clearing" = "Leeren.."; +"lng_download_path_clearing" = "Leeren..."; "lng_download_path_cleared" = "Geleert!"; "lng_download_path_clear_failed" = "Ein Fehler ist aufgetreten :("; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|# Bild|# Bilder}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# Sprachnachricht|# Sprachnachrichten}, {size}"; "lng_local_storage_clear" = "Leeren"; -"lng_local_storage_clearing" = "Entferne.."; +"lng_local_storage_clearing" = "Leeren..."; "lng_local_storage_cleared" = "Alles entfernt!"; "lng_local_storage_clear_failed" = "Ein Fehler ist aufgetreten :("; @@ -331,7 +331,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_passcode_logout" = "Abmelden"; "lng_passcode_need_unblock" = "Bitte erst entsperren."; -"lng_cloud_password_waiting" = "Bestätigungslink gesendet an {email}.."; +"lng_cloud_password_waiting" = "Bestätigungslink gesendet an {email}..."; "lng_cloud_password_change" = "Kennwort ändern"; "lng_cloud_password_create" = "Kennwort erstellen"; "lng_cloud_password_remove" = "Kennwort entfernen"; @@ -358,7 +358,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "Kennwort wurde nicht geändert"; "lng_connection_type" = "Verbindungsart:"; -"lng_connection_auto_connecting" = "Standard (verbinden..)"; +"lng_connection_auto_connecting" = "Standard (verbinden...)"; "lng_connection_auto" = "Standard ({transport} verwendet)"; "lng_connection_proxy_connecting" = "Verbinde über Proxy..."; "lng_connection_proxy" = "{transport} mit Proxy"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "{user} aus der Gruppe entfernen?"; "lng_profile_sure_kick_channel" = "{user} aus dem Kanal entfernen?"; "lng_profile_sure_kick_admin" = "{user} als Administrator entfernen?"; -"lng_profile_loading" = "Lade.."; +"lng_profile_loading" = "Lade..."; "lng_profile_shared_media" = "Geteilte Medien"; "lng_profile_no_media" = "Noch keine Medien in diesem Chat"; "lng_profile_photos" = "{count:_not_used_|# Bild|# Bilder} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# Link|# Links} »"; "lng_profile_shared_links_header" = "Links aus dem Chat"; "lng_profile_copy_phone" = "Telefonnummer kopieren"; +"lng_profile_copy_fullname" = "Anzeigename kopieren"; "lng_channel_add_admins" = "Neuer Administrator"; "lng_channel_add_members" = "Mitglieder hinzufügen"; @@ -659,10 +660,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_remove" = "Löschen"; "lng_stickers_return" = "Rückgängig"; "lng_stickers_restore" = "Zeigen"; -"lng_stickers_count" = "{count:Lade..|# Sticker|# Sticker}"; +"lng_stickers_count" = "{count:Lade...|# Sticker|# Sticker}"; "lng_in_dlg_photo" = "Bild"; -"lng_in_dlg_video" = "Video"; +"lng_in_dlg_video" = "Videodatei"; +"lng_in_dlg_audio_file" = "Audiodatei"; "lng_in_dlg_contact" = "Kontakt"; "lng_in_dlg_audio" = "Sprachnachricht"; "lng_in_dlg_file" = "Datei"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "Spam in dieser Gruppe melden?"; "lng_report_spam_sure_channel" = "Möchtest du wirklich Spam in diesem Kanal melden?"; "lng_report_spam_ok" = "Melden"; -"lng_cant_send_to_not_contact" = "Derzeit kannst du nur Personen schreiben, wenn ihr eure Nummern ausgetauscht habt. {more_info}"; -"lng_cant_invite_not_contact" = "Du kannst nur Personen hinzufügen, wenn ihr eure Nummern ausgetauscht habt. {more_info}"; -"lng_cant_invite_not_contact_channel" = "Du kannst nur Personen hinzufügen,wenn ihr\neure Nummern ausgetauscht habt. {more_info}\n"; +"lng_cant_send_to_not_contact" = "Derzeit kannst du nur Personen schreiben,\nwenn ihr eure Nummern ausgetauscht habt.\n{more_info}"; +"lng_cant_invite_not_contact" = "Du kannst nur Personen hinzufügen,\nwenn ihr eure Nummern ausgetauscht habt.\n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Du kannst nur Personen hinzufügen,\nwenn ihr eure Nummern ausgetauscht habt.\n{more_info}"; "lng_cant_more_info" = "Weitere Infos »"; +"lng_cant_invite_banned" = "Nur Admins können diesen Nutzer hinzufügen."; "lng_cant_invite_privacy" = "Du kannst mit diesen Nutzern keine Gruppe erstellen, weil sie es nicht erlauben."; "lng_cant_invite_privacy_channel" = "Du kannst diese Nutzer keinen Kanälen hinzufügen, weil sie es nicht erlauben."; +"lng_cant_do_this" = "Verzeihung. Das ist leider nicht möglich."; "lng_send_button" = "Senden"; -"lng_message_ph" = "Schreibe deine Nachricht.."; -"lng_comment_ph" = "Schreibe ein Kommentar.."; -"lng_broadcast_ph" = "Sende einen Broadcast.."; -"lng_broadcast_silent_ph" = "Lautloser Broadcast"; +"lng_message_ph" = "Schreibe deine Nachricht..."; +"lng_comment_ph" = "Schreibe ein Kommentar..."; +"lng_broadcast_ph" = "Sende einen Broadcast..."; +"lng_broadcast_silent_ph" = "Lautloser Broadcast..."; "lng_record_cancel" = "Zum Abbrechen rausbewegen"; "lng_will_be_notified" = "Mitglieder werden benachrichtigt"; "lng_wont_be_notified" = "Mitglieder werden nicht benachrichtigt"; @@ -718,26 +722,27 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_users_typing" = "{user} und {second_user} tippen"; "lng_many_typing" = "{count:_not_used_|# tippt|# tippen}"; "lng_send_action_record_video" = "schickt Video"; -"lng_user_action_record_video" = "{user} sendet Video"; -"lng_send_action_upload_video" = "schickt Video"; -"lng_user_action_upload_video" = "{user} sendet Video"; -"lng_send_action_record_audio" = "nimmt Audio auf"; -"lng_user_action_record_audio" = "{user} nimmt Audio auf"; -"lng_send_action_upload_audio" = "nimmt Audio auf"; -"lng_user_action_upload_audio" = "{user} sendet Audio"; -"lng_send_action_upload_photo" = "sendet Bild"; -"lng_user_action_upload_photo" = "{user} sendet Bild"; -"lng_send_action_upload_file" = "sendet Datei"; -"lng_user_action_upload_file" = "{user} sendet Datei"; -"lng_send_action_geo_location" = "wählt Standort aus"; -"lng_user_action_geo_location" = "{user} wählt Standort aus"; -"lng_send_action_choose_contact" = "wählt Kontakt aus"; -"lng_user_action_choose_contact" = "{user} wählt Kontakt aus"; +"lng_user_action_record_video" = "{user} sendet ein Video"; +"lng_send_action_upload_video" = "schickt ein Video"; +"lng_user_action_upload_video" = "{user} sendet ein Video"; +"lng_send_action_record_audio" = "nimmt ein Audio auf"; +"lng_user_action_record_audio" = "{user} nimmt eine Sprachnachricht auf"; +"lng_send_action_upload_audio" = "sendet eine Sprachnachricht"; +"lng_user_action_upload_audio" = "{user} sendet eine Sprachnachricht"; +"lng_send_action_upload_photo" = "sendet ein Bild"; +"lng_user_action_upload_photo" = "{user} sendet ein Bild"; +"lng_send_action_upload_file" = "sendet eine Datei"; +"lng_user_action_upload_file" = "{user} sendet eine Datei"; +"lng_send_action_geo_location" = "wählt einen Standort aus"; +"lng_user_action_geo_location" = "{user} wählt einen Standort aus"; +"lng_send_action_choose_contact" = "wählt einen Kontakt aus"; +"lng_user_action_choose_contact" = "{user} wählt einen Kontakt aus"; "lng_unread_bar" = "{count:_not_used_|# Ungelesene Nachricht|# Ungelesene Nachrichten}"; "lng_maps_point" = "Standort"; "lng_save_photo" = "Bild speichern"; -"lng_save_video" = "Video speichern"; +"lng_save_video" = "Videodatei speichern"; +"lng_save_audio_file" = "Audiodatei speichern"; "lng_save_audio" = "Sprachnachricht speichern"; "lng_save_file" = "Datei speichern"; "lng_save_downloaded" = "{ready} / {total} {mb}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "E-Mail-Adresse kopieren"; "lng_context_copy_hashtag" = "Hashtag kopieren"; "lng_context_copy_mention" = "Benutzername kopieren"; -"lng_context_save_image" = "Bild speichern unter"; +"lng_context_save_image" = "Bild speichern unter..."; "lng_context_forward_image" = "Bild weiterleiten"; "lng_context_delete_image" = "Bild löschen"; "lng_context_copy_image" = "Bild kopieren"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Download abbrechen"; "lng_context_show_in_folder" = "Im Ordner anzeigen"; "lng_context_show_in_finder" = "Im Finder zeigen"; -"lng_context_save_video" = "Video speichern unter.."; -"lng_context_save_audio" = "Sprachnachricht speichern unter.."; +"lng_context_save_video" = "Videodatei speichern unter..."; +"lng_context_save_audio_file" = "Audiodatei speichern unter..."; +"lng_context_save_audio" = "Sprachnachricht speichern unter..."; "lng_context_pack_info" = "Sticker-Paket"; "lng_context_pack_add" = "Sticker hinzufügen"; -"lng_context_save_file" = "Datei speichern als.."; +"lng_context_save_file" = "Datei speichern unter..."; "lng_context_forward_file" = "Datei weiterleiten"; "lng_context_delete_file" = "Datei löschen"; "lng_context_close_file" = "Datei schließen"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "Nur Dateien bis maximal 1,5 GB können gesendet werden :("; "lng_send_folder" = "Verzeichnis «{name}» kann nicht gesendet werden :("; -"lng_forward_choose" = "Empfänger wählen.."; +"lng_forward_choose" = "Empfänger wählen..."; "lng_forward_cant" = "Weiterleiten nicht möglich :("; "lng_forward_confirm" = "An {recipient} weiterleiten?"; "lng_forward_share_contact" = "Kontakt an {recipient} senden?"; diff --git a/Telegram/SourceFiles/langs/lang_es.strings b/Telegram/SourceFiles/langs/lang_es.strings index dfa3a6261..79a8f1247 100644 --- a/Telegram/SourceFiles/langs/lang_es.strings +++ b/Telegram/SourceFiles/langs/lang_es.strings @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "Este mensaje fue eliminado"; "lng_edit_too_long" = "Tu texto es demasiado largo"; "lng_edit_message" = "Editar mensaje"; -"lng_edit_message_text" = "Nuevo texto..."; +"lng_edit_message_text" = "Nuevo mensaje..."; "lng_deleted" = "Desconocido"; "lng_deleted_message" = "Mensaje eliminado"; "lng_pinned_message" = "Mensaje anclado"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Guardar"; "lng_settings_upload" = "Poner foto de perfil"; "lng_settings_crop_profile" = "Selecciona el área para tu foto de perfil"; -"lng_settings_uploading_photo" = "Cargando foto..."; +"lng_settings_uploading_photo" = "Subiendo foto..."; "lng_username_title" = "Alias"; "lng_username_about" = "Puedes elegir un alias en Telegram. \nSi lo haces, otras personas te podrán \nencontrar por ese alias y contactarte \nsin saber tu número de teléfono.\n\nPuedes usar a-z, 0-9 y guiones bajos.\nLa longitud mínima es de 5 caracteres."; @@ -360,7 +360,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_connection_type" = "Tipo de conexión:"; "lng_connection_auto_connecting" = "Por defecto (conectando...)"; "lng_connection_auto" = "Por defecto ({transport} en uso)"; -"lng_connection_proxy_connecting" = "Conectando a través de un proxy..."; +"lng_connection_proxy_connecting" = "Conectando a través de proxy..."; "lng_connection_proxy" = "{transport} con un proxy"; "lng_connection_header" = "Tipo de conexión"; "lng_connection_auto_rb" = "Automático (TCP si existe o HTTP)"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# enlace|# enlaces} »"; "lng_profile_shared_links_header" = "Enlaces"; "lng_profile_copy_phone" = "Copiar número"; +"lng_profile_copy_fullname" = "Copiar nombre"; "lng_channel_add_admins" = "Nuevo administrador"; "lng_channel_add_members" = "Añadir miembros"; @@ -663,8 +664,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_in_dlg_photo" = "Foto"; "lng_in_dlg_video" = "Vídeo"; +"lng_in_dlg_audio_file" = "Audio"; "lng_in_dlg_contact" = "Contacto"; -"lng_in_dlg_audio" = "Audio"; +"lng_in_dlg_audio" = "Mensaje de voz"; "lng_in_dlg_file" = "Archivo"; "lng_in_dlg_sticker" = "Sticker"; "lng_in_dlg_sticker_emoji" = "{emoji} (sticker)"; @@ -678,12 +680,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "¿Quieres reportar el spam en este grupo?"; "lng_report_spam_sure_channel" = "¿Quieres reportar a este canal como spam?"; "lng_report_spam_ok" = "Reportar"; -"lng_cant_send_to_not_contact" = "Por ahora, sólo puedes enviar mensajes\na contactos mutuos. {more_info}"; -"lng_cant_invite_not_contact" = "Por ahora, sólo puedes añadir contactos \nmutuos a grupos. {more_info}"; -"lng_cant_invite_not_contact_channel" = "Lo sentimos, sólo puedes añadir contactos\nmutuos a canales. {more_info}"; +"lng_cant_send_to_not_contact" = "Por ahora, sólo puedes enviar\nmensajes a contactos mutuos. \n{more_info}"; +"lng_cant_invite_not_contact" = "Por ahora, sólo puedes añadir \ncontactos mutuos a grupos. \n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Por ahora, sólo puedes añadir \ncontactos mutuos a canales. \n{more_info}"; "lng_cant_more_info" = "Más información »"; +"lng_cant_invite_banned" = "Sólo el administrador puede añadir a este usuario."; "lng_cant_invite_privacy" = "No puedes añadir a este usuario a grupos por sus ajustes de privacidad."; "lng_cant_invite_privacy_channel" = "No puedes añadir a este usuario a canales por sus ajustes de privacidad."; +"lng_cant_do_this" = "Lo sentimos, esta acción no está disponible."; "lng_send_button" = "Enviar"; "lng_message_ph" = "Escribe un mensaje..."; @@ -717,28 +721,29 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} está escribiendo"; "lng_users_typing" = "{user} y {second_user} están escribiendo"; "lng_many_typing" = "{count:_not_used_|# está|# están} escribiendo"; -"lng_send_action_record_video" = "grabando vídeo"; +"lng_send_action_record_video" = "grabando un vídeo"; "lng_user_action_record_video" = "{user} está grabando un vídeo"; -"lng_send_action_upload_video" = "enviando vídeo"; +"lng_send_action_upload_video" = "enviando un vídeo"; "lng_user_action_upload_video" = "{user} está enviando un vídeo"; -"lng_send_action_record_audio" = "grabando audio"; -"lng_user_action_record_audio" = "{user} está grabando un audio"; -"lng_send_action_upload_audio" = "enviando audio"; -"lng_user_action_upload_audio" = "{user} está enviando un audio"; -"lng_send_action_upload_photo" = "enviando foto"; +"lng_send_action_record_audio" = "grabando un mensaje de voz"; +"lng_user_action_record_audio" = "{user} está grabando un mensaje de voz"; +"lng_send_action_upload_audio" = "enviando un mensaje de voz"; +"lng_user_action_upload_audio" = "{user} está enviando un mensaje de voz"; +"lng_send_action_upload_photo" = "enviando una foto"; "lng_user_action_upload_photo" = "{user} está enviando una foto"; -"lng_send_action_upload_file" = "enviando archivo"; +"lng_send_action_upload_file" = "enviando un archivo"; "lng_user_action_upload_file" = "{user} está enviando un archivo"; "lng_send_action_geo_location" = "obteniendo ubicación"; "lng_user_action_geo_location" = "{user} está obteniendo una ubicación"; -"lng_send_action_choose_contact" = "eligiendo contacto"; +"lng_send_action_choose_contact" = "eligiendo un contacto"; "lng_user_action_choose_contact" = "{user} está eligiendo un contacto"; "lng_unread_bar" = "{count:_not_used_|# mensaje sin leer|# mensajes sin leer}"; "lng_maps_point" = "Ubicación"; "lng_save_photo" = "Guardar imagen"; "lng_save_video" = "Guardar vídeo"; -"lng_save_audio" = "Guardar audio"; +"lng_save_audio_file" = "Guardar audio"; +"lng_save_audio" = "Guardar mensaje de voz"; "lng_save_file" = "Guardar archivo"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -764,6 +769,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_show_in_folder" = "Mostrar en la carpeta"; "lng_context_show_in_finder" = "Mostrar en el Finder"; "lng_context_save_video" = "Guardar como..."; +"lng_context_save_audio_file" = "Guardar como..."; "lng_context_save_audio" = "Guardar como..."; "lng_context_pack_info" = "Información del pack"; "lng_context_pack_add" = "Añadir stickers"; diff --git a/Telegram/SourceFiles/langs/lang_it.strings b/Telegram/SourceFiles/langs/lang_it.strings index 1a8e00d88..2dd317d7e 100644 --- a/Telegram/SourceFiles/langs/lang_it.strings +++ b/Telegram/SourceFiles/langs/lang_it.strings @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "Questo messaggio è stato eliminato"; "lng_edit_too_long" = "Il tuo messaggio è troppo lungo"; "lng_edit_message" = "Modifica messaggio"; -"lng_edit_message_text" = "Nuovo testo messaggio.."; +"lng_edit_message_text" = "Nuovo testo messaggio..."; "lng_deleted" = "Sconosciuto"; "lng_deleted_message" = "Messaggio eliminato"; "lng_pinned_message" = "Messaggio fissato"; @@ -162,7 +162,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_code_telegram" = "Per favore inserisci il codice che hai\nappena ricevuto nell'altra app di [b]Telegram[/b]."; "lng_code_no_telegram" = "Invia codice via SMS"; "lng_code_call" = "Telegram ti chiamerà tra {minutes}:{seconds}"; -"lng_code_calling" = "Richiedendo una telefonata da Telegram.."; +"lng_code_calling" = "Richiedo una telefonata da Telegram..."; "lng_code_called" = "Telegram ti ha chiamato"; "lng_bad_phone" = "Numero di telefono non valido. Per favore riprova."; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "Nome canale"; "lng_no_contacts" = "Non hai contatti"; "lng_no_chats" = "Le tua chat saranno qui"; -"lng_contacts_loading" = "Caricamento.."; +"lng_contacts_loading" = "Caricamento..."; "lng_contacts_not_found" = "Nessun contatto trovato"; "lng_dlg_search_chat" = "Cerca in questa chat"; "lng_dlg_search_channel" = "Cerca in questo canale"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Salva"; "lng_settings_upload" = "Imposta foto profilo"; "lng_settings_crop_profile" = "Seleziona un riquadro per la tua foto profilo"; -"lng_settings_uploading_photo" = "Caricamento foto.."; +"lng_settings_uploading_photo" = "Caricamento foto..."; "lng_username_title" = "Username"; "lng_username_about" = "Puoi scegliere un username su Telegram.\nSe lo fai, le altre persone potranno trovarti\ntramite questo username e contattarti \nsenza conoscere il tuo numero di telefono.\n\nPuoi usare a-z, 0-9 e underscore.\nLa lunghezza minima è di 5 caratteri."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "Aggiorna automaticamente"; "lng_settings_current_version" = "Versione {version}"; "lng_settings_check_now" = "Cerca aggiornamenti"; -"lng_settings_update_checking" = "Cerco aggiornamenti.."; +"lng_settings_update_checking" = "Cerco aggiornamenti..."; "lng_settings_latest_installed" = "L'ultima versione è installata"; -"lng_settings_downloading" = "Download aggiornamento {ready} / {total} MB.."; +"lng_settings_downloading" = "Download aggiornamento {ready} / {total} MB..."; "lng_settings_update_ready" = "La nuova versione è pronta"; "lng_settings_update_now" = "Riavvia ora"; "lng_settings_update_fail" = "Ricerca aggiornamenti fallita :("; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "Il download del file non può iniziare. La causa potrebbe essere una posizione sbagliata per i download.\n\nPuoi cambiare il percorso di download nelle Impostazioni."; "lng_download_path_settings" = "Impostazioni"; "lng_download_finish_failed" = "Il download del file non può essere concluso.\n\nVuoi riprovare?"; -"lng_download_path_clearing" = "Eliminazione.."; +"lng_download_path_clearing" = "Elimino..."; "lng_download_path_cleared" = "Eliminato!"; "lng_download_path_clear_failed" = "Eliminazione fallita :("; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|# immagine|# immagini}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# messaggio vocale|# messaggi vocali}, {size}"; "lng_local_storage_clear" = "Elimina tutto"; -"lng_local_storage_clearing" = "Eliminando.."; +"lng_local_storage_clearing" = "Elimino..."; "lng_local_storage_cleared" = "Eliminato!"; "lng_local_storage_clear_failed" = "Eliminazione fallita :("; @@ -331,7 +331,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_passcode_logout" = "Disconnetti"; "lng_passcode_need_unblock" = "Devi prima sbloccarmi."; -"lng_cloud_password_waiting" = "Link di conferma inviato a {email}.."; +"lng_cloud_password_waiting" = "Link di conferma inviato a {email}..."; "lng_cloud_password_change" = "Cambia password"; "lng_cloud_password_create" = "Password cloud"; "lng_cloud_password_remove" = "Rimuovi password"; @@ -358,9 +358,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "La password non è stata cambiata"; "lng_connection_type" = "Tipo di connessione:"; -"lng_connection_auto_connecting" = "Predefinita (connetto..)"; +"lng_connection_auto_connecting" = "Predefinita (connetto...)"; "lng_connection_auto" = "Predefinita ({transport} in uso)"; -"lng_connection_proxy_connecting" = "Connetto tramite proxy.."; +"lng_connection_proxy_connecting" = "Connetto tramite proxy..."; "lng_connection_proxy" = "{transport} con proxy"; "lng_connection_header" = "Tipo di connessione"; "lng_connection_auto_rb" = "Auto (TCP se disponibile o HTTP)"; @@ -396,7 +396,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_sessions_other_desc" = "Ti puoi connettere a Telegram da altri dispositivi mobili, tablet e desktop usando lo stesso numero. Tutti i tuoi dati saranno sincronizzati istantaneamente."; "lng_sessions_terminate_all" = "Termina tutte le altre sessioni"; -"lng_preview_loading" = "Recupero le info del link.."; +"lng_preview_loading" = "Recupero le info del link..."; "lng_profile_chat_unaccessible" = "Gruppo non accessibile"; "lng_topbar_info" = "Info"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "Rimuovere {user} dal gruppo?"; "lng_profile_sure_kick_channel" = "Rimuovere {user} dal canale?"; "lng_profile_sure_kick_admin" = "Rimuovere {user} dagli amministratori?"; -"lng_profile_loading" = "Caricamento.."; +"lng_profile_loading" = "Caricamento..."; "lng_profile_shared_media" = "Media condivisi"; "lng_profile_no_media" = "Nessun media in questa chat."; "lng_profile_photos" = "{count:_not_used_|# foto|# foto} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# link condiviso|# link condivisi} »"; "lng_profile_shared_links_header" = "Panoramica link condivisi"; "lng_profile_copy_phone" = "Copia numero di telefono"; +"lng_profile_copy_fullname" = "Copia nome"; "lng_channel_add_admins" = "Nuovo amministratore"; "lng_channel_add_members" = "Aggiungi membri"; @@ -659,12 +660,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_remove" = "Elimina"; "lng_stickers_return" = "Annulla"; "lng_stickers_restore" = "Ripristina"; -"lng_stickers_count" = "{count:Caricamento..|# sticker|# sticker}"; +"lng_stickers_count" = "{count:Caricamento...|# sticker|# sticker}"; "lng_in_dlg_photo" = "Foto"; -"lng_in_dlg_video" = "Video"; +"lng_in_dlg_video" = "File video"; +"lng_in_dlg_audio_file" = "File audio"; "lng_in_dlg_contact" = "Contatto"; -"lng_in_dlg_audio" = "Audio"; +"lng_in_dlg_audio" = "Messaggio vocale"; "lng_in_dlg_file" = "File"; "lng_in_dlg_sticker" = "Sticker"; "lng_in_dlg_sticker_emoji" = "{emoji} (sticker)"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "Sei sicuro di voler segnalare dello spam in questo gruppo?"; "lng_report_spam_sure_channel" = "Sei sicuro di voler segnalare dello spam in questo canale?"; "lng_report_spam_ok" = "Segnala"; -"lng_cant_send_to_not_contact" = "Spiacenti, ma al momento puoi scrivere\nsolo ai contatti reciproci. {more_info}"; -"lng_cant_invite_not_contact" = "Spiacenti, ma al momento puoi aggiungere\nai gruppi solo contatti reciproci. {more_info}"; -"lng_cant_invite_not_contact_channel" = "Spiacenti, ma al momento puoi aggiungere\nai canali solo contatti reciproci. {more_info}"; +"lng_cant_send_to_not_contact" = "Spiacenti, ma al momento puoi scrivere\nsolo ai contatti reciproci.\n{more_info}"; +"lng_cant_invite_not_contact" = "Spiacenti, ma al momento puoi aggiungere\nai gruppi solo contatti reciproci.\n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Spiacenti, ma al momento puoi aggiungere\nai canali solo contatti reciproci.\n{more_info}"; "lng_cant_more_info" = "Più info »"; +"lng_cant_invite_banned" = "Spiacenti, solo l'amministratore può aggiungere questo utente."; "lng_cant_invite_privacy" = "Spiacenti, non puoi aggiungere questo utente al gruppo a causa delle sue impostazioni di privacy."; "lng_cant_invite_privacy_channel" = "Spiacenti, non puoi aggiungere questo utente al canale a causa delle sue impostazioni di privacy."; +"lng_cant_do_this" = "Spiacenti, questa azione non è disponibile."; "lng_send_button" = "Invia"; -"lng_message_ph" = "Scrivi un messaggio.."; -"lng_comment_ph" = "Scrivi un commento.."; -"lng_broadcast_ph" = "Pubblica un post.."; -"lng_broadcast_silent_ph" = "Post silenzioso.."; +"lng_message_ph" = "Scrivi un messaggio..."; +"lng_comment_ph" = "Scrivi un commento..."; +"lng_broadcast_ph" = "Pubblica un post..."; +"lng_broadcast_silent_ph" = "Post silenzioso..."; "lng_record_cancel" = "Rilascia fuori da qui per annullare"; "lng_will_be_notified" = "I post saranno notificati ai membri"; "lng_wont_be_notified" = "I post non saranno notificati ai membri"; @@ -721,24 +725,25 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_action_record_video" = "{user} sta registrando un video"; "lng_send_action_upload_video" = "inviando un video"; "lng_user_action_upload_video" = "{user} sta inviando un video"; -"lng_send_action_record_audio" = "registrando un audio"; -"lng_user_action_record_audio" = "{user} sta registrando un audio"; -"lng_send_action_upload_audio" = "inviando un audio"; -"lng_user_action_upload_audio" = "{user} sta inviando un audio"; +"lng_send_action_record_audio" = "registrando un messaggio vocale"; +"lng_user_action_record_audio" = "{user} sta registrando un messaggio vocale"; +"lng_send_action_upload_audio" = "inviando un messaggio vocale"; +"lng_user_action_upload_audio" = "{user} sta inviando un messaggio vocale"; "lng_send_action_upload_photo" = "inviando una foto"; "lng_user_action_upload_photo" = "{user} sta inviando una foto"; "lng_send_action_upload_file" = "inviando un file"; "lng_user_action_upload_file" = "{user} sta inviando un file"; -"lng_send_action_geo_location" = "selezionando una posizione"; -"lng_user_action_geo_location" = "{user} sta selezionando una posizione"; -"lng_send_action_choose_contact" = "selezionando un contatto"; -"lng_user_action_choose_contact" = "{user} sta selezionando un contatto"; +"lng_send_action_geo_location" = "scegliendo una posizione"; +"lng_user_action_geo_location" = "{user} sta scegliendo una posizione"; +"lng_send_action_choose_contact" = "scegliendo un contatto"; +"lng_user_action_choose_contact" = "{user} sta scegliendo un contatto"; "lng_unread_bar" = "{count:_not_used_|# messaggio non letto|# messaggi non letti}"; "lng_maps_point" = "Posizione"; "lng_save_photo" = "Salva immagine"; -"lng_save_video" = "Salva video"; -"lng_save_audio" = "Salva audio"; +"lng_save_video" = "Salva file video"; +"lng_save_audio_file" = "Salva file audio"; +"lng_save_audio" = "Salva messaggio vocale"; "lng_save_file" = "Salva file"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "Copia indirizzo email"; "lng_context_copy_hashtag" = "Copia hashtag"; "lng_context_copy_mention" = "Copia username"; -"lng_context_save_image" = "Salva immagine come.."; +"lng_context_save_image" = "Salva immagine come..."; "lng_context_forward_image" = "Inoltra immagine"; "lng_context_delete_image" = "Elimina immagine"; "lng_context_copy_image" = "Copia immagine"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Annulla download"; "lng_context_show_in_folder" = "Mostra nella cartella"; "lng_context_show_in_finder" = "Mostra nel Finder"; -"lng_context_save_video" = "Salva video come.."; -"lng_context_save_audio" = "Salva audio come.."; +"lng_context_save_video" = "Salva file video come..."; +"lng_context_save_audio_file" = "Salva file audio come..."; +"lng_context_save_audio" = "Salva messaggio vocale come..."; "lng_context_pack_info" = "Mostra sticker"; "lng_context_pack_add" = "Aggiungi sticker"; -"lng_context_save_file" = "Salva file come.."; +"lng_context_save_file" = "Salva file come..."; "lng_context_forward_file" = "Inoltra file"; "lng_context_delete_file" = "Elimina file"; "lng_context_close_file" = "Chiudi file"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "Impossibile inviare il file, perchè è più grande di 1.5 GB :("; "lng_send_folder" = "Impossibile inviare «{name}» perchè è una cartella :("; -"lng_forward_choose" = "Scegli destinatario.."; +"lng_forward_choose" = "Scegli destinatario..."; "lng_forward_cant" = "Spiacenti, impossibile inoltrare qui :("; "lng_forward_confirm" = "Inoltra a {recipient}?"; "lng_forward_share_contact" = "Condividi contatto con {recipient}?"; @@ -857,7 +863,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_search_global_results" = "Risultati ricerca globale"; "lng_media_save_progress" = "{ready} di {total} {mb}"; -"lng_mediaview_save_as" = "Salva come.."; +"lng_mediaview_save_as" = "Salva come..."; "lng_mediaview_copy" = "Copia"; "lng_mediaview_forward" = "Inoltra"; "lng_mediaview_delete" = "Elimina"; diff --git a/Telegram/SourceFiles/langs/lang_ko.strings b/Telegram/SourceFiles/langs/lang_ko.strings index cf661c075..ff30db37d 100644 --- a/Telegram/SourceFiles/langs/lang_ko.strings +++ b/Telegram/SourceFiles/langs/lang_ko.strings @@ -86,8 +86,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cancel" = "취소"; "lng_continue" = "계속"; "lng_close" = "닫기"; -"lng_connecting" = "연결중입니다.."; -"lng_reconnecting" = " {count:지금| #초 후에| #초 후에} 다시 연결합니다.."; +"lng_connecting" = "Connecting..."; +"lng_reconnecting" = "Reconnect {count:now|in # s|in # s}..."; "lng_reconnecting_try_now" = "다시 시도"; "lng_status_service_notifications" = "서비스 알림"; @@ -108,7 +108,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_status_lastseen_date" = "{date}에 마지막으로 접속"; "lng_status_lastseen_date_time" = "{date}일 {time}에 마지막으로 접속"; "lng_status_online" = "온라인"; -"lng_status_connecting" = "연결중.."; +"lng_status_connecting" = "connecting..."; "lng_chat_status_unaccessible" = "그룹 접근 불가"; "lng_chat_status_members" = "{count:맴버 없음|#명|#명}"; @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "메시지는 삭제 되었습니다."; "lng_edit_too_long" = "메시지 길이가 너무 깁니다."; "lng_edit_message" = "메시지 수정"; -"lng_edit_message_text" = "새로운 메시지 내용."; +"lng_edit_message_text" = "New message text..."; "lng_deleted" = "알 수 없음"; "lng_deleted_message" = "삭제된 메시지"; "lng_pinned_message" = "고정된 메시지"; @@ -162,7 +162,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_code_telegram" = "[b]텔레그램[/b] 앱으로 부터 방금 수신받은,\n코드를 입력해주세요."; "lng_code_no_telegram" = "코드를 SMS로 전송"; "lng_code_call" = "텔레그램이 {minutes}:{seconds}후에는 전화를 겁니다."; -"lng_code_calling" = "텔레그램으로부터 전화 요청을 하고 있습니다.."; +"lng_code_calling" = "Requesting a call from Telegram..."; "lng_code_called" = "텔레그램이 회원님의 전화번호로 전화를 걸었습니다."; "lng_bad_phone" = "잘못된 전화번호입니다. 다시 시도해주세요."; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "채널명"; "lng_no_contacts" = "연락처가 없습니다."; "lng_no_chats" = "대화시 대화방이 존재 할 곳입니다."; -"lng_contacts_loading" = "로드중.."; +"lng_contacts_loading" = "Loading..."; "lng_contacts_not_found" = "연락처를 찾을 수 없음"; "lng_dlg_search_chat" = "이 채팅에서 검색"; "lng_dlg_search_channel" = "이 채널방에서 검색"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "저장"; "lng_settings_upload" = "프로필 이미지 선택"; "lng_settings_crop_profile" = "프로필 사진으로 사용할 사각영역을 선택하세요"; -"lng_settings_uploading_photo" = "사진 업로드중.."; +"lng_settings_uploading_photo" = "Uploading photo..."; "lng_username_title" = "아이디"; "lng_username_about" = "텔레그램 아이디를 설정할 수 있습니다. \n아이디를 설정하면 회원님의 전화번호를 몰라도 아이디로 회원님을 찾아 대화를 나눌 수 있습니다.\n아이디는 영문, 밑줄, 숫자로 a-z, _, 0-9, \n다섯 글자 이상으로 설정해 주세요."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "자동 업데이트"; "lng_settings_current_version" = " {version}"; "lng_settings_check_now" = "업데이트 확인"; -"lng_settings_update_checking" = "업데이트 확인 중.."; +"lng_settings_update_checking" = "Checking for updates..."; "lng_settings_latest_installed" = "최신 버전이 설치되어 있습니다."; -"lng_settings_downloading" = "업데이트를 다운로드중입니다.. {ready} / {total} MB.."; +"lng_settings_downloading" = "Downloading update {ready} / {total} MB..."; "lng_settings_update_ready" = "새로운 버전을 설치 할 수 있습니다."; "lng_settings_update_now" = "재시작 합니다."; "lng_settings_update_fail" = "업데이트 확인 실패 :("; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "파일 다운로드를 시작 할 수 없습니다. 올바르지 않은 다운로드 경로가 원인 일 수도 있습니다.\n\n설정에 가시면 다운로드 경로를 변경하실 수 있습니다."; "lng_download_path_settings" = "설정"; "lng_download_finish_failed" = "파일 다운로드를 끝낼 수 없습니다.\n\n다시 시도하시겠습니까?"; -"lng_download_path_clearing" = "초기화 중.."; +"lng_download_path_clearing" = "Clearing..."; "lng_download_path_cleared" = "초기화 완료!"; "lng_download_path_clear_failed" = "초기화 실패 :("; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|이미지 #개|이미지 #개}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|음성 메시지 #개|음성 메시지 #개}, {size}"; "lng_local_storage_clear" = "전체 정리"; -"lng_local_storage_clearing" = "초기화 중.."; +"lng_local_storage_clearing" = "Clearing..."; "lng_local_storage_cleared" = "초기화 완료!"; "lng_local_storage_clear_failed" = "초기화 실패 :("; @@ -331,7 +331,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_passcode_logout" = "로그아웃"; "lng_passcode_need_unblock" = "잠금코드를 먼저 해제해주세요."; -"lng_cloud_password_waiting" = "{email}로 확인 이메일을 전송하였습니다.."; +"lng_cloud_password_waiting" = "Confirmation link sent to {email}..."; "lng_cloud_password_change" = "클라우드 비밀번호 변경"; "lng_cloud_password_create" = "클라우드 비밀번호"; "lng_cloud_password_remove" = "클라우드 비밀번호 삭제"; @@ -358,9 +358,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "비밀번호가 변경되지 않았습니다."; "lng_connection_type" = "연결 유형:"; -"lng_connection_auto_connecting" = "기본값 (연결중..)"; +"lng_connection_auto_connecting" = "Default (connecting...)"; "lng_connection_auto" = "기본값 ({transport} 사용)"; -"lng_connection_proxy_connecting" = "프록시 연결 중..."; +"lng_connection_proxy_connecting" = "Connecting through proxy..."; "lng_connection_proxy" = "{transport} 프록시 연결"; "lng_connection_header" = "연결 유형"; "lng_connection_auto_rb" = "자동 (사용 가능하다면 TCP 아니면 HTTP 사용)"; @@ -396,7 +396,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_sessions_other_desc" = "동일한 휴대번호로 다른 휴대기기, 태블릿과 데스크탑에서 텔레그램 로그인이 가능합니다. 모든 데이터는 즉시 동기화 됩니다."; "lng_sessions_terminate_all" = "다른 모든 세션 강제 종료"; -"lng_preview_loading" = "링크 정보를 가져오는 중.."; +"lng_preview_loading" = "Getting Link Info..."; "lng_profile_chat_unaccessible" = "그룹에 접근할 수 없습니다."; "lng_topbar_info" = "정보"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "{user}를 추방하시겠습니까?"; "lng_profile_sure_kick_channel" = "{user}를 추방하시겠습니까?"; "lng_profile_sure_kick_admin" = "{user}를 관리자에서 제외 하시겠습니까?"; -"lng_profile_loading" = "로딩중.."; +"lng_profile_loading" = "Loading..."; "lng_profile_shared_media" = "공유된 미디어"; "lng_profile_no_media" = "대화에 미디어가 존재하지 않습니다."; "lng_profile_photos" = "{count:_not_used_|#개의 사진|#개의 사진} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# 공유된 링크|# 공유된 링크} »"; "lng_profile_shared_links_header" = "공유된 링크 현황"; "lng_profile_copy_phone" = "전화번호 복사"; +"lng_profile_copy_fullname" = "Copy name"; "lng_channel_add_admins" = "새로운 관리자"; "lng_channel_add_members" = "구성원 추가"; @@ -659,12 +660,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_remove" = "삭제"; "lng_stickers_return" = "실행취소"; "lng_stickers_restore" = "복구"; -"lng_stickers_count" = "{count:Loading..|# 스티커|# 스티커} "; +"lng_stickers_count" = "{count:Loading...|# sticker|# stickers}"; "lng_in_dlg_photo" = "사진"; -"lng_in_dlg_video" = "비디오"; +"lng_in_dlg_video" = "Video file"; +"lng_in_dlg_audio_file" = "Audio file"; "lng_in_dlg_contact" = "연락처"; -"lng_in_dlg_audio" = "음성"; +"lng_in_dlg_audio" = "Voice message"; "lng_in_dlg_file" = "파일"; "lng_in_dlg_sticker" = "스티커"; "lng_in_dlg_sticker_emoji" = "{emoji} (스티커)"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "선택한 그룹메시지를 스팸으로 신고하시겠습니까?"; "lng_report_spam_sure_channel" = "선택한 채널메시지를 스팸으로 신고하시겠습니까?"; "lng_report_spam_ok" = "신고하기"; -"lng_cant_send_to_not_contact" = "죄송하지만, 현재 서로 연락처가 추가된\n회원들끼리만 전송이 가능합니다. {more_info}"; -"lng_cant_invite_not_contact" = "죄송하지만, 현재 서로 연락처가 추가된\n회원들끼리만 추가 가능합니다. {more_info}"; -"lng_cant_invite_not_contact_channel" = "죄송하지만, 현재 서로 연락처가 추가된\n회원들끼리만 추가 가능합니다. {more_info}"; +"lng_cant_send_to_not_contact" = "Sorry, you can only send messages to\nmutual contacts at the moment.\n{more_info}"; +"lng_cant_invite_not_contact" = "Sorry, you can only add mutual contacts\nto groups at the moment.\n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Sorry, you can only add mutual contacts\nto channels at the moment.\n{more_info}"; "lng_cant_more_info" = "자세한 정보 »"; +"lng_cant_invite_banned" = "Sorry, only admin can add this user."; "lng_cant_invite_privacy" = "죄송합니다, 개인설정으로 인하여 이 사용자를 그룹에 초대할 수 없습니다."; "lng_cant_invite_privacy_channel" = "죄송합니다, 개인설정으로 인하여 이 사용자를 채널에 초대할 수 없습니다."; +"lng_cant_do_this" = "Sorry, this action is unavailable."; "lng_send_button" = "보내기"; -"lng_message_ph" = "메시지 쓰기"; -"lng_comment_ph" = "코멘트 쓰기.."; -"lng_broadcast_ph" = "단체메시지 쓰기."; -"lng_broadcast_silent_ph" = "음소거 메시지.."; +"lng_message_ph" = "Write a message..."; +"lng_comment_ph" = "Write a comment..."; +"lng_broadcast_ph" = "Broadcast a message..."; +"lng_broadcast_silent_ph" = "Silent broadcast..."; "lng_record_cancel" = "이 영역 밖에서 마우스 클릭을 해제하시면 취소가 됩니다."; "lng_will_be_notified" = "메시지 작성시 구성원들에게 알림이 갑니다."; "lng_wont_be_notified" = "메시지 작성시 구성원들에게 알림이 가지 않습니다."; @@ -717,28 +721,29 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user}님이 입력중입니다."; "lng_users_typing" = "{user}님과 {second_user}님이 입력중입니다."; "lng_many_typing" = "{count:_not_used_|#명이|#명이} 입력중입니다"; -"lng_send_action_record_video" = "비디오 녹화 중"; -"lng_user_action_record_video" = "{user}님이 녹화중입니다."; -"lng_send_action_upload_video" = "비디오 전송 중"; -"lng_user_action_upload_video" = "{user}님이 비디오를 전송 중입니다."; -"lng_send_action_record_audio" = "오디오 녹음 중"; -"lng_user_action_record_audio" = "{user}님이 오디오를 녹음 중입니다."; -"lng_send_action_upload_audio" = "오디오 전송 중"; -"lng_user_action_upload_audio" = "{user}님이 오디오를 전송 중입니다."; -"lng_send_action_upload_photo" = "사진 전송 중"; -"lng_user_action_upload_photo" = "{user}님이 사진을 전송 중입니다."; -"lng_send_action_upload_file" = "파일을 전송 중"; -"lng_user_action_upload_file" = "{user}님이 사진을 전송 중입니다."; -"lng_send_action_geo_location" = "위치 선택 중"; -"lng_user_action_geo_location" = "{user}님이 위치를 선택 중입니다."; -"lng_send_action_choose_contact" = "연락처 선택 중"; -"lng_user_action_choose_contact" = "{user}님이 연락처를 선택 중입니다."; +"lng_send_action_record_video" = "recording a video"; +"lng_user_action_record_video" = "{user} is recording a video"; +"lng_send_action_upload_video" = "sending a video"; +"lng_user_action_upload_video" = "{user} is sending a video"; +"lng_send_action_record_audio" = "recording a voice message"; +"lng_user_action_record_audio" = "{user} is recording a voice message"; +"lng_send_action_upload_audio" = "sending a voice message"; +"lng_user_action_upload_audio" = "{user} is sending a voice message"; +"lng_send_action_upload_photo" = "sending a photo"; +"lng_user_action_upload_photo" = "{user} is sending a photo"; +"lng_send_action_upload_file" = "sending a file"; +"lng_user_action_upload_file" = "{user} is sending a file"; +"lng_send_action_geo_location" = "picking a location"; +"lng_user_action_geo_location" = "{user} is picking a location"; +"lng_send_action_choose_contact" = "choosing a contact"; +"lng_user_action_choose_contact" = "{user} is choosing a contact"; "lng_unread_bar" = "{count:_not_used_|#개의 읽지 않은 메시지|#개의 읽지 않은 메시지}"; "lng_maps_point" = "위치"; "lng_save_photo" = "사진 저장"; -"lng_save_video" = "동영상 저장"; -"lng_save_audio" = "음성 저장"; +"lng_save_video" = "Save video file"; +"lng_save_audio_file" = "Save audio file"; +"lng_save_audio" = "Save voice message"; "lng_save_file" = "파일 저장"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "이메일 복사"; "lng_context_copy_hashtag" = "해시태그 복사"; "lng_context_copy_mention" = "아이디 복사"; -"lng_context_save_image" = "이미지를 다른 이름으로 저장.."; +"lng_context_save_image" = "Save Image As..."; "lng_context_forward_image" = "이미지 전달"; "lng_context_delete_image" = "이미지 삭제"; "lng_context_copy_image" = "이미지 복사"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "다운로드 취소"; "lng_context_show_in_folder" = "탐색기에서 보기"; "lng_context_show_in_finder" = "탐색기에서 보기"; -"lng_context_save_video" = "비디오 이름을 다른이름으로 저장."; -"lng_context_save_audio" = "음성메시지를 다른 이름으로 저장.."; +"lng_context_save_video" = "Save Video File As..."; +"lng_context_save_audio_file" = "Save Audio File As..."; +"lng_context_save_audio" = "Save Voice Message As..."; "lng_context_pack_info" = "팩 정보"; "lng_context_pack_add" = "스티커 추가"; -"lng_context_save_file" = "파일을 다른 이름으로 저장.."; +"lng_context_save_file" = "Save File As..."; "lng_context_forward_file" = "파일 전달"; "lng_context_delete_file" = "파일 삭제"; "lng_context_close_file" = "파일 닫기"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "파일이 1.5GB 보다 큼으로 전송 할 수 없습니다 :("; "lng_send_folder" = " «{name}»은 폴더이기 때문에 전송 할 수 없습니다 :("; -"lng_forward_choose" = "수신자를 선택하세요.."; +"lng_forward_choose" = "Choose recipient..."; "lng_forward_cant" = "이쪽으로 전달 할 수 없습니다 :("; "lng_forward_confirm" = "{recipient} 님에게 전달하시겠습니까?"; "lng_forward_share_contact" = "{recipient} 님에게 연락처를 공유하시겠습니까?"; @@ -857,7 +863,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_search_global_results" = "아이디 검색 결과"; "lng_media_save_progress" = "{ready} / {total} {mb}"; -"lng_mediaview_save_as" = "다른 이름으로 저장하기"; +"lng_mediaview_save_as" = "Save As..."; "lng_mediaview_copy" = "복사하기"; "lng_mediaview_forward" = "전달"; "lng_mediaview_delete" = "삭제"; diff --git a/Telegram/SourceFiles/langs/lang_nl.strings b/Telegram/SourceFiles/langs/lang_nl.strings index 801c4b822..635693b07 100644 --- a/Telegram/SourceFiles/langs/lang_nl.strings +++ b/Telegram/SourceFiles/langs/lang_nl.strings @@ -86,8 +86,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cancel" = "Annuleren"; "lng_continue" = "Doorgaan"; "lng_close" = "Sluiten"; -"lng_connecting" = "Verbinden"; -"lng_reconnecting" = "Opnieuw verbinden {count:nu|over # s|over # s}"; +"lng_connecting" = "Verbinden..."; +"lng_reconnecting" = "Opnieuw verbinden {count:nu|over # s|over # s}..."; "lng_reconnecting_try_now" = "Probeer nu"; "lng_status_service_notifications" = "servicemeldingen"; @@ -108,7 +108,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_status_lastseen_date" = "laatst gezien {date}"; "lng_status_lastseen_date_time" = "laatst gezien {date} om {time}"; "lng_status_online" = "online"; -"lng_status_connecting" = "verbinden"; +"lng_status_connecting" = "verbinden..."; "lng_chat_status_unaccessible" = "groep is ontoegankelijk"; "lng_chat_status_members" = "{count:geen leden|# lid|# leden}"; @@ -162,7 +162,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_code_telegram" = "Voer de code in die je zojuist\nhebt ontvangen in je vorige [b]Telegram[/b]-app."; "lng_code_no_telegram" = "Verstuur code via SMS"; "lng_code_call" = "Telegram belt je over {minutes}:{seconds}"; -"lng_code_calling" = "Oproepverzoek versturen naar Telegram"; +"lng_code_calling" = "Oproepverzoek naar Telegram..."; "lng_code_called" = "Telegram heeft je nummer gebeld"; "lng_bad_phone" = "Ongeldig telefoonnummer. \nProbeer het opnieuw."; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "Kanaalnaam"; "lng_no_contacts" = "Je hebt geen contacten"; "lng_no_chats" = "Hier komen je chats"; -"lng_contacts_loading" = "Bezig met laden"; +"lng_contacts_loading" = "Laden..."; "lng_contacts_not_found" = "Geen contacten gevonden"; "lng_dlg_search_chat" = "Zoek in deze chat"; "lng_dlg_search_channel" = "Zoek in dit kanaal"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Opslaan"; "lng_settings_upload" = "Profielfoto instellen"; "lng_settings_crop_profile" = "Kies een vierkant voor je profielfoto"; -"lng_settings_uploading_photo" = "Foto uploaden"; +"lng_settings_uploading_photo" = "Foto uploaden..."; "lng_username_title" = "Gebruikersnaam"; "lng_username_about" = "Je kunt hier je gebruikersnaam kiezen. \nHiermee kunnen anderen je vinden \nen contact met je opnemen zonder \nje telefoonnummer te weten.\n\na-z, 0-9 en underscore is toegestaan. \nDe minimale lengte is 5 tekens."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "Automatisch bijwerken"; "lng_settings_current_version" = "Versie {version}"; "lng_settings_check_now" = "Controleer op updates"; -"lng_settings_update_checking" = "Op updates controleren"; +"lng_settings_update_checking" = "Controleren op updates..."; "lng_settings_latest_installed" = "Meest recente versie is geïnstalleerd."; -"lng_settings_downloading" = "Update downloaden {ready} / {total} MB"; +"lng_settings_downloading" = "Update downloaden {ready} / {total} MB..."; "lng_settings_update_ready" = "Nieuwe versie staat klaar"; "lng_settings_update_now" = "Nu herstarten"; "lng_settings_update_fail" = "Controleren op updates mislukt"; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "Download kon niet worden gestart. De oorzaak kan een ongeldige downloadmap zijn.\n\nJe kunt de map aanpassen via instellingen."; "lng_download_path_settings" = "Instellingen"; "lng_download_finish_failed" = "Downloaden mislukt.\n\nWil je het opnieuw proberen?"; -"lng_download_path_clearing" = "Wissen"; +"lng_download_path_clearing" = "Wissen..."; "lng_download_path_cleared" = "Gewist!"; "lng_download_path_clear_failed" = "Wissen mislukt"; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|# afbeelding|# afbeeldingen}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# spraakbericht|# spraakberichten}, {size}"; "lng_local_storage_clear" = "Alles wissen"; -"lng_local_storage_clearing" = "Wissen"; +"lng_local_storage_clearing" = "Wissen..."; "lng_local_storage_cleared" = "Gewist!"; "lng_local_storage_clear_failed" = "Wissen mislukt"; @@ -358,9 +358,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "Wachtwoord is niet gewijzigd"; "lng_connection_type" = "Verbindingstype:"; -"lng_connection_auto_connecting" = "Standaard (verbinden)"; +"lng_connection_auto_connecting" = "Standaard (verbinden...)"; "lng_connection_auto" = "Standaard ({transport} wordt gebruikt)"; -"lng_connection_proxy_connecting" = "Verbinden via proxy.."; +"lng_connection_proxy_connecting" = "Verbinden via proxy..."; "lng_connection_proxy" = "{transport} met proxy"; "lng_connection_header" = "Verbindingstype"; "lng_connection_auto_rb" = "Auto (TCP indien beschikbaar of HTTP)"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "{user} uit de groep verwijderen?"; "lng_profile_sure_kick_channel" = "{user} uit het kanaal verwijderen?"; "lng_profile_sure_kick_admin" = "{user} ontslaan als beheerder?"; -"lng_profile_loading" = "Bezig met laden"; +"lng_profile_loading" = "Laden..."; "lng_profile_shared_media" = "Gedeelde media"; "lng_profile_no_media" = "Geen media in deze chat."; "lng_profile_photos" = "{count:_not_used_|# foto|# foto's} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# gedeelde link|# gedeelde links} »"; "lng_profile_shared_links_header" = "Links-overzicht"; "lng_profile_copy_phone" = "Telefoonnummer kopiëren"; +"lng_profile_copy_fullname" = "Naam kopiëren"; "lng_channel_add_admins" = "Beheerder toevoegen"; "lng_channel_add_members" = "Leden toevoegen"; @@ -662,9 +663,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_count" = "{count:Laden..|# sticker|# stickers}"; "lng_in_dlg_photo" = "Foto"; -"lng_in_dlg_video" = "Video"; +"lng_in_dlg_video" = "Video file"; +"lng_in_dlg_audio_file" = "Audio file"; "lng_in_dlg_contact" = "Contact"; -"lng_in_dlg_audio" = "Geluidsbestand"; +"lng_in_dlg_audio" = "Voice message"; "lng_in_dlg_file" = "Bestand"; "lng_in_dlg_sticker" = "Sticker"; "lng_in_dlg_sticker_emoji" = "{emoji} (sticker)"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "Spam van deze groep echt melden?"; "lng_report_spam_sure_channel" = "Spam van dit kanaal echt melden?"; "lng_report_spam_ok" = "Melden"; -"lng_cant_send_to_not_contact" = "Op dit moment kun je alleen berichten\nversturen naar onderlinge contacten. {more_info}"; -"lng_cant_invite_not_contact" = "Op dit moment kun je alleen onderlinge\ncontacten aan groepen toevoegen. {more_info}"; +"lng_cant_send_to_not_contact" = "Je kunt momenteel alleen berichten\nversturen naar onderlinge contacten.\n{more_info}"; +"lng_cant_invite_not_contact" = "Je kunt momenteel alleen onderlinge\ncontacten aan kanalen toevoegen.\n{more_info}"; "lng_cant_invite_not_contact_channel" = "Je kunt momenteel alleen onderlinge\ncontacten aan kanalen toevoegen.\n{more_info}"; "lng_cant_more_info" = "Meer informatie »"; +"lng_cant_invite_banned" = "Alleen beheerders kunnen deze gebruiker toevoegen."; "lng_cant_invite_privacy" = "Je kunt deze gebruiker niet toevoegen aan groepen door zijn/haar privacyinstellingen."; "lng_cant_invite_privacy_channel" = "Je kunt deze gebruiker niet toevoegen aan kanalen door zijn/haar privacyinstellingen."; +"lng_cant_do_this" = "Deze actie is niet beschikbaar."; "lng_send_button" = "Stuur"; -"lng_message_ph" = "Bericht schrijven"; -"lng_comment_ph" = "Reactie"; -"lng_broadcast_ph" = "Massabericht"; -"lng_broadcast_silent_ph" = "Stil massabericht.."; +"lng_message_ph" = "Bericht..."; +"lng_comment_ph" = "Reactie..."; +"lng_broadcast_ph" = "Massabericht..."; +"lng_broadcast_silent_ph" = "Stil massabericht..."; "lng_record_cancel" = "Annuleren: uit het vak loslaten"; "lng_will_be_notified" = "Berichtgeving voor leden"; "lng_wont_be_notified" = "Geen berichtgeving voor leden"; @@ -721,14 +725,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_action_record_video" = "{user} neemt video op"; "lng_send_action_upload_video" = "video versturen"; "lng_user_action_upload_video" = "{user} verstuurt video"; -"lng_send_action_record_audio" = "geluid opnemen"; -"lng_user_action_record_audio" = "{user} neemt geluid op"; -"lng_send_action_upload_audio" = "geluid versturen"; -"lng_user_action_upload_audio" = "{user} verstuurt geluid"; +"lng_send_action_record_audio" = "spraakbericht opnemen"; +"lng_user_action_record_audio" = "{user} neemt spraakbericht op"; +"lng_send_action_upload_audio" = "spraakbericht versturen"; +"lng_user_action_upload_audio" = "{user} verstuurt spraakbericht"; "lng_send_action_upload_photo" = "foto versturen"; "lng_user_action_upload_photo" = "{user} verstuurt een foto"; "lng_send_action_upload_file" = "bestand versturen"; -"lng_user_action_upload_file" = "{user} verstuurt een bestand"; +"lng_user_action_upload_file" = "{user} verstuurt bestand"; "lng_send_action_geo_location" = "locatie kiezen"; "lng_user_action_geo_location" = "{user} kiest een locatie"; "lng_send_action_choose_contact" = "contact kiezen"; @@ -737,8 +741,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_maps_point" = "Locatie"; "lng_save_photo" = "Afbeelding opslaan"; -"lng_save_video" = "Video opslaan"; -"lng_save_audio" = "Geluidsbestand opslaan"; +"lng_save_video" = "Save video file"; +"lng_save_audio_file" = "Save audio file"; +"lng_save_audio" = "Save voice message"; "lng_save_file" = "Bestand opslaan"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "E-mailadres kopiëren"; "lng_context_copy_hashtag" = "Hashtag kopiëren"; "lng_context_copy_mention" = "Gebruikersnaam kopiëren"; -"lng_context_save_image" = "Afbeelding opslaan als"; +"lng_context_save_image" = "Afbeelding opslaan als..."; "lng_context_forward_image" = "Afbeelding doorsturen"; "lng_context_delete_image" = "Afbeelding verwijderen"; "lng_context_copy_image" = "Afbeelding kopiëren"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Download annuleren"; "lng_context_show_in_folder" = "Weergeven in map"; "lng_context_show_in_finder" = "Weergeven in Finder"; -"lng_context_save_video" = "Video opslaan als"; -"lng_context_save_audio" = "Geluidsbestand opslaan als"; +"lng_context_save_video" = "Save Video File As..."; +"lng_context_save_audio_file" = "Save Audio File As..."; +"lng_context_save_audio" = "Save Voice Message As..."; "lng_context_pack_info" = "Bundelinformatie"; "lng_context_pack_add" = "Stickers toevoegen"; -"lng_context_save_file" = "Bestand opslaan als"; +"lng_context_save_file" = "Bestand opslaan als..."; "lng_context_forward_file" = "Bestand doorsturen"; "lng_context_delete_file" = "Bestand verwijderen"; "lng_context_close_file" = "Bestand sluiten"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "Dit bestand is groter dan 1,5 GB en kan niet worden verstuurd :("; "lng_send_folder" = "Kan de map «{name}» niet versturen, kies een bestand. :("; -"lng_forward_choose" = "Ontvanger kiezen"; +"lng_forward_choose" = "Ontvanger kiezen..."; "lng_forward_cant" = "Sorry, doorsturen hierheen kan niet :("; "lng_forward_confirm" = "Doorsturen naar {recipient}?"; "lng_forward_share_contact" = "Contact delen met {recipient}?"; @@ -857,7 +863,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_search_global_results" = "Wereldwijde zoekresultaten"; "lng_media_save_progress" = "{ready} van {total} {mb}"; -"lng_mediaview_save_as" = "Opslaan als"; +"lng_mediaview_save_as" = "Opslaan als..."; "lng_mediaview_copy" = "Kopiëren"; "lng_mediaview_forward" = "Doorsturen"; "lng_mediaview_delete" = "Verwijder"; diff --git a/Telegram/SourceFiles/langs/lang_pt_BR.strings b/Telegram/SourceFiles/langs/lang_pt_BR.strings index e0e255d99..2113785ed 100644 --- a/Telegram/SourceFiles/langs/lang_pt_BR.strings +++ b/Telegram/SourceFiles/langs/lang_pt_BR.strings @@ -87,7 +87,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_continue" = "Continuar"; "lng_close" = "Fechar"; "lng_connecting" = "Conectando..."; -"lng_reconnecting" = "Reconectar {count:agora|em # s|em # s}.."; +"lng_reconnecting" = "Reconectar {count:agora|em # s|em # s}..."; "lng_reconnecting_try_now" = "Tentar agora"; "lng_status_service_notifications" = "notificações de serviço"; @@ -127,7 +127,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_edit_deleted" = "Essa mensagem foi apagada"; "lng_edit_too_long" = "Sua mensagem está muito longa"; "lng_edit_message" = "Editar mensagem"; -"lng_edit_message_text" = "Nova mensagem..."; +"lng_edit_message_text" = "Nova mensagem de texto..."; "lng_deleted" = "Desconhecido"; "lng_deleted_message" = "Mensagem apagada"; "lng_pinned_message" = "Mensagem fixada"; @@ -201,7 +201,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_dlg_new_channel_name" = "Nome do canal"; "lng_no_contacts" = "Você não possui contatos"; "lng_no_chats" = "Seus chats estarão aqui"; -"lng_contacts_loading" = "Carregando.."; +"lng_contacts_loading" = "Carregando..."; "lng_contacts_not_found" = "Nenhum contato encontrado"; "lng_dlg_search_chat" = "Buscar nesse chat"; "lng_dlg_search_channel" = "Buscar nesse canal"; @@ -210,7 +210,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_save" = "Salvar"; "lng_settings_upload" = "Definir Foto de Perfil"; "lng_settings_crop_profile" = "Selecione uma área para a foto do perfil"; -"lng_settings_uploading_photo" = "Carregando foto.."; +"lng_settings_uploading_photo" = "Carregando foto..."; "lng_username_title" = "Nome de usuário"; "lng_username_about" = "Você pode escolher um nome de usuário no Telegram.\nAssim, outras pessoas poderão te encontrar\npelo nome de usuário e entrar em contato\nsem precisar saber seu telefone.\n\nVocê pode usar a-z, 0-9 e underline.\nO tamanho mínimo é 5 caracteres."; @@ -247,9 +247,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_auto_update" = "Atualizar automaticamente"; "lng_settings_current_version" = "Versão {version}"; "lng_settings_check_now" = "Verificar atualizações"; -"lng_settings_update_checking" = "Verificando atualizações"; +"lng_settings_update_checking" = "Verificando atualizações..."; "lng_settings_latest_installed" = "Última versão está instalada"; -"lng_settings_downloading" = "Baixando atualização {ready} / {total} MB.."; +"lng_settings_downloading" = "Baixando atualização {ready} / {total} MB..."; "lng_settings_update_ready" = "Nova versão está pronta"; "lng_settings_update_now" = "Reiniciar Agora"; "lng_settings_update_fail" = "Verificação de atualização falhou :("; @@ -291,7 +291,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_download_path_failed" = "Download do arquivo não pôde iniciar. Isso pode ter acontecido por um problema na pasta de downlaod.\n\nVocê pode alterar o caminho dos downloads em Configurações."; "lng_download_path_settings" = "Configurações"; "lng_download_finish_failed" = "Arquivo baixado não pôde ser finalizado.\n\nGostaria de tentar novamente?"; -"lng_download_path_clearing" = "Limpando.."; +"lng_download_path_clearing" = "Limpando..."; "lng_download_path_cleared" = "Concluído!"; "lng_download_path_clear_failed" = "Limpeza falhou :("; @@ -300,7 +300,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_settings_images_cached" = "{count:_not_used_|# imagem|# imagens}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# mensagem de voz|# mensagens de voz}, {size}"; "lng_local_storage_clear" = "Limpar tudo"; -"lng_local_storage_clearing" = "Limpando.."; +"lng_local_storage_clearing" = "Limpando..."; "lng_local_storage_cleared" = "Concluído!"; "lng_local_storage_clear_failed" = "Limpeza falhou :("; @@ -331,7 +331,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_passcode_logout" = "Sair"; "lng_passcode_need_unblock" = "Você precisa me desbloquear primeiro."; -"lng_cloud_password_waiting" = "Link de confirmação enviado para {email}.."; +"lng_cloud_password_waiting" = "Link de confirmação enviado para {email}..."; "lng_cloud_password_change" = "Alterar senha da nuvem"; "lng_cloud_password_create" = "Senha da nuvem"; "lng_cloud_password_remove" = "Remover senha da nuvem"; @@ -358,7 +358,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_cloud_password_is_same" = "Senha não alterada"; "lng_connection_type" = "Tipo de conexão:"; -"lng_connection_auto_connecting" = "Padrão (conectando..)"; +"lng_connection_auto_connecting" = "Padrão (conectando...)"; "lng_connection_auto" = "Padrão ({transport} usado)"; "lng_connection_proxy_connecting" = "Conectando via proxy..."; "lng_connection_proxy" = "{transport} com proxy"; @@ -396,7 +396,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_sessions_other_desc" = "Você pode entrar no Telegram de outro celular, tablet e computadores, usando o mesmo número de telefone. Todos seus dados estarão sincronizados."; "lng_sessions_terminate_all" = "Encerrar todas as outras sessões"; -"lng_preview_loading" = "Obtendo informações.."; +"lng_preview_loading" = "Obtendo Informações do Link..."; "lng_profile_chat_unaccessible" = "Grupo inacessível"; "lng_topbar_info" = "Info"; @@ -439,7 +439,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_sure_kick" = "Remover {user} do grupo?"; "lng_profile_sure_kick_channel" = "Remover {user} do canal?"; "lng_profile_sure_kick_admin" = "Remover {user} dos administradores?"; -"lng_profile_loading" = "Carregando.."; +"lng_profile_loading" = "Carregando..."; "lng_profile_shared_media" = "Mídia compartilhada"; "lng_profile_no_media" = "Nenhuma mídia nessa conversa."; "lng_profile_photos" = "{count:_not_used_|# foto|# fotos} »"; @@ -455,6 +455,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_profile_shared_links" = "{count:_not_used_|# link|# links} »"; "lng_profile_shared_links_header" = "Links"; "lng_profile_copy_phone" = "Copiar número de telefone"; +"lng_profile_copy_fullname" = "Copiar nome"; "lng_channel_add_admins" = "Novo administrador"; "lng_channel_add_members" = "Adicionar membros"; @@ -659,12 +660,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_stickers_remove" = "Remover"; "lng_stickers_return" = "Desfazer"; "lng_stickers_restore" = "Restaurar"; -"lng_stickers_count" = "{count:Carregando..|# sticker|# stickers}"; +"lng_stickers_count" = "{count:Carregando...|# sticker|# stickers}"; "lng_in_dlg_photo" = "Foto"; "lng_in_dlg_video" = "Vídeo"; +"lng_in_dlg_audio_file" = "Áudio"; "lng_in_dlg_contact" = "Contato"; -"lng_in_dlg_audio" = "Áudio"; +"lng_in_dlg_audio" = "Mensagem de voz"; "lng_in_dlg_file" = "Arquivo"; "lng_in_dlg_sticker" = "Sticker"; "lng_in_dlg_sticker_emoji" = "{emoji} (sticker)"; @@ -678,18 +680,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_report_spam_sure_group" = "Tem certeza que deseja reportar spam desse grupo?"; "lng_report_spam_sure_channel" = "Tem certeza que deseja reportar spam desse canal?"; "lng_report_spam_ok" = "Reportar"; -"lng_cant_send_to_not_contact" = "Você só pode enviar mensagens para\ncontatos mútuos no momento. {more_info}"; -"lng_cant_invite_not_contact" = "Você só pode adicionar contatos\nmútuos ao grupo no momento. {more_info}"; -"lng_cant_invite_not_contact_channel" = "Desculpe, você só pode adicionar contatos\nmútuos para canais no momento. {more_info}"; +"lng_cant_send_to_not_contact" = "Desculpe, você só pode enviar mensagens\npara contatos mútuos no momento.\n{more_info}"; +"lng_cant_invite_not_contact" = "Desculpe, no momento você só pode adicionar\ncontatos mútuos em grupos.\n{more_info}"; +"lng_cant_invite_not_contact_channel" = "Desculpe, no momento você só pode adicionar\ncontatos mútuos nos canais.\n{more_info}"; "lng_cant_more_info" = "Informações »"; +"lng_cant_invite_banned" = "Apenas um administrador pode adicionar esse usuário."; "lng_cant_invite_privacy" = "Você não pode adicionar esse usuário em grupos devido as configurações de privacidade."; "lng_cant_invite_privacy_channel" = "Você não pode adicionar esse usuário em canais devido as configurações de privacidade."; +"lng_cant_do_this" = "Essa ação não está disponível."; "lng_send_button" = "Enviar"; -"lng_message_ph" = "Escrever a mensagem.."; +"lng_message_ph" = "Escrever uma mensagem..."; "lng_comment_ph" = "Escreva um comentário..."; -"lng_broadcast_ph" = "Transmitir a mensagem..."; -"lng_broadcast_silent_ph" = "Silenciar transmissão..."; +"lng_broadcast_ph" = "Transmitir uma mensagem..."; +"lng_broadcast_silent_ph" = "Transmissão silenciosa..."; "lng_record_cancel" = "Solte fora desse campo para cancelar"; "lng_will_be_notified" = "Os membros serão notificados quando você postar"; "lng_wont_be_notified" = "Os membros não serão notificados quando você postar"; @@ -717,28 +721,29 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_user_typing" = "{user} está escrevendo"; "lng_users_typing" = "{user} e {second_user} estão escrevendo"; "lng_many_typing" = "{count:_not_used_|# está|# estão} escrevendo"; -"lng_send_action_record_video" = "gravando vídeo"; -"lng_user_action_record_video" = "{user} está gravando vídeo"; -"lng_send_action_upload_video" = "enviando vídeo"; -"lng_user_action_upload_video" = "{user} está enviando vídeo"; -"lng_send_action_record_audio" = "gravando áudio"; -"lng_user_action_record_audio" = "{user} está gravando áudio"; -"lng_send_action_upload_audio" = "enviando áudio"; -"lng_user_action_upload_audio" = "{user} está gravando áudio"; -"lng_send_action_upload_photo" = "enviando foto"; -"lng_user_action_upload_photo" = "{user} está enviando foto"; -"lng_send_action_upload_file" = "enviando arquivo"; -"lng_user_action_upload_file" = "{user} está enviando arquivo"; -"lng_send_action_geo_location" = "escolhendo local"; -"lng_user_action_geo_location" = "{user} está escolhendo local"; -"lng_send_action_choose_contact" = "escolhendo contato"; -"lng_user_action_choose_contact" = "{user} está escolhendo contato"; +"lng_send_action_record_video" = "gravando um vídeo"; +"lng_user_action_record_video" = "{user} está gravando um vídeo"; +"lng_send_action_upload_video" = "enviando um vídeo"; +"lng_user_action_upload_video" = "{user} está enviando um vídeo"; +"lng_send_action_record_audio" = "gravando uma mensagem de voz"; +"lng_user_action_record_audio" = "{user} está gravando um áudio"; +"lng_send_action_upload_audio" = "enviando uma mensagem de voz"; +"lng_user_action_upload_audio" = "{user} está enviando um áudio"; +"lng_send_action_upload_photo" = "enviando uma foto"; +"lng_user_action_upload_photo" = "{user} está enviando uma foto"; +"lng_send_action_upload_file" = "enviando um arquivo"; +"lng_user_action_upload_file" = "{user} está enviando um arquivo"; +"lng_send_action_geo_location" = "escolhendo uma localização"; +"lng_user_action_geo_location" = "{user} está escolhendo uma localização"; +"lng_send_action_choose_contact" = "escolhendo um contato"; +"lng_user_action_choose_contact" = "{user} está escolhendo um contato"; "lng_unread_bar" = "{count:_not_used_|# mensagem não lida|# mensagens não lidas}"; "lng_maps_point" = "Localização"; "lng_save_photo" = "Salvar imagem"; "lng_save_video" = "Salvar vídeo"; -"lng_save_audio" = "Salvar áudio"; +"lng_save_audio_file" = "Salvar áudio"; +"lng_save_audio" = "Salvar mensagens de voz"; "lng_save_file" = "Salvar arquivo"; "lng_save_downloaded" = "{ready} / {total} {mb}"; "lng_duration_and_size" = "{duration}, {size}"; @@ -755,7 +760,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_copy_email" = "Copiar endereço de email"; "lng_context_copy_hashtag" = "Copiar hashtag"; "lng_context_copy_mention" = "Copiar nome de usuário"; -"lng_context_save_image" = "Salvar Imagem Como.."; +"lng_context_save_image" = "Salvar Imagem Como..."; "lng_context_forward_image" = "Encaminhar Imagem"; "lng_context_delete_image" = "Apagar Imagem"; "lng_context_copy_image" = "Copiar Imagem"; @@ -763,11 +768,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_context_cancel_download" = "Cancelar Download"; "lng_context_show_in_folder" = "Mostrar na Pasta"; "lng_context_show_in_finder" = "Mostrar no Finder"; -"lng_context_save_video" = "Salvar Vídeo Como.."; -"lng_context_save_audio" = "Salvar Áudio Como.."; +"lng_context_save_video" = "Salvar Vídeo Como..."; +"lng_context_save_audio_file" = "Salvar Áudio Como..."; +"lng_context_save_audio" = "Salvar Mensagem de Voz Como..."; "lng_context_pack_info" = "Informação do pacote"; "lng_context_pack_add" = "Adicionar aos Stickers"; -"lng_context_save_file" = "Salvar Arquivo Como.."; +"lng_context_save_file" = "Salvar Arquivo Como..."; "lng_context_forward_file" = "Encaminhar Arquivo"; "lng_context_delete_file" = "Apagar Arquivo"; "lng_context_close_file" = "Fechar Arquivo"; @@ -794,7 +800,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_send_image_too_large" = "Não pude enviar, o arquivo é maior que 1.5GB :("; "lng_send_folder" = "Não pude enviar «{name}» porque é um diretório :("; -"lng_forward_choose" = "Escolher recipiente.."; +"lng_forward_choose" = "Escolher recipiente..."; "lng_forward_cant" = "Desculpe, não há como encaminhar aqui :("; "lng_forward_confirm" = "Encaminhar para {recipient}?"; "lng_forward_share_contact" = "Compartilhar contato com {recipient}?"; @@ -857,7 +863,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org "lng_search_global_results" = "Resultados da busca global"; "lng_media_save_progress" = "{ready} de {total} {mb}"; -"lng_mediaview_save_as" = "Salvar Como.."; +"lng_mediaview_save_as" = "Salvar Como..."; "lng_mediaview_copy" = "Copiar"; "lng_mediaview_forward" = "Encaminhar"; "lng_mediaview_delete" = "Apagar"; diff --git a/Telegram/SourceFiles/layout.cpp b/Telegram/SourceFiles/layout.cpp index 31605b763..794d81de5 100644 --- a/Telegram/SourceFiles/layout.cpp +++ b/Telegram/SourceFiles/layout.cpp @@ -293,9 +293,10 @@ void LayoutAbstractFileItem::setStatusSize(int32 newSize, int32 fullSize, int32 } } -LayoutOverviewDate::LayoutOverviewDate(const QDate &date, bool month) : LayoutItem(OverviewItemInfo::Bit()) +LayoutOverviewDate::LayoutOverviewDate(const QDate &date, bool month) : LayoutItem() , _date(date) , _text(month ? langMonthFull(date) : langDayOfMonthFull(date)) { + AddComponents(OverviewItemInfo::Bit()); } void LayoutOverviewDate::initDimensions() { @@ -311,7 +312,7 @@ void LayoutOverviewDate::paint(Painter &p, const QRect &clip, uint32 selection, } } -LayoutOverviewPhoto::LayoutOverviewPhoto(PhotoData *photo, HistoryItem *parent) : LayoutMediaItem(0, parent) +LayoutOverviewPhoto::LayoutOverviewPhoto(PhotoData *photo, HistoryItem *parent) : LayoutMediaItem(parent) , _data(photo) , _link(new PhotoLink(photo)) , _goodLoaded(false) { @@ -385,7 +386,7 @@ void LayoutOverviewPhoto::getState(TextLinkPtr &link, HistoryCursorState &cursor } } -LayoutOverviewVideo::LayoutOverviewVideo(DocumentData *video, HistoryItem *parent) : LayoutAbstractFileItem(0, parent) +LayoutOverviewVideo::LayoutOverviewVideo(DocumentData *video, HistoryItem *parent) : LayoutAbstractFileItem(parent) , _data(video) , _duration(formatDurationText(_data->duration())) , _thumbLoaded(false) { @@ -533,7 +534,7 @@ void LayoutOverviewVideo::updateStatusText() const { statusSize = _data->uploadOffset; } else if (_data->loading()) { statusSize = _data->loadOffset(); - } else if (!_data->already().isEmpty()) { + } else if (_data->loaded()) { statusSize = FileStatusSizeLoaded; } else { statusSize = FileStatusSizeReady; @@ -549,9 +550,11 @@ void LayoutOverviewVideo::updateStatusText() const { } } -LayoutOverviewVoice::LayoutOverviewVoice(DocumentData *voice, HistoryItem *parent) : LayoutAbstractFileItem(OverviewItemInfo::Bit(), parent) +LayoutOverviewVoice::LayoutOverviewVoice(DocumentData *voice, HistoryItem *parent) : LayoutAbstractFileItem(parent) , _data(voice) , _namel(new DocumentOpenLink(_data)) { + AddComponents(OverviewItemInfo::Bit()); + t_assert(_data->voice() != 0); setLinks(new DocumentOpenLink(_data), new DocumentOpenLink(_data), new DocumentCancelLink(_data)); @@ -741,7 +744,7 @@ bool LayoutOverviewVoice::updateStatusText() const { return showPause; } -LayoutOverviewDocument::LayoutOverviewDocument(DocumentData *document, HistoryItem *parent) : LayoutAbstractFileItem(OverviewItemInfo::Bit(), parent) +LayoutOverviewDocument::LayoutOverviewDocument(DocumentData *document, HistoryItem *parent) : LayoutAbstractFileItem(parent) , _data(document) , _msgl(new MessageLink(parent)) , _namel(new DocumentOpenLink(_data)) @@ -751,6 +754,8 @@ LayoutOverviewDocument::LayoutOverviewDocument(DocumentData *document, HistoryIt , _namew(st::semiboldFont->width(_name)) , _datew(st::normalFont->width(_date)) , _colorIndex(documentColorIndex(_data, _ext)) { + AddComponents(OverviewItemInfo::Bit()); + setLinks(new DocumentOpenLink(_data), new DocumentSaveLink(_data), new DocumentCancelLink(_data)); setStatusSize(FileStatusSizeReady, _data->size, _data->song() ? _data->song()->duration : -1, 0); @@ -866,7 +871,9 @@ void LayoutOverviewDocument::paint(Painter &p, const QRect &clip, uint32 selecti if (_data->thumb->loaded()) { if (_thumb.isNull() || loaded != _thumbForLoaded) { _thumbForLoaded = loaded; - _thumb = _data->thumb->pixNoCache(_thumbw, 0, true, !_thumbForLoaded, false, st::overviewFileSize, st::overviewFileSize); + ImagePixOptions options = ImagePixSmooth; + if (!_thumbForLoaded) options |= ImagePixBlurred; + _thumb = _data->thumb->pixNoCache(_thumbw, 0, options, st::overviewFileSize, st::overviewFileSize); } p.drawPixmap(rthumb.topLeft(), _thumb); } else { @@ -1064,12 +1071,9 @@ namespace { } } -LayoutOverviewLink::LayoutOverviewLink(HistoryMedia *media, HistoryItem *parent) : LayoutMediaItem(OverviewItemInfo::Bit(), parent) -, _titlew(0) -, _page(0) -, _pixw(0) -, _pixh(0) -, _text(st::msgMinWidth) { +LayoutOverviewLink::LayoutOverviewLink(HistoryMedia *media, HistoryItem *parent) : LayoutMediaItem(parent) { + AddComponents(OverviewItemInfo::Bit()); + QString text = _parent->originalText(); EntitiesInText entities = _parent->originalEntities(); @@ -1322,7 +1326,7 @@ LayoutOverviewLink::Link::Link(const QString &url, const QString &text) , lnk(linkFromUrl(url)) { } -LayoutInlineItem::LayoutInlineItem(InlineResult *result, DocumentData *doc, PhotoData *photo) : LayoutItem(0) +LayoutInlineItem::LayoutInlineItem(InlineResult *result, DocumentData *doc, PhotoData *photo) : LayoutItem() , _result(result) , _doc(doc) , _photo(photo) @@ -1574,7 +1578,7 @@ void LayoutInlineGif::prepareThumb(int32 width, int32 height, const QSize &frame if (doc && !doc->thumb->isNull()) { if (doc->thumb->loaded()) { if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) { - _thumb = doc->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height); + _thumb = doc->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), ImagePixSmooth, width, height); } } else { doc->thumb->load(); @@ -1582,7 +1586,7 @@ void LayoutInlineGif::prepareThumb(int32 width, int32 height, const QSize &frame } else if (_result && !_result->thumb_url.isEmpty()) { if (_result->thumb->loaded()) { if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) { - _thumb = _result->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height); + _thumb = _result->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), ImagePixSmooth, width, height); } } else { _result->thumb->load(); @@ -1792,13 +1796,13 @@ void LayoutInlinePhoto::prepareThumb(int32 width, int32 height, const QSize &fra if (photo) { if (photo->medium->loaded()) { if (!_thumbLoaded || _thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) { - _thumb = photo->medium->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height); + _thumb = photo->medium->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), ImagePixSmooth, width, height); } _thumbLoaded = true; } else { if (photo->thumb->loaded()) { if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) { - _thumb = photo->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height); + _thumb = photo->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), ImagePixSmooth, width, height); } } photo->medium->load(); @@ -1806,7 +1810,7 @@ void LayoutInlinePhoto::prepareThumb(int32 width, int32 height, const QSize &fra } else { if (_result->thumb->loaded()) { if (_thumb.width() != width * cIntRetinaFactor() || _thumb.height() != height * cIntRetinaFactor()) { - _thumb = _result->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), true, false, false, width, height); + _thumb = _result->thumb->pixNoCache(frame.width() * cIntRetinaFactor(), frame.height() * cIntRetinaFactor(), ImagePixSmooth, width, height); } } else { _result->thumb->load(); @@ -1933,7 +1937,7 @@ void LayoutInlineWebVideo::prepareThumb(int32 width, int32 height) const { w = width; } } - _thumb = _result->thumb->pixNoCache(w * cIntRetinaFactor(), h * cIntRetinaFactor(), true, false, false, width, height); + _thumb = _result->thumb->pixNoCache(w * cIntRetinaFactor(), h * cIntRetinaFactor(), ImagePixSmooth, width, height); } } else { _result->thumb->load(); @@ -2081,7 +2085,7 @@ void LayoutInlineArticle::prepareThumb(int32 width, int32 height) const { w = width; } } - _thumb = _result->thumb->pixNoCache(w * cIntRetinaFactor(), h * cIntRetinaFactor(), true, false, false, width, height); + _thumb = _result->thumb->pixNoCache(w * cIntRetinaFactor(), h * cIntRetinaFactor(), ImagePixSmooth, width, height); } } else { _result->thumb->load(); diff --git a/Telegram/SourceFiles/layout.h b/Telegram/SourceFiles/layout.h index 9cd624127..a91d83bb2 100644 --- a/Telegram/SourceFiles/layout.h +++ b/Telegram/SourceFiles/layout.h @@ -101,10 +101,11 @@ public: }; class LayoutMediaItem; -class LayoutItem : public Interfaces { +class LayoutItem : public Composer { public: - LayoutItem(uint64 i_mask) : Interfaces(i_mask), _maxw(0), _minh(0) { + LayoutItem() { } + LayoutItem &operator=(const LayoutItem &) = delete; int32 maxWidth() const { return _maxw; @@ -167,14 +168,16 @@ public: } protected: - int32 _width, _height, _maxw, _minh; - LayoutItem &operator=(const LayoutItem &); + int _width = 0; + int _height = 0; + int _maxw = 0; + int _minh = 0; }; class LayoutMediaItem : public LayoutItem { public: - LayoutMediaItem(uint64 i_mask, HistoryItem *parent) : LayoutItem(i_mask), _parent(parent) { + LayoutMediaItem(HistoryItem *parent) : _parent(parent) { } virtual LayoutMediaItem *toLayoutMediaItem() { @@ -194,7 +197,7 @@ protected: class LayoutRadialProgressItem : public LayoutMediaItem { public: - LayoutRadialProgressItem(uint64 i_mask, HistoryItem *parent) : LayoutMediaItem(i_mask, parent) + LayoutRadialProgressItem(HistoryItem *parent) : LayoutMediaItem(parent) , _radial(0) , a_iconOver(0, 0) , _a_iconOver(animation(this, &LayoutRadialProgressItem::step_iconOver)) { @@ -240,7 +243,7 @@ private: class LayoutAbstractFileItem : public LayoutRadialProgressItem { public: - LayoutAbstractFileItem(uint64 i_mask, HistoryItem *parent) : LayoutRadialProgressItem(i_mask, parent) { + LayoutAbstractFileItem(HistoryItem *parent) : LayoutRadialProgressItem(parent) { } protected: @@ -268,19 +271,19 @@ public: }; -class OverviewItemInfo : public BasicInterface { +class OverviewItemInfo : public BaseComponent { public: - OverviewItemInfo(Interfaces *) : _top(0) { + OverviewItemInfo(Composer*) { } - int32 top() const { + int top() const { return _top; } - void setTop(int32 top) { + void setTop(int top) { _top = top; } private: - int32 _top; + int _top = 0; }; @@ -440,10 +443,11 @@ private: TextLinkPtr _photol; QString _title, _letter; - int32 _titlew; - WebPageData *_page; - int32 _pixw, _pixh; - Text _text; + int _titlew = 0; + WebPageData *_page = nullptr; + int _pixw = 0; + int _pixh = 0; + Text _text = { int(st::msgMinWidth) }; struct Link { Link() : width(0) { diff --git a/Telegram/SourceFiles/localimageloader.cpp b/Telegram/SourceFiles/localimageloader.cpp index 4ce85fa75..7ae676ce2 100644 --- a/Telegram/SourceFiles/localimageloader.cpp +++ b/Telegram/SourceFiles/localimageloader.cpp @@ -171,7 +171,7 @@ void TaskQueueWorker::onTaskAdded() { _inTaskAdded = false; } -FileLoadTask::FileLoadTask(const QString &filepath, PrepareMediaType type, const FileLoadTo &to, FileLoadForceConfirmType confirm) : _id(MTP::nonce()) +FileLoadTask::FileLoadTask(const QString &filepath, PrepareMediaType type, const FileLoadTo &to, FileLoadForceConfirmType confirm) : _id(rand_value()) , _to(to) , _filepath(filepath) , _duration(0) @@ -180,7 +180,7 @@ FileLoadTask::FileLoadTask(const QString &filepath, PrepareMediaType type, const , _result(0) { } -FileLoadTask::FileLoadTask(const QByteArray &content, PrepareMediaType type, const FileLoadTo &to) : _id(MTP::nonce()) +FileLoadTask::FileLoadTask(const QByteArray &content, PrepareMediaType type, const FileLoadTo &to) : _id(rand_value()) , _to(to) , _content(content) , _duration(0) @@ -189,7 +189,7 @@ FileLoadTask::FileLoadTask(const QByteArray &content, PrepareMediaType type, con , _result(0) { } -FileLoadTask::FileLoadTask(const QImage &image, PrepareMediaType type, const FileLoadTo &to, FileLoadForceConfirmType confirm, const QString &originalText) : _id(MTP::nonce()) +FileLoadTask::FileLoadTask(const QImage &image, PrepareMediaType type, const FileLoadTo &to, FileLoadForceConfirmType confirm, const QString &originalText) : _id(rand_value()) , _to(to) , _image(image) , _duration(0) @@ -199,7 +199,7 @@ FileLoadTask::FileLoadTask(const QImage &image, PrepareMediaType type, const Fil , _result(0) { } -FileLoadTask::FileLoadTask(const QByteArray &voice, int32 duration, const VoiceWaveform &waveform, const FileLoadTo &to) : _id(MTP::nonce()) +FileLoadTask::FileLoadTask(const QByteArray &voice, int32 duration, const VoiceWaveform &waveform, const FileLoadTo &to) : _id(rand_value()) , _to(to) , _content(voice) , _duration(duration) @@ -323,7 +323,7 @@ void FileLoadTask::process() { thumb = full; thumbSize = MTP_photoSize(MTP_string(""), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)); - thumbId = MTP::nonce(); + thumbId = rand_value(); } } } @@ -350,7 +350,7 @@ void FileLoadTask::process() { thumb = full; thumbSize = MTP_photoSize(MTP_string(""), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)); - thumbId = MTP::nonce(); + thumbId = rand_value(); if (filename.endsWith(qstr(".mp4"), Qt::CaseInsensitive)) { filemime = qstr("video/mp4"); @@ -406,12 +406,12 @@ void FileLoadTask::process() { thumb = full; thumbSize = MTP_photoSize(MTP_string(""), MTP_fileLocationUnavailable(MTP_long(0), MTP_int(0), MTP_long(0)), MTP_int(full.width()), MTP_int(full.height()), MTP_int(0)); - thumbId = MTP::nonce(); + thumbId = rand_value(); } } if (voice) { - attributes[0] = MTP_documentAttributeAudio(MTP_int(MTPDdocumentAttributeAudio::flag_voice | MTPDdocumentAttributeAudio::flag_waveform), MTP_int(_duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(_waveform))); + attributes[0] = MTP_documentAttributeAudio(MTP_flags(MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform), MTP_int(_duration), MTPstring(), MTPstring(), MTP_string(documentWaveformEncode5bit(_waveform))); attributes.resize(1); document = MTP_document(MTP_long(_id), MTP_long(0), MTP_int(unixtime()), MTP_string(filemime), MTP_int(filesize), thumbSize, MTP_int(MTP::maindc()), MTP_vector(attributes)); } else { diff --git a/Telegram/SourceFiles/localimageloader.h b/Telegram/SourceFiles/localimageloader.h index 6e6b5a0ee..49266a7a8 100644 --- a/Telegram/SourceFiles/localimageloader.h +++ b/Telegram/SourceFiles/localimageloader.h @@ -29,13 +29,13 @@ enum PrepareMediaType { }; struct ToPrepareMedia { - ToPrepareMedia(const QString &file, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(MTP::nonce()), file(file), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { + ToPrepareMedia(const QString &file, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(rand_value()), file(file), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { } - ToPrepareMedia(const QImage &img, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(MTP::nonce()), img(img), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { + ToPrepareMedia(const QImage &img, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(rand_value()), img(img), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { } - ToPrepareMedia(const QByteArray &data, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(MTP::nonce()), data(data), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { + ToPrepareMedia(const QByteArray &data, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(rand_value()), data(data), peer(peer), type(t), duration(0), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { } - ToPrepareMedia(const QByteArray &data, int32 duration, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(MTP::nonce()), data(data), peer(peer), type(t), duration(duration), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { + ToPrepareMedia(const QByteArray &data, int32 duration, const PeerId &peer, PrepareMediaType t, bool broadcast, bool ctrlShiftEnter, MsgId replyTo) : id(rand_value()), data(data), peer(peer), type(t), duration(duration), ctrlShiftEnter(ctrlShiftEnter), replyTo(replyTo) { } PhotoId id; QString file; diff --git a/Telegram/SourceFiles/localstorage.cpp b/Telegram/SourceFiles/localstorage.cpp index 118ba1c92..035b1b5a3 100644 --- a/Telegram/SourceFiles/localstorage.cpp +++ b/Telegram/SourceFiles/localstorage.cpp @@ -19,8 +19,11 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" + #include "localstorage.h" +#include + #include "mainwidget.h" #include "window.h" #include "lang.h" @@ -110,7 +113,7 @@ namespace { path.reserve(base.size() + 0x11); path += base; do { - result = MTP::nonce(); + result = rand_value(); path.resize(base.size()); path += toFilePart(result); } while (!result || keyAlreadyUsed(path, options)); @@ -157,8 +160,8 @@ namespace { QByteArray _settingsSalt, _passKeySalt, _passKeyEncrypted; - mtpAuthKey _oldKey, _settingsKey, _passKey, _localKey; - void createLocalKey(const QByteArray &pass, QByteArray *salt, mtpAuthKey *result) { + MTP::AuthKey _oldKey, _settingsKey, _passKey, _localKey; + void createLocalKey(const QByteArray &pass, QByteArray *salt, MTP::AuthKey *result) { uchar key[LocalEncryptKeySize] = { 0 }; int32 iterCount = pass.size() ? LocalEncryptIterCount : LocalEncryptNoPwdIterCount; // dont slow down for no password QByteArray newSalt; @@ -279,7 +282,7 @@ namespace { return true; } - static QByteArray prepareEncrypted(EncryptedDescriptor &data, const mtpAuthKey &key = _localKey) { + static QByteArray prepareEncrypted(EncryptedDescriptor &data, const MTP::AuthKey &key = _localKey) { data.finish(); QByteArray &toEncrypt(data.data); @@ -293,11 +296,11 @@ namespace { *(uint32*)toEncrypt.data() = size; QByteArray encrypted(0x10 + fullSize, Qt::Uninitialized); // 128bit of sha1 - key128, sizeof(data), data hashSha1(toEncrypt.constData(), toEncrypt.size(), encrypted.data()); - aesEncryptLocal(toEncrypt.constData(), encrypted.data() + 0x10, fullSize, &key, encrypted.constData()); + MTP::aesEncryptLocal(toEncrypt.constData(), encrypted.data() + 0x10, fullSize, &key, encrypted.constData()); return encrypted; } - bool writeEncrypted(EncryptedDescriptor &data, const mtpAuthKey &key = _localKey) { + bool writeEncrypted(EncryptedDescriptor &data, const MTP::AuthKey &key = _localKey) { return writeData(prepareEncrypted(data, key)); } void finish() { @@ -465,7 +468,7 @@ namespace { return false; } - bool decryptLocal(EncryptedDescriptor &result, const QByteArray &encrypted, const mtpAuthKey &key = _localKey) { + bool decryptLocal(EncryptedDescriptor &result, const QByteArray &encrypted, const MTP::AuthKey &key = _localKey) { if (encrypted.size() <= 16 || (encrypted.size() & 0x0F)) { LOG(("App Error: bad encrypted part size: %1").arg(encrypted.size())); return false; @@ -501,7 +504,7 @@ namespace { return true; } - bool readEncryptedFile(FileReadDescriptor &result, const QString &name, int options = UserPath | SafePath, const mtpAuthKey &key = _localKey) { + bool readEncryptedFile(FileReadDescriptor &result, const QString &name, int options = UserPath | SafePath, const MTP::AuthKey &key = _localKey) { if (!readFile(result, name, options)) { return false; } @@ -531,7 +534,7 @@ namespace { return true; } - bool readEncryptedFile(FileReadDescriptor &result, const FileKey &fkey, int options = UserPath | SafePath, const mtpAuthKey &key = _localKey) { + bool readEncryptedFile(FileReadDescriptor &result, const FileKey &fkey, int options = UserPath | SafePath, const MTP::AuthKey &key = _localKey) { return readEncryptedFile(result, toFilePart(fkey), options, key); } @@ -864,7 +867,7 @@ namespace { } } - mtpDcOptions *_dcOpts = 0; + MTP::DcOptions *_dcOpts = 0; bool _readSetting(quint32 blockId, QDataStream &stream, int version) { switch (blockId) { case dbiDcOptionOld: { @@ -873,16 +876,17 @@ namespace { stream >> dcId >> host >> ip >> port; if (!_checkStreamStatus(stream)) return false; - if (_dcOpts) _dcOpts->insert(dcId, mtpDcOption(dcId, 0, ip.toUtf8().constData(), port)); + if (_dcOpts) _dcOpts->insert(dcId, MTP::DcOption(dcId, 0, ip.toUtf8().constData(), port)); } break; case dbiDcOption: { - quint32 dcIdWithShift, flags, port; + quint32 dcIdWithShift, port; + qint32 flags; QString ip; stream >> dcIdWithShift >> flags >> ip >> port; if (!_checkStreamStatus(stream)) return false; - if (_dcOpts) _dcOpts->insert(dcIdWithShift, mtpDcOption(dcIdWithShift % _mtp_internal::dcShift, flags, ip.toUtf8().constData(), port)); + if (_dcOpts) _dcOpts->insert(dcIdWithShift, MTP::DcOption(MTP::bareDcId(dcIdWithShift), MTPDdcOption::Flags(flags), ip.toUtf8().constData(), port)); } break; case dbiChatSizeMax: { @@ -927,8 +931,8 @@ namespace { if (!_checkStreamStatus(stream)) return false; DEBUG_LOG(("MTP Info: key found, dc %1, key: %2").arg(dcId).arg(Logs::mb(key, 256).str())); - dcId = dcId % _mtp_internal::dcShift; - mtpAuthKeyPtr keyPtr(new mtpAuthKey()); + dcId = MTP::bareDcId(dcId); + MTP::AuthKeyPtr keyPtr(new MTP::AuthKey()); keyPtr->setKey(key); keyPtr->setDC(dcId); @@ -1366,7 +1370,7 @@ namespace { bool result = false; QFile file(cWorkingDir() + qsl("tdata/config")); if (file.open(QIODevice::ReadOnly)) { - LOG(("App Info: reading old config..")); + LOG(("App Info: reading old config...")); QDataStream stream(&file); stream.setVersion(QDataStream::Qt_5_1); @@ -1446,7 +1450,7 @@ namespace { QBuffer decryptedStream(&decrypted); decryptedStream.open(QIODevice::ReadOnly); decryptedStream.seek(4); // skip size - LOG(("App Info: reading encrypted old user config..")); + LOG(("App Info: reading encrypted old user config...")); _readOldUserSettingsFields(&decryptedStream, version); } else if (!_readSetting(blockId, stream, version)) { @@ -1459,19 +1463,19 @@ namespace { bool result = false; QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString()) + qsl("_config")); if (file.open(QIODevice::ReadOnly)) { - LOG(("App Info: reading old user config..")); + LOG(("App Info: reading old user config...")); qint32 version = 0; - mtpDcOptions dcOpts; + MTP::DcOptions dcOpts; { QReadLocker lock(MTP::dcOptionsMutex()); - dcOpts = cDcOptions(); + dcOpts = Global::DcOptions(); } _dcOpts = &dcOpts; _readOldUserSettingsFields(&file, version); { QWriteLocker lock(MTP::dcOptionsMutex()); - cSetDcOptions(dcOpts); + Global::SetDcOptions(dcOpts); } file.close(); @@ -1533,7 +1537,7 @@ namespace { QBuffer decryptedStream(&decrypted); decryptedStream.open(QIODevice::ReadOnly); decryptedStream.seek(4); // skip size - LOG(("App Info: reading encrypted old keys..")); + LOG(("App Info: reading encrypted old keys...")); _readOldMtpDataFields(&decryptedStream, version); } else if (!_readSetting(blockId, stream, version)) { @@ -1546,19 +1550,19 @@ namespace { bool result = false; QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString())); if (file.open(QIODevice::ReadOnly)) { - LOG(("App Info: reading old keys..")); + LOG(("App Info: reading old keys...")); qint32 version = 0; - mtpDcOptions dcOpts; + MTP::DcOptions dcOpts; { QReadLocker lock(MTP::dcOptionsMutex()); - dcOpts = cDcOptions(); + dcOpts = Global::DcOptions(); } _dcOpts = &dcOpts; _readOldMtpDataFields(&file, version); { QWriteLocker lock(MTP::dcOptionsMutex()); - cSetDcOptions(dcOpts); + Global::SetDcOptions(dcOpts); } file.close(); @@ -1643,7 +1647,7 @@ namespace { return _writeUserSettings(); } - LOG(("App Info: reading encrypted user settings..")); + LOG(("App Info: reading encrypted user settings...")); while (!userSettings.stream.atEnd()) { quint32 blockId; userSettings.stream >> blockId; @@ -1664,16 +1668,16 @@ namespace { return; } - mtpKeysMap keys = MTP::getKeys(); + MTP::AuthKeysMap keys = MTP::getKeys(); quint32 size = sizeof(quint32) + sizeof(qint32) + sizeof(quint32); size += keys.size() * (sizeof(quint32) + sizeof(quint32) + 256); EncryptedDescriptor data(size); data.stream << quint32(dbiUser) << qint32(MTP::authedId()) << quint32(MTP::maindc()); - for (mtpKeysMap::const_iterator i = keys.cbegin(), e = keys.cend(); i != e; ++i) { - data.stream << quint32(dbiKey) << quint32((*i)->getDC()); - (*i)->write(data.stream); + for_const (const MTP::AuthKeyPtr &key, keys) { + data.stream << quint32(dbiKey) << quint32(key->getDC()); + key->write(data.stream); } mtp.writeEncrypted(data, _localKey); @@ -1689,7 +1693,7 @@ namespace { return; } - LOG(("App Info: reading encrypted mtp data..")); + LOG(("App Info: reading encrypted mtp data...")); while (!mtp.stream.atEnd()) { quint32 blockId; mtp.stream >> blockId; @@ -1715,7 +1719,7 @@ namespace { if (!readFile(mapData, qsl("map"))) { return Local::ReadMapFailed; } - LOG(("App Info: reading map..")); + LOG(("App Info: reading map...")); QByteArray salt, keyEncrypted, mapEncrypted; mapData.stream >> salt >> keyEncrypted >> mapEncrypted; @@ -1731,7 +1735,7 @@ namespace { EncryptedDescriptor keyData, map; if (!decryptLocal(keyData, keyEncrypted, _passKey)) { - LOG(("App Info: could not decrypt pass-protected key from map file, maybe bad password..")); + LOG(("App Info: could not decrypt pass-protected key from map file, maybe bad password...")); return Local::ReadMapPassNeeded; } uchar key[LocalEncryptKeySize] = { 0 }; @@ -1748,7 +1752,7 @@ namespace { LOG(("App Error: could not decrypt map.")); return Local::ReadMapFailed; } - LOG(("App Info: reading encrypted map..")); + LOG(("App Info: reading encrypted map...")); DraftsMap draftsMap, draftCursorsMap; DraftsNotReadMap draftsNotReadMap; @@ -2097,7 +2101,7 @@ namespace Local { _readOldMtpData(false); // needed further in _readMtpData return writeSettings(); } - LOG(("App Info: reading settings..")); + LOG(("App Info: reading settings...")); QByteArray salt, settingsEncrypted; settingsData.stream >> salt >> settingsEncrypted; @@ -2113,16 +2117,16 @@ namespace Local { EncryptedDescriptor settings; if (!decryptLocal(settings, settingsEncrypted, _settingsKey)) { - LOG(("App Error: could not decrypt settings from settings file, maybe bad passcode..")); + LOG(("App Error: could not decrypt settings from settings file, maybe bad passcode...")); return writeSettings(); } - mtpDcOptions dcOpts; + MTP::DcOptions dcOpts; { QReadLocker lock(MTP::dcOptionsMutex()); - dcOpts = cDcOptions(); + dcOpts = Global::DcOptions(); } _dcOpts = &dcOpts; - LOG(("App Info: reading encrypted settings..")); + LOG(("App Info: reading encrypted settings...")); while (!settings.stream.atEnd()) { quint32 blockId; settings.stream >> blockId; @@ -2137,20 +2141,23 @@ namespace Local { if (dcOpts.isEmpty()) { const BuiltInDc *bdcs = builtInDcs(); for (int i = 0, l = builtInDcsCount(); i < l; ++i) { - dcOpts.insert(bdcs[i].id, mtpDcOption(bdcs[i].id, 0, bdcs[i].ip, bdcs[i].port)); + MTPDdcOption::Flags flags = 0; + MTP::ShiftedDcId idWithShift = MTP::shiftDcId(bdcs[i].id, flags); + dcOpts.insert(idWithShift, MTP::DcOption(bdcs[i].id, flags, bdcs[i].ip, bdcs[i].port)); DEBUG_LOG(("MTP Info: adding built in DC %1 connect option: %2:%3").arg(bdcs[i].id).arg(bdcs[i].ip).arg(bdcs[i].port)); } const BuiltInDc *bdcsipv6 = builtInDcsIPv6(); for (int i = 0, l = builtInDcsCountIPv6(); i < l; ++i) { - int32 flags = MTPDdcOption::flag_ipv6, idWithShift = bdcsipv6[i].id + (flags * _mtp_internal::dcShift); - dcOpts.insert(idWithShift, mtpDcOption(bdcsipv6[i].id, flags, bdcsipv6[i].ip, bdcsipv6[i].port)); + MTPDdcOption::Flags flags = MTPDdcOption::Flag::f_ipv6; + MTP::ShiftedDcId idWithShift = MTP::shiftDcId(bdcsipv6[i].id, flags); + dcOpts.insert(idWithShift, MTP::DcOption(bdcsipv6[i].id, flags, bdcsipv6[i].ip, bdcsipv6[i].port)); DEBUG_LOG(("MTP Info: adding built in DC %1 IPv6 connect option: %2:%3").arg(bdcsipv6[i].id).arg(bdcsipv6[i].ip).arg(bdcsipv6[i].port)); } } { QWriteLocker lock(MTP::dcOptionsMutex()); - cSetDcOptions(dcOpts); + Global::SetDcOptions(dcOpts); } _oldSettingsVersion = settingsData.version; @@ -2173,30 +2180,34 @@ namespace Local { } settings.writeData(_settingsSalt); - mtpDcOptions dcOpts; + MTP::DcOptions dcOpts; { QReadLocker lock(MTP::dcOptionsMutex()); - dcOpts = cDcOptions(); + dcOpts = Global::DcOptions(); } if (dcOpts.isEmpty()) { const BuiltInDc *bdcs = builtInDcs(); for (int i = 0, l = builtInDcsCount(); i < l; ++i) { - dcOpts.insert(bdcs[i].id, mtpDcOption(bdcs[i].id, 0, bdcs[i].ip, bdcs[i].port)); + MTPDdcOption::Flags flags = 0; + MTP::ShiftedDcId idWithShift = MTP::shiftDcId(bdcs[i].id, flags); + dcOpts.insert(idWithShift, MTP::DcOption(bdcs[i].id, flags, bdcs[i].ip, bdcs[i].port)); DEBUG_LOG(("MTP Info: adding built in DC %1 connect option: %2:%3").arg(bdcs[i].id).arg(bdcs[i].ip).arg(bdcs[i].port)); } const BuiltInDc *bdcsipv6 = builtInDcsIPv6(); for (int i = 0, l = builtInDcsCountIPv6(); i < l; ++i) { - dcOpts.insert(bdcsipv6[i].id + (MTPDdcOption::flag_ipv6 * _mtp_internal::dcShift), mtpDcOption(bdcsipv6[i].id, MTPDdcOption::flag_ipv6, bdcsipv6[i].ip, bdcsipv6[i].port)); + MTPDdcOption::Flags flags = MTPDdcOption::Flag::f_ipv6; + MTP::ShiftedDcId idWithShift = MTP::shiftDcId(bdcsipv6[i].id, flags); + dcOpts.insert(idWithShift, MTP::DcOption(bdcsipv6[i].id, flags, bdcsipv6[i].ip, bdcsipv6[i].port)); DEBUG_LOG(("MTP Info: adding built in DC %1 IPv6 connect option: %2:%3").arg(bdcsipv6[i].id).arg(bdcsipv6[i].ip).arg(bdcsipv6[i].port)); } QWriteLocker lock(MTP::dcOptionsMutex()); - cSetDcOptions(dcOpts); + Global::SetDcOptions(dcOpts); } quint32 size = 12 * (sizeof(quint32) + sizeof(qint32)); - for (mtpDcOptions::const_iterator i = dcOpts.cbegin(), e = dcOpts.cend(); i != e; ++i) { + for (auto i = dcOpts.cbegin(), e = dcOpts.cend(); i != e; ++i) { size += sizeof(quint32) + sizeof(quint32) + sizeof(quint32); size += sizeof(quint32) + _stringSize(QString::fromUtf8(i->ip.data(), i->ip.size())); } @@ -2223,9 +2234,9 @@ namespace Local { data.stream << quint32(dbiLastUpdateCheck) << qint32(cLastUpdateCheck()); data.stream << quint32(dbiScale) << qint32(cConfigScale()); data.stream << quint32(dbiLang) << qint32(cLang()); - for (mtpDcOptions::const_iterator i = dcOpts.cbegin(), e = dcOpts.cend(); i != e; ++i) { + for (auto i = dcOpts.cbegin(), e = dcOpts.cend(); i != e; ++i) { data.stream << quint32(dbiDcOption) << quint32(i.key()); - data.stream << quint32(i->flags) << QString::fromUtf8(i->ip.data(), i->ip.size()); + data.stream << qint32(i->flags) << QString::fromUtf8(i->ip.data(), i->ip.size()); data.stream << quint32(i->port); } data.stream << quint32(dbiLangFile) << cLangFile(); @@ -2280,7 +2291,7 @@ namespace Local { } bool checkPasscode(const QByteArray &passcode) { - mtpAuthKey tmp; + MTP::AuthKey tmp; createLocalKey(passcode, &_passKeySalt, &tmp); return (tmp == _passKey); } @@ -3019,10 +3030,10 @@ namespace Local { } void _writeStickerSet(QDataStream &stream, uint64 setId) { - StickerSets::const_iterator it = cStickerSets().constFind(setId); - if (it == cStickerSets().cend()) return; + auto it = Global::StickerSets().constFind(setId); + if (it == Global::StickerSets().cend()) return; - bool notLoaded = (it->flags & MTPDstickerSet_flag_NOT_LOADED); + bool notLoaded = (it->flags & MTPDstickerSet_ClientFlag::f_not_loaded); if (notLoaded) { stream << quint64(it->id) << quint64(it->access) << it->title << it->shortName << qint32(-it->count) << qint32(it->hash) << qint32(it->flags); return; @@ -3063,7 +3074,7 @@ namespace Local { void writeStickers() { if (!_working()) return; - const StickerSets &sets(cStickerSets()); + const Stickers::Sets &sets(Global::StickerSets()); if (sets.isEmpty()) { if (_stickersKey) { clearKey(_stickersKey); @@ -3075,10 +3086,10 @@ namespace Local { int32 setsCount = 0; QByteArray hashToWrite; quint32 size = sizeof(quint32) + _bytearraySize(hashToWrite); - for (StickerSets::const_iterator i = sets.cbegin(); i != sets.cend(); ++i) { - bool notLoaded = (i->flags & MTPDstickerSet_flag_NOT_LOADED); + for (auto i = sets.cbegin(); i != sets.cend(); ++i) { + bool notLoaded = (i->flags & MTPDstickerSet_ClientFlag::f_not_loaded); if (notLoaded) { - if (!(i->flags & MTPDstickerSet::flag_disabled) || (i->flags & MTPDstickerSet::flag_official)) { // waiting to receive + if (!(i->flags & MTPDstickerSet::Flag::f_disabled) || (i->flags & MTPDstickerSet::Flag::f_official)) { // waiting to receive return; } } else { @@ -3114,8 +3125,8 @@ namespace Local { } EncryptedDescriptor data(size); data.stream << quint32(setsCount) << hashToWrite; - _writeStickerSet(data.stream, CustomStickerSetId); - for (StickerSetsOrder::const_iterator i = cStickerSetsOrder().cbegin(), e = cStickerSetsOrder().cend(); i != e; ++i) { + _writeStickerSet(data.stream, Stickers::CustomSetId); + for (auto i = Global::StickerSetsOrder().cbegin(), e = Global::StickerSetsOrder().cend(); i != e; ++i) { _writeStickerSet(data.stream, *i); } FileWriteDescriptor file(_stickersKey); @@ -3134,17 +3145,17 @@ namespace Local { return; } - StickerSets &sets(cRefStickerSets()); + Stickers::Sets &sets(Global::RefStickerSets()); sets.clear(); - StickerSetsOrder &order(cRefStickerSetsOrder()); + Stickers::Order &order(Global::RefStickerSetsOrder()); order.clear(); RecentStickerPack &recent(cRefRecentStickers()); recent.clear(); - StickerSet &def(sets.insert(DefaultStickerSetId, StickerSet(DefaultStickerSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet::flag_official)).value()); - StickerSet &custom(sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)).value()); + Stickers::Set &def(sets.insert(Stickers::DefaultSetId, Stickers::Set(Stickers::DefaultSetId, 0, lang(lng_stickers_default_set), QString(), 0, 0, MTPDstickerSet::Flag::f_official)).value()); + Stickers::Set &custom(sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)).value()); QMap read; while (!stickers.stream.atEnd()) { @@ -3183,11 +3194,11 @@ namespace Local { if (recent.size() < StickerPanPerRow * StickerPanRowsPerPage && qAbs(value) > 1) recent.push_back(qMakePair(doc, qAbs(value))); } if (def.stickers.isEmpty()) { - sets.remove(DefaultStickerSetId); + sets.remove(Stickers::DefaultSetId); } else { - order.push_front(DefaultStickerSetId); + order.push_front(Stickers::DefaultSetId); } - if (custom.stickers.isEmpty()) sets.remove(CustomStickerSetId); + if (custom.stickers.isEmpty()) sets.remove(Stickers::CustomSetId); writeStickers(); writeUserSettings(); @@ -3210,10 +3221,10 @@ namespace Local { return; } - StickerSets &sets(cRefStickerSets()); + Stickers::Sets &sets(Global::RefStickerSets()); sets.clear(); - StickerSetsOrder &order(cRefStickerSetsOrder()); + Stickers::Order &order(Global::RefStickerSetsOrder()); order.clear(); quint32 cnt; @@ -3231,20 +3242,24 @@ namespace Local { qint32 setHash = 0, setFlags = 0; if (stickers.version > 8033) { stickers.stream >> setHash >> setFlags; + if (setFlags & qFlags(MTPDstickerSet_ClientFlag::f_not_loaded__old)) { + setFlags &= ~qFlags(MTPDstickerSet_ClientFlag::f_not_loaded__old); + setFlags |= qFlags(MTPDstickerSet_ClientFlag::f_not_loaded); + } } - if (setId == DefaultStickerSetId) { + if (setId == Stickers::DefaultSetId) { setTitle = lang(lng_stickers_default_set); - setFlags |= MTPDstickerSet::flag_official; + setFlags |= qFlags(MTPDstickerSet::Flag::f_official); order.push_front(setId); - } else if (setId == CustomStickerSetId) { + } else if (setId == Stickers::CustomSetId) { setTitle = lang(lng_custom_stickers); } else if (setId) { order.push_back(setId); } else { continue; } - StickerSet &set(sets.insert(setId, StickerSet(setId, setAccess, setTitle, setShortName, 0, setHash, setFlags)).value()); + Stickers::Set &set(sets.insert(setId, Stickers::Set(setId, setAccess, setTitle, setShortName, 0, setHash, MTPDstickerSet::Flags(setFlags))).value()); if (scnt < 0) { // disabled not loaded set set.count = -scnt; continue; @@ -3264,7 +3279,7 @@ namespace Local { if (read.contains(id)) continue; read.insert(id, true); - if (setId == DefaultStickerSetId || setId == CustomStickerSetId) { + if (setId == Stickers::DefaultSetId || setId == Stickers::CustomSetId) { typeOfSet = StickerSetTypeEmpty; } @@ -3325,17 +3340,17 @@ namespace Local { int32 countStickersHash(bool checkOfficial) { uint32 acc = 0; bool foundOfficial = false, foundBad = false;; - const StickerSets &sets(cStickerSets()); - const StickerSetsOrder &order(cStickerSetsOrder()); - for (StickerSetsOrder::const_iterator i = order.cbegin(), e = order.cend(); i != e; ++i) { - StickerSets::const_iterator j = sets.constFind(*i); + const Stickers::Sets &sets(Global::StickerSets()); + const Stickers::Order &order(Global::StickerSetsOrder()); + for (auto i = order.cbegin(), e = order.cend(); i != e; ++i) { + auto j = sets.constFind(*i); if (j != sets.cend()) { if (j->id == 0) { foundBad = true; - } else if (j->flags & MTPDstickerSet::flag_official) { + } else if (j->flags & MTPDstickerSet::Flag::f_official) { foundOfficial = true; } - if (!(j->flags & MTPDstickerSet::flag_disabled)) { + if (!(j->flags & MTPDstickerSet::Flag::f_disabled)) { acc = (acc * 20261) + j->hash; } } @@ -3535,7 +3550,7 @@ namespace Local { return result; } - void _writePeer(QDataStream &stream, PeerData *peer, int32 fileVersion = AppVersion) { + void _writePeer(QDataStream &stream, PeerData *peer) { stream << quint64(peer->id) << quint64(peer->photoId); _writeStorageImageLocation(stream, peer->photoLoc); if (peer->isUser()) { @@ -3545,7 +3560,7 @@ namespace Local { if (AppVersion >= 9012) { stream << qint32(user->flags); } - if (AppVersion >= 9016 || fileVersion >= 9016) { + if (AppVersion >= 9016) { stream << (user->botInfo ? user->botInfo->inlinePlaceholder : QString()); } stream << qint32(user->onlineTill) << qint32(user->contact) << qint32(user->botInfo ? user->botInfo->version : -1); @@ -3565,18 +3580,16 @@ namespace Local { } PeerData *_readPeer(FileReadDescriptor &from, int32 fileVersion = 0) { - PeerData *result = 0; quint64 peerId = 0, photoId = 0; from.stream >> peerId >> photoId; StorageImageLocation photoLoc(_readStorageImageLocation(from)); - result = App::peerLoaded(peerId); - bool wasLoaded = (result && result->loaded); - + PeerData *result = App::peerLoaded(peerId); + bool wasLoaded = (result != nullptr); if (!wasLoaded) { result = App::peer(peerId); - result->loaded = true; + result->loadedStatus = PeerData::FullLoaded; } if (result->isUser()) { UserData *user = result->asUser(); @@ -3600,7 +3613,7 @@ namespace Local { user->setName(first, last, pname, username); user->access = access; - user->flags = flags; + user->flags = MTPDuser::Flags(flags); user->onlineTill = onlineTill; user->contact = contact; user->setBotInfoVersion(botInfoVersion); @@ -3616,7 +3629,7 @@ namespace Local { user->inputUser = MTP_inputUser(MTP_int(peerToUser(user->id)), MTP_long((user->access == UserNoAccess) ? 0 : user->access)); } - user->photo = photoLoc.isNull() ? ImagePtr(userDefPhoto(user->colorIndex)) : ImagePtr(photoLoc); + user->setUserpic(photoLoc.isNull() ? ImagePtr(userDefPhoto(user->colorIndex)) : ImagePtr(photoLoc)); } } else if (result->isChat()) { ChatData *chat = result->asChat(); @@ -3629,7 +3642,7 @@ namespace Local { flags = flagsData; } else { // flagsData was haveLeft - flags = (flagsData == 1 ? MTPDchat::flag_left : 0); + flags = (flagsData == 1) ? MTPDchat::Flags(MTPDchat::Flag::f_left) : MTPDchat::Flags(0); } if (!wasLoaded) { chat->updateName(name, QString(), QString()); @@ -3638,20 +3651,20 @@ namespace Local { chat->version = version; chat->creator = creator; chat->isForbidden = (forbidden == 1); - chat->flags = flags; + chat->flags = MTPDchat::Flags(flags); chat->invitationUrl = invitationUrl; chat->input = MTP_inputPeerChat(MTP_int(peerToChat(chat->id))); chat->inputChat = MTP_int(peerToChat(chat->id)); - chat->photo = photoLoc.isNull() ? ImagePtr(chatDefPhoto(chat->colorIndex)) : ImagePtr(photoLoc); + chat->setUserpic(photoLoc.isNull() ? ImagePtr(chatDefPhoto(chat->colorIndex)) : ImagePtr(photoLoc)); } } else if (result->isChannel()) { ChannelData *channel = result->asChannel(); QString name, invitationUrl; quint64 access; - qint32 date, version, adminned, forbidden, flags; + qint32 date, version, forbidden, flags; from.stream >> name >> access >> date >> version >> forbidden >> flags >> invitationUrl; if (!wasLoaded) { @@ -3660,13 +3673,13 @@ namespace Local { channel->date = date; channel->version = version; channel->isForbidden = (forbidden == 1); - channel->flags = flags; + channel->flags = MTPDchannel::Flags(flags); channel->invitationUrl = invitationUrl; channel->input = MTP_inputPeerChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); channel->inputChannel = MTP_inputChannel(MTP_int(peerToChannel(channel->id)), MTP_long(access)); - channel->photo = photoLoc.isNull() ? ImagePtr((channel->isMegagroup() ? chatDefPhoto(channel->colorIndex) : channelDefPhoto(channel->colorIndex))) : ImagePtr(photoLoc); + channel->setUserpic(photoLoc.isNull() ? ImagePtr((channel->isMegagroup() ? chatDefPhoto(channel->colorIndex) : channelDefPhoto(channel->colorIndex))) : ImagePtr(photoLoc)); } } if (!wasLoaded) { @@ -3722,7 +3735,7 @@ namespace Local { } data.stream << quint32(botsCnt); for (RecentInlineBots::const_iterator i = bots.cbegin(), e = bots.cend(); i != e; ++i) { - _writePeer(data.stream, *i, 9016); + _writePeer(data.stream, *i); } FileWriteDescriptor file(_recentHashtagsAndBotsKey); file.writeEncrypted(data); diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 5a1e5d520..68fa217d0 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -19,9 +19,14 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" + +#include "logs.h" + #include #include "pspecific.h" +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS + // see https://blog.inventic.eu/2012/08/qt-and-google-breakpad/ #ifdef Q_OS_WIN @@ -30,17 +35,20 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "client/windows/handler/exception_handler.h" #pragma warning(pop) -#elif defined Q_OS_MAC +#elif defined Q_OS_MAC // Q_OS_WIN +#include #ifdef MAC_USE_BREAKPAD #include "client/mac/handler/exception_handler.h" -#else +#else // MAC_USE_BREAKPAD #include "client/crashpad_client.h" -#endif +#endif // else for MAC_USE_BREAKPAD -#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 +#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 // Q_OS_MAC #include "client/linux/handler/exception_handler.h" -#endif +#endif // Q_OS_LINUX64 || Q_OS_LINUX32 + +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS enum LogDataType { LogDataMain, @@ -79,7 +87,7 @@ QString _logsEntryStart() { QDateTime tm(QDateTime::currentDateTime()); QThread *thread = QThread::currentThread(); - MTPThread *mtpThread = qobject_cast(thread); + MTP::internal::Thread *mtpThread = qobject_cast(thread); uint threadId = mtpThread ? mtpThread->getThreadId() : 0; return QString("[%1 %2-%3]").arg(tm.toString("hh:mm:ss.zzz")).arg(QString("%1").arg(threadId, 2, 10, QChar('0'))).arg(++index, 7, 10, QChar('0')); @@ -286,8 +294,8 @@ void _logsWrite(LogDataType type, const QString &msg) { void _moveOldDataFiles(const QString &from); namespace SignalHandlers { - void StartBreakpad(); - void FinishBreakpad(); + void StartCrashHandler(); + void FinishCrashHandler(); } namespace Logs { @@ -303,22 +311,22 @@ namespace Logs { QString initialWorkingDir = QDir(cWorkingDir()).absolutePath() + '/', moveOldDataFrom; if (cBetaVersion()) { cSetDebug(true); -#if (defined Q_OS_MAC || defined Q_OS_LINUX) +#if defined Q_OS_MAC || defined Q_OS_LINUX } else { #ifdef _DEBUG cForceWorkingDir(cExeDir()); -#else +#else // _DEBUG if (cWorkingDir().isEmpty()) { cForceWorkingDir(psAppDataPath()); } -#endif +#endif // else for _DEBUG workingDirChosen = true; -#if (defined Q_OS_LINUX && !defined _DEBUG) // fix first version +#if defined Q_OS_LINUX && !defined _DEBUG // fix first version moveOldDataFrom = initialWorkingDir; -#endif +#endif // Q_OS_LINUX && !_DEBUG -#endif +#endif // Q_OS_MAC || Q_OS_LINUX } LogsData = new LogsDataFields(); @@ -337,7 +345,7 @@ namespace Logs { QDir().mkpath(cWorkingDir() + qstr("tdata")); Sandbox::WorkingDirReady(); - SignalHandlers::StartBreakpad(); + SignalHandlers::StartCrashHandler(); if (!LogsData->openMain()) { delete LogsData; @@ -389,7 +397,7 @@ namespace Logs { _logsMutex(LogDataMain, true); - SignalHandlers::FinishBreakpad(); + SignalHandlers::FinishCrashHandler(); } bool started() { @@ -606,6 +614,11 @@ void _moveOldDataFiles(const QString &wasDir) { namespace SignalHandlers { + typedef std::map AnnotationsMap; + AnnotationsMap ProcessAnnotations; + +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS + QString CrashDumpPath; FILE *CrashDumpFile = nullptr; int CrashDumpFileNo = 0; @@ -642,14 +655,26 @@ namespace SignalHandlers { return stream; } + template + struct _writeNumberSignAndRemoveIt { + static void call(Type &number) { + if (number < 0) { + _writeChar('-'); + number = -number; + } + } + }; + template + struct _writeNumberSignAndRemoveIt { + static void call(Type &number) { + } + }; + template const dump &_writeNumber(const dump &stream, Type number) { if (!CrashDumpFile) return stream; - if (number < 0) { - _writeChar('-'); - number = -number; - } + _writeNumberSignAndRemoveIt<(Type(-1) > Type(0)), Type>::call(number); Type upper = 1, prev = number / 10; while (prev >= upper) { upper *= 10; @@ -700,9 +725,6 @@ namespace SignalHandlers { bool LoggingCrashHeaderWritten = false; QMutex LoggingCrashMutex; - typedef std::map AnnotationsMap; - AnnotationsMap ProcessAnnotations; - const char *BreakpadDumpPath = 0; const wchar_t *BreakpadDumpPathW = 0; @@ -714,9 +736,9 @@ namespace SignalHandlers { sigaction(signum, &SIG_def[signum], 0); } -#else +#else // Q_OS_MAC || Q_OS_LINUX32 || Q_OS_LINUX64 void Handler(int signum) { -#endif +#endif // else for Q_OS_MAC || Q_OS_LINUX || Q_OS_LINUX64 const char* name = 0; switch (signum) { @@ -727,7 +749,7 @@ namespace SignalHandlers { #ifndef Q_OS_WIN case SIGBUS: name = "SIGBUS"; break; case SIGSYS: name = "SIGSYS"; break; -#endif +#endif // !Q_OS_WIN } Qt::HANDLE thread = QThread::currentThreadId(); @@ -817,17 +839,17 @@ namespace SignalHandlers { dump() << "_unknown_module_\n"; } } -#endif +#endif // Q_OS_MAC dump() << "\nBacktrace:\n"; backtrace_symbols_fd(addresses, size, CrashDumpFileNo); -#else +#else // Q_OS_MAC || Q_OS_LINUX32 || Q_OS_LINUX64 dump() << "\nBacktrace:\n"; psWriteStackTrace(); -#endif +#endif // else for Q_OS_MAC || Q_OS_LINUX32 || Q_OS_LINUX64 dump() << "\n"; @@ -841,11 +863,11 @@ namespace SignalHandlers { #ifdef Q_OS_WIN bool DumpCallback(const wchar_t* _dump_dir, const wchar_t* _minidump_id, void* context, EXCEPTION_POINTERS* exinfo, MDRawAssertionInfo* assertion, bool success) -#elif defined Q_OS_MAC +#elif defined Q_OS_MAC // Q_OS_WIN bool DumpCallback(const char* _dump_dir, const char* _minidump_id, void *context, bool success) -#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 +#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 // Q_OS_MAC bool DumpCallback(const google_breakpad::MinidumpDescriptor &md, void *context, bool success) -#endif +#endif // Q_OS_LINUX64 || Q_OS_LINUX32 { if (CrashLogged) return success; CrashLogged = true; @@ -853,20 +875,23 @@ namespace SignalHandlers { #ifdef Q_OS_WIN BreakpadDumpPathW = _minidump_id; Handler(-1); -#else +#else // Q_OS_WIN #ifdef Q_OS_MAC BreakpadDumpPath = _minidump_id; -#else +#else // Q_OS_MAC BreakpadDumpPath = md.path(); -#endif +#endif // else for Q_OS_MAC Handler(-1, 0, 0); -#endif +#endif // else for Q_OS_WIN return success; } -#endif +#endif // !Q_OS_MAC || MAC_USE_BREAKPAD - void StartBreakpad() { +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS + + void StartCrashHandler() { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS ProcessAnnotations["Binary"] = cExeName().toUtf8().constData(); ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData(); ProcessAnnotations["Version"] = (cBetaVersion() ? qsl("%1 beta").arg(cBetaVersion()) : (cDevVersion() ? qsl("%1 dev") : qsl("%1")).arg(AppVersion)).toUtf8().constData(); @@ -885,7 +910,7 @@ namespace SignalHandlers { /*context*/ 0, true ); -#elif defined Q_OS_MAC +#elif defined Q_OS_MAC // Q_OS_WIN #ifdef MAC_USE_BREAKPAD #ifndef _DEBUG @@ -897,9 +922,9 @@ namespace SignalHandlers { true, 0 ); -#endif +#endif // !_DEBUG SetSignalHandlers = false; -#else +#else // MAC_USE_BREAKPAD crashpad::CrashpadClient crashpad_client; std::string handler = (cExeDir() + cExeName() + qsl("/Contents/Helpers/crashpad_handler")).toUtf8().constData(); std::string database = QFile::encodeName(dumpspath).constData(); @@ -911,7 +936,7 @@ namespace SignalHandlers { false)) { crashpad_client.UseHandler(); } -#endif +#endif // else for MAC_USE_BREAKPAD #elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32 BreakpadExceptionHandler = new google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(QFile::encodeName(dumpspath).toStdString()), @@ -921,26 +946,36 @@ namespace SignalHandlers { true, -1 ); -#endif +#endif // Q_OS_LINUX64 || Q_OS_LINUX32 +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } - void FinishBreakpad() { + void FinishCrashHandler() { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS + #if !defined Q_OS_MAC || defined MAC_USE_BREAKPAD if (BreakpadExceptionHandler) { google_breakpad::ExceptionHandler *h = BreakpadExceptionHandler; BreakpadExceptionHandler = 0; delete h; } -#endif +#endif // !Q_OS_MAC || MAC_USE_BREAKPAD + +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } Status start() { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS CrashDumpPath = cWorkingDir() + qsl("tdata/working"); + #ifdef Q_OS_WIN - if (FILE *f = _wfopen(CrashDumpPath.toStdWString().c_str(), L"rb")) { -#else + FILE *f = nullptr; + if (_wfopen_s(&f, CrashDumpPath.toStdWString().c_str(), L"rb") != 0) { + f = nullptr; + } else { +#else // !Q_OS_WIN if (FILE *f = fopen(QFile::encodeName(CrashDumpPath).constData(), "rb")) { -#endif +#endif // else for !Q_OS_WIN QByteArray lastdump; char buffer[256 * 1024] = { 0 }; int32 read = fread(buffer, 1, 256 * 1024, f); @@ -955,21 +990,30 @@ namespace SignalHandlers { return LastCrashed; } + +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS return restart(); } Status restart() { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS if (CrashDumpFile) { return Started; } #ifdef Q_OS_WIN - CrashDumpFile = _wfopen(CrashDumpPath.toStdWString().c_str(), L"wb"); -#else + if (_wfopen_s(&CrashDumpFile, CrashDumpPath.toStdWString().c_str(), L"wb") != 0) { + CrashDumpFile = nullptr; + } +#else // Q_OS_WIN CrashDumpFile = fopen(QFile::encodeName(CrashDumpPath).constData(), "wb"); -#endif +#endif // else for Q_OS_WIN if (CrashDumpFile) { +#ifdef Q_OS_WIN + CrashDumpFileNo = _fileno(CrashDumpFile); +#else // Q_OS_WIN CrashDumpFileNo = fileno(CrashDumpFile); +#endif // else for Q_OS_WIN if (SetSignalHandlers) { #ifndef Q_OS_WIN struct sigaction sigact; @@ -984,12 +1028,12 @@ namespace SignalHandlers { sigaction(SIGFPE, &sigact, &SIG_def[SIGFPE]); sigaction(SIGBUS, &sigact, &SIG_def[SIGBUS]); sigaction(SIGSYS, &sigact, &SIG_def[SIGSYS]); -#else +#else // !Q_OS_WIN signal(SIGABRT, SignalHandlers::Handler); signal(SIGSEGV, SignalHandlers::Handler); signal(SIGILL, SignalHandlers::Handler); signal(SIGFPE, SignalHandlers::Handler); -#endif +#endif // else for !Q_OS_WIN } return Started; } @@ -997,20 +1041,25 @@ namespace SignalHandlers { LOG(("FATAL: Could not open '%1' for writing!").arg(CrashDumpPath)); return CantOpen; +#else // !TDESKTOP_DISABLE_CRASH_REPORTS + return Started; +#endif // else for !TDESKTOP_DISABLE_CRASH_REPORTS } void finish() { - FinishBreakpad(); +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS + FinishCrashHandler(); if (CrashDumpFile) { fclose(CrashDumpFile); CrashDumpFile = nullptr; #ifdef Q_OS_WIN _wunlink(CrashDumpPath.toStdWString().c_str()); -#else +#else // Q_OS_WIN unlink(CrashDumpPath.toUtf8().constData()); -#endif +#endif // else for Q_OS_WIN } +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } void setSelfUsername(const QString &username) { diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index b79c0f7ad..e0300abb6 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -30,8 +30,10 @@ int main(int argc, char *argv[]) { return psFixPrevious(); } else if (cLaunchMode() == LaunchModeCleanup) { return psCleanup(); +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS } else if (cLaunchMode() == LaunchModeShowCrash) { return showCrashReportWindow(QFileInfo(cStartUrl()).absoluteFilePath()); +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } // both are finished in Application::closeApplication @@ -60,16 +62,18 @@ int main(int argc, char *argv[]) { #ifndef TDESKTOP_DISABLE_AUTOUPDATE if (cRestartingUpdate()) { - DEBUG_LOG(("Application Info: executing updater to install update..")); + DEBUG_LOG(("Application Info: executing updater to install update...")); psExecUpdater(); } else #endif if (cRestarting()) { - DEBUG_LOG(("Application Info: executing Telegram, because of restart..")); + DEBUG_LOG(("Application Info: executing Telegram, because of restart...")); psExecTelegram(); } SignalHandlers::finish(); PlatformSpecific::finish(); Logs::finish(); + + return result; } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 168782359..2f2805d1e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -35,6 +35,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "localstorage.h" +#include "shortcuts.h" + #include "audio.h" TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w) @@ -56,6 +58,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w) , _addContact(this, lang(lng_profile_add_contact), st::topBarButton) , _deleteContact(this, lang(lng_profile_delete_contact), st::topBarButton) , _mediaType(this, lang(lng_media_type), st::topBarButton) +, _search(this, st::topBarSearch) , _sideShadow(this, st::shadowColor) { connect(&_forward, SIGNAL(clicked()), this, SLOT(onForwardSelection())); @@ -66,6 +69,7 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w) connect(&_deleteContact, SIGNAL(clicked()), this, SLOT(onDeleteContact())); connect(&_edit, SIGNAL(clicked()), this, SLOT(onEdit())); connect(&_leaveGroup, SIGNAL(clicked()), this, SLOT(onDeleteAndExit())); + connect(&_search, SIGNAL(clicked()), this, SLOT(onSearch())); setCursor(style::cur_pointer); showAll(); @@ -147,6 +151,10 @@ void TopBarWidget::onDeleteAndExitSure() { } } +void TopBarWidget::onSearch() { + Shortcuts::launch(qsl("search")); +} + void TopBarWidget::enterEvent(QEvent *e) { a_over.start(1); _a_appearance.start(); @@ -261,6 +269,7 @@ void TopBarWidget::resizeEvent(QResizeEvent *e) { if (!_edit.isHidden()) _edit.move(r -= _edit.width(), 0); if (!_addContact.isHidden()) _addContact.move(r -= _addContact.width(), 0); if (!_mediaType.isHidden()) _mediaType.move(r -= _mediaType.width(), 0); + _search.move(width() - (_info.isHidden() ? st::topBarForwardPadding.right() : _info.width()) - _search.width(), 0); _sideShadow.resize(st::lineWidth, height()); _sideShadow.moveToLeft(0, 0); @@ -276,6 +285,7 @@ void TopBarWidget::startAnim() { _delete.hide(); _forward.hide(); _mediaType.hide(); + _search.hide(); _animating = true; } @@ -318,6 +328,7 @@ void TopBarWidget::showAll() { _delete.hide(); _forward.hide(); _mediaType.hide(); + _search.hide(); } else { if (p && p->isChannel() && (p->asChannel()->amCreator() || (p->isMegagroup() && p->asChannel()->amEditor()))) { _edit.show(); @@ -346,9 +357,15 @@ void TopBarWidget::showAll() { _mediaType.hide(); } } - if (App::main() && App::main()->historyPeer() && !o && !p && _clearSelection.isHidden() && Adaptive::OneColumn()) { - _info.show(); + if (h && !o && !p && _clearSelection.isHidden()) { + if (Adaptive::OneColumn()) { + _info.show(); + } else { + _info.hide(); + } + _search.show(); } else { + _search.hide(); _info.hide(); } } @@ -598,20 +615,21 @@ void MainWidget::finishForwarding(History *hist, bool broadcast, bool silent) { PeerData *forwardFrom = 0; App::main()->readServerHistory(hist, false); - int32 sendFlags = 0, flags = 0; + MTPDmessage::Flags flags = 0; + MTPmessages_ForwardMessages::Flags sendFlags = 0; bool channelPost = hist->peer->isChannel() && !hist->peer->isMegagroup() && hist->peer->asChannel()->canPublish() && (hist->peer->asChannel()->isBroadcast() || broadcast); bool showFromName = !channelPost || hist->peer->asChannel()->addsSignature(); bool silentPost = channelPost && silent; if (channelPost) { - sendFlags |= MTPmessages_ForwardMessages::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_ForwardMessages::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_ForwardMessages::flag_silent; + sendFlags |= MTPmessages_ForwardMessages::Flag::f_silent; } QVector ids; @@ -619,7 +637,7 @@ void MainWidget::finishForwarding(History *hist, bool broadcast, bool silent) { ids.reserve(_toForward.size()); randomIds.reserve(_toForward.size()); for (SelectedItemSet::const_iterator i = _toForward.cbegin(), e = _toForward.cend(); i != e; ++i) { - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); if (genClientSideMessage) { FullMsgId newId(peerToChannel(hist->peer->id), clientMsgId()); HistoryMessage *msg = static_cast(_toForward.cbegin().value()); @@ -633,7 +651,7 @@ void MainWidget::finishForwarding(History *hist, bool broadcast, bool silent) { } if (forwardFrom != i.value()->history()->peer) { if (forwardFrom) { - hist->sendRequestId = MTP::send(MTPmessages_ForwardMessages(MTP_int(sendFlags), forwardFrom->input, MTP_vector(ids), MTP_vector(randomIds), hist->peer->input), rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_ForwardMessages(MTP_flags(sendFlags), forwardFrom->input, MTP_vector(ids), MTP_vector(randomIds), hist->peer->input), rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); ids.resize(0); randomIds.resize(0); } @@ -642,7 +660,7 @@ void MainWidget::finishForwarding(History *hist, bool broadcast, bool silent) { ids.push_back(MTP_int(i.value()->id)); randomIds.push_back(MTP_long(randomId)); } - hist->sendRequestId = MTP::send(MTPmessages_ForwardMessages(MTP_int(sendFlags), forwardFrom->input, MTP_vector(ids), MTP_vector(randomIds), hist->peer->input), rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); + hist->sendRequestId = MTP::send(MTPmessages_ForwardMessages(MTP_flags(sendFlags), forwardFrom->input, MTP_vector(ids), MTP_vector(randomIds), hist->peer->input), rpcDone(&MainWidget::sentUpdatesReceived), RPCFailHandlerPtr(), 0, 0, hist->sendRequestId); if (history.peer() == hist->peer) { history.peerMessagesUpdated(); @@ -670,8 +688,7 @@ void MainWidget::webPagesUpdate() { WebPageItems::const_iterator j = items.constFind(App::webPage(i.key())); if (j != items.cend()) { for (HistoryItemsMap::const_iterator k = j.value().cbegin(), e = j.value().cend(); k != e; ++k) { - k.key()->initDimensions(); - Notify::historyItemResized(k.key()); + k.key()->setPendingInitDimensions(); } } } @@ -766,8 +783,7 @@ void MainWidget::notify_userIsContactChanged(UserData *user, bool fromThisApp) { SharedContactItems::const_iterator i = items.constFind(peerToUser(user->id)); if (i != items.cend()) { for (HistoryItemsMap::const_iterator j = i->cbegin(), e = i->cend(); j != e; ++j) { - j.key()->initDimensions(); - Ui::repaintHistoryItem(j.key()); + j.key()->setPendingInitDimensions(); } } @@ -813,6 +829,10 @@ void MainWidget::notify_automaticLoadSettingsChangedGif() { history.notify_automaticLoadSettingsChangedGif(); } +void MainWidget::notify_handlePendingHistoryUpdate() { + history.notify_handlePendingHistoryUpdate(); +} + void MainWidget::cmd_search() { history.cmd_search(); } @@ -825,18 +845,6 @@ void MainWidget::cmd_previous_chat() { history.cmd_previous_chat(); } -void MainWidget::notify_historyItemResized(const HistoryItem *item, bool scrollToIt) { - if (!item || ((history.peer() == item->history()->peer || (history.peer() && history.peer() == item->history()->peer->migrateTo())) && !item->detached())) { - history.notify_historyItemResized(item, scrollToIt); - } else if (item) { - item->history()->width = 0; - if (history.peer() == item->history()->peer || (history.peer() && history.peer() == item->history()->peer->migrateTo())) { - history.resizeEvent(0); - } - } - if (item) Ui::repaintHistoryItem(item); -} - void MainWidget::noHider(HistoryHider *destroyed) { if (_hider == destroyed) { _hider = 0; @@ -909,7 +917,7 @@ void MainWidget::forwardLayer(int32 forwardSelected) { void MainWidget::deleteLayer(int32 selectedCount) { if (selectedCount == -1 && !overview) { - if (auto item = App::contextItem()) { + if (HistoryItem *item = App::contextItem()) { if (item->suggestBanReportDeleteAll()) { Ui::showLayer(new RichDeleteMessageBox(item->history()->peer->asChannel(), item->from()->asUser(), item->id)); return; @@ -1067,16 +1075,16 @@ void MainWidget::deleteAllFromUser(ChannelData *channel, UserData *from) { t_assert(channel != nullptr && from != nullptr); QVector toDestroy; - if (auto history = App::historyLoaded(channel->id)) { - for (auto i = history->blocks.cbegin(), e = history->blocks.cend(); i != e; ++i) { - for (auto j = (*i)->items.cbegin(), n = (*i)->items.cend(); j != n; ++j) { - if ((*j)->from() == from && (*j)->type() == HistoryItemMsg && (*j)->canDelete()) { - toDestroy.push_back((*j)->id); + if (History *history = App::historyLoaded(channel->id)) { + for (HistoryBlock *block : history->blocks) { + for (HistoryItem *item : block->items) { + if (item->from() == from && item->type() == HistoryItemMsg && item->canDelete()) { + toDestroy.push_back(item->id); } } } - for (auto i = toDestroy.cbegin(), e = toDestroy.cend(); i != e; ++i) { - if (auto item = App::histItemById(peerToChannel(channel->id), *i)) { + for (const MsgId &msgId : toDestroy) { + if (HistoryItem *item = App::histItemById(peerToChannel(channel->id), msgId)) { item->destroy(); } } @@ -1095,7 +1103,7 @@ void MainWidget::deleteAllFromUserPart(DeleteAllFromUserParams params, const MTP if (!MTP::authedId()) return; if (offset > 0) { MTP::send(MTPchannels_DeleteUserHistory(params.channel->inputChannel, params.from->inputUser), rpcDone(&MainWidget::deleteAllFromUserPart, params)); - } else if (auto h = App::historyLoaded(params.channel)) { + } else if (History *h = App::historyLoaded(params.channel)) { if (!h->lastMsg) { checkPeerHistory(params.channel); } @@ -1139,7 +1147,9 @@ bool MainWidget::addParticipantFail(UserData *user, const RPCError &error) { if (mtpIsFlood(error)) return false; QString text = lang(lng_failed_add_participant); - if (error.type() == "USER_LEFT_CHAT") { // trying to return banned user to his group + if (error.type() == "USER_LEFT_CHAT") { // trying to return a user who has left + } else if (error.type() == "USER_KICKED") { // trying to return a user who was kicked by admin + text = lang(lng_cant_invite_banned); } else if (error.type() == "USER_PRIVACY_RESTRICTED") { text = lang(lng_cant_invite_privacy); } else if (error.type() == "USER_NOT_MUTUAL_CONTACT") { // trying to return user who does not have me in contacts @@ -1158,8 +1168,10 @@ bool MainWidget::addParticipantsFail(ChannelData *channel, const RPCError &error QString text = lang(lng_failed_add_participant); if (error.type() == "USER_LEFT_CHAT") { // trying to return banned user to his group + } else if (error.type() == "USER_KICKED") { // trying to return a user who was kicked by admin + text = lang(lng_cant_invite_banned); } else if (error.type() == "USER_PRIVACY_RESTRICTED") { - text = lang(lng_cant_invite_privacy_channel); + text = lang(channel->isMegagroup() ? lng_cant_invite_privacy : lng_cant_invite_privacy_channel); } else if (error.type() == "USER_NOT_MUTUAL_CONTACT") { // trying to return user who does not have me in contacts text = lang(channel->isMegagroup() ? lng_failed_add_not_mutual : lng_failed_add_not_mutual_channel); } else if (error.type() == "PEER_FLOOD") { @@ -1354,7 +1366,7 @@ void MainWidget::sendMessage(History *hist, const QString &text, MsgId replyTo, if (replyTo < 0) replyTo = history.replyToId(); while (textSplit(sendingText, sendingEntities, leftText, leftEntities, MaxMessageSize)) { FullMsgId newId(peerToChannel(hist->peer->id), clientMsgId()); - uint64 randomId = MTP::nonce(); + uint64 randomId = rand_value(); trimTextWithEntities(sendingText, sendingEntities); @@ -1362,40 +1374,40 @@ void MainWidget::sendMessage(History *hist, const QString &text, MsgId replyTo, App::historyRegSentData(randomId, hist->peer->id, sendingText); MTPstring msgText(MTP_string(sendingText)); - int32 flags = newMessageFlags(hist->peer) | MTPDmessage::flag_entities; // unread, out - int32 sendFlags = 0; + MTPDmessage::Flags flags = newMessageFlags(hist->peer) | MTPDmessage::Flag::f_entities; // unread, out + MTPmessages_SendMessage::Flags sendFlags = 0; if (replyTo) { - flags |= MTPDmessage::flag_reply_to_msg_id; - sendFlags |= MTPmessages_SendMessage::flag_reply_to_msg_id; + flags |= MTPDmessage::Flag::f_reply_to_msg_id; + sendFlags |= MTPmessages_SendMessage::Flag::f_reply_to_msg_id; } MTPMessageMedia media = MTP_messageMediaEmpty(); if (webPageId == CancelledWebPageId) { - sendFlags |= MTPmessages_SendMessage::flag_no_webpage; + sendFlags |= MTPmessages_SendMessage::Flag::f_no_webpage; } else if (webPageId) { WebPageData *page = App::webPage(webPageId); media = MTP_messageMediaWebPage(MTP_webPagePending(MTP_long(page->id), MTP_int(page->pendingTill))); - flags |= MTPDmessage::flag_media; + flags |= MTPDmessage::Flag::f_media; } bool channelPost = hist->peer->isChannel() && !hist->peer->isMegagroup() && hist->peer->asChannel()->canPublish() && (hist->peer->asChannel()->isBroadcast() || broadcast); bool showFromName = !channelPost || hist->peer->asChannel()->addsSignature(); bool silentPost = channelPost && silent; if (channelPost) { - sendFlags |= MTPmessages_SendMessage::flag_broadcast; - flags |= MTPDmessage::flag_views; - flags |= MTPDmessage::flag_post; + sendFlags |= MTPmessages_SendMessage::Flag::f_broadcast; + flags |= MTPDmessage::Flag::f_views; + flags |= MTPDmessage::Flag::f_post; } if (showFromName) { - flags |= MTPDmessage::flag_from_id; + flags |= MTPDmessage::Flag::f_from_id; } if (silentPost) { - sendFlags |= MTPmessages_SendMessage::flag_silent; + sendFlags |= MTPmessages_SendMessage::Flag::f_silent; } MTPVector localEntities = linksToMTP(sendingEntities), sentEntities = linksToMTP(sendingEntities, true); if (!sentEntities.c_vector().v.isEmpty()) { - sendFlags |= MTPmessages_SendMessage::flag_entities; + sendFlags |= MTPmessages_SendMessage::Flag::f_entities; } - hist->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(hist->peer->id), MTPnullFwdHeader, MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1), MTPint()), NewMessageUnread); - hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_int(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, sentEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); + hist->addNewMessage(MTP_message(MTP_flags(flags), MTP_int(newId.msg), MTP_int(showFromName ? MTP::authedId() : 0), peerToMTP(hist->peer->id), MTPnullFwdHeader, MTPint(), MTP_int(replyTo), MTP_int(unixtime()), msgText, media, MTPnullMarkup, localEntities, MTP_int(1), MTPint()), NewMessageUnread); + hist->sendRequestId = MTP::send(MTPmessages_SendMessage(MTP_flags(sendFlags), hist->peer->input, MTP_int(replyTo), msgText, MTP_long(randomId), MTPnullMarkup, sentEntities), rpcDone(&MainWidget::sentUpdatesReceived, randomId), rpcFail(&MainWidget::sendMessageFail), 0, 0, hist->sendRequestId); } finishForwarding(hist, broadcast, silent); @@ -1485,8 +1497,11 @@ bool MainWidget::preloadOverview(PeerData *peer, MediaOverviewType type) { return false; } - int32 flags = (peer->isChannel() && !peer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _overviewPreload[type].insert(peer, MTP::send(MTPmessages_Search(MTP_int(flags), peer->input, MTP_string(""), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::overviewPreloaded, peer), rpcFail(&MainWidget::overviewFailed, peer), 0, 10)); + MTPmessages_Search::Flags flags = 0; + if (peer->isChannel() && !peer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _overviewPreload[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(flags), peer->input, MTP_string(""), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0)), rpcDone(&MainWidget::overviewPreloaded, peer), rpcFail(&MainWidget::overviewFailed, peer), 0, 10)); return true; } @@ -1618,8 +1633,11 @@ void MainWidget::loadMediaBack(PeerData *peer, MediaOverviewType type, bool many MTPMessagesFilter filter = typeToMediaFilter(type); if (type == OverviewCount) return; - int32 flags = (peer->isChannel() && !peer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _overviewLoad[type].insert(peer, MTP::send(MTPmessages_Search(MTP_int(flags), peer->input, MTPstring(), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(minId), MTP_int(limit)), rpcDone(&MainWidget::overviewLoaded, history))); + MTPmessages_Search::Flags flags = 0; + if (peer->isChannel() && !peer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _overviewLoad[type].insert(peer, MTP::send(MTPmessages_Search(MTP_flags(flags), peer->input, MTPstring(), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(minId), MTP_int(limit)), rpcDone(&MainWidget::overviewLoaded, history))); } void MainWidget::peerUsernameChanged(PeerData *peer) { @@ -1745,6 +1763,14 @@ void MainWidget::ui_showPeerHistoryAsync(quint64 peerId, qint32 showAtMsgId) { Ui::showPeerHistory(peerId, showAtMsgId); } +void MainWidget::ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId) { + if (HistoryItem *item = App::histItemById(channelId, msgId)) { + if (HistoryMedia *media = item->getMedia()) { + media->playInline(item, true); + } + } +} + void MainWidget::audioPlayProgress(const AudioMsgId &audioId) { AudioMsgId playing; AudioPlayerState state = AudioPlayerStopped; @@ -1753,24 +1779,9 @@ void MainWidget::audioPlayProgress(const AudioMsgId &audioId) { audioPlayer()->clearStoppedAtStart(audioId); DocumentData *audio = audioId.audio; - QString already = audio->already(true); - if (already.isEmpty() && !audio->data().isEmpty()) { - bool mp3 = (audio->mime == qstr("audio/mp3")); - QString filename = saveFileName(lang(lng_save_audio), mp3 ? qsl("MP3 Audio (*.mp3);;All files (*.*)") : qsl("OGG Opus Audio (*.ogg);;All files (*.*)"), qsl("audio"), mp3 ? qsl(".mp3") : qsl(".ogg"), false); - if (!filename.isEmpty()) { - QFile f(filename); - if (f.open(QIODevice::WriteOnly)) { - if (f.write(audio->data()) == audio->data().size()) { - f.close(); - already = filename; - audio->setLocation(FileLocation(StorageFilePartial, filename)); - Local::writeFileLocation(mediaKey(AudioFileLocation, audio->dc, audio->id), FileLocation(mtpToStorageType(mtpc_storage_filePartial), filename)); - } - } - } - } - if (!already.isEmpty()) { - psOpenFile(already); + QString filepath = audio->filepath(DocumentData::FilePathResolveSaveFromData); + if (!filepath.isEmpty()) { + psOpenFile(filepath); } } @@ -1790,35 +1801,9 @@ void MainWidget::documentPlayProgress(const SongMsgId &songId) { audioPlayer()->clearStoppedAtStart(songId); DocumentData *document = songId.song; - QString already = document->already(true); - if (already.isEmpty() && !document->data().isEmpty()) { - QString name = document->name, filter; - MimeType mimeType = mimeTypeForName(document->mime); - QStringList p = mimeType.globPatterns(); - QString pattern = p.isEmpty() ? QString() : p.front(); - if (name.isEmpty()) { - name = pattern.isEmpty() ? qsl(".unknown") : pattern.replace('*', QString()); - } - if (pattern.isEmpty()) { - filter = QString(); - } else { - filter = mimeType.filterString() + qsl(";;All files (*.*)"); - } - QString filename = saveFileName(lang(lng_save_file), filter, qsl("doc"), name, false); - if (!filename.isEmpty()) { - QFile f(filename); - if (f.open(QIODevice::WriteOnly)) { - if (f.write(document->data()) == document->data().size()) { - f.close(); - already = filename; - document->setLocation(FileLocation(StorageFilePartial, filename)); - Local::writeFileLocation(mediaKey(DocumentFileLocation, document->dc, document->id), FileLocation(mtpToStorageType(mtpc_storage_filePartial), filename)); - } - } - } - } - if (!already.isEmpty()) { - psOpenFile(already); + QString filepath = document->filepath(DocumentData::FilePathResolveSaveFromData); + if (!filepath.isEmpty()) { + psOpenFile(filepath); } } @@ -1977,13 +1962,13 @@ void MainWidget::dialogsCancelled() { } void MainWidget::serviceNotification(const QString &msg, const MTPMessageMedia &media) { - int32 flags = MTPDmessage::flag_unread | MTPDmessage::flag_entities | MTPDmessage::flag_from_id; + MTPDmessage::Flags flags = MTPDmessage::Flag::f_unread | MTPDmessage::Flag::f_entities | MTPDmessage::Flag::f_from_id; QString sendingText, leftText = msg; EntitiesInText sendingEntities, leftEntities = textParseEntities(leftText, _historyTextNoMonoOptions.flags); HistoryItem *item = 0; while (textSplit(sendingText, sendingEntities, leftText, leftEntities, MaxMessageSize)) { MTPVector localEntities = linksToMTP(sendingEntities); - item = App::histories().addNewMessage(MTP_message(MTP_int(flags), MTP_int(clientMsgId()), MTP_int(ServiceUserId), MTP_peerUser(MTP_int(MTP::authedId())), MTPnullFwdHeader, MTPint(), MTPint(), MTP_int(unixtime()), MTP_string(sendingText), media, MTPnullMarkup, localEntities, MTPint(), MTPint()), NewMessageUnread); + item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), MTP_int(clientMsgId()), MTP_int(ServiceUserId), MTP_peerUser(MTP_int(MTP::authedId())), MTPnullFwdHeader, MTPint(), MTPint(), MTP_int(unixtime()), MTP_string(sendingText), media, MTPnullMarkup, localEntities, MTPint(), MTPint()), NewMessageUnread); } if (item) { history.peerMessagesUpdated(item->history()->peer->id); @@ -2263,9 +2248,16 @@ void MainWidget::ctrlEnterSubmitUpdated() { void MainWidget::ui_showPeerHistory(quint64 peerId, qint32 showAtMsgId, bool back) { if (PeerData *peer = App::peerLoaded(peerId)) { if (peer->migrateTo()) { - peerId = peer->migrateTo()->id; + peer = peer->migrateTo(); + peerId = peer->id; if (showAtMsgId > 0) showAtMsgId = -showAtMsgId; } + QString restriction = peer->restrictionReason(); + if (!restriction.isEmpty()) { + Ui::showChatsList(); + Ui::showLayer(new InformBox(restriction)); + return; + } } if (!back && (!peerId || (_stack.size() == 1 && _stack[0]->type() == HistoryStackItem && _stack[0]->peer->id == peerId))) { back = true; @@ -2607,6 +2599,16 @@ void MainWidget::sentUpdatesReceived(uint64 randomId, const MTPUpdates &result) App::emitPeerUpdated(); } +bool MainWidget::deleteChannelFailed(const RPCError &error) { + if (mtpIsFlood(error)) return false; + + //if (error.type() == qstr("CHANNEL_TOO_LARGE")) { + // Ui::showLayer(new InformBox(lang(lng_cant_delete_channel))); + //} + + return true; +} + void MainWidget::inviteToChannelDone(ChannelData *channel, const MTPUpdates &updates) { sentUpdatesReceived(updates); QTimer::singleShot(ReloadChannelMembersTimeout, this, SLOT(onActiveChannelUpdateFull())); @@ -2934,7 +2936,7 @@ void MainWidget::onUpdateNotifySettings() { if (peer->notify == UnknownNotifySettings || peer->notify == EmptyNotifySettings) { peer->notify = new NotifySettings(); } - MTP::send(MTPaccount_UpdateNotifySettings(MTP_inputNotifyPeer(peer->input), MTP_inputPeerNotifySettings(MTP_int(peer->notify->flags), MTP_int(peer->notify->mute), MTP_string(peer->notify->sound))), RPCResponseHandler(), 0, updateNotifySettingPeers.isEmpty() ? 0 : 10); + MTP::send(MTPaccount_UpdateNotifySettings(MTP_inputNotifyPeer(peer->input), MTP_inputPeerNotifySettings(MTP_flags(mtpCastFlags(peer->notify->flags)), MTP_int(peer->notify->mute), MTP_string(peer->notify->sound))), RPCResponseHandler(), 0, updateNotifySettingPeers.isEmpty() ? 0 : 10); } } @@ -3031,7 +3033,7 @@ void MainWidget::gotChannelDifference(ChannelData *channel, const MTPupdates_Cha } if (history.peer() == channel) { history.updateToEndVisibility(); - history.onListScroll(); + history.preloadHistoryIfNeeded(); } h->asChannelHistory()->getRangeDifference(); } @@ -3431,8 +3433,7 @@ void MainWidget::getChannelDifference(ChannelData *channel, GetChannelDifference int32 fixInScrollMsgTop = 0; history->asChannelHistory()->getSwitchReadyFor(SwitchAtTopMsgId, fixInScrollMsgId, fixInScrollMsgTop); history->getReadyFor(ShowAtTheEndMsgId, fixInScrollMsgId, fixInScrollMsgTop); - history->lastWidth = 0; - history->lastScrollTop = INT_MAX; + history->forgetScrollState(); } } } @@ -3823,9 +3824,9 @@ void MainWidget::updateNotifySetting(PeerData *peer, NotifySettingStatus notify, peer->notify->mute = (notify == NotifySettingSetMuted) ? (unixtime() + muteFor) : 0; } if (silent == SilentNotifiesSetSilent) { - peer->notify->flags |= MTPDpeerNotifySettings::flag_silent; + peer->notify->flags |= MTPDpeerNotifySettings::Flag::f_silent; } else if (silent == SilentNotifiesSetNotify) { - peer->notify->flags &= ~MTPDpeerNotifySettings::flag_silent; + peer->notify->flags &= ~MTPDpeerNotifySettings::Flag::f_silent; } } if (notify != NotifySettingDontChange) { @@ -3888,9 +3889,9 @@ void MainWidget::incrementSticker(DocumentData *sticker) { case mtpc_inputStickerSetID: setId = sticker->sticker()->set.c_inputStickerSetID().vid.v; break; case mtpc_inputStickerSetShortName: setName = qs(sticker->sticker()->set.c_inputStickerSetShortName().vshort_name).toLower().trimmed(); break; } - StickerSets &sets(cRefStickerSets()); - for (StickerSets::const_iterator i = sets.cbegin(); i != sets.cend(); ++i) { - if (i->id == CustomStickerSetId || i->id == DefaultStickerSetId || (setId && i->id == setId) || (!setName.isEmpty() && i->shortName.toLower().trimmed() == setName)) { + Stickers::Sets &sets(Global::RefStickerSets()); + for (auto i = sets.cbegin(); i != sets.cend(); ++i) { + if (i->id == Stickers::CustomSetId || i->id == Stickers::DefaultSetId || (setId && i->id == setId) || (!setName.isEmpty() && i->shortName.toLower().trimmed() == setName)) { for (int32 j = 0, l = i->stickers.size(); j < l; ++j) { if (i->stickers.at(j) == sticker) { found = true; @@ -3901,9 +3902,9 @@ void MainWidget::incrementSticker(DocumentData *sticker) { } } if (!found) { - StickerSets::iterator it = sets.find(CustomStickerSetId); + Stickers::Sets::iterator it = sets.find(Stickers::CustomSetId); if (it == sets.cend()) { - it = sets.insert(CustomStickerSetId, StickerSet(CustomStickerSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)); + it = sets.insert(Stickers::CustomSetId, Stickers::Set(Stickers::CustomSetId, 0, lang(lng_custom_stickers), QString(), 0, 0, 0)); } it->stickers.push_back(sticker); ++it->count; @@ -4046,7 +4047,7 @@ void MainWidget::updateReceived(const mtpPrime *from, const mtpPrime *end) { feedUpdates(updates); } App::emitPeerUpdated(); - } catch (mtpErrorUnexpected &e) { // just some other type + } catch (mtpErrorUnexpected &) { // just some other type } } update(); @@ -4098,17 +4099,17 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { case mtpc_updateShortMessage: { const MTPDupdateShortMessage &d(updates.c_updateShortMessage()); - if (!App::userLoaded(d.vuser_id.v) || (d.has_via_bot_id() && !App::peerLoaded(peerFromUser(d.vvia_bot_id)))) { + if (!App::userLoaded(d.vuser_id.v) || (d.has_via_bot_id() && !App::userLoaded(d.vvia_bot_id.v))) { MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } if (d.has_fwd_from() && d.vfwd_from.type() == mtpc_messageFwdHeader) { const MTPDmessageFwdHeader &f(d.vfwd_from.c_messageFwdHeader()); - if (f.has_from_id() && !App::peerLoaded(peerFromUser(f.vfrom_id))) { + if (f.has_from_id() && !App::userLoaded(f.vfrom_id.v)) { MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } - if (f.has_channel_id() && !App::peerLoaded(peerFromChannel(f.vchannel_id))) { + if (f.has_channel_id() && !App::channelLoaded(f.vchannel_id.v)) { MTP_LOG(0, ("getDifference { good - getting user for updateShortMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } @@ -4118,8 +4119,8 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } // update before applying skipped - int32 flags = d.vflags.v | MTPDmessage::flag_from_id; - HistoryItem *item = App::histories().addNewMessage(MTP_message(MTP_int(flags), d.vid, d.is_out() ? MTP_int(MTP::authedId()) : d.vuser_id, MTP_peerUser(d.is_out() ? d.vuser_id : MTP_int(MTP::authedId())), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread); + MTPDmessage::Flags flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id; + HistoryItem *item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), d.vid, d.is_out() ? MTP_int(MTP::authedId()) : d.vuser_id, MTP_peerUser(d.is_out() ? d.vuser_id : MTP_int(MTP::authedId())), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread); if (item) { history.peerMessagesUpdated(item->history()->peer->id); } @@ -4132,18 +4133,18 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { case mtpc_updateShortChatMessage: { const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage()); bool noFrom = !App::userLoaded(d.vfrom_id.v); - if (!App::chatLoaded(d.vchat_id.v) || noFrom || (d.has_via_bot_id() && !App::peerLoaded(peerFromUser(d.vvia_bot_id)))) { + if (!App::chatLoaded(d.vchat_id.v) || noFrom || (d.has_via_bot_id() && !App::userLoaded(d.vvia_bot_id.v))) { MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); if (noFrom && App::api()) App::api()->requestFullPeer(App::chatLoaded(d.vchat_id.v)); return getDifference(); } if (d.has_fwd_from() && d.vfwd_from.type() == mtpc_messageFwdHeader) { const MTPDmessageFwdHeader &f(d.vfwd_from.c_messageFwdHeader()); - if (f.has_from_id() && !App::peerLoaded(peerFromUser(f.vfrom_id))) { + if (f.has_from_id() && !App::userLoaded(f.vfrom_id.v)) { MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } - if (f.has_channel_id() && !App::peerLoaded(peerFromChannel(f.vchannel_id))) { + if (f.has_channel_id() && !App::channelLoaded(f.vchannel_id.v)) { MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); return getDifference(); } @@ -4153,8 +4154,8 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { } // update before applying skipped - int32 flags = d.vflags.v | MTPDmessage::flag_from_id; - HistoryItem *item = App::histories().addNewMessage(MTP_message(MTP_int(flags), d.vid, d.vfrom_id, MTP_peerChat(d.vchat_id), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread); + MTPDmessage::Flags flags = mtpCastFlags(d.vflags.v) | MTPDmessage::Flag::f_from_id; + HistoryItem *item = App::histories().addNewMessage(MTP_message(MTP_flags(flags), d.vid, d.vfrom_id, MTP_peerChat(d.vchat_id), d.vfwd_from, d.vvia_bot_id, d.vreply_to_msg_id, d.vdate, d.vmessage, MTP_messageMediaEmpty(), MTPnullMarkup, d.has_entities() ? d.ventities : MTPnullEntities, MTPint(), MTPint()), NewMessageUnread); if (item) { history.peerMessagesUpdated(item->history()->peer->id); } @@ -4176,9 +4177,6 @@ void MainWidget::feedUpdates(const MTPUpdates &updates, uint64 randomId) { if (HistoryItem *item = App::histItemById(peerToChannel(peerId), d.vid.v)) { item->setText(text, d.has_entities() ? entitiesFromMTP(d.ventities.c_vector().v) : EntitiesInText()); item->updateMedia(d.has_media() ? (&d.vmedia) : 0); - item->initDimensions(); - Notify::historyItemResized(item); - item->addToOverview(AddToOverviewNew); } } @@ -4359,9 +4357,9 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { case mtpc_updateChatUserTyping: { const MTPDupdateChatUserTyping &d(update.c_updateChatUserTyping()); History *history = 0; - if (PeerData *chat = App::peerLoaded(peerFromChat(d.vchat_id.v))) { + if (PeerData *chat = App::chatLoaded(d.vchat_id.v)) { history = App::historyLoaded(chat->id); - } else if (PeerData *channel = App::peerLoaded(peerFromChannel(d.vchat_id.v))) { + } else if (PeerData *channel = App::channelLoaded(d.vchat_id.v)) { history = App::historyLoaded(channel->id); } UserData *user = (d.vuser_id.v == MTP::authedId()) ? 0 : App::userLoaded(d.vuser_id.v); @@ -4438,7 +4436,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { UserData *user = App::userLoaded(d.vuser_id.v); if (user) { user->setPhoto(d.vphoto); - user->photo->load(); + user->loadUserpic(); if (mtpIsTrue(d.vprevious)) { user->photosCount = -1; user->photos.clear(); @@ -4461,7 +4459,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { UserData *user = App::userLoaded(d.vuser_id.v); if (user) { if (App::history(user->id)->loadedAtBottom()) { - App::history(user->id)->addNewService(clientMsgId(), date(d.vdate), lng_action_user_registered(lt_from, user->name), MTPDmessage::flag_unread); + App::history(user->id)->addNewService(clientMsgId(), date(d.vdate), lng_action_user_registered(lt_from, user->name), MTPDmessage::Flag::f_unread); } } } break; @@ -4684,10 +4682,10 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { if (set.vset.type() == mtpc_stickerSet) { const MTPDstickerSet &s(set.vset.c_stickerSet()); - StickerSets &sets(cRefStickerSets()); - StickerSets::iterator it = sets.find(s.vid.v); + Stickers::Sets &sets(Global::RefStickerSets()); + auto it = sets.find(s.vid.v); if (it == sets.cend()) { - it = sets.insert(s.vid.v, StickerSet(s.vid.v, s.vaccess_hash.v, stickerSetTitle(s), qs(s.vshort_name), s.vcount.v, s.vhash.v, s.vflags.v)); + it = sets.insert(s.vid.v, Stickers::Set(s.vid.v, s.vaccess_hash.v, stickerSetTitle(s), qs(s.vshort_name), s.vcount.v, s.vhash.v, s.vflags.v)); } const QVector &v(set.vdocuments.c_vector().v); @@ -4718,7 +4716,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { } } - StickerSetsOrder &order(cRefStickerSetsOrder()); + auto &order(Global::RefStickerSetsOrder()); int32 insertAtIndex = 0, currentIndex = order.indexOf(s.vid.v); if (currentIndex != insertAtIndex) { if (currentIndex > 0) { @@ -4727,7 +4725,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { order.insert(insertAtIndex, s.vid.v); } - StickerSets::iterator custom = sets.find(CustomStickerSetId); + auto custom = sets.find(Stickers::CustomSetId); if (custom != sets.cend()) { for (int32 i = 0, l = it->stickers.size(); i < l; ++i) { int32 removeIndex = custom->stickers.indexOf(it->stickers.at(i)); @@ -4746,26 +4744,26 @@ void MainWidget::feedUpdate(const MTPUpdate &update) { case mtpc_updateStickerSetsOrder: { const MTPDupdateStickerSetsOrder &d(update.c_updateStickerSetsOrder()); const QVector &order(d.vorder.c_vector().v); - const StickerSets &sets(cStickerSets()); - StickerSetsOrder result; + const Stickers::Sets &sets(Global::StickerSets()); + Stickers::Order result; for (int32 i = 0, l = order.size(); i < l; ++i) { if (sets.constFind(order.at(i).v) == sets.cend()) { break; } result.push_back(order.at(i).v); } - if (result.size() != cStickerSetsOrder().size() || result.size() != order.size()) { - cSetLastStickersUpdate(0); + if (result.size() != Global::StickerSetsOrder().size() || result.size() != order.size()) { + Global::SetLastStickersUpdate(0); App::main()->updateStickers(); } else { - cSetStickerSetsOrder(result); + Global::SetStickerSetsOrder(result); Local::writeStickers(); emit stickersUpdated(); } } break; case mtpc_updateStickerSets: { - cSetLastStickersUpdate(0); + Global::SetLastStickersUpdate(0); App::main()->updateStickers(); } break; diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 30e40dbc3..67c2398f0 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -78,6 +78,7 @@ public slots: void onDeleteContactSure(); void onDeleteAndExit(); void onDeleteAndExitSure(); + void onSearch(); signals: @@ -105,6 +106,8 @@ private: FlatButton _edit, _leaveGroup, _addContact, _deleteContact; FlatButton _mediaType; + IconedButton _search; + PlainShadow _sideShadow; }; @@ -248,6 +251,7 @@ public: void sentUpdatesReceived(const MTPUpdates &updates) { return sentUpdatesReceived(0, updates); } + bool deleteChannelFailed(const RPCError &error); void inviteToChannelDone(ChannelData *channel, const MTPUpdates &updates); void historyToDown(History *hist); void dialogsToUp(); @@ -441,9 +445,9 @@ public: void notify_userIsContactChanged(UserData *user, bool fromThisApp); void notify_migrateUpdated(PeerData *peer); void notify_clipStopperHidden(ClipStopperType type); - void notify_historyItemResized(const HistoryItem *row, bool scrollToIt); void notify_historyItemLayoutChanged(const HistoryItem *item); void notify_automaticLoadSettingsChangedGif(); + void notify_handlePendingHistoryUpdate(); void cmd_search(); void cmd_next_chat(); @@ -517,6 +521,7 @@ public slots: void onDownloadPathSettings(); void ui_showPeerHistoryAsync(quint64 peerId, qint32 showAtMsgId); + void ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId); private: diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 492189aa4..853603304 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -313,7 +313,7 @@ void MediaView::updateControls() { _docRadial.start(_doc->progress()); } } else { - if (_doc->loaded(true)) { + if (_doc->loaded(DocumentData::FilePathResolveChecked)) { _docDownload.hide(); _docSaveAs.moveToLeft(_docRect.x() + 2 * st::mvDocPadding + st::mvDocIconSize, _docRect.y() + st::mvDocPadding + st::mvDocLinksTop); _docSaveAs.show(); @@ -333,7 +333,7 @@ void MediaView::updateControls() { _docCancel.hide(); } - _saveVisible = ((_photo && _photo->loaded()) || (_doc && (_doc->loaded(true) || (!fileShown() && (_photo || _doc))))); + _saveVisible = ((_photo && _photo->loaded()) || (_doc && (_doc->loaded(DocumentData::FilePathResolveChecked) || (!fileShown() && (_photo || _doc))))); _saveNav = myrtlrect(width() - st::mvIconSize.width() * 2, height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height()); _saveNavIcon = centersprite(_saveNav, st::mvSave); _moreNav = myrtlrect(width() - st::mvIconSize.width(), height() - st::mvIconSize.height(), st::mvIconSize.width(), st::mvIconSize.height()); @@ -394,7 +394,7 @@ void MediaView::updateControls() { void MediaView::updateDropdown() { _btnSaveCancel->setVisible(_doc && _doc->loading()); _btnToMessage->setVisible(_msgid > 0); - _btnShowInFolder->setVisible(_doc && !_doc->already(true).isEmpty()); + _btnShowInFolder->setVisible(_doc && !_doc->filepath(DocumentData::FilePathResolveChecked).isEmpty()); _btnSaveAs->setVisible(true); _btnCopy->setVisible((_doc && fileShown()) || (_photo && _photo->loaded())); _btnForward->setVisible(_canForward); @@ -685,8 +685,11 @@ void MediaView::onSaveCancel() { void MediaView::onShowInFolder() { if (!_doc) return; - QString already(_doc->already(true)); - if (!already.isEmpty()) psShowInFolder(already); + + QString filepath = _doc->filepath(DocumentData::FilePathResolveChecked); + if (!filepath.isEmpty()) { + psShowInFolder(filepath); + } } void MediaView::onForward() { @@ -964,7 +967,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty if (!_doc->data().isEmpty() && _doc->isAnimation()) { if (!_gif) { if (_doc->dimensions.width() && _doc->dimensions.height()) { - _current = _doc->thumb->pixNoCache(_doc->dimensions.width(), _doc->dimensions.height(), true, true, false, _doc->dimensions.width(), _doc->dimensions.height()); + _current = _doc->thumb->pixNoCache(_doc->dimensions.width(), _doc->dimensions.height(), ImagePixSmooth | ImagePixBlurred, _doc->dimensions.width(), _doc->dimensions.height()); } _gif = new ClipReader(location, _doc->data(), func(this, &MediaView::clipCallback)); } @@ -972,7 +975,7 @@ void MediaView::displayDocument(DocumentData *doc, HistoryItem *item) { // empty if (_doc->isAnimation()) { if (!_gif) { if (_doc->dimensions.width() && _doc->dimensions.height()) { - _current = _doc->thumb->pixNoCache(_doc->dimensions.width(), _doc->dimensions.height(), true, true, false, _doc->dimensions.width(), _doc->dimensions.height()); + _current = _doc->thumb->pixNoCache(_doc->dimensions.width(), _doc->dimensions.height(), ImagePixSmooth | ImagePixBlurred, _doc->dimensions.width(), _doc->dimensions.height()); } _gif = new ClipReader(location, _doc->data(), func(this, &MediaView::clipCallback)); } @@ -1113,17 +1116,17 @@ void MediaView::paintEvent(QPaintEvent *e) { int32 w = _width * cIntRetinaFactor(); if (_full <= 0 && _photo->loaded()) { int32 h = int((_photo->full->height() * (qreal(w) / qreal(_photo->full->width()))) + 0.9999); - _current = _photo->full->pixNoCache(w, h, true); + _current = _photo->full->pixNoCache(w, h, ImagePixSmooth); if (cRetina()) _current.setDevicePixelRatio(cRetinaFactor()); _full = 1; } else if (_full < 0 && _photo->medium->loaded()) { int32 h = int((_photo->full->height() * (qreal(w) / qreal(_photo->full->width()))) + 0.9999); - _current = _photo->medium->pixNoCache(w, h, true, true); + _current = _photo->medium->pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred); if (cRetina()) _current.setDevicePixelRatio(cRetinaFactor()); _full = 0; } else if (_current.isNull() && _photo->thumb->loaded()) { int32 h = int((_photo->full->height() * (qreal(w) / qreal(_photo->full->width()))) + 0.9999); - _current = _photo->thumb->pixNoCache(w, h, true, true); + _current = _photo->thumb->pixNoCache(w, h, ImagePixSmooth | ImagePixBlurred); if (cRetina()) _current.setDevicePixelRatio(cRetinaFactor()); } else if (_current.isNull()) { _current = _photo->thumb->pix(); diff --git a/Telegram/SourceFiles/mtproto/auth_key.cpp b/Telegram/SourceFiles/mtproto/auth_key.cpp new file mode 100644 index 000000000..cd0f3497b --- /dev/null +++ b/Telegram/SourceFiles/mtproto/auth_key.cpp @@ -0,0 +1,59 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/auth_key.h" + +#include + +namespace MTP { + +void aesIgeEncrypt(const void *src, void *dst, uint32 len, const void *key, const void *iv) { + uchar aes_key[32], aes_iv[32]; + memcpy(aes_key, key, 32); + memcpy(aes_iv, iv, 32); + + AES_KEY aes; + AES_set_encrypt_key(aes_key, 256, &aes); + AES_ige_encrypt(static_cast(src), static_cast(dst), len, &aes, aes_iv, AES_ENCRYPT); +} + +void aesIgeDecrypt(const void *src, void *dst, uint32 len, const void *key, const void *iv) { + uchar aes_key[32], aes_iv[32]; + memcpy(aes_key, key, 32); + memcpy(aes_iv, iv, 32); + + AES_KEY aes; + AES_set_decrypt_key(aes_key, 256, &aes); + AES_ige_encrypt(static_cast(src), static_cast(dst), len, &aes, aes_iv, AES_DECRYPT); +} + +void aesCtrEncrypt(void *data, uint32 len, const void *key, CTRState *state) { + AES_KEY aes; + AES_set_encrypt_key(static_cast(key), 256, &aes); + + static_assert(CTRState::IvecSize == AES_BLOCK_SIZE, "Wrong size of ctr ivec!"); + static_assert(CTRState::EcountSize == AES_BLOCK_SIZE, "Wrong size of ctr ecount!"); + + AES_ctr128_encrypt(static_cast(data), static_cast(data), len, &aes, state->ivec, state->ecount, &state->num); +} + +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpAuthKey.h b/Telegram/SourceFiles/mtproto/auth_key.h similarity index 64% rename from Telegram/SourceFiles/mtproto/mtpAuthKey.h rename to Telegram/SourceFiles/mtproto/auth_key.h index 9bd994461..935eee423 100644 --- a/Telegram/SourceFiles/mtproto/mtpAuthKey.h +++ b/Telegram/SourceFiles/mtproto/auth_key.h @@ -20,10 +20,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -class mtpAuthKey { +namespace MTP { + +class AuthKey { public: - mtpAuthKey() : _isset(false), _dc(0) { + AuthKey() : _isset(false), _dc(0) { } bool created() const { @@ -52,7 +54,7 @@ public: } void prepareAES(const MTPint128 &msgKey, MTPint256 &aesKey, MTPint256 &aesIV, bool send = true) const { - if (!_isset) throw mtpErrorKeyNotReady(QString("prepareAES(.., %1)").arg(Logs::b(send))); + if (!_isset) throw mtpErrorKeyNotReady(QString("prepareAES(..., %1)").arg(Logs::b(send))); uint32 x = send ? 0 : 8; @@ -88,13 +90,13 @@ public: } void write(QDataStream &to) const { - if (!_isset) throw mtpErrorKeyNotReady("write(..)"); + if (!_isset) throw mtpErrorKeyNotReady("write(...)"); to.writeRawData(_key, 256); } static const uint64 RecreateKeyId = 0xFFFFFFFFFFFFFFFFL; - friend bool operator==(const mtpAuthKey &a, const mtpAuthKey &b); + friend bool operator==(const AuthKey &a, const AuthKey &b); private: @@ -105,40 +107,54 @@ private: }; -inline bool operator==(const mtpAuthKey &a, const mtpAuthKey &b) { +inline bool operator==(const AuthKey &a, const AuthKey &b) { return !memcmp(a._key, b._key, 256); } -typedef QSharedPointer mtpAuthKeyPtr; -typedef QVector mtpKeysMap; +typedef QSharedPointer AuthKeyPtr; +typedef QVector AuthKeysMap; -void aesEncrypt(const void *src, void *dst, uint32 len, void *key, void *iv); -void aesDecrypt(const void *src, void *dst, uint32 len, void *key, void *iv); +void aesIgeEncrypt(const void *src, void *dst, uint32 len, const void *key, const void *iv); +void aesIgeDecrypt(const void *src, void *dst, uint32 len, const void *key, const void *iv); -inline void aesEncrypt(const void *src, void *dst, uint32 len, const mtpAuthKeyPtr &authKey, const MTPint128 &msgKey) { +inline void aesIgeEncrypt(const void *src, void *dst, uint32 len, const AuthKeyPtr &authKey, const MTPint128 &msgKey) { MTPint256 aesKey, aesIV; authKey->prepareAES(msgKey, aesKey, aesIV); - return aesEncrypt(src, dst, len, &aesKey, &aesIV); + return aesIgeEncrypt(src, dst, len, static_cast(&aesKey), static_cast(&aesIV)); } -inline void aesEncryptLocal(const void *src, void *dst, uint32 len, const mtpAuthKey *authKey, const void *key128) { +inline void aesEncryptLocal(const void *src, void *dst, uint32 len, const AuthKey *authKey, const void *key128) { MTPint256 aesKey, aesIV; authKey->prepareAES(*(const MTPint128*)key128, aesKey, aesIV, false); - return aesEncrypt(src, dst, len, &aesKey, &aesIV); + return aesIgeEncrypt(src, dst, len, static_cast(&aesKey), static_cast(&aesIV)); } -inline void aesDecrypt(const void *src, void *dst, uint32 len, const mtpAuthKeyPtr &authKey, const MTPint128 &msgKey) { +inline void aesIgeDecrypt(const void *src, void *dst, uint32 len, const AuthKeyPtr &authKey, const MTPint128 &msgKey) { MTPint256 aesKey, aesIV; authKey->prepareAES(msgKey, aesKey, aesIV, false); - return aesDecrypt(src, dst, len, &aesKey, &aesIV); + return aesIgeDecrypt(src, dst, len, static_cast(&aesKey), static_cast(&aesIV)); } -inline void aesDecryptLocal(const void *src, void *dst, uint32 len, const mtpAuthKey *authKey, const void *key128) { +inline void aesDecryptLocal(const void *src, void *dst, uint32 len, const AuthKey *authKey, const void *key128) { MTPint256 aesKey, aesIV; authKey->prepareAES(*(const MTPint128*)key128, aesKey, aesIV, false); - return aesDecrypt(src, dst, len, &aesKey, &aesIV); + return aesIgeDecrypt(src, dst, len, static_cast(&aesKey), static_cast(&aesIV)); } + +// ctr used inplace, encrypt the data and leave it at the same place +struct CTRState { + static constexpr int KeySize = 32; + static constexpr int IvecSize = 16; + static constexpr int EcountSize = 16; + + uchar ivec[IvecSize] = { 0 }; + uint32 num = 0; + uchar ecount[EcountSize] = { 0 }; +}; +void aesCtrEncrypt(void *data, uint32 len, const void *key, CTRState *state); + +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp similarity index 63% rename from Telegram/SourceFiles/mtproto/mtpConnection.cpp rename to Telegram/SourceFiles/mtproto/connection.cpp index 470bc0db3..d05737382 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -20,284 +20,295 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" +#include "mtproto/connection.h" + +#include +#include +#include +#include +#include #include +#include "zlib.h" + +#include "mtproto/rsa_public_key.h" + +using std::string; + +namespace MTP { +namespace internal { namespace { - bool parsePQ(const std::string &pqStr, std::string &pStr, std::string &qStr) { - if (pqStr.length() > 8) return false; // more than 64 bit pq - uint64 pq = 0, p, q; - const uchar *pqChars = (const uchar*)&pqStr[0]; - for (uint32 i = 0, l = pqStr.length(); i < l; ++i) { - pq <<= 8; - pq |= (uint64)pqChars[i]; - } - uint64 pqSqrt = (uint64)sqrtl((long double)pq), ySqr, y; - while (pqSqrt * pqSqrt > pq) --pqSqrt; - while (pqSqrt * pqSqrt < pq) ++pqSqrt; - for (ySqr = pqSqrt * pqSqrt - pq; ; ++pqSqrt, ySqr = pqSqrt * pqSqrt - pq) { - y = (uint64)sqrtl((long double)ySqr); - while (y * y > ySqr) --y; - while (y * y < ySqr) ++y; - if (!ySqr || y + pqSqrt >= pq) return false; - if (y * y == ySqr) { - p = pqSqrt + y; - q = (pqSqrt > y) ? (pqSqrt - y) : (y - pqSqrt); - break; - } - } - if (p > q) swap(p, q); +bool parsePQ(const string &pqStr, string &pStr, string &qStr) { + if (pqStr.length() > 8) return false; // more than 64 bit pq - pStr.resize(4); - uchar *pChars = (uchar*)&pStr[0]; - for (uint32 i = 0; i < 4; ++i) { - *(pChars + 3 - i) = (uchar)(p & 0xFF); - p >>= 8; + uint64 pq = 0, p, q; + const uchar *pqChars = (const uchar*)&pqStr[0]; + for (uint32 i = 0, l = pqStr.length(); i < l; ++i) { + pq <<= 8; + pq |= (uint64)pqChars[i]; + } + uint64 pqSqrt = (uint64)sqrtl((long double)pq), ySqr, y; + while (pqSqrt * pqSqrt > pq) --pqSqrt; + while (pqSqrt * pqSqrt < pq) ++pqSqrt; + for (ySqr = pqSqrt * pqSqrt - pq; ; ++pqSqrt, ySqr = pqSqrt * pqSqrt - pq) { + y = (uint64)sqrtl((long double)ySqr); + while (y * y > ySqr) --y; + while (y * y < ySqr) ++y; + if (!ySqr || y + pqSqrt >= pq) return false; + if (y * y == ySqr) { + p = pqSqrt + y; + q = (pqSqrt > y) ? (pqSqrt - y) : (y - pqSqrt); + break; + } + } + if (p > q) swap(p, q); + + pStr.resize(4); + uchar *pChars = (uchar*)&pStr[0]; + for (uint32 i = 0; i < 4; ++i) { + *(pChars + 3 - i) = (uchar)(p & 0xFF); + p >>= 8; + } + + qStr.resize(4); + uchar *qChars = (uchar*)&qStr[0]; + for (uint32 i = 0; i < 4; ++i) { + *(qChars + 3 - i) = (uchar)(q & 0xFF); + q >>= 8; + } + + return true; +} + +class BigNumCounter { +public: + bool count(const void *power, const void *modul, uint32 g, void *gResult, const void *g_a, void *g_aResult) { + DEBUG_LOG(("BigNum Info: counting g_b = g ^ b % dh_prime and auth_key = g_a ^ b % dh_prime")); + uint32 g_be = qToBigEndian(g); + if ( + !BN_bin2bn((const uchar*)power, 64 * sizeof(uint32), &bnPower) || + !BN_bin2bn((const uchar*)modul, 64 * sizeof(uint32), &bnModul) || + !BN_bin2bn((const uchar*)&g_be, sizeof(uint32), &bn_g) || + !BN_bin2bn((const uchar*)g_a, 64 * sizeof(uint32), &bn_g_a) + ) { + ERR_load_crypto_strings(); + LOG(("BigNum Error: BN_bin2bn failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); + DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); + return false; } - qStr.resize(4); - uchar *qChars = (uchar*)&qStr[0]; - for (uint32 i = 0; i < 4; ++i) { - *(qChars + 3 - i) = (uchar)(q & 0xFF); - q >>= 8; + if (!BN_mod_exp(&bnResult, &bn_g, &bnPower, &bnModul, ctx)) { + ERR_load_crypto_strings(); + LOG(("BigNum Error: BN_mod_exp failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); + DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); + return false; + } + + uint32 resultLen = BN_num_bytes(&bnResult); + if (resultLen != 64 * sizeof(uint32)) { + DEBUG_LOG(("BigNum Error: bad gResult len (%1)").arg(resultLen)); + return false; + } + resultLen = BN_bn2bin(&bnResult, (uchar*)gResult); + if (resultLen != 64 * sizeof(uint32)) { + DEBUG_LOG(("BigNum Error: bad gResult export len (%1)").arg(resultLen)); + return false; + } + + BN_add_word(&bnResult, 1); // check g_b < dh_prime - 1 + if (BN_cmp(&bnResult, &bnModul) >= 0) { + DEBUG_LOG(("BigNum Error: bad g_b >= dh_prime - 1")); + return false; + } + + if (!BN_mod_exp(&bnResult, &bn_g_a, &bnPower, &bnModul, ctx)) { + ERR_load_crypto_strings(); + LOG(("BigNum Error: BN_mod_exp failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); + DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); + return false; + } + + resultLen = BN_num_bytes(&bnResult); + if (resultLen != 64 * sizeof(uint32)) { + DEBUG_LOG(("BigNum Error: bad g_aResult len (%1)").arg(resultLen)); + return false; + } + resultLen = BN_bn2bin(&bnResult, (uchar*)g_aResult); + if (resultLen != 64 * sizeof(uint32)) { + DEBUG_LOG(("BigNum Error: bad g_aResult export len (%1)").arg(resultLen)); + return false; + } + + BN_add_word(&bn_g_a, 1); // check g_a < dh_prime - 1 + if (BN_cmp(&bn_g_a, &bnModul) >= 0) { + DEBUG_LOG(("BigNum Error: bad g_a >= dh_prime - 1")); + return false; } return true; } - class _BigNumCounter { - public: - bool count(const void *power, const void *modul, uint32 g, void *gResult, const void *g_a, void *g_aResult) { - DEBUG_LOG(("BigNum Info: counting g_b = g ^ b % dh_prime and auth_key = g_a ^ b % dh_prime")); - uint32 g_be = qToBigEndian(g); - if ( - !BN_bin2bn((const uchar*)power, 64 * sizeof(uint32), &bnPower) || - !BN_bin2bn((const uchar*)modul, 64 * sizeof(uint32), &bnModul) || - !BN_bin2bn((const uchar*)&g_be, sizeof(uint32), &bn_g) || - !BN_bin2bn((const uchar*)g_a, 64 * sizeof(uint32), &bn_g_a) - ) { - ERR_load_crypto_strings(); - LOG(("BigNum Error: BN_bin2bn failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); - DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); - return false; - } - - if (!BN_mod_exp(&bnResult, &bn_g, &bnPower, &bnModul, ctx)) { - ERR_load_crypto_strings(); - LOG(("BigNum Error: BN_mod_exp failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); - DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); - return false; - } - - uint32 resultLen = BN_num_bytes(&bnResult); - if (resultLen != 64 * sizeof(uint32)) { - DEBUG_LOG(("BigNum Error: bad gResult len (%1)").arg(resultLen)); - return false; - } - resultLen = BN_bn2bin(&bnResult, (uchar*)gResult); - if (resultLen != 64 * sizeof(uint32)) { - DEBUG_LOG(("BigNum Error: bad gResult export len (%1)").arg(resultLen)); - return false; - } - - BN_add_word(&bnResult, 1); // check g_b < dh_prime - 1 - if (BN_cmp(&bnResult, &bnModul) >= 0) { - DEBUG_LOG(("BigNum Error: bad g_b >= dh_prime - 1")); - return false; - } - - if (!BN_mod_exp(&bnResult, &bn_g_a, &bnPower, &bnModul, ctx)) { - ERR_load_crypto_strings(); - LOG(("BigNum Error: BN_mod_exp failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); - DEBUG_LOG(("BigNum Error: base %1, power %2, modul %3").arg(Logs::mb(&g_be, sizeof(uint32)).str()).arg(Logs::mb(power, 64 * sizeof(uint32)).str()).arg(Logs::mb(modul, 64 * sizeof(uint32)).str())); - return false; - } - - resultLen = BN_num_bytes(&bnResult); - if (resultLen != 64 * sizeof(uint32)) { - DEBUG_LOG(("BigNum Error: bad g_aResult len (%1)").arg(resultLen)); - return false; - } - resultLen = BN_bn2bin(&bnResult, (uchar*)g_aResult); - if (resultLen != 64 * sizeof(uint32)) { - DEBUG_LOG(("BigNum Error: bad g_aResult export len (%1)").arg(resultLen)); - return false; - } - - BN_add_word(&bn_g_a, 1); // check g_a < dh_prime - 1 - if (BN_cmp(&bn_g_a, &bnModul) >= 0) { - DEBUG_LOG(("BigNum Error: bad g_a >= dh_prime - 1")); - return false; - } - - return true; - } - - _BigNumCounter() : ctx(BN_CTX_new()) { - BN_init(&bnPower); - BN_init(&bnModul); - BN_init(&bn_g); - BN_init(&bn_g_a); - BN_init(&bnResult); - } - ~_BigNumCounter() { - BN_CTX_free(ctx); - BN_clear_free(&bnPower); - BN_clear_free(&bnModul); - BN_clear_free(&bn_g); - BN_clear_free(&bn_g_a); - BN_clear_free(&bnResult); - } - - private: - BIGNUM bnPower, bnModul, bn_g, bn_g_a, bnResult; - BN_CTX *ctx; - }; - - // Miller-Rabin primality test - class _BigNumPrimeTest { - public: - - bool isPrimeAndGood(const void *pData, uint32 iterCount, int32 g) { - if (!memcmp(pData, "\xC7\x1C\xAE\xB9\xC6\xB1\xC9\x04\x8E\x6C\x52\x2F\x70\xF1\x3F\x73\x98\x0D\x40\x23\x8E\x3E\x21\xC1\x49\x34\xD0\x37\x56\x3D\x93\x0F\x48\x19\x8A\x0A\xA7\xC1\x40\x58\x22\x94\x93\xD2\x25\x30\xF4\xDB\xFA\x33\x6F\x6E\x0A\xC9\x25\x13\x95\x43\xAE\xD4\x4C\xCE\x7C\x37\x20\xFD\x51\xF6\x94\x58\x70\x5A\xC6\x8C\xD4\xFE\x6B\x6B\x13\xAB\xDC\x97\x46\x51\x29\x69\x32\x84\x54\xF1\x8F\xAF\x8C\x59\x5F\x64\x24\x77\xFE\x96\xBB\x2A\x94\x1D\x5B\xCD\x1D\x4A\xC8\xCC\x49\x88\x07\x08\xFA\x9B\x37\x8E\x3C\x4F\x3A\x90\x60\xBE\xE6\x7C\xF9\xA4\xA4\xA6\x95\x81\x10\x51\x90\x7E\x16\x27\x53\xB5\x6B\x0F\x6B\x41\x0D\xBA\x74\xD8\xA8\x4B\x2A\x14\xB3\x14\x4E\x0E\xF1\x28\x47\x54\xFD\x17\xED\x95\x0D\x59\x65\xB4\xB9\xDD\x46\x58\x2D\xB1\x17\x8D\x16\x9C\x6B\xC4\x65\xB0\xD6\xFF\x9C\xA3\x92\x8F\xEF\x5B\x9A\xE4\xE4\x18\xFC\x15\xE8\x3E\xBE\xA0\xF8\x7F\xA9\xFF\x5E\xED\x70\x05\x0D\xED\x28\x49\xF4\x7B\xF9\x59\xD9\x56\x85\x0C\xE9\x29\x85\x1F\x0D\x81\x15\xF6\x35\xB1\x05\xEE\x2E\x4E\x15\xD0\x4B\x24\x54\xBF\x6F\x4F\xAD\xF0\x34\xB1\x04\x03\x11\x9C\xD8\xE3\xB9\x2F\xCC\x5B", 256)) { - if (g == 3 || g == 4 || g == 5 || g == 7) { - return true; - } - } - if ( - !BN_bin2bn((const uchar*)pData, 64 * sizeof(uint32), &bnPrime) - ) { - ERR_load_crypto_strings(); - LOG(("BigNum PT Error: BN_bin2bn failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); - DEBUG_LOG(("BigNum PT Error: prime %1").arg(Logs::mb(pData, 64 * sizeof(uint32)).str())); - return false; - } - - int32 numBits = BN_num_bits(&bnPrime); - if (numBits != 2048) { - LOG(("BigNum PT Error: BN_bin2bn failed, bad dh_prime num bits: %1").arg(numBits)); - return false; - } - - if (BN_is_prime_ex(&bnPrime, MTPMillerRabinIterCount, ctx, NULL) == 0) { - return false; - } - - switch (g) { - case 2: { - int32 mod8 = BN_mod_word(&bnPrime, 8); - if (mod8 != 7) { - LOG(("BigNum PT Error: bad g value: %1, mod8: %2").arg(g).arg(mod8)); - return false; - } - } break; - case 3: { - int32 mod3 = BN_mod_word(&bnPrime, 3); - if (mod3 != 2) { - LOG(("BigNum PT Error: bad g value: %1, mod3: %2").arg(g).arg(mod3)); - return false; - } - } break; - case 4: break; - case 5: { - int32 mod5 = BN_mod_word(&bnPrime, 5); - if (mod5 != 1 && mod5 != 4) { - LOG(("BigNum PT Error: bad g value: %1, mod5: %2").arg(g).arg(mod5)); - return false; - } - } break; - case 6: { - int32 mod24 = BN_mod_word(&bnPrime, 24); - if (mod24 != 19 && mod24 != 23) { - LOG(("BigNum PT Error: bad g value: %1, mod24: %2").arg(g).arg(mod24)); - return false; - } - } break; - case 7: { - int32 mod7 = BN_mod_word(&bnPrime, 7); - if (mod7 != 3 && mod7 != 5 && mod7 != 6) { - LOG(("BigNum PT Error: bad g value: %1, mod7: %2").arg(g).arg(mod7)); - return false; - } - } break; - default: - LOG(("BigNum PT Error: bad g value: %1").arg(g)); - return false; - break; - } - - BN_sub_word(&bnPrime, 1); // (p - 1) / 2 - BN_div_word(&bnPrime, 2); - - if (BN_is_prime_ex(&bnPrime, MTPMillerRabinIterCount, ctx, NULL) == 0) { - return false; - } - - return true; - } - - _BigNumPrimeTest() : ctx(BN_CTX_new()) { - BN_init(&bnPrime); - } - ~_BigNumPrimeTest() { - BN_CTX_free(ctx); - BN_clear_free(&bnPrime); - } - - private: - BIGNUM bnPrime; - BN_CTX *ctx; - }; - - typedef QMap PublicRSAKeys; - PublicRSAKeys gPublicRSA; - - bool gConfigInited = false; - void initRSAConfig() { - if (gConfigInited) return; - gConfigInited = true; - - DEBUG_LOG(("MTP Info: MTP config init")); - - // read all public keys - uint32 keysCnt; - const char **keys = cPublicRSAKeys(keysCnt); - for (uint32 i = 0; i < keysCnt; ++i) { - mtpPublicRSA key(keys[i]); - if (key.key()) { - gPublicRSA.insert(key.fingerPrint(), key); - } else { - LOG(("MTP Error: could not read this public RSA key:")); - LOG((keys[i])); - } - } - DEBUG_LOG(("MTP Info: read %1 public RSA keys").arg(gPublicRSA.size())); + BigNumCounter() : ctx(BN_CTX_new()) { + BN_init(&bnPower); + BN_init(&bnModul); + BN_init(&bn_g); + BN_init(&bn_g_a); + BN_init(&bnResult); } + ~BigNumCounter() { + BN_CTX_free(ctx); + BN_clear_free(&bnPower); + BN_clear_free(&bnModul); + BN_clear_free(&bn_g); + BN_clear_free(&bn_g_a); + BN_clear_free(&bnResult); + } + +private: + BIGNUM bnPower, bnModul, bn_g, bn_g_a, bnResult; + BN_CTX *ctx; +}; + +// Miller-Rabin primality test +class BigNumPrimeTest { +public: + + bool isPrimeAndGood(const void *pData, uint32 iterCount, int32 g) { + if (!memcmp(pData, "\xC7\x1C\xAE\xB9\xC6\xB1\xC9\x04\x8E\x6C\x52\x2F\x70\xF1\x3F\x73\x98\x0D\x40\x23\x8E\x3E\x21\xC1\x49\x34\xD0\x37\x56\x3D\x93\x0F\x48\x19\x8A\x0A\xA7\xC1\x40\x58\x22\x94\x93\xD2\x25\x30\xF4\xDB\xFA\x33\x6F\x6E\x0A\xC9\x25\x13\x95\x43\xAE\xD4\x4C\xCE\x7C\x37\x20\xFD\x51\xF6\x94\x58\x70\x5A\xC6\x8C\xD4\xFE\x6B\x6B\x13\xAB\xDC\x97\x46\x51\x29\x69\x32\x84\x54\xF1\x8F\xAF\x8C\x59\x5F\x64\x24\x77\xFE\x96\xBB\x2A\x94\x1D\x5B\xCD\x1D\x4A\xC8\xCC\x49\x88\x07\x08\xFA\x9B\x37\x8E\x3C\x4F\x3A\x90\x60\xBE\xE6\x7C\xF9\xA4\xA4\xA6\x95\x81\x10\x51\x90\x7E\x16\x27\x53\xB5\x6B\x0F\x6B\x41\x0D\xBA\x74\xD8\xA8\x4B\x2A\x14\xB3\x14\x4E\x0E\xF1\x28\x47\x54\xFD\x17\xED\x95\x0D\x59\x65\xB4\xB9\xDD\x46\x58\x2D\xB1\x17\x8D\x16\x9C\x6B\xC4\x65\xB0\xD6\xFF\x9C\xA3\x92\x8F\xEF\x5B\x9A\xE4\xE4\x18\xFC\x15\xE8\x3E\xBE\xA0\xF8\x7F\xA9\xFF\x5E\xED\x70\x05\x0D\xED\x28\x49\xF4\x7B\xF9\x59\xD9\x56\x85\x0C\xE9\x29\x85\x1F\x0D\x81\x15\xF6\x35\xB1\x05\xEE\x2E\x4E\x15\xD0\x4B\x24\x54\xBF\x6F\x4F\xAD\xF0\x34\xB1\x04\x03\x11\x9C\xD8\xE3\xB9\x2F\xCC\x5B", 256)) { + if (g == 3 || g == 4 || g == 5 || g == 7) { + return true; + } + } + if ( + !BN_bin2bn((const uchar*)pData, 64 * sizeof(uint32), &bnPrime) + ) { + ERR_load_crypto_strings(); + LOG(("BigNum PT Error: BN_bin2bn failed, error: %1").arg(ERR_error_string(ERR_get_error(), 0))); + DEBUG_LOG(("BigNum PT Error: prime %1").arg(Logs::mb(pData, 64 * sizeof(uint32)).str())); + return false; + } + + int32 numBits = BN_num_bits(&bnPrime); + if (numBits != 2048) { + LOG(("BigNum PT Error: BN_bin2bn failed, bad dh_prime num bits: %1").arg(numBits)); + return false; + } + + if (BN_is_prime_ex(&bnPrime, MTPMillerRabinIterCount, ctx, NULL) == 0) { + return false; + } + + switch (g) { + case 2: { + int32 mod8 = BN_mod_word(&bnPrime, 8); + if (mod8 != 7) { + LOG(("BigNum PT Error: bad g value: %1, mod8: %2").arg(g).arg(mod8)); + return false; + } + } break; + case 3: { + int32 mod3 = BN_mod_word(&bnPrime, 3); + if (mod3 != 2) { + LOG(("BigNum PT Error: bad g value: %1, mod3: %2").arg(g).arg(mod3)); + return false; + } + } break; + case 4: break; + case 5: { + int32 mod5 = BN_mod_word(&bnPrime, 5); + if (mod5 != 1 && mod5 != 4) { + LOG(("BigNum PT Error: bad g value: %1, mod5: %2").arg(g).arg(mod5)); + return false; + } + } break; + case 6: { + int32 mod24 = BN_mod_word(&bnPrime, 24); + if (mod24 != 19 && mod24 != 23) { + LOG(("BigNum PT Error: bad g value: %1, mod24: %2").arg(g).arg(mod24)); + return false; + } + } break; + case 7: { + int32 mod7 = BN_mod_word(&bnPrime, 7); + if (mod7 != 3 && mod7 != 5 && mod7 != 6) { + LOG(("BigNum PT Error: bad g value: %1, mod7: %2").arg(g).arg(mod7)); + return false; + } + } break; + default: + LOG(("BigNum PT Error: bad g value: %1").arg(g)); + return false; + break; + } + + BN_sub_word(&bnPrime, 1); // (p - 1) / 2 + BN_div_word(&bnPrime, 2); + + if (BN_is_prime_ex(&bnPrime, MTPMillerRabinIterCount, ctx, NULL) == 0) { + return false; + } + + return true; + } + + BigNumPrimeTest() : ctx(BN_CTX_new()) { + BN_init(&bnPrime); + } + ~BigNumPrimeTest() { + BN_CTX_free(ctx); + BN_clear_free(&bnPrime); + } + +private: + BIGNUM bnPrime; + BN_CTX *ctx; +}; + +typedef QMap RSAPublicKeys; +RSAPublicKeys InitRSAPublicKeys() { + DEBUG_LOG(("MTP Info: RSA public keys list creation")); + + RSAPublicKeys result; + + int keysCount; + const char **keys = cPublicRSAKeys(keysCount); + for (int i = 0; i < keysCount; ++i) { + RSAPublicKey key(keys[i]); + if (key.isValid()) { + result.insert(key.getFingerPrint(), key); + } else { + LOG(("MTP Error: could not read this public RSA key:")); + LOG((keys[i])); + } + } + DEBUG_LOG(("MTP Info: read %1 public RSA keys").arg(result.size())); + return result; } -uint32 MTPThreadIdIncrement = 0; +} // namespace -MTPThread::MTPThread() : QThread(0) -, _threadId(++MTPThreadIdIncrement) { +uint32 ThreadIdIncrement = 0; + +Thread::Thread() : QThread(nullptr) +, _threadId(++ThreadIdIncrement) { } -uint32 MTPThread::getThreadId() const { +uint32 Thread::getThreadId() const { return _threadId; } -MTPThread::~MTPThread() { +Thread::~Thread() { } -MTProtoConnection::MTProtoConnection() : thread(nullptr), data(nullptr) { +Connection::Connection() : thread(nullptr), data(nullptr) { } -int32 MTProtoConnection::start(MTPSessionData *sessionData, int32 dc) { +int32 Connection::start(SessionData *sessionData, int32 dc) { t_assert(thread == nullptr && data == nullptr); - initRSAConfig(); - - thread = new MTPThread(); - data = new MTProtoConnectionPrivate(thread, this, sessionData, dc); + thread = new Thread(); + data = new ConnectionPrivate(thread, this, sessionData, dc); dc = data->getDC(); if (!dc) { @@ -312,15 +323,15 @@ int32 MTProtoConnection::start(MTPSessionData *sessionData, int32 dc) { return dc; } -void MTProtoConnection::kill() { +void Connection::kill() { t_assert(data != nullptr && thread != nullptr); data->stop(); data = nullptr; // will be deleted in thread::finished signal thread->quit(); - _mtp_internal::queueQuittingConnection(this); + queueQuittingConnection(this); } -void MTProtoConnection::waitTillFinish() { +void Connection::waitTillFinish() { t_assert(data == nullptr && thread != nullptr); DEBUG_LOG(("Waiting for connectionThread to finish")); @@ -329,958 +340,33 @@ void MTProtoConnection::waitTillFinish() { thread = nullptr; } -int32 MTProtoConnection::state() const { +int32 Connection::state() const { t_assert(data != nullptr && thread != nullptr); return data->getState(); } -QString MTProtoConnection::transport() const { +QString Connection::transport() const { t_assert(data != nullptr && thread != nullptr); return data->transport(); } -MTProtoConnection::~MTProtoConnection() { +Connection::~Connection() { t_assert(data == nullptr && thread == nullptr); } -namespace { - mtpBuffer _handleHttpResponse(QNetworkReply *reply) { - QByteArray response = reply->readAll(); - TCP_LOG(("HTTP Info: read %1 bytes").arg(response.size())); - - if (response.isEmpty()) return mtpBuffer(); - - if (response.size() & 0x03 || response.size() < 8) { - LOG(("HTTP Error: bad response size %1").arg(response.size())); - return mtpBuffer(1, -500); - } - - mtpBuffer data(response.size() >> 2); - memcpy(data.data(), response.constData(), response.size()); - - return data; - } - - bool _handleHttpError(QNetworkReply *reply) { // returnes "maybe bad key" - bool mayBeBadKey = false; - - QVariant statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); - if (statusCode.isValid()) { - int status = statusCode.toInt(); - mayBeBadKey = (status == 410); - if (status == 429) { - LOG(("Protocol Error: 429 flood code returned!")); - } - } - - switch (reply->error()) { - case QNetworkReply::ConnectionRefusedError: LOG(("HTTP Error: connection refused - %1").arg(reply->errorString())); break; - case QNetworkReply::RemoteHostClosedError: LOG(("HTTP Error: remote host closed - %1").arg(reply->errorString())); break; - case QNetworkReply::HostNotFoundError: LOG(("HTTP Error: host not found - %2").arg(reply->error()).arg(reply->errorString())); break; - case QNetworkReply::TimeoutError: LOG(("HTTP Error: timeout - %2").arg(reply->error()).arg(reply->errorString())); break; - case QNetworkReply::OperationCanceledError: LOG(("HTTP Error: cancelled - %2").arg(reply->error()).arg(reply->errorString())); break; - case QNetworkReply::SslHandshakeFailedError: - case QNetworkReply::TemporaryNetworkFailureError: - case QNetworkReply::NetworkSessionFailedError: - case QNetworkReply::BackgroundRequestNotAllowedError: - case QNetworkReply::UnknownNetworkError: LOG(("HTTP Error: network error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; - - // proxy errors (101-199): - case QNetworkReply::ProxyConnectionRefusedError: - case QNetworkReply::ProxyConnectionClosedError: - case QNetworkReply::ProxyNotFoundError: - case QNetworkReply::ProxyTimeoutError: - case QNetworkReply::ProxyAuthenticationRequiredError: - case QNetworkReply::UnknownProxyError:LOG(("HTTP Error: proxy error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; - - // content errors (201-299): - case QNetworkReply::ContentAccessDenied: - case QNetworkReply::ContentOperationNotPermittedError: - case QNetworkReply::ContentNotFoundError: - case QNetworkReply::AuthenticationRequiredError: - case QNetworkReply::ContentReSendError: - case QNetworkReply::UnknownContentError: LOG(("HTTP Error: content error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; - - // protocol errors - case QNetworkReply::ProtocolUnknownError: - case QNetworkReply::ProtocolInvalidOperationError: - case QNetworkReply::ProtocolFailure: LOG(("HTTP Error: protocol error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; - }; - TCP_LOG(("HTTP Error %1, restarting! - %2").arg(reply->error()).arg(reply->errorString())); - - return mayBeBadKey; - } - - uint32 _tcpPacketSize(const char *packet) { // must have at least 4 bytes readable - uint32 result = (packet[0] > 0) ? packet[0] : 0; - if (result == 0x7f) { - const uchar *bytes = reinterpret_cast(packet); - result = (((uint32(bytes[3]) << 8) | uint32(bytes[2])) << 8) | uint32(bytes[1]); - return (result << 2) + 4; - } - return (result << 2) + 1; - } - - mtpBuffer _handleTcpResponse(const char *packet, uint32 length) { - if (length < 5 || length > MTPPacketSizeMax) { - LOG(("TCP Error: bad packet size %1").arg(length)); - return mtpBuffer(1, -500); - } - int32 size = packet[0], len = length - 1; - if (size == 0x7f) { - const uchar *bytes = reinterpret_cast(packet); - size = (((uint32(bytes[3]) << 8) | uint32(bytes[2])) << 8) | uint32(bytes[1]); - len -= 3; - } - if (size * int32(sizeof(mtpPrime)) != len) { - LOG(("TCP Error: bad packet header")); - TCP_LOG(("TCP Error: bad packet header, packet: %1").arg(Logs::mb(packet, length).str())); - return mtpBuffer(1, -500); - } - const mtpPrime *packetdata = reinterpret_cast(packet + (length - len)); - TCP_LOG(("TCP Info: packet received, size = %1").arg(size * sizeof(mtpPrime))); - if (size == 1) { - if (*packetdata == -429) { - LOG(("Protocol Error: -429 flood code returned!")); - } else { - LOG(("TCP Error: error packet received, code = %1").arg(*packetdata)); - } - return mtpBuffer(1, *packetdata); - } - - mtpBuffer data(size); - memcpy(data.data(), packetdata, size * sizeof(mtpPrime)); - - return data; - } - - void _handleTcpError(QAbstractSocket::SocketError e, QTcpSocket &sock) { - switch (e) { - case QAbstractSocket::ConnectionRefusedError: - LOG(("TCP Error: socket connection refused - %1").arg(sock.errorString())); - break; - - case QAbstractSocket::RemoteHostClosedError: - TCP_LOG(("TCP Info: remote host closed socket connection - %1").arg(sock.errorString())); - break; - - case QAbstractSocket::HostNotFoundError: - LOG(("TCP Error: host not found - %1").arg(sock.errorString())); - break; - - case QAbstractSocket::SocketTimeoutError: - LOG(("TCP Error: socket timeout - %1").arg(sock.errorString())); - break; - - case QAbstractSocket::NetworkError: - LOG(("TCP Error: network - %1").arg(sock.errorString())); - break; - - case QAbstractSocket::ProxyAuthenticationRequiredError: - case QAbstractSocket::ProxyConnectionRefusedError: - case QAbstractSocket::ProxyConnectionClosedError: - case QAbstractSocket::ProxyConnectionTimeoutError: - case QAbstractSocket::ProxyNotFoundError: - case QAbstractSocket::ProxyProtocolError: - LOG(("TCP Error: proxy (%1) - %2").arg(e).arg(sock.errorString())); - break; - - default: - LOG(("TCP Error: other (%1) - %2").arg(e).arg(sock.errorString())); - break; - } - - TCP_LOG(("TCP Error %1, restarting! - %2").arg(e).arg(sock.errorString())); - } - - mtpBuffer _preparePQFake(const MTPint128 &nonce) { - MTPReq_pq req_pq(nonce); - mtpBuffer buffer; - uint32 requestSize = req_pq.innerLength() >> 2; - - buffer.resize(0); - buffer.reserve(8 + requestSize); - buffer.push_back(0); // tcp packet len - buffer.push_back(0); // tcp packet num - buffer.push_back(0); - buffer.push_back(0); - buffer.push_back(0); - buffer.push_back(unixtime()); - buffer.push_back(requestSize * 4); - req_pq.write(buffer); - buffer.push_back(0); // tcp crc32 hash - - return buffer; - } - - MTPResPQ _readPQFakeReply(const mtpBuffer &buffer) { - const mtpPrime *answer(buffer.constData()); - uint32 len = buffer.size(); - if (len < 5) { - LOG(("Fake PQ Error: bad request answer, len = %1").arg(len * sizeof(mtpPrime))); - DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); - throw Exception("bad pq reply"); - } - if (answer[0] != 0 || answer[1] != 0 || (((uint32)answer[2]) & 0x03) != 1/* || (unixtime() - answer[3] > 300) || (answer[3] - unixtime() > 60)*/) { // didnt sync time yet - LOG(("Fake PQ Error: bad request answer start (%1 %2 %3)").arg(answer[0]).arg(answer[1]).arg(answer[2])); - DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); - throw Exception("bad pq reply"); - } - uint32 answerLen = (uint32)answer[4]; - if (answerLen != (len - 5) * sizeof(mtpPrime)) { - LOG(("Fake PQ Error: bad request answer %1 <> %2").arg(answerLen).arg((len - 5) * sizeof(mtpPrime))); - DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); - throw Exception("bad pq reply"); - } - const mtpPrime *from(answer + 5), *end(from + len - 5); - MTPResPQ response; - response.read(from, end); - return response; - } - -} - -MTPabstractTcpConnection::MTPabstractTcpConnection() : -packetNum(0), packetRead(0), packetLeft(0), readingToShort(true), currentPos((char*)shortBuffer) { -} - -void MTPabstractTcpConnection::socketRead() { - if (sock.state() != QAbstractSocket::ConnectedState) { - LOG(("MTP error: socket not connected in socketRead(), state: %1").arg(sock.state())); - emit error(); - return; - } - - do { - uint32 toRead = packetLeft ? packetLeft : (readingToShort ? (MTPShortBufferSize * sizeof(mtpPrime)-packetRead) : 4); - if (readingToShort) { - if (currentPos + toRead > ((char*)shortBuffer) + MTPShortBufferSize * sizeof(mtpPrime)) { - longBuffer.resize(((packetRead + toRead) >> 2) + 1); - memcpy(&longBuffer[0], shortBuffer, packetRead); - currentPos = ((char*)&longBuffer[0]) + packetRead; - readingToShort = false; - } - } else { - if (longBuffer.size() * sizeof(mtpPrime) < packetRead + toRead) { - longBuffer.resize(((packetRead + toRead) >> 2) + 1); - currentPos = ((char*)&longBuffer[0]) + packetRead; - } - } - int32 bytes = (int32)sock.read(currentPos, toRead); - if (bytes > 0) { - TCP_LOG(("TCP Info: read %1 bytes").arg(bytes)); - - packetRead += bytes; - currentPos += bytes; - if (packetLeft) { - packetLeft -= bytes; - if (!packetLeft) { - socketPacket(currentPos - packetRead, packetRead); - currentPos = (char*)shortBuffer; - packetRead = packetLeft = 0; - readingToShort = true; - longBuffer.clear(); - } else { - TCP_LOG(("TCP Info: not enough %1 for packet! read %2").arg(packetLeft).arg(packetRead)); - emit receivedSome(); - } - } else { - bool move = false; - while (packetRead >= 4) { - uint32 packetSize = _tcpPacketSize(currentPos - packetRead); - if (packetSize < 5 || packetSize > MTPPacketSizeMax) { - LOG(("TCP Error: packet size = %1").arg(packetSize)); - emit error(); - return; - } - if (packetRead >= packetSize) { - socketPacket(currentPos - packetRead, packetSize); - packetRead -= packetSize; - packetLeft = 0; - move = true; - } else { - packetLeft = packetSize - packetRead; - TCP_LOG(("TCP Info: not enough %1 for packet! size %2 read %3").arg(packetLeft).arg(packetSize).arg(packetRead)); - emit receivedSome(); - break; - } - } - if (move) { - if (!packetRead) { - currentPos = (char*)shortBuffer; - readingToShort = true; - longBuffer.clear(); - } else if (!readingToShort && packetRead < MTPShortBufferSize * sizeof(mtpPrime)) { - memcpy(shortBuffer, currentPos - packetRead, packetRead); - currentPos = (char*)shortBuffer + packetRead; - readingToShort = true; - longBuffer.clear(); - } - } - } - } else if (bytes < 0) { - LOG(("TCP Error: socket read return -1")); - emit error(); - return; - } else { - TCP_LOG(("TCP Info: no bytes read, but bytes available was true..")); - break; - } - } while (sock.state() == QAbstractSocket::ConnectedState && sock.bytesAvailable()); -} - -MTPautoConnection::MTPautoConnection(QThread *thread) : MTPabstractTcpConnection() -, status(WaitingBoth) -, tcpNonce(MTP::nonce()) -, httpNonce(MTP::nonce()) -, _flagsTcp(0) -, _flagsHttp(0) -, _tcpTimeout(MTPMinReceiveDelay) { - moveToThread(thread); - - manager.moveToThread(thread); - manager.setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy)); - - httpStartTimer.moveToThread(thread); - httpStartTimer.setSingleShot(true); - connect(&httpStartTimer, SIGNAL(timeout()), this, SLOT(onHttpStart())); - - tcpTimeoutTimer.moveToThread(thread); - tcpTimeoutTimer.setSingleShot(true); - connect(&tcpTimeoutTimer, SIGNAL(timeout()), this, SLOT(onTcpTimeoutTimer())); - - sock.moveToThread(thread); - sock.setProxy(QNetworkProxy(QNetworkProxy::NoProxy)); - connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); - connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected())); - connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); -} - -void MTPautoConnection::onHttpStart() { - if (status == HttpReady) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by timer").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - sock.disconnectFromHost(); - emit connected(); - } -} - -void MTPautoConnection::onSocketConnected() { - if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { - mtpBuffer buffer(_preparePQFake(tcpNonce)); - - DEBUG_LOG(("Connection Info: sending fake req_pq through TCP/%1 transport").arg((_flagsTcp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - - if (_tcpTimeout < 0) _tcpTimeout = -_tcpTimeout; - tcpTimeoutTimer.start(_tcpTimeout); - - tcpSend(buffer); - } else if (status == WaitingHttp || status == UsingHttp) { - sock.disconnectFromHost(); - } -} - -void MTPautoConnection::onTcpTimeoutTimer() { - if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { - if (_tcpTimeout < MTPMaxReceiveDelay) _tcpTimeout *= 2; - _tcpTimeout = -_tcpTimeout; - - QAbstractSocket::SocketState state = sock.state(); - if (state == QAbstractSocket::ConnectedState || state == QAbstractSocket::ConnectingState || state == QAbstractSocket::HostLookupState) { - sock.disconnectFromHost(); - } else if (state != QAbstractSocket::ClosingState) { - sock.connectToHost(QHostAddress(_addrTcp), _portTcp); - } - } -} - -void MTPautoConnection::onSocketDisconnected() { - if (_tcpTimeout < 0) { - _tcpTimeout = -_tcpTimeout; - if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { - sock.connectToHost(QHostAddress(_addrTcp), _portTcp); - return; - } - } - if (status == WaitingBoth) { - status = WaitingHttp; - } else if (status == WaitingTcp || status == UsingTcp) { - emit disconnected(); - } else if (status == HttpReady) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by socket disconnect").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - emit connected(); - } -} - -void MTPautoConnection::sendData(mtpBuffer &buffer) { - if (status == FinishedWork) return; - - if (buffer.size() < 3) { - LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); - TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); - emit error(); - return; - } - - if (status == UsingTcp) { - tcpSend(buffer); - } else { - httpSend(buffer); - } -} - -uint32 FourCharsToUInt(char ch1, char ch2, char ch3, char ch4) { - char ch[4] = { ch1, ch2, ch3, ch4 }; - return *reinterpret_cast(ch); -} - -void MTPautoConnection::tcpSend(mtpBuffer &buffer) { - if (!packetNum) { - char nonce[64]; - uint32 *first = reinterpret_cast(nonce), *second = first + 1; - uint32 g1 = FourCharsToUInt('P', 'O', 'S', 'T'), g2 = FourCharsToUInt('G', 'E', 'T', ' '), g3 = FourCharsToUInt('H', 'E', 'A', 'D'); - uint32 first1 = 0x44414548U, first2 = 0x54534f50U, first3 = 0x20544547U, first4 = 0x20544547U, first5 = 0xeeeeeeeeU; - uint32 second1 = 0; - do { - memset_rand(nonce, sizeof(nonce)); - } while (*first == first1 || *first == first2 || *first == first3 || *first == first4 || *first == first5 || *second == second1 || *reinterpret_cast(nonce) == 0xef); - sock.write(nonce, sizeof(nonce)); - } - ++packetNum; - - uint32 size = buffer.size() - 3, len = size * 4; - char *data = reinterpret_cast(&buffer[0]); - if (size < 0x7f) { - data[7] = char(size); - TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 1)); - - sock.write(data + 7, len + 1); - } else { - data[4] = 0x7f; - reinterpret_cast(data)[5] = uchar(size & 0xFF); - reinterpret_cast(data)[6] = uchar((size >> 8) & 0xFF); - reinterpret_cast(data)[7] = uchar((size >> 16) & 0xFF); - TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 4)); - - sock.write(data + 4, len + 4); - } -} - -void MTPautoConnection::httpSend(mtpBuffer &buffer) { - int32 requestSize = (buffer.size() - 3) * sizeof(mtpPrime); - - QNetworkRequest request(address); - request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize)); - request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded"))); - - TCP_LOG(("HTTP Info: sending %1 len request").arg(requestSize)); - requests.insert(manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize))); -} - -void MTPautoConnection::disconnectFromServer() { - if (status == FinishedWork) return; - status = FinishedWork; - - Requests copy = requests; - requests.clear(); - for (Requests::const_iterator i = copy.cbegin(), e = copy.cend(); i != e; ++i) { - (*i)->abort(); - (*i)->deleteLater(); - } - - disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); - - address = QUrl(); - - disconnect(&sock, SIGNAL(readyRead()), 0, 0); - sock.close(); - - httpStartTimer.stop(); -} - -void MTPautoConnection::connectTcp(const QString &addr, int32 port, int32 flags) { - _addrTcp = addr; - _portTcp = port; - _flagsTcp = flags; - - connect(&sock, SIGNAL(readyRead()), this, SLOT(socketRead())); - sock.connectToHost(QHostAddress(_addrTcp), _portTcp); -} - -void MTPautoConnection::connectHttp(const QString &addr, int32 port, int32 flags) { - address = QUrl(((flags & MTPDdcOption::flag_ipv6) ? qsl("http://[%1]:%2/api") : qsl("http://%1:%2/api")).arg(addr).arg(80));//not p - always 80 port for http transport - TCP_LOG(("HTTP Info: address is %1").arg(address.toDisplayString())); - connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); - - _addrHttp = addr; - _portHttp = port; - _flagsHttp = flags; - - mtpBuffer buffer(_preparePQFake(httpNonce)); - - DEBUG_LOG(("Connection Info: sending fake req_pq through HTTP/%1 transport").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - - httpSend(buffer); -} - -bool MTPautoConnection::isConnected() const { - return (status == UsingTcp) || (status == UsingHttp); -} - -void MTPautoConnection::requestFinished(QNetworkReply *reply) { - if (status == FinishedWork) return; - - reply->deleteLater(); - if (reply->error() == QNetworkReply::NoError) { - requests.remove(reply); - - mtpBuffer data = _handleHttpResponse(reply); - if (data.size() == 1) { - if (status == WaitingBoth) { - status = WaitingTcp; - } else { - emit error(); - } - } else if (!data.isEmpty()) { - if (status == UsingHttp) { - receivedQueue.push_back(data); - emit receivedData(); - } else if (status == WaitingBoth || status == WaitingHttp) { - try { - MTPResPQ res_pq = _readPQFakeReply(data); - const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); - if (res_pq_data.vnonce == httpNonce) { - if (status == WaitingBoth) { - status = HttpReady; - httpStartTimer.start(MTPTcpConnectionWaitTimeout); - } else { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by pq-response, awaited").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - sock.disconnectFromHost(); - emit connected(); - } - } - } catch (Exception &e) { - DEBUG_LOG(("Connection Error: exception in parsing HTTP fake pq-responce, %1").arg(e.what())); - if (status == WaitingBoth) { - status = WaitingTcp; - } else { - emit error(); - } - } - } else if (status == UsingTcp) { - DEBUG_LOG(("Connection Info: already using tcp, ignoring http response")); - } - } - } else { - if (!requests.remove(reply)) { - return; - } - - bool mayBeBadKey = _handleHttpError(reply) && _sentEncrypted; - if (status == WaitingBoth) { - status = WaitingTcp; - } else if (status == WaitingHttp || status == UsingHttp) { - emit error(mayBeBadKey); - } else { - LOG(("Strange Http Error: status %1").arg(status)); - } - } -} - -void MTPautoConnection::socketPacket(const char *packet, uint32 length) { - if (status == FinishedWork) return; - - mtpBuffer data = _handleTcpResponse(packet, length); - if (data.size() == 1) { - if (status == WaitingBoth) { - status = WaitingHttp; - sock.disconnectFromHost(); - } else if (status == HttpReady) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by bad tcp response, ready").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - sock.disconnectFromHost(); - emit connected(); - } else if (status == WaitingTcp || status == UsingTcp) { - bool mayBeBadKey = (data[0] == -410) && _sentEncrypted; - emit error(mayBeBadKey); - } else { - LOG(("Strange Tcp Error; status %1").arg(status)); - } - } else if (status == UsingTcp) { - receivedQueue.push_back(data); - emit receivedData(); - } else if (status == WaitingBoth || status == WaitingTcp || status == HttpReady) { - tcpTimeoutTimer.stop(); - try { - MTPResPQ res_pq = _readPQFakeReply(data); - const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); - if (res_pq_data.vnonce == tcpNonce) { - DEBUG_LOG(("Connection Info: TCP/%1-transport chosen by pq-response").arg((_flagsTcp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingTcp; - emit connected(); - } - } catch (Exception &e) { - DEBUG_LOG(("Connection Error: exception in parsing TCP fake pq-responce, %1").arg(e.what())); - if (status == WaitingBoth) { - status = WaitingHttp; - sock.disconnectFromHost(); - } else if (status == HttpReady) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by bad tcp response, awaited").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - sock.disconnectFromHost(); - emit connected(); - } else { - emit error(); - } - } - } -} - -bool MTPautoConnection::usingHttpWait() { - return (status == UsingHttp); -} - -bool MTPautoConnection::needHttpWait() { - return (status == UsingHttp) ? requests.isEmpty() : false; -} - -int32 MTPautoConnection::debugState() const { - return (status == UsingHttp) ? -1 : (UsingTcp ? sock.state() : -777); -} - -QString MTPautoConnection::transport() const { - if (status == UsingTcp) { - return qsl("TCP"); - } else if (status == UsingHttp) { - return qsl("HTTP"); - } else { - return QString(); - } -} - -void MTPautoConnection::socketError(QAbstractSocket::SocketError e) { - if (status == FinishedWork) return; - - _handleTcpError(e, sock); - if (status == WaitingBoth) { - status = WaitingHttp; - } else if (status == HttpReady) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by tcp error, ready").arg((_flagsHttp & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - emit connected(); - } else if (status == WaitingTcp || status == UsingTcp) { - emit error(); - } else { - LOG(("Strange Tcp Error: status %1").arg(status)); - } -} - -MTPtcpConnection::MTPtcpConnection(QThread *thread) : status(WaitingTcp), -tcpNonce(MTP::nonce()), _tcpTimeout(MTPMinReceiveDelay), _flags(0) { - moveToThread(thread); - - tcpTimeoutTimer.moveToThread(thread); - tcpTimeoutTimer.setSingleShot(true); - connect(&tcpTimeoutTimer, SIGNAL(timeout()), this, SLOT(onTcpTimeoutTimer())); - - sock.moveToThread(thread); - App::setProxySettings(sock); - connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); - connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected())); - connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); -} - -void MTPtcpConnection::onSocketConnected() { - if (status == WaitingTcp) { - mtpBuffer buffer(_preparePQFake(tcpNonce)); - - DEBUG_LOG(("Connection Info: sending fake req_pq through TCP/%1 transport").arg((_flags & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - - if (_tcpTimeout < 0) _tcpTimeout = -_tcpTimeout; - tcpTimeoutTimer.start(_tcpTimeout); - - sendData(buffer); - } -} - -void MTPtcpConnection::onTcpTimeoutTimer() { - if (status == WaitingTcp) { - if (_tcpTimeout < MTPMaxReceiveDelay) _tcpTimeout *= 2; - _tcpTimeout = -_tcpTimeout; - - QAbstractSocket::SocketState state = sock.state(); - if (state == QAbstractSocket::ConnectedState || state == QAbstractSocket::ConnectingState || state == QAbstractSocket::HostLookupState) { - sock.disconnectFromHost(); - } else if (state != QAbstractSocket::ClosingState) { - sock.connectToHost(QHostAddress(_addr), _port); - } - } -} - -void MTPtcpConnection::onSocketDisconnected() { - if (_tcpTimeout < 0) { - _tcpTimeout = -_tcpTimeout; - if (status == WaitingTcp) { - sock.connectToHost(QHostAddress(_addr), _port); - return; - } - } - if (status == WaitingTcp || status == UsingTcp) { - emit disconnected(); - } -} - -void MTPtcpConnection::sendData(mtpBuffer &buffer) { - if (status == FinishedWork) return; - - if (buffer.size() < 3) { - LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); - TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); - emit error(); - return; - } - - if (!packetNum) { - char nonce[64]; - uint32 *first = reinterpret_cast(nonce), *second = first + 1; - uint32 g1 = FourCharsToUInt('P', 'O', 'S', 'T'), g2 = FourCharsToUInt('G', 'E', 'T', ' '), g3 = FourCharsToUInt('H', 'E', 'A', 'D'); - uint32 first1 = 0x44414548U, first2 = 0x54534f50U, first3 = 0x20544547U, first4 = 0x20544547U, first5 = 0xeeeeeeeeU; - uint32 second1 = 0; - do { - memset_rand(nonce, sizeof(nonce)); - } while (*first == first1 || *first == first2 || *first == first3 || *first == first4 || *first == first5 || *second == second1 || *reinterpret_cast(nonce) == 0xef); - sock.write(nonce, sizeof(nonce)); - } - ++packetNum; - - uint32 size = buffer.size() - 3, len = size * 4; - char *data = reinterpret_cast(&buffer[0]); - if (size < 0x7f) { - data[7] = char(size); - TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 1)); - - sock.write(data + 7, len + 1); - } else { - data[4] = 0x7f; - reinterpret_cast(data)[5] = uchar(size & 0xFF); - reinterpret_cast(data)[6] = uchar((size >> 8) & 0xFF); - reinterpret_cast(data)[7] = uchar((size >> 16) & 0xFF); - TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 4)); - - sock.write(data + 4, len + 4); - } -} - -void MTPtcpConnection::disconnectFromServer() { - if (status == FinishedWork) return; - status = FinishedWork; - - disconnect(&sock, SIGNAL(readyRead()), 0, 0); - sock.close(); -} - -void MTPtcpConnection::connectTcp(const QString &addr, int32 port, int32 flags) { - _addr = addr; - _port = port; - _flags = flags; - - connect(&sock, SIGNAL(readyRead()), this, SLOT(socketRead())); - sock.connectToHost(QHostAddress(_addr), _port); -} - -void MTPtcpConnection::socketPacket(const char *packet, uint32 length) { - if (status == FinishedWork) return; - - mtpBuffer data = _handleTcpResponse(packet, length); - if (data.size() == 1) { - bool mayBeBadKey = (data[0] == -410) && _sentEncrypted; - emit error(mayBeBadKey); - } else if (status == UsingTcp) { - receivedQueue.push_back(data); - emit receivedData(); - } else if (status == WaitingTcp) { - tcpTimeoutTimer.stop(); - try { - MTPResPQ res_pq = _readPQFakeReply(data); - const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); - if (res_pq_data.vnonce == tcpNonce) { - DEBUG_LOG(("Connection Info: TCP/%1-transport chosen by pq-response").arg((_flags & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingTcp; - emit connected(); - } - } catch (Exception &e) { - DEBUG_LOG(("Connection Error: exception in parsing TCP fake pq-responce, %1").arg(e.what())); - emit error(); - } - } -} - -bool MTPtcpConnection::isConnected() const { - return (status == UsingTcp); -} - -int32 MTPtcpConnection::debugState() const { - return sock.state(); -} - -QString MTPtcpConnection::transport() const { - return isConnected() ? qsl("TCP") : QString(); -} - -void MTPtcpConnection::socketError(QAbstractSocket::SocketError e) { - if (status == FinishedWork) return; - - _handleTcpError(e, sock); - emit error(); -} - -MTPhttpConnection::MTPhttpConnection(QThread *thread) : status(WaitingHttp), httpNonce(MTP::nonce()), _flags(0) { - moveToThread(thread); - manager.moveToThread(thread); - App::setProxySettings(manager); -} - -void MTPhttpConnection::sendData(mtpBuffer &buffer) { - if (status == FinishedWork) return; - - if (buffer.size() < 3) { - LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); - TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); - emit error(); - return; - } - - int32 requestSize = (buffer.size() - 3) * sizeof(mtpPrime); - - QNetworkRequest request(address); - request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize)); - request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded"))); - - TCP_LOG(("HTTP Info: sending %1 len request %2").arg(requestSize).arg(Logs::mb(&buffer[2], requestSize).str())); - requests.insert(manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize))); -} - -void MTPhttpConnection::disconnectFromServer() { - if (status == FinishedWork) return; - status = FinishedWork; - - Requests copy = requests; - requests.clear(); - for (Requests::const_iterator i = copy.cbegin(), e = copy.cend(); i != e; ++i) { - (*i)->abort(); - (*i)->deleteLater(); - } - - disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); - - address = QUrl(); -} - -void MTPhttpConnection::connectHttp(const QString &addr, int32 p, int32 flags) { - address = QUrl(((flags & MTPDdcOption::flag_ipv6) ? qsl("http://[%1]:%2/api") : qsl("http://%1:%2/api")).arg(addr).arg(80));//not p - always 80 port for http transport - TCP_LOG(("HTTP Info: address is %1").arg(address.toDisplayString())); - connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); - - _flags = flags; - - mtpBuffer buffer(_preparePQFake(httpNonce)); - - DEBUG_LOG(("Connection Info: sending fake req_pq through HTTP/%1 transport").arg((flags & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - - sendData(buffer); -} - -bool MTPhttpConnection::isConnected() const { - return (status == UsingHttp); -} - -void MTPhttpConnection::requestFinished(QNetworkReply *reply) { - if (status == FinishedWork) return; - - reply->deleteLater(); - if (reply->error() == QNetworkReply::NoError) { - requests.remove(reply); - - mtpBuffer data = _handleHttpResponse(reply); - if (data.size() == 1) { - emit error(); - } else if (!data.isEmpty()) { - if (status == UsingHttp) { - receivedQueue.push_back(data); - emit receivedData(); - } else { - try { - MTPResPQ res_pq = _readPQFakeReply(data); - const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); - if (res_pq_data.vnonce == httpNonce) { - DEBUG_LOG(("Connection Info: HTTP/%1-transport connected by pq-response").arg((_flags & MTPDdcOption::flag_ipv6) ? "IPv6" : "IPv4")); - status = UsingHttp; - emit connected(); - } - } catch (Exception &e) { - DEBUG_LOG(("Connection Error: exception in parsing HTTP fake pq-responce, %1").arg(e.what())); - emit error(); - } - } - } - } else { - if (!requests.remove(reply)) { - return; - } - - bool mayBeBadKey = _handleHttpError(reply) && _sentEncrypted; - - emit error(mayBeBadKey); - } -} - -bool MTPhttpConnection::usingHttpWait() { - return true; -} - -bool MTPhttpConnection::needHttpWait() { - return requests.isEmpty(); -} - -int32 MTPhttpConnection::debugState() const { - return -1; -} - -QString MTPhttpConnection::transport() const { - if (status == UsingHttp) { - return qsl("HTTP"); - } else { - return QString(); - } -} - -void MTProtoConnectionPrivate::createConn(bool createIPv4, bool createIPv6) { +void ConnectionPrivate::createConn(bool createIPv4, bool createIPv6) { destroyConn(); if (createIPv4) { QWriteLocker lock(&stateConnMutex); - if (cConnectionType() == dbictAuto) { - _conn4 = new MTPautoConnection(thread()); - } else if (cConnectionType() == dbictTcpProxy) { - _conn4 = new MTPtcpConnection(thread()); - } else { - _conn4 = new MTPhttpConnection(thread()); - } + _conn4 = AbstractConnection::create(thread()); connect(_conn4, SIGNAL(error(bool)), this, SLOT(onError4(bool))); connect(_conn4, SIGNAL(receivedSome()), this, SLOT(onReceivedSome())); } if (createIPv6) { QWriteLocker lock(&stateConnMutex); - if (cConnectionType() == dbictAuto) { - _conn6 = new MTPautoConnection(thread()); - } else if (cConnectionType() == dbictTcpProxy) { - _conn6 = new MTPtcpConnection(thread()); - } else { - _conn6 = new MTPhttpConnection(thread()); - } + _conn6 = AbstractConnection::create(thread()); connect(_conn6, SIGNAL(error(bool)), this, SLOT(onError6(bool))); connect(_conn6, SIGNAL(receivedSome()), this, SLOT(onReceivedSome())); } @@ -1292,19 +378,19 @@ void MTProtoConnectionPrivate::createConn(bool createIPv4, bool createIPv6) { oldConnectionTimer.start(MTPConnectionOldTimeout); } -void MTProtoConnectionPrivate::destroyConn(MTPabstractConnection **conn) { +void ConnectionPrivate::destroyConn(AbstractConnection **conn) { if (conn) { - MTPabstractConnection *toDisconnect = nullptr; + AbstractConnection *toDisconnect = nullptr; { QWriteLocker lock(&stateConnMutex); if (*conn) { toDisconnect = *conn; - disconnect(*conn, SIGNAL(connected()), 0, 0); - disconnect(*conn, SIGNAL(disconnected()), 0, 0); - disconnect(*conn, SIGNAL(error(bool)), 0, 0); - disconnect(*conn, SIGNAL(receivedData()), 0, 0); - disconnect(*conn, SIGNAL(receivedSome()), 0, 0); + disconnect(*conn, SIGNAL(connected()), nullptr, nullptr); + disconnect(*conn, SIGNAL(disconnected()), nullptr, nullptr); + disconnect(*conn, SIGNAL(error(bool)), nullptr, nullptr); + disconnect(*conn, SIGNAL(receivedData()), nullptr, nullptr); + disconnect(*conn, SIGNAL(receivedSome()), nullptr, nullptr); *conn = nullptr; } } @@ -1319,8 +405,8 @@ void MTProtoConnectionPrivate::destroyConn(MTPabstractConnection **conn) { } } -MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 _dc) : QObject(0) -, _state(MTProtoConnection::Disconnected) +ConnectionPrivate::ConnectionPrivate(QThread *thread, Connection *owner, SessionData *data, uint32 _dc) : QObject(nullptr) +, _state(DisconnectedState) , _needSessionReset(false) , dc(_dc) , _owner(owner) @@ -1353,20 +439,20 @@ MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConne moveToThread(thread); if (!dc) { - QReadLocker lock(mtpDcOptionsMutex()); - const mtpDcOptions &options(cDcOptions()); + QReadLocker lock(dcOptionsMutex()); + const MTP::DcOptions &options(Global::DcOptions()); if (options.isEmpty()) { LOG(("MTP Error: connect failed, no DCs")); dc = 0; return; } dc = options.cbegin().value().id; - DEBUG_LOG(("MTP Info: searching for any DC, %1 selected..").arg(dc)); + DEBUG_LOG(("MTP Info: searching for any DC, %1 selected...").arg(dc)); } connect(thread, SIGNAL(started()), this, SLOT(socketStart())); connect(thread, SIGNAL(finished()), this, SLOT(doFinish())); - connect(this, SIGNAL(finished(MTProtoConnection*)), _mtp_internal::globalSlotCarrier(), SLOT(connectionFinished(MTProtoConnection*)), Qt::QueuedConnection); + connect(this, SIGNAL(finished(Connection*)), globalSlotCarrier(), SLOT(connectionFinished(Connection*)), Qt::QueuedConnection); connect(&retryTimer, SIGNAL(timeout()), this, SLOT(retryByTimer())); connect(&_waitForConnectedTimer, SIGNAL(timeout()), this, SLOT(onWaitConnectedFailed())); @@ -1399,15 +485,15 @@ MTProtoConnectionPrivate::MTProtoConnectionPrivate(QThread *thread, MTProtoConne connect(this, SIGNAL(resendAllAsync()), sessionData->owner(), SLOT(resendAll())); } -void MTProtoConnectionPrivate::onConfigLoaded() { +void ConnectionPrivate::onConfigLoaded() { socketStart(true); } -int32 MTProtoConnectionPrivate::getDC() const { +int32 ConnectionPrivate::getDC() const { return dc; } -int32 MTProtoConnectionPrivate::getState() const { +int32 ConnectionPrivate::getState() const { QReadLocker lock(&stateConnMutex); int32 result = _state; if (_state < 0) { @@ -1421,7 +507,7 @@ int32 MTProtoConnectionPrivate::getState() const { return result; } -QString MTProtoConnectionPrivate::transport() const { +QString ConnectionPrivate::transport() const { QReadLocker lock(&stateConnMutex); if ((!_conn4 && !_conn6) || (_conn4 && _conn6) || (_state < 0)) { return QString(); @@ -1431,8 +517,8 @@ QString MTProtoConnectionPrivate::transport() const { return result; } -bool MTProtoConnectionPrivate::setState(int32 state, int32 ifState) { - if (ifState != MTProtoConnection::UpdateAlways) { +bool ConnectionPrivate::setState(int32 state, int32 ifState) { + if (ifState != Connection::UpdateAlways) { QReadLocker lock(&stateConnMutex); if (_state != ifState) return false; } @@ -1448,7 +534,7 @@ bool MTProtoConnectionPrivate::setState(int32 state, int32 ifState) { return true; } -void MTProtoConnectionPrivate::resetSession() { // recreate all msg_id and msg_seqno +void ConnectionPrivate::resetSession() { // recreate all msg_id and msg_seqno _needSessionReset = false; QWriteLocker locker1(sessionData->haveSentMutex()); @@ -1516,7 +602,7 @@ void MTProtoConnectionPrivate::resetSession() { // recreate all msg_id and msg_s } } - uint64 session = MTP::nonce(); + uint64 session = rand_value(); DEBUG_LOG(("MTP Info: creating new session after bad_msg_notification, setting random server_session %1").arg(session)); sessionData->setSession(session); @@ -1568,7 +654,7 @@ void MTProtoConnectionPrivate::resetSession() { // recreate all msg_id and msg_s emit sessionResetDone(); } -mtpMsgId MTProtoConnectionPrivate::prepareToSend(mtpRequest &request, mtpMsgId currentLastId) { +mtpMsgId ConnectionPrivate::prepareToSend(mtpRequest &request, mtpMsgId currentLastId) { if (request->size() < 9) return 0; mtpMsgId msgId = *(mtpMsgId*)(request->constData() + 4); if (msgId) { // resending this request @@ -1585,7 +671,7 @@ mtpMsgId MTProtoConnectionPrivate::prepareToSend(mtpRequest &request, mtpMsgId c return msgId; } -mtpMsgId MTProtoConnectionPrivate::replaceMsgId(mtpRequest &request, mtpMsgId newId) { +mtpMsgId ConnectionPrivate::replaceMsgId(mtpRequest &request, mtpMsgId newId) { if (request->size() < 9) return 0; mtpMsgId oldMsgId = *(mtpMsgId*)(request->constData() + 4); @@ -1648,7 +734,7 @@ mtpMsgId MTProtoConnectionPrivate::replaceMsgId(mtpRequest &request, mtpMsgId ne return newId; } -mtpMsgId MTProtoConnectionPrivate::placeToContainer(mtpRequest &toSendRequest, mtpMsgId &bigMsgId, mtpMsgId *&haveSentArr, mtpRequest &req) { +mtpMsgId ConnectionPrivate::placeToContainer(mtpRequest &toSendRequest, mtpMsgId &bigMsgId, mtpMsgId *&haveSentArr, mtpRequest &req) { mtpMsgId msgId = prepareToSend(req, bigMsgId); if (msgId > bigMsgId) msgId = replaceMsgId(req, bigMsgId); if (msgId >= bigMsgId) bigMsgId = msgid(); @@ -1661,7 +747,7 @@ mtpMsgId MTProtoConnectionPrivate::placeToContainer(mtpRequest &toSendRequest, m return msgId; } -void MTProtoConnectionPrivate::tryToSend() { +void ConnectionPrivate::tryToSend() { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData || !_conn) { return; @@ -1669,23 +755,23 @@ void MTProtoConnectionPrivate::tryToSend() { bool needsLayer = !sessionData->layerWasInited(); int32 state = getState(); - bool prependOnly = (state != MTProtoConnection::Connected); + bool prependOnly = (state != ConnectedState); mtpRequest pingRequest; - if (dc < _mtp_internal::dcShift) { // main session + if (dc == bareDcId(dc)) { // main session if (!prependOnly && !_pingIdToSend && !_pingId && _pingSendAt <= getms(true)) { - _pingIdToSend = MTP::nonce(); + _pingIdToSend = rand_value(); } } if (_pingIdToSend) { - if (prependOnly || dc >= _mtp_internal::dcShift) { + if (prependOnly || dc != bareDcId(dc)) { MTPPing ping(MTPping(MTP_long(_pingIdToSend))); - uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send + uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send pingRequest = mtpRequestData::prepare(pingSize); ping.write(*pingRequest); DEBUG_LOG(("MTP Info: sending ping, ping_id: %1").arg(_pingIdToSend)); } else { MTPPing_delay_disconnect ping(MTP_long(_pingIdToSend), MTP_int(MTPPingDelayDisconnect)); - uint32 pingSize = ping.innerLength() >> 2; // copy from MTProtoSession::send + uint32 pingSize = ping.innerLength() >> 2; // copy from Session::send pingRequest = mtpRequestData::prepare(pingSize); ping.write(*pingRequest); DEBUG_LOG(("MTP Info: sending ping_delay_disconnect, ping_id: %1").arg(_pingIdToSend)); @@ -1695,7 +781,7 @@ void MTProtoConnectionPrivate::tryToSend() { _pingSendAt = pingRequest->msDate + (MTPPingSendAfterAuto * 1000ULL); pingRequest->requestId = 0; // dont add to haveSent / wereAcked maps - if (dc < _mtp_internal::dcShift && !prependOnly) { // main session + if (dc == bareDcId(dc) && !prependOnly) { // main session _pingSender.start(MTPPingSendAfter * 1000); } @@ -1821,7 +907,7 @@ void MTProtoConnectionPrivate::tryToSend() { mtpRequest wrappedRequest(mtpRequestData::prepare(toSendSize, toSendSize + 3)); // cons + msg_id wrappedRequest->resize(4); memcpy(wrappedRequest->data(), toSendRequest->constData(), 4 * sizeof(mtpPrime)); - _mtp_internal::wrapInvokeAfter(wrappedRequest, toSendRequest, haveSent); + wrapInvokeAfter(wrappedRequest, toSendRequest, haveSent); toSendRequest = wrappedRequest; } if (needsLayer) { @@ -1899,7 +985,7 @@ void MTProtoConnectionPrivate::tryToSend() { req->msDate = mtpRequestData::isStateRequest(req) ? 0 : getms(true); int32 reqNeedsLayer = (needsLayer && req->needsLayer) ? toSendRequest->size() : 0; if (req->after) { - _mtp_internal::wrapInvokeAfter(toSendRequest, req, haveSent, reqNeedsLayer ? initSizeInInts : 0); + wrapInvokeAfter(toSendRequest, req, haveSent, reqNeedsLayer ? initSizeInInts : 0); if (reqNeedsLayer) { memcpy(toSendRequest->data() + reqNeedsLayer + 4, initSerialized.constData(), initSize); *(toSendRequest->data() + reqNeedsLayer + 3) += initSize; @@ -1946,7 +1032,7 @@ void MTProtoConnectionPrivate::tryToSend() { sendRequest(toSendRequest, needAnyResponse, lockFinished); } -void MTProtoConnectionPrivate::retryByTimer() { +void ConnectionPrivate::retryByTimer() { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData) return; @@ -1957,7 +1043,7 @@ void MTProtoConnectionPrivate::retryByTimer() { } else if (retryTimeout < 64000) { retryTimeout *= 2; } - if (keyId == mtpAuthKey::RecreateKeyId) { + if (keyId == AuthKey::RecreateKeyId) { if (sessionData->getKey()) { unlockKey(); @@ -1969,18 +1055,18 @@ void MTProtoConnectionPrivate::retryByTimer() { socketStart(); } -void MTProtoConnectionPrivate::restartNow() { +void ConnectionPrivate::restartNow() { retryTimeout = 1; retryTimer.stop(); restart(); } -void MTProtoConnectionPrivate::socketStart(bool afterConfig) { +void ConnectionPrivate::socketStart(bool afterConfig) { if (_finished) { DEBUG_LOG(("MTP Error: socketStart() called for finished connection!")); return; } - bool isDldDc = (dc >= MTP::dldStart) && (dc < MTP::dldEnd); + bool isDldDc = isDldDcId(dc); if (isDldDc) { // using media_only addresses only if key for this dc is already created QReadLocker lockFinished(&sessionDataMutex); if (sessionData) { @@ -1990,40 +1076,40 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { } } - int32 baseDc = (dc % _mtp_internal::dcShift); + int32 bareDc = bareDcId(dc); static const int IPv4address = 0, IPv6address = 1; static const int TcpProtocol = 0, HttpProtocol = 1; - int32 flags[2][2] = { { 0 } }; + MTPDdcOption::Flags flags[2][2] = { { 0 } }; string ip[2][2]; uint32 port[2][2] = { { 0 } }; { - QReadLocker lock(mtpDcOptionsMutex()); - const mtpDcOptions &options(cDcOptions()); + QReadLocker lock(dcOptionsMutex()); + const MTP::DcOptions &options(Global::DcOptions()); int32 shifts[2][2][4] = { { // IPv4 { // TCP IPv4 - isDldDc ? (MTPDdcOption::flag_media_only | MTPDdcOption::flag_tcpo_only) : -1, - MTPDdcOption::flag_tcpo_only, - isDldDc ? (MTPDdcOption::flag_media_only) : -1, + isDldDc ? (MTPDdcOption::Flag::f_media_only | MTPDdcOption::Flag::f_tcpo_only) : -1, + qFlags(MTPDdcOption::Flag::f_tcpo_only), + isDldDc ? qFlags(MTPDdcOption::Flag::f_media_only) : -1, 0 }, { // HTTP IPv4 -1, -1, - isDldDc ? (MTPDdcOption::flag_media_only) : -1, + isDldDc ? qFlags(MTPDdcOption::Flag::f_media_only) : -1, 0 }, }, { // IPv6 { // TCP IPv6 - isDldDc ? (MTPDdcOption::flag_media_only | MTPDdcOption::flag_tcpo_only | MTPDdcOption::flag_ipv6) : -1, - MTPDdcOption::flag_tcpo_only | MTPDdcOption::flag_ipv6, - isDldDc ? (MTPDdcOption::flag_media_only | MTPDdcOption::flag_ipv6) : -1, - MTPDdcOption::flag_ipv6 + isDldDc ? (MTPDdcOption::Flag::f_media_only | MTPDdcOption::Flag::f_tcpo_only | MTPDdcOption::Flag::f_ipv6) : -1, + MTPDdcOption::Flag::f_tcpo_only | MTPDdcOption::Flag::f_ipv6, + isDldDc ? (MTPDdcOption::Flag::f_media_only | MTPDdcOption::Flag::f_ipv6) : -1, + qFlags(MTPDdcOption::Flag::f_ipv6) }, { // HTTP IPv6 -1, -1, - isDldDc ? (MTPDdcOption::flag_media_only | MTPDdcOption::flag_ipv6) : -1, - MTPDdcOption::flag_ipv6 + isDldDc ? (MTPDdcOption::Flag::f_media_only | MTPDdcOption::Flag::f_ipv6) : -1, + qFlags(MTPDdcOption::Flag::f_ipv6) }, }, }; @@ -2033,7 +1119,7 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { int32 mask = shifts[address][protocol][shift]; if (mask < 0) continue; - mtpDcOptions::const_iterator index = options.constFind(baseDc + _mtp_internal::dcShift * mask); + auto index = options.constFind(shiftDcId(bareDc, mask)); if (index != options.cend()) { ip[address][protocol] = index->ip; flags[address][protocol] = index->flags; @@ -2053,8 +1139,8 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { } if (noIPv4) DEBUG_LOG(("MTP Info: DC %1 options for IPv4 over HTTP not found, waiting for config").arg(dc)); if (cTryIPv6() && noIPv6) DEBUG_LOG(("MTP Info: DC %1 options for IPv6 over HTTP not found, waiting for config").arg(dc)); - connect(mtpConfigLoader(), SIGNAL(loaded()), this, SLOT(onConfigLoaded())); - mtpConfigLoader()->load(); + connect(configLoader(), SIGNAL(loaded()), this, SLOT(onConfigLoaded())); + configLoader()->load(); return; } @@ -2064,12 +1150,12 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { retryTimer.stop(); _waitForConnectedTimer.stop(); - setState(MTProtoConnection::Connecting); + setState(ConnectingState); _pingId = _pingMsgId = _pingIdToSend = _pingSendAt = 0; _pingSender.stop(); - if (!noIPv4) DEBUG_LOG(("MTP Info: creating IPv4 connection to %1:%2 (tcp) and %3:%4 (http)..").arg(ip[IPv4address][TcpProtocol].c_str()).arg(port[IPv4address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol])); - if (!noIPv6) DEBUG_LOG(("MTP Info: creating IPv6 connection to [%1]:%2 (tcp) and [%3]:%4 (http)..").arg(ip[IPv6address][TcpProtocol].c_str()).arg(port[IPv6address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol])); + if (!noIPv4) DEBUG_LOG(("MTP Info: creating IPv4 connection to %1:%2 (tcp) and %3:%4 (http)...").arg(ip[IPv4address][TcpProtocol].c_str()).arg(port[IPv4address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol])); + if (!noIPv6) DEBUG_LOG(("MTP Info: creating IPv6 connection to [%1]:%2 (tcp) and [%3]:%4 (http)...").arg(ip[IPv6address][TcpProtocol].c_str()).arg(port[IPv6address][TcpProtocol]).arg(ip[IPv4address][HttpProtocol].c_str()).arg(port[IPv4address][HttpProtocol])); _waitForConnectedTimer.start(_waitForConnected); if (auto conn = _conn4) { @@ -2086,23 +1172,23 @@ void MTProtoConnectionPrivate::socketStart(bool afterConfig) { } } -void MTProtoConnectionPrivate::restart(bool mayBeBadKey) { +void ConnectionPrivate::restart(bool mayBeBadKey) { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData) return; - DEBUG_LOG(("MTP Info: restarting MTProtoConnection, maybe bad key = %1").arg(Logs::b(mayBeBadKey))); + DEBUG_LOG(("MTP Info: restarting Connection, maybe bad key = %1").arg(Logs::b(mayBeBadKey))); _waitForReceivedTimer.stop(); _waitForConnectedTimer.stop(); - mtpAuthKeyPtr key(sessionData->getKey()); + AuthKeyPtr key(sessionData->getKey()); if (key) { if (!sessionData->isCheckedKey()) { if (mayBeBadKey) { clearMessages(); - keyId = mtpAuthKey::RecreateKeyId; + keyId = AuthKey::RecreateKeyId; // retryTimeout = 1; // no ddos please - LOG(("MTP Info: key may be bad and was not checked - but won't be destroyed, no log outs because of bad server right now..")); + LOG(("MTP Info: key may be bad and was not checked - but won't be destroyed, no log outs because of bad server right now...")); } } else { sessionData->setCheckedKey(false); @@ -2123,7 +1209,7 @@ void MTProtoConnectionPrivate::restart(bool mayBeBadKey) { setState(-retryTimeout); } -void MTProtoConnectionPrivate::onSentSome(uint64 size) { +void ConnectionPrivate::onSentSome(uint64 size) { if (!_waitForReceivedTimer.isActive()) { uint64 remain = _waitForReceived; if (!oldConnection) { @@ -2133,9 +1219,9 @@ void MTProtoConnectionPrivate::onSentSome(uint64 size) { DEBUG_LOG(("Checking connect for request with size %1 bytes, delay will be %2").arg(size).arg(remain)); } } - if (dc >= MTP::uplStart && dc < MTP::uplEnd) { + if (isUplDcId(dc)) { remain *= MTPUploadSessionsCount; - } else if (dc >= MTP::dldStart && dc < MTP::dldEnd) { + } else if (isDldDcId(dc)) { remain *= MTPDownloadSessionsCount; } _waitForReceivedTimer.start(remain); @@ -2143,7 +1229,7 @@ void MTProtoConnectionPrivate::onSentSome(uint64 size) { if (!firstSentAt) firstSentAt = getms(true); } -void MTProtoConnectionPrivate::onReceivedSome() { +void ConnectionPrivate::onReceivedSome() { if (oldConnection) { oldConnection = false; DEBUG_LOG(("This connection marked as not old!")); @@ -2159,16 +1245,16 @@ void MTProtoConnectionPrivate::onReceivedSome() { } } -void MTProtoConnectionPrivate::onOldConnection() { +void ConnectionPrivate::onOldConnection() { oldConnection = true; _waitForReceived = MTPMinReceiveDelay; DEBUG_LOG(("This connection marked as old! _waitForReceived now %1ms").arg(_waitForReceived)); } -void MTProtoConnectionPrivate::onPingSender() { +void ConnectionPrivate::onPingSender() { if (_pingId) { if (_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto - 1) * 1000ULL < getms(true)) { - LOG(("Could not send ping for MTPPingSendAfter seconds, restarting..")); + LOG(("Could not send ping for MTPPingSendAfter seconds, restarting...")); return restart(); } else { _pingSender.start(_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto) * 1000ULL - getms(true)); @@ -2178,7 +1264,7 @@ void MTProtoConnectionPrivate::onPingSender() { } } -void MTProtoConnectionPrivate::onPingSendForce() { +void ConnectionPrivate::onPingSendForce() { if (!_pingId) { _pingSendAt = 0; DEBUG_LOG(("Will send ping!")); @@ -2186,7 +1272,7 @@ void MTProtoConnectionPrivate::onPingSendForce() { } } -void MTProtoConnectionPrivate::onWaitReceivedFailed() { +void ConnectionPrivate::onWaitReceivedFailed() { if (cConnectionType() != dbictAuto && cConnectionType() != dbictTcpProxy) { return; } @@ -2203,7 +1289,7 @@ void MTProtoConnectionPrivate::onWaitReceivedFailed() { QTimer::singleShot(0, this, SLOT(socketStart())); } -void MTProtoConnectionPrivate::onWaitConnectedFailed() { +void ConnectionPrivate::onWaitConnectedFailed() { DEBUG_LOG(("MTP Info: can't connect in %1ms").arg(_waitForConnected)); if (_waitForConnected < MTPMaxConnectDelay) _waitForConnected *= 2; @@ -2214,7 +1300,7 @@ void MTProtoConnectionPrivate::onWaitConnectedFailed() { QTimer::singleShot(0, this, SLOT(socketStart())); } -void MTProtoConnectionPrivate::onWaitIPv4Failed() { +void ConnectionPrivate::onWaitIPv4Failed() { _conn = _conn6; destroyConn(&_conn4); @@ -2227,7 +1313,7 @@ void MTProtoConnectionPrivate::onWaitIPv4Failed() { } } -void MTProtoConnectionPrivate::doDisconnect() { +void ConnectionPrivate::doDisconnect() { destroyConn(); { @@ -2239,18 +1325,18 @@ void MTProtoConnectionPrivate::doDisconnect() { clearAuthKeyData(); - setState(MTProtoConnection::Disconnected); + setState(DisconnectedState); restarted = false; } -void MTProtoConnectionPrivate::doFinish() { +void ConnectionPrivate::doFinish() { doDisconnect(); _finished = true; emit finished(_owner); deleteLater(); } -void MTProtoConnectionPrivate::handleReceived() { +void ConnectionPrivate::handleReceived() { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData) return; @@ -2266,7 +1352,7 @@ void MTProtoConnectionPrivate::handleReceived() { return restart(); } - mtpAuthKeyPtr key(sessionData->getKey()); + AuthKeyPtr key(sessionData->getKey()); if (!key || key->keyId() != keyId) { DEBUG_LOG(("MTP Error: auth_key id for dc %1 changed").arg(dc)); @@ -2298,7 +1384,7 @@ void MTProtoConnectionPrivate::handleReceived() { const mtpPrime *from(msg), *end; MTPint128 msgKey(*(MTPint128*)(encrypted + 2)); - aesDecrypt(encrypted + 6, data, dataBuffer.size(), key, msgKey); + aesIgeDecrypt(encrypted + 6, data, dataBuffer.size(), key, msgKey); uint64 serverSalt = *(uint64*)&data[0], session = *(uint64*)&data[2], msgId = *(uint64*)&data[4]; uint32 seqNo = *(uint32*)&data[6], msgLen = *(uint32*)&data[7]; @@ -2351,19 +1437,19 @@ void MTProtoConnectionPrivate::handleReceived() { badTime = true; } - bool wasConnected = (getState() == MTProtoConnection::Connected); + bool wasConnected = (getState() == ConnectedState); if (serverSalt != mySalt) { if (!badTime) { - DEBUG_LOG(("MTP Info: other salt received.. received: %1, my salt: %2, updating..").arg(serverSalt).arg(mySalt)); + DEBUG_LOG(("MTP Info: other salt received... received: %1, my salt: %2, updating...").arg(serverSalt).arg(mySalt)); sessionData->setSalt(serverSalt); - if (setState(MTProtoConnection::Connected, MTProtoConnection::Connecting)) { // only connected + if (setState(ConnectedState, ConnectingState)) { // only connected if (restarted) { emit resendAllAsync(); restarted = false; } } } else { - DEBUG_LOG(("MTP Info: other salt received.. received: %1, my salt: %2").arg(serverSalt).arg(mySalt)); + DEBUG_LOG(("MTP Info: other salt received... received: %1, my salt: %2").arg(serverSalt).arg(mySalt)); } } else { serverSalt = 0; // dont pass to handle method, so not to lock in setSalt() @@ -2428,7 +1514,7 @@ void MTProtoConnectionPrivate::handleReceived() { } if (!wasConnected) { - if (getState() == MTProtoConnection::Connected) { + if (getState() == ConnectedState) { emit needToSendAsync(); } } @@ -2438,7 +1524,7 @@ void MTProtoConnectionPrivate::handleReceived() { } } -int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime *end, uint64 msgId, int32 serverTime, uint64 serverSalt, bool badTime) { +int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime *end, uint64 msgId, int32 serverTime, uint64 serverSalt, bool badTime) { mtpTypeId cons = *from; try { @@ -2573,7 +1659,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt if (serverSalt) sessionData->setSalt(serverSalt); unixtimeSet(serverTime, true); - DEBUG_LOG(("Message Info: unixtime updated, now %1, resending in container..").arg(serverTime)); + DEBUG_LOG(("Message Info: unixtime updated, now %1, resending in container...").arg(serverTime)); resend(resendId, 0, true); } else { // must create new session, because msg_id and msg_seqno are inconsistent @@ -2590,7 +1676,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt mtpRequestId requestId = wasSent(resendId); if (requestId) { LOG(("Message Error: bad message notification received, msgId %1, error_code %2, fatal: clearing callbacks").arg(data.vbad_msg_id.v).arg(errorCode)); - _mtp_internal::clearCallbacksDelayed(RPCCallbackClears(1, RPCCallbackClear(requestId, -errorCode))); + clearCallbacksDelayed(RPCCallbackClears(1, RPCCallbackClear(requestId, -errorCode))); } else { DEBUG_LOG(("Message Error: such message was not sent recently %1").arg(resendId)); } @@ -2615,7 +1701,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt sessionData->setSalt(serverSalt); unixtimeSet(serverTime); - if (setState(MTProtoConnection::Connected, MTProtoConnection::Connecting)) { // maybe only connected + if (setState(ConnectedState, ConnectingState)) { // maybe only connected if (restarted) { emit resendAllAsync(); restarted = false; @@ -2624,13 +1710,13 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt badTime = false; - DEBUG_LOG(("Message Info: unixtime updated, now %1, server_salt updated, now %2, resending..").arg(serverTime).arg(serverSalt)); + DEBUG_LOG(("Message Info: unixtime updated, now %1, server_salt updated, now %2, resending...").arg(serverTime).arg(serverSalt)); resend(resendId); } return 1; case mtpc_msgs_state_req: { if (badTime) { - DEBUG_LOG(("Message Info: skipping with bad time..")); + DEBUG_LOG(("Message Info: skipping with bad time...")); return 0; } MTPMsgsStateReq msg(from, end); @@ -2722,7 +1808,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt MTPMsgResendReq request(rFrom, rEnd); handleMsgsStates(request.c_msg_resend_req().vmsg_ids.c_vector().v, states, toAck); } - } catch(Exception &e) { + } catch(Exception &) { LOG(("Message Error: could not parse sent msgs_state_req")); throw; } @@ -2732,7 +1818,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt case mtpc_msgs_all_info: { if (badTime) { - DEBUG_LOG(("Message Info: skipping with bad time..")); + DEBUG_LOG(("Message Info: skipping with bad time...")); return 0; } @@ -2776,14 +1862,14 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt if (received) { ackRequestData.push_back(resMsgId); } else { - DEBUG_LOG(("Message Info: answer message %1 was not received, requesting..").arg(resMsgId.v)); + DEBUG_LOG(("Message Info: answer message %1 was not received, requesting...").arg(resMsgId.v)); resendRequestData.push_back(resMsgId); } } return 1; case mtpc_msg_new_detailed_info: { if (badTime) { - DEBUG_LOG(("Message Info: skipping msg_new_detailed_info with bad time..")); + DEBUG_LOG(("Message Info: skipping msg_new_detailed_info with bad time...")); return 0; } MTPMsgDetailedInfo msg(from, end); @@ -2801,7 +1887,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt if (received) { ackRequestData.push_back(resMsgId); } else { - DEBUG_LOG(("Message Info: answer message %1 was not received, requesting..").arg(resMsgId.v)); + DEBUG_LOG(("Message Info: answer message %1 was not received, requesting...").arg(resMsgId.v)); resendRequestData.push_back(resMsgId); } } return 1; @@ -2828,7 +1914,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt MTPlong reqMsgId(++from, end); mtpTypeId typeId = from[0]; - DEBUG_LOG(("RPC Info: response received for %1, queueing..").arg(reqMsgId.v)); + DEBUG_LOG(("RPC Info: response received for %1, queueing...").arg(reqMsgId.v)); QVector ids(1, reqMsgId); if (badTime) { @@ -2909,7 +1995,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt if (badTime) return 0; MTPPing msg(from, end); - DEBUG_LOG(("Message Info: ping received, ping_id: %1, sending pong..").arg(msg.vping_id.v)); + DEBUG_LOG(("Message Info: ping received, ping_id: %1, sending pong...").arg(msg.vping_id.v)); emit sendPongAsync(msgId, msg.vping_id.v); } return 1; @@ -2926,7 +2012,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt if (data.vping_id.v == _pingId) { _pingId = 0; } else { - DEBUG_LOG(("Message Info: just pong..")); + DEBUG_LOG(("Message Info: just pong...")); } QVector ids(1, data.vmsg_id); @@ -2942,7 +2028,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt } - } catch (Exception &e) { + } catch (Exception &) { return -1; } @@ -2966,7 +2052,7 @@ int32 MTProtoConnectionPrivate::handleOneReceived(const mtpPrime *from, const mt return 1; } -mtpBuffer MTProtoConnectionPrivate::ungzip(const mtpPrime *from, const mtpPrime *end) const { +mtpBuffer ConnectionPrivate::ungzip(const mtpPrime *from, const mtpPrime *end) const { MTPstring packed(from, end); // read packed string as serialized mtp string type uint32 packedLen = packed.c_string().v.size(), unpackedChunk = packedLen, unpackedLen = 0; @@ -3013,7 +2099,7 @@ mtpBuffer MTProtoConnectionPrivate::ungzip(const mtpPrime *from, const mtpPrime return result; } -bool MTProtoConnectionPrivate::requestsFixTimeSalt(const QVector &ids, int32 serverTime, uint64 serverSalt) { +bool ConnectionPrivate::requestsFixTimeSalt(const QVector &ids, int32 serverTime, uint64 serverSalt) { uint32 idsCount = ids.size(); for (uint32 i = 0; i < idsCount; ++i) { @@ -3026,7 +2112,7 @@ bool MTProtoConnectionPrivate::requestsFixTimeSalt(const QVector &ids, return false; } -void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool byResponse) { +void ConnectionPrivate::requestsAcked(const QVector &ids, bool byResponse) { uint32 idsCount = ids.size(); DEBUG_LOG(("Message Info: requests acked, ids %1").arg(Logs::vector(ids))); @@ -3058,7 +2144,7 @@ void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool b mtpRequestId reqId = req.value()->requestId; bool moveToAcked = byResponse; if (!moveToAcked) { // ignore ACK, if we need a response (if we have a handler) - moveToAcked = !_mtp_internal::hasCallbacks(reqId); + moveToAcked = !hasCallbacks(reqId); } if (moveToAcked) { wereAcked.insert(msgId, reqId); @@ -3068,7 +2154,7 @@ void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool b } } } else { - DEBUG_LOG(("Message Info: msgId %1 was not found in recent sent, while acking requests, searching in resend..").arg(msgId)); + DEBUG_LOG(("Message Info: msgId %1 was not found in recent sent, while acking requests, searching in resend...").arg(msgId)); QWriteLocker locker3(sessionData->toResendMutex()); mtpRequestIdsMap &toResend(sessionData->toResendMap()); mtpRequestIdsMap::iterator reqIt = toResend.find(msgId); @@ -3076,7 +2162,7 @@ void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool b mtpRequestId reqId = reqIt.value(); bool moveToAcked = byResponse; if (!moveToAcked) { // ignore ACK, if we need a response (if we have a handler) - moveToAcked = !_mtp_internal::hasCallbacks(reqId); + moveToAcked = !hasCallbacks(reqId); } if (moveToAcked) { QWriteLocker locker4(sessionData->toSendMutex()); @@ -3117,7 +2203,7 @@ void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool b } if (clearedAcked.size()) { - _mtp_internal::clearCallbacksDelayed(clearedAcked); + clearCallbacksDelayed(clearedAcked); } if (toAckMore.size()) { @@ -3125,7 +2211,7 @@ void MTProtoConnectionPrivate::requestsAcked(const QVector &ids, bool b } } -void MTProtoConnectionPrivate::handleMsgsStates(const QVector &ids, const string &states, QVector &acked) { +void ConnectionPrivate::handleMsgsStates(const QVector &ids, const string &states, QVector &acked) { uint32 idsCount = ids.size(); if (!idsCount) { DEBUG_LOG(("Message Info: void ids vector in handleMsgsStates()")); @@ -3142,7 +2228,7 @@ void MTProtoConnectionPrivate::handleMsgsStates(const QVector &ids, con const mtpRequestMap &haveSent(sessionData->haveSentMap()); mtpRequestMap::const_iterator haveSentEnd = haveSent.cend(); if (haveSent.find(requestMsgId) == haveSentEnd) { - DEBUG_LOG(("Message Info: state was received for msgId %1, but request is not found, looking in resent requests..").arg(requestMsgId)); + DEBUG_LOG(("Message Info: state was received for msgId %1, but request is not found, looking in resent requests...").arg(requestMsgId)); QWriteLocker locker2(sessionData->toResendMutex()); mtpRequestIdsMap &toResend(sessionData->toResendMap()); mtpRequestIdsMap::iterator reqIt = toResend.find(requestMsgId); @@ -3169,12 +2255,12 @@ void MTProtoConnectionPrivate::handleMsgsStates(const QVector &ids, con } } -void MTProtoConnectionPrivate::resend(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { +void ConnectionPrivate::resend(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { if (msgId == _pingMsgId) return; emit resendAsync(msgId, msCanWait, forceContainer, sendMsgStateInfo); } -void MTProtoConnectionPrivate::resendMany(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { +void ConnectionPrivate::resendMany(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { for (int32 i = 0, l = msgIds.size(); i < l; ++i) { if (msgIds.at(i) == _pingMsgId) { msgIds.remove(i); @@ -3184,7 +2270,7 @@ void MTProtoConnectionPrivate::resendMany(QVector msgIds, quint64 msCan emit resendManyAsync(msgIds, msCanWait, forceContainer, sendMsgStateInfo); } -void MTProtoConnectionPrivate::onConnected4() { +void ConnectionPrivate::onConnected4() { _waitForConnected = MTPMinConnectDelay; _waitForConnectedTimer.stop(); @@ -3210,7 +2296,7 @@ void MTProtoConnectionPrivate::onConnected4() { updateAuthKey(); } -void MTProtoConnectionPrivate::onConnected6() { +void ConnectionPrivate::onConnected6() { _waitForConnected = MTPMinConnectDelay; _waitForConnectedTimer.stop(); @@ -3230,7 +2316,7 @@ void MTProtoConnectionPrivate::onConnected6() { _waitForIPv4Timer.start(MTPIPv4ConnectionWaitTimeout); } -void MTProtoConnectionPrivate::onDisconnected4() { +void ConnectionPrivate::onDisconnected4() { if (_conn && _conn == _conn6) return; // disconnected the unused if (_conn || !_conn6) { @@ -3241,7 +2327,7 @@ void MTProtoConnectionPrivate::onDisconnected4() { } } -void MTProtoConnectionPrivate::onDisconnected6() { +void ConnectionPrivate::onDisconnected6() { if (_conn && _conn == _conn4) return; // disconnected the unused if (_conn || !_conn4) { @@ -3252,11 +2338,11 @@ void MTProtoConnectionPrivate::onDisconnected6() { } } -void MTProtoConnectionPrivate::updateAuthKey() { +void ConnectionPrivate::updateAuthKey() { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData || !_conn) return; - DEBUG_LOG(("AuthKey Info: MTProtoConnection updating key from MTProtoSession, dc %1").arg(dc)); + DEBUG_LOG(("AuthKey Info: Connection updating key from Session, dc %1").arg(dc)); uint64 newKeyId = 0; { ReadLockerAttempt lock(sessionData->keyMutex()); @@ -3266,14 +2352,14 @@ void MTProtoConnectionPrivate::updateAuthKey() { keyId = newKeyId; return; // some other connection is getting key } - const mtpAuthKeyPtr &key(sessionData->getKey()); + const AuthKeyPtr &key(sessionData->getKey()); newKeyId = key ? key->keyId() : 0; } if (keyId != newKeyId) { clearMessages(); keyId = newKeyId; } - DEBUG_LOG(("AuthKey Info: MTProtoConnection update key from MTProtoSession, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str())); + DEBUG_LOG(("AuthKey Info: Connection update key from Session, dc %1 result: %2").arg(dc).arg(Logs::mb(&keyId, sizeof(keyId)).str())); if (keyId) { return authKeyCreated(); } @@ -3281,7 +2367,7 @@ void MTProtoConnectionPrivate::updateAuthKey() { DEBUG_LOG(("AuthKey Info: No key in updateAuthKey(), will be creating auth_key")); lockKey(); - const mtpAuthKeyPtr &key(sessionData->getKey()); + const AuthKeyPtr &key(sessionData->getKey()); if (key) { if (keyId != key->keyId()) clearMessages(); keyId = key->keyId(); @@ -3289,30 +2375,30 @@ void MTProtoConnectionPrivate::updateAuthKey() { return authKeyCreated(); } - authKeyData = new MTProtoConnectionPrivate::AuthKeyCreateData(); - authKeyStrings = new MTProtoConnectionPrivate::AuthKeyCreateStrings(); + authKeyData = new ConnectionPrivate::AuthKeyCreateData(); + authKeyStrings = new ConnectionPrivate::AuthKeyCreateStrings(); authKeyData->req_num = 0; - authKeyData->nonce = MTP::nonce(); + authKeyData->nonce = rand_value(); MTPReq_pq req_pq; req_pq.vnonce = authKeyData->nonce; connect(_conn, SIGNAL(receivedData()), this, SLOT(pqAnswered())); - DEBUG_LOG(("AuthKey Info: sending Req_pq..")); + DEBUG_LOG(("AuthKey Info: sending Req_pq...")); lockFinished.unlock(); sendRequestNotSecure(req_pq); } -void MTProtoConnectionPrivate::clearMessages() { - if (keyId && keyId != mtpAuthKey::RecreateKeyId && _conn) { +void ConnectionPrivate::clearMessages() { + if (keyId && keyId != AuthKey::RecreateKeyId && _conn) { _conn->received().clear(); } } -void MTProtoConnectionPrivate::pqAnswered() { +void ConnectionPrivate::pqAnswered() { disconnect(_conn, SIGNAL(receivedData()), this, SLOT(pqAnswered())); - DEBUG_LOG(("AuthKey Info: receiving Req_pq answer..")); + DEBUG_LOG(("AuthKey Info: receiving Req_pq answer...")); MTPReq_pq::ResponseType res_pq; if (!readResponseNotSecure(res_pq)) { @@ -3326,22 +2412,22 @@ void MTProtoConnectionPrivate::pqAnswered() { return restart(); } - mtpPublicRSA *rsaKey = 0; + static MTP::internal::RSAPublicKeys RSAKeys = MTP::internal::InitRSAPublicKeys(); + const MTP::internal::RSAPublicKey *rsaKey = nullptr; const QVector &fingerPrints(res_pq.c_resPQ().vserver_public_key_fingerprints.c_vector().v); - for (uint32 i = 0, l = fingerPrints.size(); i < l; ++i) { - uint64 print(fingerPrints[i].v); - PublicRSAKeys::iterator rsaIndex = gPublicRSA.find(print); - if (rsaIndex != gPublicRSA.end()) { - rsaKey = &rsaIndex.value(); + for (const MTPlong &fingerPrint : fingerPrints) { + auto it = RSAKeys.constFind(fingerPrint.v); + if (it != RSAKeys.cend()) { + rsaKey = &it.value(); break; } } if (!rsaKey) { QStringList suggested, my; - for (uint32 i = 0, l = fingerPrints.size(); i < l; ++i) { - suggested.push_back(QString("%1").arg(fingerPrints[i].v)); + for (const MTPlong &fingerPrint : fingerPrints) { + suggested.push_back(QString("%1").arg(fingerPrint.v)); } - for (PublicRSAKeys::const_iterator i = gPublicRSA.cbegin(), e = gPublicRSA.cend(); i != e; ++i) { + for (auto i = RSAKeys.cbegin(), e = RSAKeys.cend(); i != e; ++i) { my.push_back(QString("%1").arg(i.key())); } LOG(("AuthKey Error: could not choose public RSA key, suggested fingerprints: %1, my fingerprints: %2").arg(suggested.join(", ")).arg(my.join(", "))); @@ -3359,19 +2445,19 @@ void MTProtoConnectionPrivate::pqAnswered() { const string &pq(res_pq_data.vpq.c_string().v); string &p(p_q_inner_data.vp._string().v), &q(p_q_inner_data.vq._string().v); - if (!parsePQ(pq, p, q)) { + if (!MTP::internal::parsePQ(pq, p, q)) { LOG(("AuthKey Error: could not factor pq!")); DEBUG_LOG(("AuthKey Error: problematic pq: %1").arg(Logs::mb(&pq[0], pq.length()).str())); return restart(); } - authKeyData->new_nonce = MTP::nonce(); + authKeyData->new_nonce = rand_value(); p_q_inner_data.vnew_nonce = authKeyData->new_nonce; MTPReq_DH_params req_DH_params; req_DH_params.vnonce = authKeyData->nonce; req_DH_params.vserver_nonce = authKeyData->server_nonce; - req_DH_params.vpublic_key_fingerprint = MTP_long(rsaKey->fingerPrint()); + req_DH_params.vpublic_key_fingerprint = MTP_long(rsaKey->getFingerPrint()); req_DH_params.vp = p_q_inner_data.vp; req_DH_params.vq = p_q_inner_data.vq; @@ -3399,23 +2485,18 @@ void MTProtoConnectionPrivate::pqAnswered() { memset_rand(&encBuffer[encSize], (65 - encSize) * sizeof(mtpPrime)); } - dhEncString.resize(256); - int32 res = RSA_public_encrypt(256, ((const uchar*)&encBuffer[0]) + 3, (uchar*)&dhEncString[0], rsaKey->key(), RSA_NO_PADDING); - if (res != 256) { - ERR_load_crypto_strings(); - LOG(("RSA Error: RSA_public_encrypt failed, key fp: %1, result: %2, error: %3").arg(rsaKey->fingerPrint()).arg(res).arg(ERR_error_string(ERR_get_error(), 0))); + if (!rsaKey->encrypt(reinterpret_cast(&encBuffer[0]) + 3, dhEncString)) { return restart(); } - connect(_conn, SIGNAL(receivedData()), this, SLOT(dhParamsAnswered())); - DEBUG_LOG(("AuthKey Info: sending Req_DH_params..")); + DEBUG_LOG(("AuthKey Info: sending Req_DH_params...")); sendRequestNotSecure(req_DH_params); } -void MTProtoConnectionPrivate::dhParamsAnswered() { +void ConnectionPrivate::dhParamsAnswered() { disconnect(_conn, SIGNAL(receivedData()), this, SLOT(dhParamsAnswered())); - DEBUG_LOG(("AuthKey Info: receiving Req_DH_params answer..")); + DEBUG_LOG(("AuthKey Info: receiving Req_DH_params answer...")); MTPReq_DH_params::ResponseType res_DH_params; if (!readResponseNotSecure(res_DH_params)) { @@ -3463,7 +2544,7 @@ void MTProtoConnectionPrivate::dhParamsAnswered() { memcpy(authKeyData->aesIV + 8, sha1nn, 20); memcpy(authKeyData->aesIV + 28, &authKeyData->new_nonce, 4); - aesDecrypt(&encDHStr[0], &decBuffer[0], encDHLen, authKeyData->aesKey, authKeyData->aesIV); + aesIgeDecrypt(&encDHStr[0], &decBuffer[0], encDHLen, authKeyData->aesKey, authKeyData->aesIV); const mtpPrime *from(&decBuffer[5]), *to(from), *end(from + (encDHBufLen - 5)); MTPServer_DH_inner_data dh_inner(to, end); @@ -3494,7 +2575,7 @@ void MTProtoConnectionPrivate::dhParamsAnswered() { } // check that dhPrime and (dhPrime - 1) / 2 are really prime using openssl BIGNUM methods - _BigNumPrimeTest bnPrimeTest; + MTP::internal::BigNumPrimeTest bnPrimeTest; if (!bnPrimeTest.isPrimeAndGood(&dhPrime[0], MTPMillerRabinIterCount, dh_inner_data.vg.v)) { LOG(("AuthKey Error: bad dh_prime primality!").arg(dhPrime.length()).arg(g_a.length())); DEBUG_LOG(("AuthKey Error: dh_prime %1").arg(Logs::mb(&dhPrime[0], dhPrime.length()).str())); @@ -3534,7 +2615,7 @@ void MTProtoConnectionPrivate::dhParamsAnswered() { return restart(); } -void MTProtoConnectionPrivate::dhClientParamsSend() { +void ConnectionPrivate::dhClientParamsSend() { if (++authKeyData->retries > 5) { LOG(("AuthKey Error: could not create auth_key for %1 retries").arg(authKeyData->retries - 1)); return restart(); @@ -3548,11 +2629,11 @@ void MTProtoConnectionPrivate::dhClientParamsSend() { client_dh_inner_data.vg_b._string().v.resize(256); // gen rand 'b' - uint32 b[64], *g_b((uint32*)&client_dh_inner_data.vg_b._string().v[0]), g_b_len; + uint32 b[64], *g_b((uint32*)&client_dh_inner_data.vg_b._string().v[0]); memset_rand(b, sizeof(b)); // count g_b and auth_key using openssl BIGNUM methods - _BigNumCounter bnCounter; + MTP::internal::BigNumCounter bnCounter; if (!bnCounter.count(b, authKeyStrings->dh_prime.constData(), authKeyData->g, g_b, authKeyStrings->g_a.constData(), authKeyData->auth_key)) { return dhClientParamsSend(); } @@ -3587,20 +2668,20 @@ void MTProtoConnectionPrivate::dhClientParamsSend() { sdhEncString.resize(encFullSize * 4); - aesEncrypt(&encBuffer[0], &sdhEncString[0], encFullSize * sizeof(mtpPrime), authKeyData->aesKey, authKeyData->aesIV); + aesIgeEncrypt(&encBuffer[0], &sdhEncString[0], encFullSize * sizeof(mtpPrime), authKeyData->aesKey, authKeyData->aesIV); connect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); - DEBUG_LOG(("AuthKey Info: sending Req_client_DH_params..")); + DEBUG_LOG(("AuthKey Info: sending Req_client_DH_params...")); sendRequestNotSecure(req_client_DH_params); } -void MTProtoConnectionPrivate::dhClientParamsAnswered() { +void ConnectionPrivate::dhClientParamsAnswered() { QReadLocker lockFinished(&sessionDataMutex); if (!sessionData) return; disconnect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); - DEBUG_LOG(("AuthKey Info: receiving Req_client_DH_params answer..")); + DEBUG_LOG(("AuthKey Info: receiving Req_client_DH_params answer...")); MTPSet_client_DH_params::ResponseType res_client_DH_params; if (!readResponseNotSecure(res_client_DH_params)) { @@ -3638,9 +2719,9 @@ void MTProtoConnectionPrivate::dhClientParamsAnswered() { uint64 salt1 = authKeyData->new_nonce.l.l, salt2 = authKeyData->server_nonce.l, serverSalt = salt1 ^ salt2; sessionData->setSalt(serverSalt); - mtpAuthKeyPtr authKey(new mtpAuthKey()); + AuthKeyPtr authKey(new AuthKey()); authKey->setKey(authKeyData->auth_key); - authKey->setDC(dc % _mtp_internal::dcShift); + authKey->setDC(bareDcId(dc)); DEBUG_LOG(("AuthKey Info: auth key gen succeed, id: %1, server salt: %2, auth key: %3").arg(authKey->keyId()).arg(serverSalt).arg(Logs::mb(authKeyData->auth_key, 256).str())); @@ -3715,25 +2796,25 @@ void MTProtoConnectionPrivate::dhClientParamsAnswered() { return restart(); } -void MTProtoConnectionPrivate::authKeyCreated() { +void ConnectionPrivate::authKeyCreated() { clearAuthKeyData(); connect(_conn, SIGNAL(receivedData()), this, SLOT(handleReceived())); if (sessionData->getSalt()) { // else receive salt in bad_server_salt first, then try to send all the requests - setState(MTProtoConnection::Connected); + setState(ConnectedState); if (restarted) { emit resendAllAsync(); restarted = false; } } - _pingIdToSend = MTP::nonce(); // get server_salt + _pingIdToSend = rand_value(); // get server_salt emit needToSendAsync(); } -void MTProtoConnectionPrivate::clearAuthKeyData() { +void ConnectionPrivate::clearAuthKeyData() { if (authKeyData) { #ifdef Q_OS_WIN SecureZeroMemory(authKeyData, sizeof(AuthKeyCreateData)); @@ -3751,39 +2832,39 @@ void MTProtoConnectionPrivate::clearAuthKeyData() { } } -void MTProtoConnectionPrivate::onError4(bool mayBeBadKey) { +void ConnectionPrivate::onError4(bool mayBeBadKey) { if (_conn && _conn == _conn6) return; // error in the unused if (_conn || !_conn6) { destroyConn(); _waitForConnectedTimer.stop(); - MTP_LOG(dc, ("Restarting after error in IPv4 connection, maybe bad key: %1..").arg(Logs::b(mayBeBadKey))); + MTP_LOG(dc, ("Restarting after error in IPv4 connection, maybe bad key: %1...").arg(Logs::b(mayBeBadKey))); return restart(mayBeBadKey); } else { destroyConn(&_conn4); } } -void MTProtoConnectionPrivate::onError6(bool mayBeBadKey) { +void ConnectionPrivate::onError6(bool mayBeBadKey) { if (_conn && _conn == _conn4) return; // error in the unused if (_conn || !_conn4) { destroyConn(); _waitForConnectedTimer.stop(); - MTP_LOG(dc, ("Restarting after error in IPv6 connection, maybe bad key: %1..").arg(Logs::b(mayBeBadKey))); + MTP_LOG(dc, ("Restarting after error in IPv6 connection, maybe bad key: %1...").arg(Logs::b(mayBeBadKey))); return restart(mayBeBadKey); } else { destroyConn(&_conn6); } } -void MTProtoConnectionPrivate::onReadyData() { +void ConnectionPrivate::onReadyData() { } template -void MTProtoConnectionPrivate::sendRequestNotSecure(const TRequest &request) { +void ConnectionPrivate::sendRequestNotSecure(const TRequest &request) { try { mtpBuffer buffer; uint32 requestSize = request.innerLength() >> 2; @@ -3807,13 +2888,13 @@ void MTProtoConnectionPrivate::sendRequestNotSecure(const TRequest &request) { onSentSome(buffer.size() * sizeof(mtpPrime)); - } catch (Exception &e) { + } catch (Exception &) { return restart(); } } template -bool MTProtoConnectionPrivate::readResponseNotSecure(TResponse &response) { +bool ConnectionPrivate::readResponseNotSecure(TResponse &response) { onReceivedSome(); try { @@ -3844,13 +2925,13 @@ bool MTProtoConnectionPrivate::readResponseNotSecure(TResponse &response) { } const mtpPrime *from(answer + 5), *end(from + len - 5); response.read(from, end); - } catch (Exception &e) { + } catch (Exception &) { return false; } return true; } -bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResponse, QReadLocker &lockFinished) { +bool ConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResponse, QReadLocker &lockFinished) { uint32 fullSize = request->size(); if (fullSize < 9) return false; @@ -3859,14 +2940,14 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp ReadLockerAttempt lock(sessionData->keyMutex()); if (!lock) { - DEBUG_LOG(("MTP Info: could not lock key for read in sendBuffer(), dc %1, restarting..").arg(dc)); + DEBUG_LOG(("MTP Info: could not lock key for read in sendBuffer(), dc %1, restarting...").arg(dc)); lockFinished.unlock(); restart(); return false; } - mtpAuthKeyPtr key(sessionData->getKey()); + AuthKeyPtr key(sessionData->getKey()); if (!key || key->keyId() != keyId) { DEBUG_LOG(("MTP Error: auth_key id for dc %1 changed").arg(dc)); @@ -3893,7 +2974,7 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp *((uint64*)&result[2]) = keyId; *((MTPint128*)&result[4]) = msgKey; - aesEncrypt(request->constData(), &result[8], fullSize * sizeof(mtpPrime), key, msgKey); + aesIgeEncrypt(request->constData(), &result[8], fullSize * sizeof(mtpPrime), key, msgKey); DEBUG_LOG(("MTP Info: sending request, size: %1, num: %2, time: %3").arg(fullSize + 6).arg((*request)[4]).arg((*request)[5])); @@ -3907,7 +2988,7 @@ bool MTProtoConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResp return true; } -mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const { +mtpRequestId ConnectionPrivate::wasSent(mtpMsgId msgId) const { if (msgId == _pingMsgId) return mtpRequestId(0xFFFFFFFF); { QReadLocker locker(sessionData->haveSentMutex()); @@ -3930,31 +3011,34 @@ mtpRequestId MTProtoConnectionPrivate::wasSent(mtpMsgId msgId) const { return 0; } -void MTProtoConnectionPrivate::lockKey() { +void ConnectionPrivate::lockKey() { unlockKey(); sessionData->keyMutex()->lockForWrite(); myKeyLock = true; } -void MTProtoConnectionPrivate::unlockKey() { +void ConnectionPrivate::unlockKey() { if (myKeyLock) { myKeyLock = false; sessionData->keyMutex()->unlock(); } } -MTProtoConnectionPrivate::~MTProtoConnectionPrivate() { +ConnectionPrivate::~ConnectionPrivate() { t_assert(_finished && _conn == nullptr && _conn4 == nullptr && _conn6 == nullptr); } -void MTProtoConnectionPrivate::stop() { +void ConnectionPrivate::stop() { QWriteLocker lockFinished(&sessionDataMutex); if (sessionData) { if (myKeyLock) { - sessionData->owner()->notifyKeyCreated(mtpAuthKeyPtr()); // release key lock, let someone else create it + sessionData->owner()->notifyKeyCreated(AuthKeyPtr()); // release key lock, let someone else create it sessionData->keyMutex()->unlock(); myKeyLock = false; } sessionData = nullptr; } } + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection.h b/Telegram/SourceFiles/mtproto/connection.h new file mode 100644 index 000000000..dea2c3df3 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection.h @@ -0,0 +1,268 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" +#include "mtproto/auth_key.h" +#include "mtproto/connection_abstract.h" + +namespace MTP { +namespace internal { + +class ConnectionPrivate; +class SessionData; + +class Thread : public QThread { + Q_OBJECT + +public: + Thread(); + uint32 getThreadId() const; + ~Thread(); + +private: + uint32 _threadId; + +}; + +class Connection { +public: + + enum ConnectionType { + TcpConnection, + HttpConnection + }; + + Connection(); + int32 start(SessionData *data, int32 dc = 0); // return dc + void kill(); + void waitTillFinish(); + ~Connection(); + + static const int UpdateAlways = 666; + + int32 state() const; + QString transport() const; + +private: + + QThread *thread; + ConnectionPrivate *data; + +}; + +class ConnectionPrivate : public QObject { + Q_OBJECT + +public: + + ConnectionPrivate(QThread *thread, Connection *owner, SessionData *data, uint32 dc); + ~ConnectionPrivate(); + + void stop(); + + int32 getDC() const; + + int32 getState() const; + QString transport() const; + +signals: + + void needToReceive(); + void needToRestart(); + void stateChanged(qint32 newState); + void sessionResetDone(); + + void needToSendAsync(); + void sendAnythingAsync(quint64 msWait); + void sendHttpWaitAsync(); + void sendPongAsync(quint64 msgId, quint64 pingId); + void sendMsgsStateInfoAsync(quint64 msgId, QByteArray data); + void resendAsync(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo); + void resendManyAsync(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo); + void resendAllAsync(); + + void finished(Connection *connection); + +public slots: + + void retryByTimer(); + void restartNow(); + void restart(bool mayBeBadKey = false); + + void onPingSender(); + void onPingSendForce(); + + void onWaitConnectedFailed(); + void onWaitReceivedFailed(); + void onWaitIPv4Failed(); + + void onOldConnection(); + void onSentSome(uint64 size); + void onReceivedSome(); + + void onReadyData(); + void socketStart(bool afterConfig = false); + + void onConnected4(); + void onConnected6(); + void onDisconnected4(); + void onDisconnected6(); + void onError4(bool mayBeBadKey = false); + void onError6(bool mayBeBadKey = false); + + void doFinish(); + + // Auth key creation packet receive slots + void pqAnswered(); + void dhParamsAnswered(); + void dhClientParamsAnswered(); + + // General packet receive slot, connected to conn->receivedData signal + void handleReceived(); + + // Sessions signals, when we need to send something + void tryToSend(); + + void updateAuthKey(); + + void onConfigLoaded(); + +private: + + void doDisconnect(); + + void createConn(bool createIPv4, bool createIPv6); + void destroyConn(AbstractConnection **conn = 0); // 0 - destory all + + mtpMsgId placeToContainer(mtpRequest &toSendRequest, mtpMsgId &bigMsgId, mtpMsgId *&haveSentArr, mtpRequest &req); + mtpMsgId prepareToSend(mtpRequest &request, mtpMsgId currentLastId); + mtpMsgId replaceMsgId(mtpRequest &request, mtpMsgId newId); + + bool sendRequest(mtpRequest &request, bool needAnyResponse, QReadLocker &lockFinished); + mtpRequestId wasSent(mtpMsgId msgId) const; + + int32 handleOneReceived(const mtpPrime *from, const mtpPrime *end, uint64 msgId, int32 serverTime, uint64 serverSalt, bool badTime); + mtpBuffer ungzip(const mtpPrime *from, const mtpPrime *end) const; + void handleMsgsStates(const QVector &ids, const string &states, QVector &acked); + + void clearMessages(); + + bool setState(int32 state, int32 ifState = Connection::UpdateAlways); + mutable QReadWriteLock stateConnMutex; + int32 _state; + + bool _needSessionReset; + void resetSession(); + + ShiftedDcId dc; + Connection *_owner; + AbstractConnection *_conn, *_conn4, *_conn6; + + SingleTimer retryTimer; // exp retry timer + int retryTimeout; + quint64 retryWillFinish; + + SingleTimer oldConnectionTimer; + bool oldConnection; + + SingleTimer _waitForConnectedTimer, _waitForReceivedTimer, _waitForIPv4Timer; + uint32 _waitForReceived, _waitForConnected; + int64 firstSentAt; + + QVector ackRequestData, resendRequestData; + + // if badTime received - search for ids in sessionData->haveSent and sessionData->wereAcked and sync time/salt, return true if found + bool requestsFixTimeSalt(const QVector &ids, int32 serverTime, uint64 serverSalt); + + // remove msgs with such ids from sessionData->haveSent, add to sessionData->wereAcked + void requestsAcked(const QVector &ids, bool byResponse = false); + + mtpPingId _pingId, _pingIdToSend; + uint64 _pingSendAt; + mtpMsgId _pingMsgId; + SingleTimer _pingSender; + + void resend(quint64 msgId, quint64 msCanWait = 0, bool forceContainer = false, bool sendMsgStateInfo = false); + void resendMany(QVector msgIds, quint64 msCanWait = 0, bool forceContainer = false, bool sendMsgStateInfo = false); + + template + void sendRequestNotSecure(const TRequest &request); + + template + bool readResponseNotSecure(TResponse &response); + + bool restarted, _finished; + + uint64 keyId; + QReadWriteLock sessionDataMutex; + SessionData *sessionData; + + bool myKeyLock; + void lockKey(); + void unlockKey(); + + // Auth key creation fields and methods + struct AuthKeyCreateData { + AuthKeyCreateData() + : new_nonce(*(MTPint256*)((uchar*)new_nonce_buf)) + , auth_key_aux_hash(*(MTPlong*)((uchar*)new_nonce_buf + 33)) + , retries(0) + , g(0) + , req_num(0) + , msgs_sent(0) { + memset(new_nonce_buf, 0, sizeof(new_nonce_buf)); + memset(aesKey, 0, sizeof(aesKey)); + memset(aesIV, 0, sizeof(aesIV)); + memset(auth_key, 0, sizeof(auth_key)); + } + MTPint128 nonce, server_nonce; + uchar new_nonce_buf[41]; // 32 bytes new_nonce + 1 check byte + 8 bytes of auth_key_aux_hash + MTPint256 &new_nonce; + MTPlong &auth_key_aux_hash; + + uint32 retries; + MTPlong retry_id; + + int32 g; + + uchar aesKey[32], aesIV[32]; + uint32 auth_key[64]; + MTPlong auth_key_hash; + + uint32 req_num; // sent not encrypted request number + uint32 msgs_sent; + }; + struct AuthKeyCreateStrings { + QByteArray dh_prime; + QByteArray g_a; + }; + AuthKeyCreateData *authKeyData; + AuthKeyCreateStrings *authKeyStrings; + + void dhClientParamsSend(); + void authKeyCreated(); + void clearAuthKeyData(); + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_abstract.cpp b/Telegram/SourceFiles/mtproto/connection_abstract.cpp new file mode 100644 index 000000000..1e6d96fc3 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_abstract.cpp @@ -0,0 +1,90 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/connection_abstract.h" + +#include "mtproto/connection_tcp.h" +#include "mtproto/connection_http.h" +#include "mtproto/connection_auto.h" + +namespace MTP { +namespace internal { + +AbstractConnection::~AbstractConnection() { +} + +mtpBuffer AbstractConnection::preparePQFake(const MTPint128 &nonce) { + MTPReq_pq req_pq(nonce); + mtpBuffer buffer; + uint32 requestSize = req_pq.innerLength() >> 2; + + buffer.resize(0); + buffer.reserve(8 + requestSize); + buffer.push_back(0); // tcp packet len + buffer.push_back(0); // tcp packet num + buffer.push_back(0); + buffer.push_back(0); + buffer.push_back(0); + buffer.push_back(unixtime()); + buffer.push_back(requestSize * 4); + req_pq.write(buffer); + buffer.push_back(0); // tcp crc32 hash + + return buffer; +} + +MTPResPQ AbstractConnection::readPQFakeReply(const mtpBuffer &buffer) { + const mtpPrime *answer(buffer.constData()); + uint32 len = buffer.size(); + if (len < 5) { + LOG(("Fake PQ Error: bad request answer, len = %1").arg(len * sizeof(mtpPrime))); + DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); + throw Exception("bad pq reply"); + } + if (answer[0] != 0 || answer[1] != 0 || (((uint32)answer[2]) & 0x03) != 1/* || (unixtime() - answer[3] > 300) || (answer[3] - unixtime() > 60)*/) { // didnt sync time yet + LOG(("Fake PQ Error: bad request answer start (%1 %2 %3)").arg(answer[0]).arg(answer[1]).arg(answer[2])); + DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); + throw Exception("bad pq reply"); + } + uint32 answerLen = (uint32)answer[4]; + if (answerLen != (len - 5) * sizeof(mtpPrime)) { + LOG(("Fake PQ Error: bad request answer %1 <> %2").arg(answerLen).arg((len - 5) * sizeof(mtpPrime))); + DEBUG_LOG(("Fake PQ Error: answer bytes %1").arg(Logs::mb(answer, len * sizeof(mtpPrime)).str())); + throw Exception("bad pq reply"); + } + const mtpPrime *from(answer + 5), *end(from + len - 5); + MTPResPQ response; + response.read(from, end); + return response; +} + +AbstractConnection *AbstractConnection::create(QThread *thread) { + if (cConnectionType() == dbictHttpProxy) { + return new HTTPConnection(thread); + } else if (cConnectionType() == dbictTcpProxy) { + return new TCPConnection(thread); + } + return new AutoConnection(thread); +} + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_abstract.h b/Telegram/SourceFiles/mtproto/connection_abstract.h new file mode 100644 index 000000000..1547e1076 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_abstract.h @@ -0,0 +1,91 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" + +namespace MTP { +namespace internal { + +class AbstractConnection : public QObject { + Q_OBJECT + +public: + + AbstractConnection(QThread *thread) : _sentEncrypted(false) { + moveToThread(thread); + } + AbstractConnection(const AbstractConnection &other) = delete; + AbstractConnection &operator=(const AbstractConnection &other) = delete; + virtual ~AbstractConnection() = 0; + + // virtual constructor + static AbstractConnection *create(QThread *thread); + + void setSentEncrypted() { + _sentEncrypted = true; + } + + virtual void sendData(mtpBuffer &buffer) = 0; // has size + 3, buffer[0] = len, buffer[1] = packetnum, buffer[last] = crc32 + virtual void disconnectFromServer() = 0; + virtual void connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) = 0; + virtual void connectHttp(const QString &addr, int32 port, MTPDdcOption::Flags flags) = 0; + virtual bool isConnected() const = 0; + virtual bool usingHttpWait() { + return false; + } + virtual bool needHttpWait() { + return false; + } + + virtual int32 debugState() const = 0; + + virtual QString transport() const = 0; + + typedef QList BuffersQueue; + BuffersQueue &received() { + return receivedQueue; + } + +signals: + + void receivedData(); + void receivedSome(); // to stop restart timer + + void error(bool mayBeBadKey = false); + + void connected(); + void disconnected(); + +protected: + + BuffersQueue receivedQueue; // list of received packets, not processed yet + bool _sentEncrypted; + + // first we always send fake MTPReq_pq to see if connection works at all + // we send them simultaneously through TCP/HTTP/IPv4/IPv6 to choose the working one + static mtpBuffer preparePQFake(const MTPint128 &nonce); + static MTPResPQ readPQFakeReply(const mtpBuffer &buffer); + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_auto.cpp b/Telegram/SourceFiles/mtproto/connection_auto.cpp new file mode 100644 index 000000000..74aa09baf --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_auto.cpp @@ -0,0 +1,344 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/connection_auto.h" + +#include "mtproto/connection_http.h" + +namespace MTP { +namespace internal { + +AutoConnection::AutoConnection(QThread *thread) : AbstractTCPConnection(thread) +, status(WaitingBoth) +, tcpNonce(rand_value()) +, httpNonce(rand_value()) +, _flagsTcp(0) +, _flagsHttp(0) +, _tcpTimeout(MTPMinReceiveDelay) { + manager.moveToThread(thread); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY + manager.setProxy(QNetworkProxy(QNetworkProxy::DefaultProxy)); +#endif + + httpStartTimer.moveToThread(thread); + httpStartTimer.setSingleShot(true); + connect(&httpStartTimer, SIGNAL(timeout()), this, SLOT(onHttpStart())); + + tcpTimeoutTimer.moveToThread(thread); + tcpTimeoutTimer.setSingleShot(true); + connect(&tcpTimeoutTimer, SIGNAL(timeout()), this, SLOT(onTcpTimeoutTimer())); + + sock.moveToThread(thread); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY + sock.setProxy(QNetworkProxy(QNetworkProxy::NoProxy)); +#endif + connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); + connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected())); + connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); +} + +void AutoConnection::onHttpStart() { + if (status == HttpReady) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by timer").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + sock.disconnectFromHost(); + emit connected(); + } +} + +void AutoConnection::onSocketConnected() { + if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { + mtpBuffer buffer(preparePQFake(tcpNonce)); + + DEBUG_LOG(("Connection Info: sending fake req_pq through TCP/%1 transport").arg((_flagsTcp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + + if (_tcpTimeout < 0) _tcpTimeout = -_tcpTimeout; + tcpTimeoutTimer.start(_tcpTimeout); + + tcpSend(buffer); + } else if (status == WaitingHttp || status == UsingHttp) { + sock.disconnectFromHost(); + } +} + +void AutoConnection::onTcpTimeoutTimer() { + if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { + if (_tcpTimeout < MTPMaxReceiveDelay) _tcpTimeout *= 2; + _tcpTimeout = -_tcpTimeout; + + QAbstractSocket::SocketState state = sock.state(); + if (state == QAbstractSocket::ConnectedState || state == QAbstractSocket::ConnectingState || state == QAbstractSocket::HostLookupState) { + sock.disconnectFromHost(); + } else if (state != QAbstractSocket::ClosingState) { + sock.connectToHost(QHostAddress(_addrTcp), _portTcp); + } + } +} + +void AutoConnection::onSocketDisconnected() { + if (_tcpTimeout < 0) { + _tcpTimeout = -_tcpTimeout; + if (status == HttpReady || status == WaitingBoth || status == WaitingTcp) { + sock.connectToHost(QHostAddress(_addrTcp), _portTcp); + return; + } + } + if (status == WaitingBoth) { + status = WaitingHttp; + } else if (status == WaitingTcp || status == UsingTcp) { + emit disconnected(); + } else if (status == HttpReady) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by socket disconnect").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + emit connected(); + } +} + +void AutoConnection::sendData(mtpBuffer &buffer) { + if (status == FinishedWork) return; + + if (buffer.size() < 3) { + LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); + TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); + emit error(); + return; + } + + if (status == UsingTcp) { + tcpSend(buffer); + } else { + httpSend(buffer); + } +} + +void AutoConnection::httpSend(mtpBuffer &buffer) { + int32 requestSize = (buffer.size() - 3) * sizeof(mtpPrime); + + QNetworkRequest request(address); + request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize)); + request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded"))); + + TCP_LOG(("HTTP Info: sending %1 len request").arg(requestSize)); + requests.insert(manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize))); +} + +void AutoConnection::disconnectFromServer() { + if (status == FinishedWork) return; + status = FinishedWork; + + Requests copy = requests; + requests.clear(); + for (Requests::const_iterator i = copy.cbegin(), e = copy.cend(); i != e; ++i) { + (*i)->abort(); + (*i)->deleteLater(); + } + + disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); + + address = QUrl(); + + disconnect(&sock, SIGNAL(readyRead()), 0, 0); + sock.close(); + + httpStartTimer.stop(); +} + +void AutoConnection::connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) { + _addrTcp = addr; + _portTcp = port; + _flagsTcp = flags; + + connect(&sock, SIGNAL(readyRead()), this, SLOT(socketRead())); + sock.connectToHost(QHostAddress(_addrTcp), _portTcp); +} + +void AutoConnection::connectHttp(const QString &addr, int32 port, MTPDdcOption::Flags flags) { + address = QUrl(((flags & MTPDdcOption::Flag::f_ipv6) ? qsl("http://[%1]:%2/api") : qsl("http://%1:%2/api")).arg(addr).arg(80));//not p - always 80 port for http transport + TCP_LOG(("HTTP Info: address is %1").arg(address.toDisplayString())); + connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); + + _addrHttp = addr; + _portHttp = port; + _flagsHttp = flags; + + mtpBuffer buffer(preparePQFake(httpNonce)); + + DEBUG_LOG(("Connection Info: sending fake req_pq through HTTP/%1 transport").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + + httpSend(buffer); +} + +bool AutoConnection::isConnected() const { + return (status == UsingTcp) || (status == UsingHttp); +} + +void AutoConnection::requestFinished(QNetworkReply *reply) { + if (status == FinishedWork) return; + + reply->deleteLater(); + if (reply->error() == QNetworkReply::NoError) { + requests.remove(reply); + + mtpBuffer data = HTTPConnection::handleResponse(reply); + if (data.size() == 1) { + if (status == WaitingBoth) { + status = WaitingTcp; + } else { + emit error(); + } + } else if (!data.isEmpty()) { + if (status == UsingHttp) { + receivedQueue.push_back(data); + emit receivedData(); + } else if (status == WaitingBoth || status == WaitingHttp) { + try { + MTPResPQ res_pq = readPQFakeReply(data); + const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); + if (res_pq_data.vnonce == httpNonce) { + if (status == WaitingBoth) { + status = HttpReady; + httpStartTimer.start(MTPTcpConnectionWaitTimeout); + } else { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by pq-response, awaited").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + sock.disconnectFromHost(); + emit connected(); + } + } + } catch (Exception &e) { + DEBUG_LOG(("Connection Error: exception in parsing HTTP fake pq-responce, %1").arg(e.what())); + if (status == WaitingBoth) { + status = WaitingTcp; + } else { + emit error(); + } + } + } else if (status == UsingTcp) { + DEBUG_LOG(("Connection Info: already using tcp, ignoring http response")); + } + } + } else { + if (!requests.remove(reply)) { + return; + } + + bool mayBeBadKey = HTTPConnection::handleError(reply) && _sentEncrypted; + if (status == WaitingBoth) { + status = WaitingTcp; + } else if (status == WaitingHttp || status == UsingHttp) { + emit error(mayBeBadKey); + } else { + LOG(("Strange Http Error: status %1").arg(status)); + } + } +} + +void AutoConnection::socketPacket(const char *packet, uint32 length) { + if (status == FinishedWork) return; + + mtpBuffer data = AbstractTCPConnection::handleResponse(packet, length); + if (data.size() == 1) { + if (status == WaitingBoth) { + status = WaitingHttp; + sock.disconnectFromHost(); + } else if (status == HttpReady) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by bad tcp response, ready").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + sock.disconnectFromHost(); + emit connected(); + } else if (status == WaitingTcp || status == UsingTcp) { + bool mayBeBadKey = (data[0] == -410) && _sentEncrypted; + emit error(mayBeBadKey); + } else { + LOG(("Strange Tcp Error; status %1").arg(status)); + } + } else if (status == UsingTcp) { + receivedQueue.push_back(data); + emit receivedData(); + } else if (status == WaitingBoth || status == WaitingTcp || status == HttpReady) { + tcpTimeoutTimer.stop(); + try { + MTPResPQ res_pq = readPQFakeReply(data); + const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); + if (res_pq_data.vnonce == tcpNonce) { + DEBUG_LOG(("Connection Info: TCP/%1-transport chosen by pq-response").arg((_flagsTcp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingTcp; + emit connected(); + } + } catch (Exception &e) { + DEBUG_LOG(("Connection Error: exception in parsing TCP fake pq-responce, %1").arg(e.what())); + if (status == WaitingBoth) { + status = WaitingHttp; + sock.disconnectFromHost(); + } else if (status == HttpReady) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by bad tcp response, awaited").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + sock.disconnectFromHost(); + emit connected(); + } else { + emit error(); + } + } + } +} + +bool AutoConnection::usingHttpWait() { + return (status == UsingHttp); +} + +bool AutoConnection::needHttpWait() { + return (status == UsingHttp) ? requests.isEmpty() : false; +} + +int32 AutoConnection::debugState() const { + return (status == UsingHttp) ? -1 : (UsingTcp ? sock.state() : -777); +} + +QString AutoConnection::transport() const { + if (status == UsingTcp) { + return qsl("TCP"); + } else if (status == UsingHttp) { + return qsl("HTTP"); + } else { + return QString(); + } +} + +void AutoConnection::socketError(QAbstractSocket::SocketError e) { + if (status == FinishedWork) return; + + AbstractTCPConnection::handleError(e, sock); + if (status == WaitingBoth) { + status = WaitingHttp; + } else if (status == HttpReady) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport chosen by tcp error, ready").arg((_flagsHttp & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + emit connected(); + } else if (status == WaitingTcp || status == UsingTcp) { + emit error(); + } else { + LOG(("Strange Tcp Error: status %1").arg(status)); + } +} + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_auto.h b/Telegram/SourceFiles/mtproto/connection_auto.h new file mode 100644 index 000000000..60a5b9b44 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_auto.h @@ -0,0 +1,94 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" +#include "mtproto/connection_tcp.h" + +namespace MTP { +namespace internal { + +class AutoConnection : public AbstractTCPConnection { + Q_OBJECT + +public: + + AutoConnection(QThread *thread); + + void sendData(mtpBuffer &buffer) override; + void disconnectFromServer() override; + void connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override; + void connectHttp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override; + bool isConnected() const override; + bool usingHttpWait() override; + bool needHttpWait() override; + + int32 debugState() const override; + + QString transport() const override; + +public slots: + + void socketError(QAbstractSocket::SocketError e); + void requestFinished(QNetworkReply *reply); + + void onSocketConnected(); + void onSocketDisconnected(); + void onHttpStart(); + + void onTcpTimeoutTimer(); + +protected: + + void socketPacket(const char *packet, uint32 length) override; + +private: + + void httpSend(mtpBuffer &buffer); + enum Status { + WaitingBoth = 0, + WaitingHttp, + WaitingTcp, + HttpReady, + UsingHttp, + UsingTcp, + FinishedWork + }; + Status status; + MTPint128 tcpNonce, httpNonce; + QTimer httpStartTimer; + + QNetworkAccessManager manager; + QUrl address; + + typedef QSet Requests; + Requests requests; + + QString _addrTcp, _addrHttp; + int32 _portTcp, _portHttp; + MTPDdcOption::Flags _flagsTcp, _flagsHttp; + int32 _tcpTimeout; + QTimer tcpTimeoutTimer; + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_http.cpp b/Telegram/SourceFiles/mtproto/connection_http.cpp new file mode 100644 index 000000000..39f26e131 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_http.cpp @@ -0,0 +1,218 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/connection_http.h" + +namespace MTP { +namespace internal { + +mtpBuffer HTTPConnection::handleResponse(QNetworkReply *reply) { + QByteArray response = reply->readAll(); + TCP_LOG(("HTTP Info: read %1 bytes").arg(response.size())); + + if (response.isEmpty()) return mtpBuffer(); + + if (response.size() & 0x03 || response.size() < 8) { + LOG(("HTTP Error: bad response size %1").arg(response.size())); + return mtpBuffer(1, -500); + } + + mtpBuffer data(response.size() >> 2); + memcpy(data.data(), response.constData(), response.size()); + + return data; +} + +bool HTTPConnection::handleError(QNetworkReply *reply) { // returnes "maybe bad key" + bool mayBeBadKey = false; + + QVariant statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); + if (statusCode.isValid()) { + int status = statusCode.toInt(); + mayBeBadKey = (status == 410); + if (status == 429) { + LOG(("Protocol Error: 429 flood code returned!")); + } + } + + switch (reply->error()) { + case QNetworkReply::ConnectionRefusedError: LOG(("HTTP Error: connection refused - %1").arg(reply->errorString())); break; + case QNetworkReply::RemoteHostClosedError: LOG(("HTTP Error: remote host closed - %1").arg(reply->errorString())); break; + case QNetworkReply::HostNotFoundError: LOG(("HTTP Error: host not found - %2").arg(reply->error()).arg(reply->errorString())); break; + case QNetworkReply::TimeoutError: LOG(("HTTP Error: timeout - %2").arg(reply->error()).arg(reply->errorString())); break; + case QNetworkReply::OperationCanceledError: LOG(("HTTP Error: cancelled - %2").arg(reply->error()).arg(reply->errorString())); break; + case QNetworkReply::SslHandshakeFailedError: + case QNetworkReply::TemporaryNetworkFailureError: + case QNetworkReply::NetworkSessionFailedError: + case QNetworkReply::BackgroundRequestNotAllowedError: + case QNetworkReply::UnknownNetworkError: LOG(("HTTP Error: network error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; + + // proxy errors (101-199): + case QNetworkReply::ProxyConnectionRefusedError: + case QNetworkReply::ProxyConnectionClosedError: + case QNetworkReply::ProxyNotFoundError: + case QNetworkReply::ProxyTimeoutError: + case QNetworkReply::ProxyAuthenticationRequiredError: + case QNetworkReply::UnknownProxyError:LOG(("HTTP Error: proxy error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; + + // content errors (201-299): + case QNetworkReply::ContentAccessDenied: + case QNetworkReply::ContentOperationNotPermittedError: + case QNetworkReply::ContentNotFoundError: + case QNetworkReply::AuthenticationRequiredError: + case QNetworkReply::ContentReSendError: + case QNetworkReply::UnknownContentError: LOG(("HTTP Error: content error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; + + // protocol errors + case QNetworkReply::ProtocolUnknownError: + case QNetworkReply::ProtocolInvalidOperationError: + case QNetworkReply::ProtocolFailure: LOG(("HTTP Error: protocol error %1 - %2").arg(reply->error()).arg(reply->errorString())); break; + }; + TCP_LOG(("HTTP Error %1, restarting! - %2").arg(reply->error()).arg(reply->errorString())); + + return mayBeBadKey; +} + +HTTPConnection::HTTPConnection(QThread *thread) : AbstractConnection(thread) +, status(WaitingHttp) +, httpNonce(rand_value()) +, _flags(0) { + manager.moveToThread(thread); + App::setProxySettings(manager); +} + +void HTTPConnection::sendData(mtpBuffer &buffer) { + if (status == FinishedWork) return; + + if (buffer.size() < 3) { + LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); + TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); + emit error(); + return; + } + + int32 requestSize = (buffer.size() - 3) * sizeof(mtpPrime); + + QNetworkRequest request(address); + request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant(requestSize)); + request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(qsl("application/x-www-form-urlencoded"))); + + TCP_LOG(("HTTP Info: sending %1 len request %2").arg(requestSize).arg(Logs::mb(&buffer[2], requestSize).str())); + requests.insert(manager.post(request, QByteArray((const char*)(&buffer[2]), requestSize))); +} + +void HTTPConnection::disconnectFromServer() { + if (status == FinishedWork) return; + status = FinishedWork; + + Requests copy = requests; + requests.clear(); + for (Requests::const_iterator i = copy.cbegin(), e = copy.cend(); i != e; ++i) { + (*i)->abort(); + (*i)->deleteLater(); + } + + disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); + + address = QUrl(); +} + +void HTTPConnection::connectHttp(const QString &addr, int32 p, MTPDdcOption::Flags flags) { + address = QUrl(((flags & MTPDdcOption::Flag::f_ipv6) ? qsl("http://[%1]:%2/api") : qsl("http://%1:%2/api")).arg(addr).arg(80));//not p - always 80 port for http transport + TCP_LOG(("HTTP Info: address is %1").arg(address.toDisplayString())); + connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestFinished(QNetworkReply*))); + + _flags = flags; + + mtpBuffer buffer(preparePQFake(httpNonce)); + + DEBUG_LOG(("Connection Info: sending fake req_pq through HTTP/%1 transport").arg((flags & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + + sendData(buffer); +} + +bool HTTPConnection::isConnected() const { + return (status == UsingHttp); +} + +void HTTPConnection::requestFinished(QNetworkReply *reply) { + if (status == FinishedWork) return; + + reply->deleteLater(); + if (reply->error() == QNetworkReply::NoError) { + requests.remove(reply); + + mtpBuffer data = handleResponse(reply); + if (data.size() == 1) { + emit error(); + } else if (!data.isEmpty()) { + if (status == UsingHttp) { + receivedQueue.push_back(data); + emit receivedData(); + } else { + try { + MTPResPQ res_pq = readPQFakeReply(data); + const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); + if (res_pq_data.vnonce == httpNonce) { + DEBUG_LOG(("Connection Info: HTTP/%1-transport connected by pq-response").arg((_flags & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingHttp; + emit connected(); + } + } catch (Exception &e) { + DEBUG_LOG(("Connection Error: exception in parsing HTTP fake pq-responce, %1").arg(e.what())); + emit error(); + } + } + } + } else { + if (!requests.remove(reply)) { + return; + } + + bool mayBeBadKey = handleError(reply) && _sentEncrypted; + + emit error(mayBeBadKey); + } +} + +bool HTTPConnection::usingHttpWait() { + return true; +} + +bool HTTPConnection::needHttpWait() { + return requests.isEmpty(); +} + +int32 HTTPConnection::debugState() const { + return -1; +} + +QString HTTPConnection::transport() const { + if (status == UsingHttp) { + return qsl("HTTP"); + } else { + return QString(); + } +} + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_http.h b/Telegram/SourceFiles/mtproto/connection_http.h new file mode 100644 index 000000000..54f3af11d --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_http.h @@ -0,0 +1,76 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" +#include "mtproto/connection_abstract.h" + +namespace MTP { +namespace internal { + +class HTTPConnection : public AbstractConnection { + Q_OBJECT + +public: + + HTTPConnection(QThread *thread); + + void sendData(mtpBuffer &buffer) override; + void disconnectFromServer() override; + void connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override { // not supported + } + void connectHttp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override; + bool isConnected() const override; + bool usingHttpWait() override; + bool needHttpWait() override; + + int32 debugState() const override; + + QString transport() const override; + + public slots: + + void requestFinished(QNetworkReply *reply); + + static mtpBuffer handleResponse(QNetworkReply *reply); + static bool handleError(QNetworkReply *reply); // returnes "maybe bad key" + +private: + + enum Status { + WaitingHttp = 0, + UsingHttp, + FinishedWork + }; + Status status; + MTPint128 httpNonce; + MTPDdcOption::Flags _flags; + + QNetworkAccessManager manager; + QUrl address; + + typedef QSet Requests; + Requests requests; + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_tcp.cpp b/Telegram/SourceFiles/mtproto/connection_tcp.cpp new file mode 100644 index 000000000..33f62df52 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_tcp.cpp @@ -0,0 +1,398 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/connection_tcp.h" + +#include + +namespace MTP { +namespace internal { + +namespace { + +uint32 tcpPacketSize(const char *packet) { // must have at least 4 bytes readable + uint32 result = (packet[0] > 0) ? packet[0] : 0; + if (result == 0x7f) { + const uchar *bytes = reinterpret_cast(packet); + result = (((uint32(bytes[3]) << 8) | uint32(bytes[2])) << 8) | uint32(bytes[1]); + return (result << 2) + 4; + } + return (result << 2) + 1; +} + +} // namespace + +AbstractTCPConnection::AbstractTCPConnection(QThread *thread) : AbstractConnection(thread) +, packetNum(0) +, packetRead(0) +, packetLeft(0) +, readingToShort(true) +, currentPos((char*)shortBuffer) { +} + +AbstractTCPConnection::~AbstractTCPConnection() { +} + +void AbstractTCPConnection::socketRead() { + if (sock.state() != QAbstractSocket::ConnectedState) { + LOG(("MTP error: socket not connected in socketRead(), state: %1").arg(sock.state())); + emit error(); + return; + } + + do { + uint32 toRead = packetLeft ? packetLeft : (readingToShort ? (MTPShortBufferSize * sizeof(mtpPrime) - packetRead) : 4); + if (readingToShort) { + if (currentPos + toRead > ((char*)shortBuffer) + MTPShortBufferSize * sizeof(mtpPrime)) { + longBuffer.resize(((packetRead + toRead) >> 2) + 1); + memcpy(&longBuffer[0], shortBuffer, packetRead); + currentPos = ((char*)&longBuffer[0]) + packetRead; + readingToShort = false; + } + } else { + if (longBuffer.size() * sizeof(mtpPrime) < packetRead + toRead) { + longBuffer.resize(((packetRead + toRead) >> 2) + 1); + currentPos = ((char*)&longBuffer[0]) + packetRead; + } + } + int32 bytes = (int32)sock.read(currentPos, toRead); + if (bytes > 0) { + aesCtrEncrypt(currentPos, bytes, _receiveKey, &_receiveState); + TCP_LOG(("TCP Info: read %1 bytes").arg(bytes)); + + packetRead += bytes; + currentPos += bytes; + if (packetLeft) { + packetLeft -= bytes; + if (!packetLeft) { + socketPacket(currentPos - packetRead, packetRead); + currentPos = (char*)shortBuffer; + packetRead = packetLeft = 0; + readingToShort = true; + longBuffer.clear(); + } else { + TCP_LOG(("TCP Info: not enough %1 for packet! read %2").arg(packetLeft).arg(packetRead)); + emit receivedSome(); + } + } else { + bool move = false; + while (packetRead >= 4) { + uint32 packetSize = tcpPacketSize(currentPos - packetRead); + if (packetSize < 5 || packetSize > MTPPacketSizeMax) { + LOG(("TCP Error: packet size = %1").arg(packetSize)); + emit error(); + return; + } + if (packetRead >= packetSize) { + socketPacket(currentPos - packetRead, packetSize); + packetRead -= packetSize; + packetLeft = 0; + move = true; + } else { + packetLeft = packetSize - packetRead; + TCP_LOG(("TCP Info: not enough %1 for packet! size %2 read %3").arg(packetLeft).arg(packetSize).arg(packetRead)); + emit receivedSome(); + break; + } + } + if (move) { + if (!packetRead) { + currentPos = (char*)shortBuffer; + readingToShort = true; + longBuffer.clear(); + } else if (!readingToShort && packetRead < MTPShortBufferSize * sizeof(mtpPrime)) { + memcpy(shortBuffer, currentPos - packetRead, packetRead); + currentPos = (char*)shortBuffer + packetRead; + readingToShort = true; + longBuffer.clear(); + } + } + } + } else if (bytes < 0) { + LOG(("TCP Error: socket read return -1")); + emit error(); + return; + } else { + TCP_LOG(("TCP Info: no bytes read, but bytes available was true...")); + break; + } + } while (sock.state() == QAbstractSocket::ConnectedState && sock.bytesAvailable()); +} + +mtpBuffer AbstractTCPConnection::handleResponse(const char *packet, uint32 length) { + if (length < 5 || length > MTPPacketSizeMax) { + LOG(("TCP Error: bad packet size %1").arg(length)); + return mtpBuffer(1, -500); + } + int32 size = packet[0], len = length - 1; + if (size == 0x7f) { + const uchar *bytes = reinterpret_cast(packet); + size = (((uint32(bytes[3]) << 8) | uint32(bytes[2])) << 8) | uint32(bytes[1]); + len -= 3; + } + if (size * int32(sizeof(mtpPrime)) != len) { + LOG(("TCP Error: bad packet header")); + TCP_LOG(("TCP Error: bad packet header, packet: %1").arg(Logs::mb(packet, length).str())); + return mtpBuffer(1, -500); + } + const mtpPrime *packetdata = reinterpret_cast(packet + (length - len)); + TCP_LOG(("TCP Info: packet received, size = %1").arg(size * sizeof(mtpPrime))); + if (size == 1) { + if (*packetdata == -429) { + LOG(("Protocol Error: -429 flood code returned!")); + } else { + LOG(("TCP Error: error packet received, code = %1").arg(*packetdata)); + } + return mtpBuffer(1, *packetdata); + } + + mtpBuffer data(size); + memcpy(data.data(), packetdata, size * sizeof(mtpPrime)); + + return data; +} + +void AbstractTCPConnection::handleError(QAbstractSocket::SocketError e, QTcpSocket &sock) { + switch (e) { + case QAbstractSocket::ConnectionRefusedError: + LOG(("TCP Error: socket connection refused - %1").arg(sock.errorString())); + break; + + case QAbstractSocket::RemoteHostClosedError: + TCP_LOG(("TCP Info: remote host closed socket connection - %1").arg(sock.errorString())); + break; + + case QAbstractSocket::HostNotFoundError: + LOG(("TCP Error: host not found - %1").arg(sock.errorString())); + break; + + case QAbstractSocket::SocketTimeoutError: + LOG(("TCP Error: socket timeout - %1").arg(sock.errorString())); + break; + + case QAbstractSocket::NetworkError: + LOG(("TCP Error: network - %1").arg(sock.errorString())); + break; + + case QAbstractSocket::ProxyAuthenticationRequiredError: + case QAbstractSocket::ProxyConnectionRefusedError: + case QAbstractSocket::ProxyConnectionClosedError: + case QAbstractSocket::ProxyConnectionTimeoutError: + case QAbstractSocket::ProxyNotFoundError: + case QAbstractSocket::ProxyProtocolError: + LOG(("TCP Error: proxy (%1) - %2").arg(e).arg(sock.errorString())); + break; + + default: + LOG(("TCP Error: other (%1) - %2").arg(e).arg(sock.errorString())); + break; + } + + TCP_LOG(("TCP Error %1, restarting! - %2").arg(e).arg(sock.errorString())); +} + +TCPConnection::TCPConnection(QThread *thread) : AbstractTCPConnection(thread) +, status(WaitingTcp) +, tcpNonce(rand_value()) +, _tcpTimeout(MTPMinReceiveDelay) +, _flags(0) { + tcpTimeoutTimer.moveToThread(thread); + tcpTimeoutTimer.setSingleShot(true); + connect(&tcpTimeoutTimer, SIGNAL(timeout()), this, SLOT(onTcpTimeoutTimer())); + + sock.moveToThread(thread); + App::setProxySettings(sock); + connect(&sock, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); + connect(&sock, SIGNAL(connected()), this, SLOT(onSocketConnected())); + connect(&sock, SIGNAL(disconnected()), this, SLOT(onSocketDisconnected())); +} + +void TCPConnection::onSocketConnected() { + if (status == WaitingTcp) { + mtpBuffer buffer(preparePQFake(tcpNonce)); + + DEBUG_LOG(("Connection Info: sending fake req_pq through TCP/%1 transport").arg((_flags & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + + if (_tcpTimeout < 0) _tcpTimeout = -_tcpTimeout; + tcpTimeoutTimer.start(_tcpTimeout); + + sendData(buffer); + } +} + +void TCPConnection::onTcpTimeoutTimer() { + if (status == WaitingTcp) { + if (_tcpTimeout < MTPMaxReceiveDelay) _tcpTimeout *= 2; + _tcpTimeout = -_tcpTimeout; + + QAbstractSocket::SocketState state = sock.state(); + if (state == QAbstractSocket::ConnectedState || state == QAbstractSocket::ConnectingState || state == QAbstractSocket::HostLookupState) { + sock.disconnectFromHost(); + } else if (state != QAbstractSocket::ClosingState) { + sock.connectToHost(QHostAddress(_addr), _port); + } + } +} + +void TCPConnection::onSocketDisconnected() { + if (_tcpTimeout < 0) { + _tcpTimeout = -_tcpTimeout; + if (status == WaitingTcp) { + sock.connectToHost(QHostAddress(_addr), _port); + return; + } + } + if (status == WaitingTcp || status == UsingTcp) { + emit disconnected(); + } +} + +void TCPConnection::sendData(mtpBuffer &buffer) { + if (status == FinishedWork) return; + + if (buffer.size() < 3) { + LOG(("TCP Error: writing bad packet, len = %1").arg(buffer.size() * sizeof(mtpPrime))); + TCP_LOG(("TCP Error: bad packet %1").arg(Logs::mb(&buffer[0], buffer.size() * sizeof(mtpPrime)).str())); + emit error(); + return; + } + + tcpSend(buffer); +} + +void AbstractTCPConnection::tcpSend(mtpBuffer &buffer) { + if (!packetNum) { + // prepare random part + char nonce[64]; + uint32 *first = reinterpret_cast(nonce), *second = first + 1; + uint32 first1 = 0x44414548U, first2 = 0x54534f50U, first3 = 0x20544547U, first4 = 0x20544547U, first5 = 0xeeeeeeeeU; + uint32 second1 = 0; + do { + memset_rand(nonce, sizeof(nonce)); + } while (*first == first1 || *first == first2 || *first == first3 || *first == first4 || *first == first5 || *second == second1 || *reinterpret_cast(nonce) == 0xef); + //sock.write(nonce, 64); + + // prepare encryption key/iv + memcpy(_sendKey, nonce + 8, CTRState::KeySize); + memcpy(_sendState.ivec, nonce + 8 + CTRState::KeySize, CTRState::IvecSize); + + // prepare decryption key/iv + char reversed[48]; + memcpy(reversed, nonce + 8, sizeof(reversed)); + std::reverse(reversed, reversed + arraysize(reversed)); + memcpy(_receiveKey, reversed, CTRState::KeySize); + memcpy(_receiveState.ivec, reversed + CTRState::KeySize, CTRState::IvecSize); + + // write protocol identifier + *reinterpret_cast(nonce + 56) = 0xefefefefU; + + sock.write(nonce, 56); + aesCtrEncrypt(nonce, 64, _sendKey, &_sendState); + sock.write(nonce + 56, 8); + } + ++packetNum; + + uint32 size = buffer.size() - 3, len = size * 4; + char *data = reinterpret_cast(&buffer[0]); + if (size < 0x7f) { + data[7] = char(size); + TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 1)); + + aesCtrEncrypt(data + 7, len + 1, _sendKey, &_sendState); + sock.write(data + 7, len + 1); + } else { + data[4] = 0x7f; + reinterpret_cast(data)[5] = uchar(size & 0xFF); + reinterpret_cast(data)[6] = uchar((size >> 8) & 0xFF); + reinterpret_cast(data)[7] = uchar((size >> 16) & 0xFF); + TCP_LOG(("TCP Info: write %1 packet %2").arg(packetNum).arg(len + 4)); + + aesCtrEncrypt(data + 4, len + 4, _sendKey, &_sendState); + sock.write(data + 4, len + 4); + } +} + +void TCPConnection::disconnectFromServer() { + if (status == FinishedWork) return; + status = FinishedWork; + + disconnect(&sock, SIGNAL(readyRead()), 0, 0); + sock.close(); +} + +void TCPConnection::connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) { + _addr = addr; + _port = port; + _flags = flags; + + connect(&sock, SIGNAL(readyRead()), this, SLOT(socketRead())); + sock.connectToHost(QHostAddress(_addr), _port); +} + +void TCPConnection::socketPacket(const char *packet, uint32 length) { + if (status == FinishedWork) return; + + mtpBuffer data = handleResponse(packet, length); + if (data.size() == 1) { + bool mayBeBadKey = (data[0] == -410) && _sentEncrypted; + emit error(mayBeBadKey); + } else if (status == UsingTcp) { + receivedQueue.push_back(data); + emit receivedData(); + } else if (status == WaitingTcp) { + tcpTimeoutTimer.stop(); + try { + MTPResPQ res_pq = readPQFakeReply(data); + const MTPDresPQ &res_pq_data(res_pq.c_resPQ()); + if (res_pq_data.vnonce == tcpNonce) { + DEBUG_LOG(("Connection Info: TCP/%1-transport chosen by pq-response").arg((_flags & MTPDdcOption::Flag::f_ipv6) ? "IPv6" : "IPv4")); + status = UsingTcp; + emit connected(); + } + } catch (Exception &e) { + DEBUG_LOG(("Connection Error: exception in parsing TCP fake pq-responce, %1").arg(e.what())); + emit error(); + } + } +} + +bool TCPConnection::isConnected() const { + return (status == UsingTcp); +} + +int32 TCPConnection::debugState() const { + return sock.state(); +} + +QString TCPConnection::transport() const { + return isConnected() ? qsl("TCP") : QString(); +} + +void TCPConnection::socketError(QAbstractSocket::SocketError e) { + if (status == FinishedWork) return; + + handleError(e, sock); + emit error(); +} + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/connection_tcp.h b/Telegram/SourceFiles/mtproto/connection_tcp.h new file mode 100644 index 000000000..d87d911ab --- /dev/null +++ b/Telegram/SourceFiles/mtproto/connection_tcp.h @@ -0,0 +1,118 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" +#include "mtproto/auth_key.h" +#include "mtproto/connection_abstract.h" + +namespace MTP { +namespace internal { + +class AbstractTCPConnection : public AbstractConnection { + Q_OBJECT + +public: + + AbstractTCPConnection(QThread *thread); + virtual ~AbstractTCPConnection() = 0; + +public slots: + + void socketRead(); + +protected: + + QTcpSocket sock; + uint32 packetNum; // sent packet number + + uint32 packetRead, packetLeft; // reading from socket + bool readingToShort; + char *currentPos; + mtpBuffer longBuffer; + mtpPrime shortBuffer[MTPShortBufferSize]; + virtual void socketPacket(const char *packet, uint32 length) = 0; + + static mtpBuffer handleResponse(const char *packet, uint32 length); + static void handleError(QAbstractSocket::SocketError e, QTcpSocket &sock); + static uint32 fourCharsToUInt(char ch1, char ch2, char ch3, char ch4) { + char ch[4] = { ch1, ch2, ch3, ch4 }; + return *reinterpret_cast(ch); + } + + void tcpSend(mtpBuffer &buffer); + uchar _sendKey[CTRState::KeySize]; + CTRState _sendState; + uchar _receiveKey[CTRState::KeySize]; + CTRState _receiveState; + +}; + +class TCPConnection : public AbstractTCPConnection { + Q_OBJECT + +public: + + TCPConnection(QThread *thread); + + void sendData(mtpBuffer &buffer) override; + void disconnectFromServer() override; + void connectTcp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override; + void connectHttp(const QString &addr, int32 port, MTPDdcOption::Flags flags) override { // not supported + } + bool isConnected() const override; + + int32 debugState() const override; + + QString transport() const override; + +public slots: + + void socketError(QAbstractSocket::SocketError e); + + void onSocketConnected(); + void onSocketDisconnected(); + + void onTcpTimeoutTimer(); + +protected: + + void socketPacket(const char *packet, uint32 length) override; + +private: + + enum Status { + WaitingTcp = 0, + UsingTcp, + FinishedWork + }; + Status status; + MTPint128 tcpNonce; + + QString _addr; + int32 _port, _tcpTimeout; + MTPDdcOption::Flags _flags; + QTimer tcpTimeoutTimer; + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp b/Telegram/SourceFiles/mtproto/core_types.cpp similarity index 92% rename from Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp rename to Telegram/SourceFiles/mtproto/core_types.cpp index 48bd7fd52..f438c4e6e 100644 --- a/Telegram/SourceFiles/mtproto/mtpCoreTypes.cpp +++ b/Telegram/SourceFiles/mtproto/core_types.cpp @@ -19,7 +19,10 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "mtpCoreTypes.h" + +#include "mtproto/core_types.h" + +#include "zlib.h" #include "lang.h" @@ -63,7 +66,7 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP } else if (strUtf8.size() < 64) { to.add(Logs::mb(strUtf8.constData(), strUtf8.size()).str()).add(" [").add(mtpWrapNumber(strUtf8.size())).add(" BYTES]"); } else { - to.add(Logs::mb(strUtf8.constData(), 16).str()).add(".. [").add(mtpWrapNumber(strUtf8.size())).add(" BYTES]"); + to.add(Logs::mb(strUtf8.constData(), 16).str()).add("... [").add(mtpWrapNumber(strUtf8.size())).add(" BYTES]"); } } break; @@ -149,13 +152,13 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP } } -const MTPReplyMarkup MTPnullMarkup = MTP_replyKeyboardMarkup(MTP_int(0), MTP_vector(0)); +const MTPReplyMarkup MTPnullMarkup = MTP_replyKeyboardMarkup(MTP_flags(MTPDreplyKeyboardMarkup::Flags(0)), MTP_vector(0)); const MTPVector MTPnullEntities = MTP_vector(0); -const MTPMessageFwdHeader MTPnullFwdHeader = MTP_messageFwdHeader(MTPint(), MTPint(), MTPint(), MTPint(), MTPint()); +const MTPMessageFwdHeader MTPnullFwdHeader = MTP_messageFwdHeader(MTP_flags(MTPDmessageFwdHeader::Flags(0)), MTPint(), MTPint(), MTPint(), MTPint()); QString stickerSetTitle(const MTPDstickerSet &s) { QString title = qs(s.vtitle); - if ((s.vflags.v & MTPDstickerSet::flag_official) && !title.compare(qstr("Great Minds"), Qt::CaseInsensitive)) { + if ((s.vflags.v & MTPDstickerSet::Flag::f_official) && !title.compare(qstr("Great Minds"), Qt::CaseInsensitive)) { return lang(lng_stickers_default_set); } return title; diff --git a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h b/Telegram/SourceFiles/mtproto/core_types.h similarity index 81% rename from Telegram/SourceFiles/mtproto/mtpCoreTypes.h rename to Telegram/SourceFiles/mtproto/core_types.h index 53965606c..136698bd8 100644 --- a/Telegram/SourceFiles/mtproto/mtpCoreTypes.h +++ b/Telegram/SourceFiles/mtproto/core_types.h @@ -21,37 +21,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #pragma once #include "types.h" -#include -#undef min -#undef max +namespace MTP { -//#define DEBUG_MTPPRIME +// type DcId represents actual data center id, while in most cases +// we use some shifted ids, like DcId() + X * DCShift +typedef int32 DcId; +typedef int32 ShiftedDcId; + +} -#ifdef DEBUG_MTPPRIME -class mtpPrime { // for debug visualization, not like int32 :( in default constructor -public: - explicit mtpPrime() : _v(0) { - } - mtpPrime(int32 v) : _v(v) { - } - mtpPrime &operator=(int32 v) { - _v = v; - return (*this); - } - operator int32&() { - return _v; - } - operator const int32 &() const { - return _v; - } -private: - int32 _v; -}; -#else typedef int32 mtpPrime; -#endif - typedef int32 mtpRequestId; typedef uint64 mtpMsgId; typedef uint64 mtpPingId; @@ -346,6 +326,7 @@ enum { mtpc_gzip_packed = 0x3072cfa1 }; static const mtpTypeId mtpc_bytes = mtpc_string; +static const mtpTypeId mtpc_flags = mtpc_int; static const mtpTypeId mtpc_core_message = -1; // undefined type, but is used static const mtpTypeId mtpLayers[] = { mtpTypeId(mtpc_invokeWithLayer1), @@ -368,7 +349,7 @@ static const mtpTypeId mtpLayers[] = { mtpTypeId(mtpc_invokeWithLayer18), }; static const uint32 mtpLayerMaxSingle = sizeof(mtpLayers) / sizeof(mtpLayers[0]); -static const mtpPrime mtpCurrentLayer = 49; +static const mtpPrime mtpCurrentLayer = 50; template class MTPBoxed : public bareT { @@ -446,6 +427,49 @@ inline MTPint MTP_int(int32 v) { } typedef MTPBoxed MTPInt; +template +class MTPflags { +public: + Flags v; + static_assert(sizeof(Flags) == sizeof(int32), "MTPflags are allowed only wrapping int32 flag types!"); + + MTPflags() { + } + MTPflags(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_flags) { + read(from, end, cons); + } + + uint32 innerLength() const { + return sizeof(Flags); + } + mtpTypeId type() const { + return mtpc_flags; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_flags) { + if (from + 1 > end) throw mtpErrorInsufficient(); + if (cons != mtpc_flags) throw mtpErrorUnexpected(cons, "MTPflags"); + v = static_cast(*(from++)); + } + void write(mtpBuffer &to) const { + to.push_back(static_cast(v)); + } + +private: + explicit MTPflags(Flags val) : v(val) { + } + + template + friend MTPflags MTP_flags(T v); +}; + +template +inline MTPflags MTP_flags(T v) { + return MTPflags(v); +} + +template +using MTPFlags = MTPBoxed>; + inline bool operator==(const MTPint &a, const MTPint &b) { return a.v == b.v; } @@ -787,19 +811,6 @@ public: VType v; }; - - -template -class MTPvector; -template -MTPvector MTP_vector(uint32 count); - -template -MTPvector MTP_vector(uint32 count, const T &value); - -template -MTPvector MTP_vector(const QVector &v); - template class MTPvector : private mtpDataOwner { public: @@ -853,9 +864,12 @@ private: explicit MTPvector(MTPDvector *_data) : mtpDataOwner(_data) { } - friend MTPvector MTP_vector(uint32 count); - friend MTPvector MTP_vector(uint32 count, const T &value); - friend MTPvector MTP_vector(const QVector &v); + template + friend MTPvector MTP_vector(uint32 count); + template + friend MTPvector MTP_vector(uint32 count, const U &value); + template + friend MTPvector MTP_vector(const QVector &v); typedef typename MTPDvector::VType VType; }; template @@ -871,19 +885,7 @@ inline MTPvector MTP_vector(const QVector &v) { return MTPvector(new MTPDvector(v)); } template -class MTPVector : public MTPBoxed > { -public: - MTPVector() { - } - MTPVector(uint32 count) : MTPBoxed >(MTP_vector(count)) { - } - MTPVector(uint32 count, const T &value) : MTPBoxed >(MTP_vector(count, value)) { - } - MTPVector(const MTPvector &v) : MTPBoxed >(v) { - } - MTPVector(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed >(from, end, cons) { - } -}; +using MTPVector = MTPBoxed>; template inline bool operator==(const MTPvector &a, const MTPvector &b) { @@ -943,7 +945,7 @@ struct MTPStringLogger { char *b = new char[newsize]; memcpy(b, p, size); alloced = newsize; - delete p; + delete[] p; p = b; } char *p; @@ -964,7 +966,7 @@ inline QString mtpTextSerialize(const mtpPrime *&from, const mtpPrime *end) { return QString::fromUtf8(to.p, to.size); } -#include "mtpScheme.h" +#include "mtproto/scheme_auto.h" inline MTPbool MTP_bool(bool v) { return v ? MTP_boolTrue() : MTP_boolFalse(); @@ -977,16 +979,104 @@ inline bool mtpIsFalse(const MTPBool &v) { return !mtpIsTrue(v); } -enum { // client side flags - MTPDmessage_flag_HAS_TEXT_LINKS = (1 << 31), // message has links for "shared links" indexing - MTPDmessage_flag_IS_GROUP_MIGRATE = (1 << 30), // message is a group migrate (group -> supergroup) service message - MTPDreplyKeyboardMarkup_flag_FORCE_REPLY = (1 << 30), // markup just wants a text reply - MTPDreplyKeyboardMarkup_flag_ZERO = (1 << 31), // none (zero) markup - MTPDstickerSet_flag_NOT_LOADED = (1 << 31), // sticker set is not yet loaded +#define CHECK_MTP_SCHEME_AND_CLIENT_FLAGS_CONFLICT(Type) \ + +// we must validate that MTProto scheme flags don't intersect with client side flags +// and define common bit operators which allow use Type_ClientFlag together with Type::Flag +#define DEFINE_MTP_CLIENT_FLAGS(Type) \ +static_assert(static_cast(Type::Flag::MAX_FIELD) < static_cast(Type##_ClientFlag::MIN_FIELD), \ + "MTProto flags conflict with client side flags!"); \ +inline Type::Flags qFlags(Type##_ClientFlag v) { return Type::Flags(static_cast(v)); } \ +inline Type::Flags operator&(Type::Flags i, Type##_ClientFlag v) { return i & qFlags(v); } \ +inline Type::Flags operator&(Type::Flag i, Type##_ClientFlag v) { return qFlags(i) & v; } \ +inline Type::Flags operator&(Type##_ClientFlag i, Type##_ClientFlag v) { return qFlags(i) & v; } \ +inline Type::Flags operator&(Type##_ClientFlag i, Type::Flag v) { return qFlags(i) & v; } \ +inline Type::Flags &operator&=(Type::Flags &i, Type##_ClientFlag v) { return i &= qFlags(v); } \ +inline Type::Flags operator|(Type::Flags i, Type##_ClientFlag v) { return i | qFlags(v); } \ +inline Type::Flags operator|(Type::Flag i, Type##_ClientFlag v) { return qFlags(i) | v; } \ +inline Type::Flags operator|(Type##_ClientFlag i, Type##_ClientFlag v) { return qFlags(i) | v; } \ +inline Type::Flags operator|(Type##_ClientFlag i, Type::Flag v) { return qFlags(i) | v; } \ +inline Type::Flags &operator|=(Type::Flags &i, Type##_ClientFlag v) { return i |= qFlags(v); } \ +inline Type::Flags operator~(Type##_ClientFlag v) { return ~qFlags(v); } + +// we use the same flags field for some additional client side flags +enum class MTPDmessage_ClientFlag : int32 { + // message has links for "shared links" indexing + f_has_text_links = (1 << 30), + + // message is a group migrate (group -> supergroup) service message + f_is_group_migrate = (1 << 29), + + // message needs initDimensions() + resize() + paint() + f_pending_init_dimensions = (1 << 28), + + // message needs resize() + paint() + f_pending_resize = (1 << 27), + + // message needs paint() + f_pending_paint = (1 << 26), + + // message is attached to previous one when displaying the history + f_attach_to_previous = (1 << 25), + + // update this when adding new client side flags + MIN_FIELD = (1 << 25), }; +DEFINE_MTP_CLIENT_FLAGS(MTPDmessage) + +enum class MTPDreplyKeyboardMarkup_ClientFlag : int32 { + // none (zero) markup + f_zero = (1 << 30), + + // markup just wants a text reply + f_force_reply = (1 << 29), + + // update this when adding new client side flags + MIN_FIELD = (1 << 29), +}; +DEFINE_MTP_CLIENT_FLAGS(MTPDreplyKeyboardMarkup) + +enum class MTPDstickerSet_ClientFlag : int32 { + // old value for sticker set is not yet loaded flag + f_not_loaded__old = (1 << 31), + + // sticker set is not yet loaded + f_not_loaded = (1 << 30), + + // update this when adding new client side flags + MIN_FIELD = (1 << 30), +}; +DEFINE_MTP_CLIENT_FLAGS(MTPDstickerSet) extern const MTPReplyMarkup MTPnullMarkup; extern const MTPVector MTPnullEntities; extern const MTPMessageFwdHeader MTPnullFwdHeader; QString stickerSetTitle(const MTPDstickerSet &s); + +inline bool mtpRequestData::isSentContainer(const mtpRequest &request) { // "request-like" wrap for msgIds vector + if (request->size() < 9) return false; + return (!request->msDate && !(*request)[6]); // msDate = 0, seqNo = 0 +} +inline bool mtpRequestData::isStateRequest(const mtpRequest &request) { + if (request->size() < 9) return false; + return (mtpTypeId((*request)[8]) == mtpc_msgs_state_req); +} +inline bool mtpRequestData::needAck(const mtpRequest &request) { + if (request->size() < 9) return false; + return mtpRequestData::needAckByType((*request)[8]); +} +inline bool mtpRequestData::needAckByType(mtpTypeId type) { + switch (type) { + case mtpc_msg_container: + case mtpc_msgs_ack: + case mtpc_http_wait: + case mtpc_bad_msg_notification: + case mtpc_msgs_all_info: + case mtpc_msgs_state_info: + case mtpc_msg_detailed_info: + case mtpc_msg_new_detailed_info: + return false; + } + return true; +} diff --git a/Telegram/SourceFiles/mtproto/mtpDC.cpp b/Telegram/SourceFiles/mtproto/dcenter.cpp similarity index 67% rename from Telegram/SourceFiles/mtproto/mtpDC.cpp rename to Telegram/SourceFiles/mtproto/dcenter.cpp index 0cb0c3bff..6fbdeac24 100644 --- a/Telegram/SourceFiles/mtproto/mtpDC.cpp +++ b/Telegram/SourceFiles/mtproto/dcenter.cpp @@ -19,44 +19,47 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "mtpDC.h" -#include "mtp.h" +#include "mtproto/dcenter.h" + +#include "mtproto/facade.h" #include "localstorage.h" -namespace { +namespace MTP { +namespace internal { - MTProtoDCMap gDCs; +namespace { + DcenterMap gDCs; bool configLoadedOnce = false; bool mainDCChanged = false; - int32 mainDC = 2; + int32 _mainDC = 2; int32 userId = 0; - typedef QMap _KeysMapForWrite; + typedef QMap _KeysMapForWrite; _KeysMapForWrite _keysMapForWrite; QMutex _keysMapForWriteMutex; -} +} // namespace -int32 mtpAuthed() { +int32 authed() { return userId; } -void mtpAuthed(int32 uid) { +void authed(int32 uid) { if (userId != uid) { userId = uid; } } -MTProtoDCMap &mtpDCMap() { +DcenterMap &DCMap() { return gDCs; } -bool mtpNeedConfig() { +bool configNeeded() { return !configLoadedOnce; } -int32 mtpMainDC() { - return mainDC; +int32 mainDC() { + return _mainDC; } namespace { @@ -73,7 +76,7 @@ namespace { } } -void mtpLogoutOtherDCs() { +void logoutOtherDCs() { QList dcs; { QMutexLocker lock(&_keysMapForWriteMutex); @@ -81,20 +84,20 @@ void mtpLogoutOtherDCs() { } for (int32 i = 0, cnt = dcs.size(); i != cnt; ++i) { if (dcs[i] != MTP::maindc()) { - logoutGuestMap.insert(MTP::lgt + dcs[i], MTP::send(MTPauth_LogOut(), rpcDone(&logoutDone), rpcFail(&logoutDone), MTP::lgt + dcs[i])); + logoutGuestMap.insert(MTP::lgtDcId(dcs[i]), MTP::send(MTPauth_LogOut(), rpcDone(&logoutDone), rpcFail(&logoutDone), MTP::lgtDcId(dcs[i]))); } } } -void mtpSetDC(int32 dc, bool firstOnly) { +void setDC(int32 dc, bool firstOnly) { if (!dc || (firstOnly && mainDCChanged)) return; mainDCChanged = true; - if (dc != mainDC) { - mainDC = dc; + if (dc != _mainDC) { + _mainDC = dc; } } -MTProtoDC::MTProtoDC(int32 id, const mtpAuthKeyPtr &key) : _id(id), _key(key), _connectionInited(false) { +Dcenter::Dcenter(int32 id, const AuthKeyPtr &key) : _id(id), _key(key), _connectionInited(false) { connect(this, SIGNAL(authKeyCreated()), this, SLOT(authKeyWrite()), Qt::QueuedConnection); QMutexLocker lock(&_keysMapForWriteMutex); @@ -105,14 +108,14 @@ MTProtoDC::MTProtoDC(int32 id, const mtpAuthKeyPtr &key) : _id(id), _key(key), _ } } -void MTProtoDC::authKeyWrite() { +void Dcenter::authKeyWrite() { DEBUG_LOG(("AuthKey Info: MTProtoDC::authKeyWrite() slot, dc %1").arg(_id)); if (_key) { Local::writeMtpData(); } } -void MTProtoDC::setKey(const mtpAuthKeyPtr &key) { +void Dcenter::setKey(const AuthKeyPtr &key) { DEBUG_LOG(("AuthKey Info: MTProtoDC::setKey(%1), emitting authKeyCreated, dc %2").arg(key ? key->keyId() : 0).arg(_id)); _key = key; _connectionInited = false; @@ -126,23 +129,23 @@ void MTProtoDC::setKey(const mtpAuthKeyPtr &key) { } } -QReadWriteLock *MTProtoDC::keyMutex() const { +QReadWriteLock *Dcenter::keyMutex() const { return &keyLock; } -const mtpAuthKeyPtr &MTProtoDC::getKey() const { +const AuthKeyPtr &Dcenter::getKey() const { return _key; } -void MTProtoDC::destroyKey() { - setKey(mtpAuthKeyPtr()); +void Dcenter::destroyKey() { + setKey(AuthKeyPtr()); QMutexLocker lock(&_keysMapForWriteMutex); _keysMapForWrite.remove(_id); } namespace { - MTProtoConfigLoader *configLoader = 0; + ConfigLoader *_configLoader = nullptr; bool loadingConfig = false; void configLoaded(const MTPConfig &result) { loadingConfig = false; @@ -151,7 +154,7 @@ namespace { DEBUG_LOG(("MTP Info: got config, chat_size_max: %1, date: %2, test_mode: %3, this_dc: %4, dc_options.length: %5").arg(data.vchat_size_max.v).arg(data.vdate.v).arg(mtpIsTrue(data.vtest_mode)).arg(data.vthis_dc.v).arg(data.vdc_options.c_vector().v.size())); - mtpUpdateDcOptions(data.vdc_options.c_vector().v); + updateDcOptions(data.vdc_options.c_vector().v); Global::SetChatSizeMax(data.vchat_size_max.v); Global::SetMegagroupSizeMax(data.vmegagroup_size_max.v); @@ -171,7 +174,7 @@ namespace { configLoadedOnce = true; Local::writeSettings(); - mtpConfigLoader()->done(); + configLoader()->done(); } bool configFailed(const RPCError &error) { if (mtpIsFlood(error)) return false; @@ -182,31 +185,31 @@ namespace { } }; -void mtpUpdateDcOptions(const QVector &options) { +void updateDcOptions(const QVector &options) { QSet already, restart; { - mtpDcOptions opts; + MTP::DcOptions opts; { - QReadLocker lock(mtpDcOptionsMutex()); - opts = cDcOptions(); + QReadLocker lock(dcOptionsMutex()); + opts = Global::DcOptions(); } for (QVector::const_iterator i = options.cbegin(), e = options.cend(); i != e; ++i) { const MTPDdcOption &optData(i->c_dcOption()); - int32 id = optData.vid.v, idWithShift = id + (optData.vflags.v * _mtp_internal::dcShift); + int32 id = optData.vid.v, idWithShift = MTP::shiftDcId(id, optData.vflags.v); if (already.constFind(idWithShift) == already.cend()) { already.insert(idWithShift); - mtpDcOptions::const_iterator a = opts.constFind(idWithShift); + auto a = opts.constFind(idWithShift); if (a != opts.cend()) { if (a.value().ip != optData.vip_address.c_string().v || a.value().port != optData.vport.v) { restart.insert(id); } } - opts.insert(idWithShift, mtpDcOption(id, optData.vflags.v, optData.vip_address.c_string().v, optData.vport.v)); + opts.insert(idWithShift, MTP::DcOption(id, optData.vflags.v, optData.vip_address.c_string().v, optData.vport.v)); } } { - QWriteLocker lock(mtpDcOptionsMutex()); - cSetDcOptions(opts); + QWriteLocker lock(dcOptionsMutex()); + Global::SetDcOptions(opts); } } for (QSet::const_iterator i = restart.cbegin(), e = restart.cend(); i != e; ++i) { @@ -218,15 +221,15 @@ namespace { QReadWriteLock _dcOptionsMutex; } -QReadWriteLock *mtpDcOptionsMutex() { +QReadWriteLock *dcOptionsMutex() { return &_dcOptionsMutex; } -MTProtoConfigLoader::MTProtoConfigLoader() : _enumCurrent(0), _enumRequest(0) { +ConfigLoader::ConfigLoader() : _enumCurrent(0), _enumRequest(0) { connect(&_enumDCTimer, SIGNAL(timeout()), this, SLOT(enumDC())); } -void MTProtoConfigLoader::load() { +void ConfigLoader::load() { if (loadingConfig) return; loadingConfig = true; @@ -235,68 +238,71 @@ void MTProtoConfigLoader::load() { _enumDCTimer.start(MTPEnumDCTimeout); } -void MTProtoConfigLoader::done() { +void ConfigLoader::done() { _enumDCTimer.stop(); if (_enumRequest) { MTP::cancel(_enumRequest); _enumRequest = 0; } if (_enumCurrent) { - MTP::killSession(MTP::cfg + _enumCurrent); + MTP::killSession(MTP::cfgDcId(_enumCurrent)); _enumCurrent = 0; } emit loaded(); } -void MTProtoConfigLoader::enumDC() { +void ConfigLoader::enumDC() { if (!loadingConfig) return; if (_enumRequest) MTP::cancel(_enumRequest); if (!_enumCurrent) { - _enumCurrent = mainDC; + _enumCurrent = _mainDC; } else { - MTP::killSession(MTP::cfg + _enumCurrent); + MTP::killSession(MTP::cfgDcId(_enumCurrent)); } OrderedSet dcs; { - QReadLocker lock(mtpDcOptionsMutex()); - const mtpDcOptions &options(cDcOptions()); - for (mtpDcOptions::const_iterator i = options.cbegin(), e = options.cend(); i != e; ++i) { - dcs.insert(i.key() % _mtp_internal::dcShift); + QReadLocker lock(dcOptionsMutex()); + const MTP::DcOptions &options(Global::DcOptions()); + for (auto i = options.cbegin(), e = options.cend(); i != e; ++i) { + dcs.insert(MTP::bareDcId(i.key())); } } - OrderedSet::const_iterator i = dcs.constFind(_enumCurrent); + auto i = dcs.constFind(_enumCurrent); if (i == dcs.cend() || (++i) == dcs.cend()) { - _enumCurrent = dcs.cbegin().key(); + _enumCurrent = *dcs.cbegin(); } else { - _enumCurrent = i.key(); + _enumCurrent = *i; } - _enumRequest = MTP::send(MTPhelp_GetConfig(), rpcDone(configLoaded), rpcFail(configFailed), MTP::cfg + _enumCurrent); + _enumRequest = MTP::send(MTPhelp_GetConfig(), rpcDone(configLoaded), rpcFail(configFailed), MTP::cfgDcId(_enumCurrent)); _enumDCTimer.start(MTPEnumDCTimeout); } -MTProtoConfigLoader *mtpConfigLoader() { - if (!configLoader) configLoader = new MTProtoConfigLoader(); - return configLoader; +ConfigLoader *configLoader() { + if (!_configLoader) _configLoader = new ConfigLoader(); + return _configLoader; } -void mtpDestroyConfigLoader() { - delete configLoader; - configLoader = 0; +void destroyConfigLoader() { + delete _configLoader; + _configLoader = nullptr; } -mtpKeysMap mtpGetKeys() { - mtpKeysMap result; +AuthKeysMap getAuthKeys() { + AuthKeysMap result; QMutexLocker lock(&_keysMapForWriteMutex); - for (_KeysMapForWrite::const_iterator i = _keysMapForWrite.cbegin(), e = _keysMapForWrite.cend(); i != e; ++i) { - result.push_back(i.value()); + for_const (const AuthKeyPtr &key, _keysMapForWrite) { + result.push_back(key); } return result; } -void mtpSetKey(int32 dcId, mtpAuthKeyPtr key) { - MTProtoDCPtr dc(new MTProtoDC(dcId, key)); +void setAuthKey(int32 dcId, AuthKeyPtr key) { + DcenterPtr dc(new Dcenter(dcId, key)); gDCs.insert(dcId, dc); } + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpDC.h b/Telegram/SourceFiles/mtproto/dcenter.h similarity index 67% rename from Telegram/SourceFiles/mtproto/mtpDC.h rename to Telegram/SourceFiles/mtproto/dcenter.h index bc8a6e787..4f47c63d3 100644 --- a/Telegram/SourceFiles/mtproto/mtpDC.h +++ b/Telegram/SourceFiles/mtproto/dcenter.h @@ -20,16 +20,19 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -class MTProtoDC : public QObject { +namespace MTP { +namespace internal { + +class Dcenter : public QObject { Q_OBJECT public: - MTProtoDC(int32 id, const mtpAuthKeyPtr &key); + Dcenter(int32 id, const AuthKeyPtr &key); QReadWriteLock *keyMutex() const; - const mtpAuthKeyPtr &getKey() const; - void setKey(const mtpAuthKeyPtr &key); + const AuthKeyPtr &getKey() const; + void setKey(const AuthKeyPtr &key); void destroyKey(); bool connectionInited() const { @@ -56,19 +59,19 @@ private: mutable QReadWriteLock keyLock; mutable QMutex initLock; int32 _id; - mtpAuthKeyPtr _key; + AuthKeyPtr _key; bool _connectionInited; }; -typedef QSharedPointer MTProtoDCPtr; -typedef QMap MTProtoDCMap; +typedef QSharedPointer DcenterPtr; +typedef QMap DcenterMap; -class MTProtoConfigLoader : public QObject { +class ConfigLoader : public QObject { Q_OBJECT public: - MTProtoConfigLoader(); + ConfigLoader(); void load(); void done(); @@ -88,21 +91,23 @@ private: }; -MTProtoConfigLoader *mtpConfigLoader(); -void mtpDestroyConfigLoader(); +ConfigLoader *configLoader(); +void destroyConfigLoader(); -MTProtoDCMap &mtpDCMap(); -bool mtpNeedConfig(); -int32 mtpMainDC(); -void mtpLogoutOtherDCs(); -void mtpSetDC(int32 dc, bool firstOnly = false); -uint32 mtpMaxChatSize(); +DcenterMap &DCMap(); +bool configNeeded(); +int32 mainDC(); +void logoutOtherDCs(); +void setDC(int32 dc, bool firstOnly = false); -int32 mtpAuthed(); -void mtpAuthed(int32 uid); +int32 authed(); +void authed(int32 uid); -mtpKeysMap mtpGetKeys(); -void mtpSetKey(int32 dc, mtpAuthKeyPtr key); +AuthKeysMap getAuthKeys(); +void setAuthKey(int32 dc, AuthKeyPtr key); -void mtpUpdateDcOptions(const QVector &options); -QReadWriteLock *mtpDcOptionsMutex(); +void updateDcOptions(const QVector &options); +QReadWriteLock *dcOptionsMutex(); + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/facade.cpp b/Telegram/SourceFiles/mtproto/facade.cpp new file mode 100644 index 000000000..ecda88d17 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/facade.cpp @@ -0,0 +1,907 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/facade.h" + +#include "localstorage.h" + +namespace MTP { + +namespace { + + typedef QMap Sessions; + Sessions sessions; + internal::Session *mainSession; + + typedef QMap RequestsByDC; // holds dcWithShift for request to this dc or -dc for request to main dc + RequestsByDC requestsByDC; + QMutex requestByDCLock; + + typedef QMap AuthExportRequests; // holds target dcWithShift for auth export request + AuthExportRequests authExportRequests; + + bool _started = false; + + uint32 layer; + + typedef QMap ParserMap; + ParserMap parserMap; + QMutex parserMapLock; + + typedef QMap RequestMap; + RequestMap requestMap; + QReadWriteLock requestMapLock; + + typedef QPair DelayedRequest; + typedef QList DelayedRequestsList; + DelayedRequestsList delayedRequests; + + typedef QMap RequestsDelays; + RequestsDelays requestsDelays; + + typedef QSet BadGuestDCRequests; + BadGuestDCRequests badGuestDCRequests; + + typedef QVector DCAuthWaiters; + typedef QMap AuthWaiters; // holds request ids waiting for auth import to specific dc + AuthWaiters authWaiters; + + typedef OrderedSet MTPQuittingConnections; + MTPQuittingConnections quittingConnections; + + QMutex toClearLock; + RPCCallbackClears toClear; + + RPCResponseHandler globalHandler; + MTPStateChangedHandler stateChangedHandler = 0; + MTPSessionResetHandler sessionResetHandler = 0; + internal::GlobalSlotCarrier *_globalSlotCarrier = 0; + + void importDone(const MTPauth_Authorization &result, mtpRequestId req) { + QMutexLocker locker1(&requestByDCLock); + + RequestsByDC::iterator i = requestsByDC.find(req); + if (i == requestsByDC.end()) { + LOG(("MTP Error: auth import request not found in requestsByDC, requestId: %1").arg(req)); + RPCError error(internal::rpcClientError("AUTH_IMPORT_FAIL", QString("did not find import request in requestsByDC, request %1").arg(req))); + if (globalHandler.onFail && authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc + return; + } + DcId newdc = bareDcId(i.value()); + + DEBUG_LOG(("MTP Info: auth import to dc %1 succeeded").arg(newdc)); + + DCAuthWaiters &waiters(authWaiters[newdc]); + if (waiters.size()) { + QReadLocker locker(&requestMapLock); + for (DCAuthWaiters::iterator i = waiters.begin(), e = waiters.end(); i != e; ++i) { + mtpRequestId requestId = *i; + RequestMap::const_iterator j = requestMap.constFind(requestId); + if (j == requestMap.cend()) { + LOG(("MTP Error: could not find request %1 for resending").arg(requestId)); + continue; + } + ShiftedDcId dcWithShift = newdc; + { + RequestsByDC::iterator k = requestsByDC.find(requestId); + if (k == requestsByDC.cend()) { + LOG(("MTP Error: could not find request %1 by dc for resending").arg(requestId)); + continue; + } + if (k.value() < 0) { + setdc(newdc); + k.value() = -newdc; + } else { + dcWithShift = shiftDcId(newdc, getDcIdShift(k.value())); + k.value() = dcWithShift; + } + DEBUG_LOG(("MTP Info: resending request %1 to dc %2 after import auth").arg(requestId).arg(k.value())); + } + if (internal::Session *session = internal::getSession(dcWithShift)) { + session->sendPrepared(j.value()); + } + } + waiters.clear(); + } + } + + bool importFail(const RPCError &error, mtpRequestId req) { + if (mtpIsFlood(error)) return false; + + if (globalHandler.onFail && authedId()) (*globalHandler.onFail)(req, error); // auth import failed + return true; + } + + void exportDone(const MTPauth_ExportedAuthorization &result, mtpRequestId req) { + AuthExportRequests::const_iterator i = authExportRequests.constFind(req); + if (i == authExportRequests.cend()) { + LOG(("MTP Error: auth export request target dcWithShift not found, requestId: %1").arg(req)); + RPCError error(internal::rpcClientError("AUTH_IMPORT_FAIL", QString("did not find target dcWithShift, request %1").arg(req))); + if (globalHandler.onFail && authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc + return; + } + + const MTPDauth_exportedAuthorization &data(result.c_auth_exportedAuthorization()); + send(MTPauth_ImportAuthorization(data.vid, data.vbytes), rpcDone(importDone), rpcFail(importFail), i.value()); + authExportRequests.remove(req); + } + + bool exportFail(const RPCError &error, mtpRequestId req) { + if (mtpIsFlood(error)) return false; + + AuthExportRequests::const_iterator i = authExportRequests.constFind(req); + if (i != authExportRequests.cend()) { + authWaiters[bareDcId(i.value())].clear(); + } + if (globalHandler.onFail && authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc + return true; + } + + bool onErrorDefault(mtpRequestId requestId, const RPCError &error) { + const QString &err(error.type()); + int32 code = error.code(); + if (!mtpIsFlood(error) && err != qsl("AUTH_KEY_UNREGISTERED")) { + int breakpoint = 0; + } + bool badGuestDC = (code == 400) && (err == qsl("FILE_ID_INVALID")); + QRegularExpressionMatch m; + if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(err)).hasMatch()) { + if (!requestId) return false; + + ShiftedDcId dcWithShift = 0, newdcWithShift = m.captured(2).toInt(); + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId); + if (i == requestsByDC.end()) { + LOG(("MTP Error: could not find request %1 for migrating to %2").arg(requestId).arg(newdcWithShift)); + } else { + dcWithShift = i.value(); + } + } + if (!dcWithShift || !newdcWithShift) return false; + + DEBUG_LOG(("MTP Info: changing request %1 from dcWithShift%2 to dc%3").arg(requestId).arg(dcWithShift).arg(newdcWithShift)); + if (dcWithShift < 0) { // newdc shift = 0 + if (false && authedId() && !authExportRequests.contains(requestId)) { // migrate not supported at this moment + DEBUG_LOG(("MTP Info: importing auth to dc %1").arg(newdcWithShift)); + DCAuthWaiters &waiters(authWaiters[newdcWithShift]); + if (!waiters.size()) { + authExportRequests.insert(send(MTPauth_ExportAuthorization(MTP_int(newdcWithShift)), rpcDone(exportDone), rpcFail(exportFail)), newdcWithShift); + } + waiters.push_back(requestId); + return true; + } else { + MTP::setdc(newdcWithShift); + } + } else { + newdcWithShift = shiftDcId(newdcWithShift, getDcIdShift(dcWithShift)); + } + + mtpRequest req; + { + QReadLocker locker(&requestMapLock); + RequestMap::const_iterator i = requestMap.constFind(requestId); + if (i == requestMap.cend()) { + LOG(("MTP Error: could not find request %1").arg(requestId)); + return false; + } + req = i.value(); + } + if (internal::Session *session = internal::getSession(newdcWithShift)) { + internal::registerRequest(requestId, (dcWithShift < 0) ? -newdcWithShift : newdcWithShift); + session->sendPrepared(req); + } + return true; + } else if (code < 0 || code >= 500 || (m = QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(err)).hasMatch()) { + if (!requestId) return false; + + int32 secs = 1; + if (code < 0 || code >= 500) { + RequestsDelays::iterator i = requestsDelays.find(requestId); + if (i != requestsDelays.cend()) { + secs = (i.value() > 60) ? i.value() : (i.value() *= 2); + } else { + requestsDelays.insert(requestId, secs); + } + } else { + secs = m.captured(1).toInt(); + if (secs >= 60) return false; + } + uint64 sendAt = getms(true) + secs * 1000 + 10; + DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end(); + for (; i != e; ++i) { + if (i->first == requestId) return true; + if (i->second > sendAt) break; + } + delayedRequests.insert(i, DelayedRequest(requestId, sendAt)); + + if (_globalSlotCarrier) _globalSlotCarrier->checkDelayed(); + + return true; + } else if (code == 401 || (badGuestDC && badGuestDCRequests.constFind(requestId) == badGuestDCRequests.cend())) { + int32 dcWithShift = 0; + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId); + if (i != requestsByDC.end()) { + dcWithShift = i.value(); + } else { + LOG(("MTP Error: unauthorized request without dc info, requestId %1").arg(requestId)); + } + } + int32 newdc = bareDcId(qAbs(dcWithShift)); + if (!newdc || newdc == internal::mainDC() || !authedId()) { + if (!badGuestDC && globalHandler.onFail) (*globalHandler.onFail)(requestId, error); // auth failed in main dc + return false; + } + + DEBUG_LOG(("MTP Info: importing auth to dcWithShift %1").arg(dcWithShift)); + DCAuthWaiters &waiters(authWaiters[newdc]); + if (!waiters.size()) { + authExportRequests.insert(send(MTPauth_ExportAuthorization(MTP_int(newdc)), rpcDone(exportDone), rpcFail(exportFail)), abs(dcWithShift)); + } + waiters.push_back(requestId); + if (badGuestDC) badGuestDCRequests.insert(requestId); + return true; + } else if (err == qsl("CONNECTION_NOT_INITED") || err == qsl("CONNECTION_LAYER_INVALID")) { + mtpRequest req; + { + QReadLocker locker(&requestMapLock); + RequestMap::const_iterator i = requestMap.constFind(requestId); + if (i == requestMap.cend()) { + LOG(("MTP Error: could not find request %1").arg(requestId)); + return false; + } + req = i.value(); + } + int32 dcWithShift = 0; + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId); + if (i == requestsByDC.end()) { + LOG(("MTP Error: could not find request %1 for resending with init connection").arg(requestId)); + } else { + dcWithShift = i.value(); + } + } + if (!dcWithShift) return false; + + if (internal::Session *session = internal::getSession(qAbs(dcWithShift))) { + req->needsLayer = true; + session->sendPrepared(req); + } + return true; + } else if (err == qsl("MSG_WAIT_FAILED")) { + mtpRequest req; + { + QReadLocker locker(&requestMapLock); + RequestMap::const_iterator i = requestMap.constFind(requestId); + if (i == requestMap.cend()) { + LOG(("MTP Error: could not find request %1").arg(requestId)); + return false; + } + req = i.value(); + } + if (!req->after) { + LOG(("MTP Error: wait failed for not dependent request %1").arg(requestId)); + return false; + } + int32 dcWithShift = 0; + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId), j = requestsByDC.find(req->after->requestId); + if (i == requestsByDC.end()) { + LOG(("MTP Error: could not find request %1 by dc").arg(requestId)); + } else if (j == requestsByDC.end()) { + LOG(("MTP Error: could not find dependent request %1 by dc").arg(req->after->requestId)); + } else { + dcWithShift = i.value(); + if (i.value() != j.value()) { + req->after = mtpRequest(); + } + } + } + if (!dcWithShift) return false; + + if (!req->after) { + if (internal::Session *session = internal::getSession(qAbs(dcWithShift))) { + req->needsLayer = true; + session->sendPrepared(req); + } + } else { + int32 newdc = bareDcId(qAbs(dcWithShift)); + DCAuthWaiters &waiters(authWaiters[newdc]); + if (waiters.indexOf(req->after->requestId) >= 0) { + if (waiters.indexOf(requestId) < 0) { + waiters.push_back(requestId); + } + if (badGuestDCRequests.constFind(req->after->requestId) != badGuestDCRequests.cend()) { + if (badGuestDCRequests.constFind(requestId) == badGuestDCRequests.cend()) { + badGuestDCRequests.insert(requestId); + } + } + } else { + uint64 at = 0; + DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end(); + for (; i != e; ++i) { + if (i->first == requestId) return true; + if (i->first == req->after->requestId) break; + } + if (i != e) { + delayedRequests.insert(i, DelayedRequest(requestId, i->second)); + } + + if (_globalSlotCarrier) _globalSlotCarrier->checkDelayed(); + } + } + return true; + } + if (badGuestDC) badGuestDCRequests.remove(requestId); + return false; + } + + bool _paused = false; + +} // namespace + +namespace internal { + +Session *getSession(ShiftedDcId shiftedDcId) { + if (!_started) return nullptr; + if (!shiftedDcId) return mainSession; + if (!bareDcId(shiftedDcId)) { + shiftedDcId += bareDcId(mainSession->getDcWithShift()); + } + + Sessions::const_iterator i = sessions.constFind(shiftedDcId); + if (i == sessions.cend()) { + i = sessions.insert(shiftedDcId, new Session(shiftedDcId)); + } + return i.value(); +} + +bool paused() { + return _paused; +} + +void registerRequest(mtpRequestId requestId, int32 dcWithShift) { + { + QMutexLocker locker(&requestByDCLock); + requestsByDC.insert(requestId, dcWithShift); + } + internal::performDelayedClear(); // need to do it somewhere... +} + +void unregisterRequest(mtpRequestId requestId) { + requestsDelays.remove(requestId); + + { + QWriteLocker locker(&requestMapLock); + requestMap.remove(requestId); + } + + QMutexLocker locker(&requestByDCLock); + requestsByDC.remove(requestId); +} + +mtpRequestId storeRequest(mtpRequest &request, const RPCResponseHandler &parser) { + mtpRequestId res = reqid(); + request->requestId = res; + if (parser.onDone || parser.onFail) { + QMutexLocker locker(&parserMapLock); + parserMap.insert(res, parser); + } + { + QWriteLocker locker(&requestMapLock); + requestMap.insert(res, request); + } + return res; +} + +mtpRequest getRequest(mtpRequestId reqId) { + static mtpRequest zero; + mtpRequest req; + { + QReadLocker locker(&requestMapLock); + RequestMap::const_iterator i = requestMap.constFind(reqId); + req = (i == requestMap.cend()) ? zero : i.value(); + } + return req; +} + +void wrapInvokeAfter(mtpRequest &to, const mtpRequest &from, const mtpRequestMap &haveSent, int32 skipBeforeRequest) { + mtpMsgId afterId(*(mtpMsgId*)(from->after->data() + 4)); + mtpRequestMap::const_iterator i = afterId ? haveSent.constFind(afterId) : haveSent.cend(); + int32 size = to->size(), lenInInts = (from.innerLength() >> 2), headlen = 4, fulllen = headlen + lenInInts; + if (i == haveSent.constEnd()) { // no invoke after or such msg was not sent or was completed recently + to->resize(size + fulllen + skipBeforeRequest); + if (skipBeforeRequest) { + memcpy(to->data() + size, from->constData() + 4, headlen * sizeof(mtpPrime)); + memcpy(to->data() + size + headlen + skipBeforeRequest, from->constData() + 4 + headlen, lenInInts * sizeof(mtpPrime)); + } else { + memcpy(to->data() + size, from->constData() + 4, fulllen * sizeof(mtpPrime)); + } + } else { + to->resize(size + fulllen + skipBeforeRequest + 3); + memcpy(to->data() + size, from->constData() + 4, headlen * sizeof(mtpPrime)); + (*to)[size + 3] += 3 * sizeof(mtpPrime); + *((mtpTypeId*)&((*to)[size + headlen + skipBeforeRequest])) = mtpc_invokeAfterMsg; + memcpy(to->data() + size + headlen + skipBeforeRequest + 1, &afterId, 2 * sizeof(mtpPrime)); + memcpy(to->data() + size + headlen + skipBeforeRequest + 3, from->constData() + 4 + headlen, lenInInts * sizeof(mtpPrime)); + if (size + 3 != 7) (*to)[7] += 3 * sizeof(mtpPrime); + } +} + +void clearCallbacks(mtpRequestId requestId, int32 errorCode) { + RPCResponseHandler h; + bool found = false; + { + QMutexLocker locker(&parserMapLock); + ParserMap::iterator i = parserMap.find(requestId); + if (i != parserMap.end()) { + h = i.value(); + found = true; + + parserMap.erase(i); + } + } + if (errorCode && found) { + rpcErrorOccured(requestId, h, rpcClientError("CLEAR_CALLBACK", QString("did not handle request %1, error code %2").arg(requestId).arg(errorCode))); + } +} + +void clearCallbacksDelayed(const RPCCallbackClears &requestIds) { + uint32 idsCount = requestIds.size(); + if (!idsCount) return; + + if (cDebug()) { + QString idsStr = QString("%1").arg(requestIds[0].requestId); + for (uint32 i = 1; i < idsCount; ++i) { + idsStr += QString(", %1").arg(requestIds[i].requestId); + } + DEBUG_LOG(("RPC Info: clear callbacks delayed, msgIds: %1").arg(idsStr)); + } + + QMutexLocker lock(&toClearLock); + uint32 toClearNow = toClear.size(); + if (toClearNow) { + toClear.resize(toClearNow + idsCount); + memcpy(toClear.data() + toClearNow, requestIds.constData(), idsCount * sizeof(RPCCallbackClear)); + } else { + toClear = requestIds; + } +} + +void performDelayedClear() { + QMutexLocker lock(&toClearLock); + if (!toClear.isEmpty()) { + for (RPCCallbackClears::iterator i = toClear.begin(), e = toClear.end(); i != e; ++i) { + if (cDebug()) { + QMutexLocker locker(&parserMapLock); + if (parserMap.find(i->requestId) != parserMap.end()) { + DEBUG_LOG(("RPC Info: clearing delayed callback %1, error code %2").arg(i->requestId).arg(i->errorCode)); + } + } + clearCallbacks(i->requestId, i->errorCode); + internal::unregisterRequest(i->requestId); + } + toClear.clear(); + } +} + +void execCallback(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) { + RPCResponseHandler h; + { + QMutexLocker locker(&parserMapLock); + ParserMap::iterator i = parserMap.find(requestId); + if (i != parserMap.cend()) { + h = i.value(); + parserMap.erase(i); + + DEBUG_LOG(("RPC Info: found parser for request %1, trying to parse response...").arg(requestId)); + } + } + if (h.onDone || h.onFail) { + try { + if (from >= end) throw mtpErrorInsufficient(); + + if (*from == mtpc_rpc_error) { + RPCError err(MTPRpcError(from, end)); + DEBUG_LOG(("RPC Info: error received, code %1, type %2, description: %3").arg(err.code()).arg(err.type()).arg(err.description())); + if (!rpcErrorOccured(requestId, h, err)) { + QMutexLocker locker(&parserMapLock); + parserMap.insert(requestId, h); + return; + } + } else { + if (h.onDone) { +// t_assert(App::app() != 0); + (*h.onDone)(requestId, from, end); + } + } + } catch (Exception &e) { + if (!rpcErrorOccured(requestId, h, rpcClientError("RESPONSE_PARSE_FAILED", QString("exception text: ") + e.what()))) { + QMutexLocker locker(&parserMapLock); + parserMap.insert(requestId, h); + return; + } + } + } else { + DEBUG_LOG(("RPC Info: parser not found for %1").arg(requestId)); + } + unregisterRequest(requestId); +} + +bool hasCallbacks(mtpRequestId requestId) { + QMutexLocker locker(&parserMapLock); + ParserMap::iterator i = parserMap.find(requestId); + return (i != parserMap.cend()); +} + +void globalCallback(const mtpPrime *from, const mtpPrime *end) { + if (globalHandler.onDone) (*globalHandler.onDone)(0, from, end); // some updates were received +} + +void onStateChange(int32 dcWithShift, int32 state) { + if (stateChangedHandler) stateChangedHandler(dcWithShift, state); +} + +void onSessionReset(int32 dcWithShift) { + if (sessionResetHandler) sessionResetHandler(dcWithShift); +} + +bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err) { // return true if need to clean request data + if (mtpIsFlood(err)) { + if (onFail && (*onFail)(requestId, err)) return true; + } + + if (onErrorDefault(requestId, err)) { + return false; + } + LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg(requestId).arg(err.code()).arg(err.type()).arg(err.description().isEmpty() ? QString() : QString(": %1").arg(err.description()))); + onFail && (*onFail)(requestId, err); + return true; +} + +GlobalSlotCarrier::GlobalSlotCarrier() { + connect(&_timer, SIGNAL(timeout()), this, SLOT(checkDelayed())); +} + +void GlobalSlotCarrier::checkDelayed() { + uint64 now = getms(true); + while (!delayedRequests.isEmpty() && now >= delayedRequests.front().second) { + mtpRequestId requestId = delayedRequests.front().first; + delayedRequests.pop_front(); + + int32 dcWithShift = 0; + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::const_iterator i = requestsByDC.constFind(requestId); + if (i != requestsByDC.cend()) { + dcWithShift = i.value(); + } else { + LOG(("MTP Error: could not find request dc for delayed resend, requestId %1").arg(requestId)); + continue; + } + } + + mtpRequest req; + { + QReadLocker locker(&requestMapLock); + RequestMap::const_iterator j = requestMap.constFind(requestId); + if (j == requestMap.cend()) { + DEBUG_LOG(("MTP Error: could not find request %1").arg(requestId)); + continue; + } + req = j.value(); + } + if (Session *session = getSession(qAbs(dcWithShift))) { + session->sendPrepared(req); + } + } + + if (!delayedRequests.isEmpty()) { + _timer.start(delayedRequests.front().second - now); + } +} + +void GlobalSlotCarrier::connectionFinished(Connection *connection) { + MTPQuittingConnections::iterator i = quittingConnections.find(connection); + if (i != quittingConnections.cend()) { + quittingConnections.erase(i); + } + + connection->waitTillFinish(); + delete connection; +} + +GlobalSlotCarrier *globalSlotCarrier() { + return _globalSlotCarrier; +} + +void queueQuittingConnection(Connection *connection) { + quittingConnections.insert(connection); +} + +} // namespace internal + +void start() { + if (started()) return; + + unixtimeInit(); + + internal::DcenterMap &dcs(internal::DCMap()); + + _globalSlotCarrier = new internal::GlobalSlotCarrier(); + + mainSession = new internal::Session(internal::mainDC()); + sessions.insert(mainSession->getDcWithShift(), mainSession); + + _started = true; + + if (internal::configNeeded()) { + internal::configLoader()->load(); + } +} + +bool started() { + return _started; +} + +void restart() { + if (!_started) return; + + for (auto i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { + i.value()->restart(); + } +} + +void restart(int32 dcMask) { + if (!_started) return; + + dcMask = bareDcId(dcMask); + for (Sessions::const_iterator i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { + if (bareDcId(i.value()->getDcWithShift()) == dcMask) { + i.value()->restart(); + } + } +} + +void pause() { + if (!_started) return; + _paused = true; +} + +void unpause() { + if (!_started) return; + _paused = false; + for (Sessions::const_iterator i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { + i.value()->unpaused(); + } +} + +void configure(int32 dc, int32 user) { + if (_started) return; + internal::setDC(dc); + internal::authed(user); +} + +void setdc(int32 dc, bool fromZeroOnly) { + if (!dc || !_started) return; + internal::setDC(dc, fromZeroOnly); + int32 oldMainDc = mainSession->getDcWithShift(); + if (maindc() != oldMainDc) { + killSession(oldMainDc); + } + Local::writeMtpData(); +} + +int32 maindc() { + return internal::mainDC(); +} + +int32 dcstate(int32 dc) { + if (!_started) return 0; + + if (!dc) return mainSession->getState(); + if (!bareDcId(dc)) { + dc += bareDcId(mainSession->getDcWithShift()); + } + + Sessions::const_iterator i = sessions.constFind(dc); + if (i != sessions.cend()) return i.value()->getState(); + + return DisconnectedState; +} + +QString dctransport(int32 dc) { + if (!_started) return QString(); + + if (!dc) return mainSession->transport(); + if (!bareDcId(dc)) { + dc += bareDcId(mainSession->getDcWithShift()); + } + + Sessions::const_iterator i = sessions.constFind(dc); + if (i != sessions.cend()) return i.value()->transport(); + + return QString(); +} + +void ping() { + if (internal::Session *session = internal::getSession(0)) { + session->ping(); + } +} + +void cancel(mtpRequestId requestId) { + if (!_started) return; + + mtpMsgId msgId = 0; + requestsDelays.remove(requestId); + { + QWriteLocker locker(&requestMapLock); + RequestMap::iterator i = requestMap.find(requestId); + if (i != requestMap.end()) { + msgId = *(mtpMsgId*)(i.value()->constData() + 4); + requestMap.erase(i); + } + } + { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId); + if (i != requestsByDC.end()) { + if (internal::Session *session = internal::getSession(qAbs(i.value()))) { + session->cancel(requestId, msgId); + } + requestsByDC.erase(i); + } + } + internal::clearCallbacks(requestId); +} + +void killSession(int32 dc) { + Sessions::iterator i = sessions.find(dc); + if (i != sessions.cend()) { + bool wasMain = (i.value() == mainSession); + + i.value()->kill(); + i.value()->deleteLater(); + sessions.erase(i); + + if (wasMain) { + mainSession = new internal::Session(internal::mainDC()); + int32 newdc = mainSession->getDcWithShift(); + i = sessions.find(newdc); + if (i != sessions.cend()) { + i.value()->kill(); + i.value()->deleteLater(); + sessions.erase(i); + } + sessions.insert(newdc, mainSession); + } + } +} + +void stopSession(int32 dc) { + Sessions::iterator i = sessions.find(dc); + if (i != sessions.end()) { + if (i.value() != mainSession) { // don't stop main session + i.value()->stop(); + } + } +} + +int32 state(mtpRequestId requestId) { + if (requestId > 0) { + QMutexLocker locker(&requestByDCLock); + RequestsByDC::iterator i = requestsByDC.find(requestId); + if (i != requestsByDC.end()) { + if (internal::Session *session = internal::getSession(qAbs(i.value()))) { + return session->requestState(requestId); + } + return MTP::RequestConnecting; + } + return MTP::RequestSent; + } + if (internal::Session *session = internal::getSession(-requestId)) { + return session->requestState(0); + } + return MTP::RequestConnecting; +} + +void finish() { + for (Sessions::iterator i = sessions.begin(), e = sessions.end(); i != e; ++i) { + i.value()->kill(); + delete i.value(); + } + sessions.clear(); + mainSession = nullptr; + + for_const (internal::Connection *connection, quittingConnections) { + connection->waitTillFinish(); + delete connection; + } + quittingConnections.clear(); + + delete _globalSlotCarrier; + _globalSlotCarrier = nullptr; + + internal::destroyConfigLoader(); + + _started = false; +} + +void authed(int32 uid) { + internal::authed(uid); +} + +int32 authedId() { + return internal::authed(); +} + +void logoutKeys(RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) { + mtpRequestId req = MTP::send(MTPauth_LogOut(), onDone, onFail); + internal::logoutOtherDCs(); +} + +void setGlobalDoneHandler(RPCDoneHandlerPtr handler) { + globalHandler.onDone = handler; +} + +void setGlobalFailHandler(RPCFailHandlerPtr handler) { + globalHandler.onFail = handler; +} + +void setStateChangedHandler(MTPStateChangedHandler handler) { + stateChangedHandler = handler; +} + +void setSessionResetHandler(MTPSessionResetHandler handler) { + sessionResetHandler = handler; +} + +void clearGlobalHandlers() { + setGlobalDoneHandler(RPCDoneHandlerPtr()); + setGlobalFailHandler(RPCFailHandlerPtr()); + setStateChangedHandler(0); + setSessionResetHandler(0); +} + +void updateDcOptions(const QVector &options) { + internal::updateDcOptions(options); + Local::writeSettings(); +} + +AuthKeysMap getKeys() { + return internal::getAuthKeys(); +} + +void setKey(int32 dc, AuthKeyPtr key) { + return internal::setAuthKey(dc, key); +} + +QReadWriteLock *dcOptionsMutex() { + return internal::dcOptionsMutex(); +} + +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/facade.h b/Telegram/SourceFiles/mtproto/facade.h new file mode 100644 index 000000000..dfd5f22ad --- /dev/null +++ b/Telegram/SourceFiles/mtproto/facade.h @@ -0,0 +1,240 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +#include "mtproto/core_types.h" +#include "mtproto/session.h" +#include "mtproto/file_download.h" + +namespace MTP { + +namespace internal { + +Session *getSession(ShiftedDcId shiftedDcId); // 0 - current set dc + +bool paused(); + +void registerRequest(mtpRequestId requestId, int32 dc); +void unregisterRequest(mtpRequestId requestId); + +mtpRequestId storeRequest(mtpRequest &request, const RPCResponseHandler &parser); +mtpRequest getRequest(mtpRequestId req); +void wrapInvokeAfter(mtpRequest &to, const mtpRequest &from, const mtpRequestMap &haveSent, int32 skipBeforeRequest = 0); +void clearCallbacks(mtpRequestId requestId, int32 errorCode = RPCError::NoError); // 0 - do not toggle onError callback +void clearCallbacksDelayed(const RPCCallbackClears &requestIds); +void performDelayedClear(); +void execCallback(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end); +bool hasCallbacks(mtpRequestId requestId); +void globalCallback(const mtpPrime *from, const mtpPrime *end); +void onStateChange(int32 dcWithShift, int32 state); +void onSessionReset(int32 dcWithShift); +bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err); // return true if need to clean request data +inline bool rpcErrorOccured(mtpRequestId requestId, const RPCResponseHandler &handler, const RPCError &err) { + return rpcErrorOccured(requestId, handler.onFail, err); +} + +// used for: +// - resending requests by timer which were postponed by flood delay +// - destroying MTProtoConnections whose thread has finished +class GlobalSlotCarrier : public QObject { + Q_OBJECT + +public: + + GlobalSlotCarrier(); + +public slots: + + void checkDelayed(); + void connectionFinished(Connection *connection); + +private: + + SingleTimer _timer; +}; + +GlobalSlotCarrier *globalSlotCarrier(); +void queueQuittingConnection(Connection *connection); + +} // namespace internal + +constexpr ShiftedDcId DCShift = 10000; +constexpr DcId bareDcId(ShiftedDcId shiftedDcId) { + return (shiftedDcId % DCShift); +} +constexpr ShiftedDcId shiftDcId(DcId dcId, int value) { + return dcId + DCShift * value; +} +constexpr int getDcIdShift(ShiftedDcId shiftedDcId) { + return (shiftedDcId - bareDcId(shiftedDcId)) / DCShift; +} + +// send(MTPhelp_GetConfig(), MTP::cfgDcId(dc)) - for dc enumeration +constexpr ShiftedDcId cfgDcId(DcId dcId) { + return shiftDcId(dcId, 0x01); +} + +// send(MTPauth_LogOut(), MTP::lgtDcId(dc)) - for logout of guest dcs enumeration +constexpr ShiftedDcId lgtDcId(DcId dcId) { + return shiftDcId(dcId, 0x02); +} + +namespace internal { + constexpr ShiftedDcId downloadDcId(DcId dcId, int index) { + static_assert(MTPDownloadSessionsCount < 0x10, "Too large MTPDownloadSessionsCount!"); + return shiftDcId(dcId, 0x10 + index); + }; +} + +// send(req, callbacks, MTP::dldDcId(dc, index)) - for download shifted dc id +inline ShiftedDcId dldDcId(DcId dcId, int index) { + t_assert(index >= 0 && index < MTPDownloadSessionsCount); + return internal::downloadDcId(dcId, index); +} +constexpr bool isDldDcId(ShiftedDcId shiftedDcId) { + return (shiftedDcId >= internal::downloadDcId(0, 0)) && (shiftedDcId < internal::downloadDcId(0, MTPDownloadSessionsCount - 1) + DCShift); +} + +namespace internal { + constexpr ShiftedDcId uploadDcId(DcId dcId, int index) { + static_assert(MTPUploadSessionsCount < 0x10, "Too large MTPUploadSessionsCount!"); + return shiftDcId(dcId, 0x20 + index); + }; +} + +// send(req, callbacks, MTP::uplDcId(index)) - for upload shifted dc id +// uploading always to the main dc so bareDcId == 0 +inline ShiftedDcId uplDcId(int index) { + t_assert(index >= 0 && index < MTPUploadSessionsCount); + return internal::uploadDcId(0, index); +}; +constexpr bool isUplDcId(ShiftedDcId shiftedDcId) { + return (shiftedDcId >= internal::uploadDcId(0, 0)) && (shiftedDcId < internal::uploadDcId(0, MTPUploadSessionsCount - 1) + DCShift); +} + +void start(); +bool started(); +void restart(); +void restart(int32 dcMask); + +void pause(); +void unpause(); + +void configure(int32 dc, int32 user); + +void setdc(int32 dc, bool fromZeroOnly = false); +int32 maindc(); + +enum { + DisconnectedState = 0, + ConnectingState = 1, + ConnectedState = 2, +}; +int32 dcstate(int32 dc = 0); +QString dctransport(int32 dc = 0); + +template +inline mtpRequestId send(const TRequest &request, RPCResponseHandler callbacks = RPCResponseHandler(), int32 dc = 0, uint64 msCanWait = 0, mtpRequestId after = 0) { + if (internal::Session *session = internal::getSession(dc)) { + return session->send(request, callbacks, msCanWait, true, !dc, after); + } + return 0; +} +template +inline mtpRequestId send(const TRequest &request, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail = RPCFailHandlerPtr(), int32 dc = 0, uint64 msCanWait = 0, mtpRequestId after = 0) { + return send(request, RPCResponseHandler(onDone, onFail), dc, msCanWait, after); +} +inline void sendAnything(int32 dc = 0, uint64 msCanWait = 0) { + if (internal::Session *session = internal::getSession(dc)) { + return session->sendAnything(msCanWait); + } +} +void ping(); +void cancel(mtpRequestId req); +void killSession(int32 dc); +void stopSession(int32 dc); + +enum { + RequestSent = 0, + RequestConnecting = 1, + RequestSending = 2 +}; +int32 state(mtpRequestId req); // < 0 means waiting for such count of ms + +void finish(); + +void authed(int32 uid); +int32 authedId(); +void logoutKeys(RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail); + +void setGlobalDoneHandler(RPCDoneHandlerPtr handler); +void setGlobalFailHandler(RPCFailHandlerPtr handler); +void setStateChangedHandler(MTPStateChangedHandler handler); +void setSessionResetHandler(MTPSessionResetHandler handler); +void clearGlobalHandlers(); + +void updateDcOptions(const QVector &options); + +AuthKeysMap getKeys(); +void setKey(int32 dc, AuthKeyPtr key); + +QReadWriteLock *dcOptionsMutex(); + +struct DcOption { + DcOption(int id, MTPDdcOption::Flags flags, const string &ip, int port) : id(id), flags(flags), ip(ip), port(port) { + } + + int id; + MTPDdcOption::Flags flags; + string ip; + int port; +}; +typedef QMap DcOptions; + +namespace internal { + + template + mtpRequestId Session::send(const TRequest &request, RPCResponseHandler callbacks, uint64 msCanWait, bool needsLayer, bool toMainDC, mtpRequestId after) { + mtpRequestId requestId = 0; + try { + uint32 requestSize = request.innerLength() >> 2; + mtpRequest reqSerialized(mtpRequestData::prepare(requestSize)); + request.write(*reqSerialized); + + DEBUG_LOG(("MTP Info: adding request to toSendMap, msCanWait %1").arg(msCanWait)); + + reqSerialized->msDate = getms(true); // > 0 - can send without container + reqSerialized->needsLayer = needsLayer; + if (after) reqSerialized->after = MTP::internal::getRequest(after); + requestId = MTP::internal::storeRequest(reqSerialized, callbacks); + + sendPrepared(reqSerialized, msCanWait); + } catch (Exception &e) { + requestId = 0; + MTP::internal::rpcErrorOccured(requestId, callbacks, rpcClientError("NO_REQUEST_ID", QString("send() failed to queue request, exception: %1").arg(e.what()))); + } + if (requestId) MTP::internal::registerRequest(requestId, toMainDC ? -getDcWithShift() : getDcWithShift()); + return requestId; + } + +} // namespace internal + +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp b/Telegram/SourceFiles/mtproto/file_download.cpp similarity index 89% rename from Telegram/SourceFiles/mtproto/mtpFileLoader.cpp rename to Telegram/SourceFiles/mtproto/file_download.cpp index f260f2ca4..b7333812b 100644 --- a/Telegram/SourceFiles/mtproto/mtpFileLoader.cpp +++ b/Telegram/SourceFiles/mtproto/file_download.cpp @@ -19,6 +19,9 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" + +#include "mtproto/file_download.h" + #include "mainwidget.h" #include "window.h" @@ -349,9 +352,9 @@ mtpFileLoader::mtpFileLoader(const StorageImageLocation *location, int32 size, L , _location(location) , _id(0) , _access(0) { - LoaderQueues::iterator i = queues.find(MTP::dld(0) + _dc); + LoaderQueues::iterator i = queues.find(MTP::dldDcId(_dc, 0)); if (i == queues.cend()) { - i = queues.insert(MTP::dld(0) + _dc, FileLoaderQueue(MaxFileQueries)); + i = queues.insert(MTP::dldDcId(_dc, 0), FileLoaderQueue(MaxFileQueries)); } _queue = &i.value(); } @@ -365,9 +368,9 @@ mtpFileLoader::mtpFileLoader(int32 dc, const uint64 &id, const uint64 &access, L , _location(0) , _id(id) , _access(access) { - LoaderQueues::iterator i = queues.find(MTP::dld(0) + _dc); + LoaderQueues::iterator i = queues.find(MTP::dldDcId(_dc, 0)); if (i == queues.cend()) { - i = queues.insert(MTP::dld(0) + _dc, FileLoaderQueue(MaxFileQueries)); + i = queues.insert(MTP::dldDcId(_dc, 0), FileLoaderQueue(MaxFileQueries)); } _queue = &i.value(); } @@ -376,9 +379,33 @@ int32 mtpFileLoader::currentOffset(bool includeSkipped) const { return (_fileIsOpen ? _file.size() : _data.size()) - (includeSkipped ? 0 : _skippedBytes); } +namespace { + QString serializereqs(const QMap &reqs) { // serialize requests map in json-like format + QString result; + result.reserve(reqs.size() * 16 + 4); + result.append(qsl("{ ")); + for (auto i = reqs.cbegin(), e = reqs.cend(); i != e;) { + result.append(QString::number(i.key())).append(qsl(" : ")).append(QString::number(i.value())); + if (++i == e) { + break; + } else { + result.append(qsl(", ")); + } + } + result.append(qsl(" }")); + return result; + } +} + bool mtpFileLoader::loadPart() { - if (_complete || _lastComplete || (!_requests.isEmpty() && !_size)) return false; - if (_size && _nextRequestOffset >= _size) return false; + if (_complete || _lastComplete || (!_requests.isEmpty() && !_size)) { + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): loadPart() returned, _complete=%2, _lastComplete=%3, _requests.size()=%4, _size=%5").arg(_id).arg(Logs::b(_complete)).arg(Logs::b(_lastComplete)).arg(_requests.size()).arg(_size)); + return false; + } + if (_size && _nextRequestOffset >= _size) { + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): loadPart() returned, _size=%2, _nextRequestOffset=%3, _requests=%4").arg(_id).arg(_size).arg(_nextRequestOffset).arg(serializereqs(_requests))); + return false; + } int32 limit = DocumentDownloadPartSize; MTPInputFileLocation loc; @@ -405,19 +432,28 @@ bool mtpFileLoader::loadPart() { App::app()->killDownloadSessionsStop(_dc); - mtpRequestId reqId = MTP::send(MTPupload_GetFile(MTPupload_getFile(loc, MTP_int(offset), MTP_int(limit))), rpcDone(&mtpFileLoader::partLoaded, offset), rpcFail(&mtpFileLoader::partFailed), MTP::dld(dcIndex) + _dc, 50); + mtpRequestId reqId = MTP::send(MTPupload_GetFile(MTPupload_getFile(loc, MTP_int(offset), MTP_int(limit))), rpcDone(&mtpFileLoader::partLoaded, offset), rpcFail(&mtpFileLoader::partFailed), MTP::dldDcId(_dc, dcIndex), 50); ++_queue->queries; dr.v[dcIndex] += limit; _requests.insert(reqId, dcIndex); _nextRequestOffset += limit; + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): requested part with offset=%2, _queue->queries=%3, _nextRequestOffset=%4, _requests=%5").arg(_id).arg(offset).arg(_queue->queries).arg(_nextRequestOffset).arg(serializereqs(_requests))); + return true; } void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result, mtpRequestId req) { Requests::iterator i = _requests.find(req); - if (i == _requests.cend()) return loadNext(); + if (i == _requests.cend()) { + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): request req=%2 for offset=%3 not found in _requests=%4").arg(_id).arg(req).arg(offset).arg(serializereqs(_requests))); + return loadNext(); + } + if (result.type() != mtpc_upload_file) { + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): bad cons received! %2").arg(_id).arg(result.type())); + return cancel(true); + } int32 limit = (_locationType == UnknownFileLocation) ? DownloadPartSize : DocumentDownloadPartSize; int32 dcIndex = i.value(); @@ -428,6 +464,9 @@ void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result, mtpRe const MTPDupload_file &d(result.c_upload_file()); const string &bytes(d.vbytes.c_string().v); + + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): got part with offset=%2, bytes=%3, _queue->queries=%4, _nextRequestOffset=%5, _requests=%6").arg(_id).arg(offset).arg(bytes.size()).arg(_queue->queries).arg(_nextRequestOffset).arg(serializereqs(_requests))); + if (bytes.size()) { if (_fileIsOpen) { int64 fsize = _file.size(); @@ -502,6 +541,8 @@ void mtpFileLoader::partLoaded(int32 offset, const MTPupload_File &result, mtpRe Local::writeImage(storageKey(*_location), StorageImageSaved(mtpToStorageType(_type), _data)); } } + } else { + if (DebugLogging::FileLoader() && _id) DEBUG_LOG(("FileLoader(%1): not done yet, _lastComplete=%2, _size=%3, _nextRequestOffset=%4, _requests=%5").arg(_id).arg(Logs::b(_lastComplete)).arg(_size).arg(_nextRequestOffset).arg(serializereqs(_requests))); } emit progress(this); loadNext(); @@ -733,9 +774,11 @@ private: }; void reinitWebLoadManager() { +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY if (webLoadManager()) { webLoadManager()->setProxySettings(App::getHttpProxySettings()); } +#endif } void stopWebLoadManager() { @@ -752,11 +795,13 @@ void stopWebLoadManager() { } } +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY void WebLoadManager::setProxySettings(const QNetworkProxy &proxy) { QMutexLocker lock(&_loaderPointersMutex); _proxySettings = proxy; emit proxyApplyDelayed(); } +#endif WebLoadManager::WebLoadManager(QThread *thread) { moveToThread(thread); @@ -940,27 +985,27 @@ void WebLoadManager::process() { i.value() = 0; } } - for (Loaders::iterator i = _loaders.begin(), e = _loaders.end(); i != e;) { - LoaderPointers::iterator it = _loaderPointers.find(i.key()->_interface); - if (it != _loaderPointers.cend() && it.key()->_private != i.key()) { + for (auto i = _loaders.begin(), e = _loaders.end(); i != e;) { + LoaderPointers::iterator it = _loaderPointers.find((*i)->_interface); + if (it != _loaderPointers.cend() && it.key()->_private != (*i)) { it = _loaderPointers.end(); } if (it == _loaderPointers.cend()) { - if (QNetworkReply *reply = i.key()->reply()) { + if (QNetworkReply *reply = (*i)->reply()) { _replies.remove(reply); reply->abort(); reply->deleteLater(); } - delete i.key(); + delete (*i); i = _loaders.erase(i); } else { ++i; } } } - for (Loaders::const_iterator i = newLoaders.cbegin(), e = newLoaders.cend(); i != e; ++i) { - if (_loaders.contains(i.key())) { - sendRequest(i.key()); + for_const (webFileLoaderPrivate *loader, newLoaders) { + if (_loaders.contains(loader)) { + sendRequest(loader); } } } @@ -983,8 +1028,10 @@ void WebLoadManager::sendRequest(webFileLoaderPrivate *loader, const QString &re } void WebLoadManager::proxyApply() { +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QMutexLocker lock(&_loaderPointersMutex); _manager.setProxy(_proxySettings); +#endif } void WebLoadManager::finish() { @@ -1000,8 +1047,8 @@ void WebLoadManager::clear() { } _loaderPointers.clear(); - for (Loaders::iterator i = _loaders.begin(), e = _loaders.end(); i != e; ++i) { - delete i.key(); + for_const (webFileLoaderPrivate *loader, _loaders) { + delete loader; } _loaders.clear(); diff --git a/Telegram/SourceFiles/mtproto/mtpFileLoader.h b/Telegram/SourceFiles/mtproto/file_download.h similarity index 99% rename from Telegram/SourceFiles/mtproto/mtpFileLoader.h rename to Telegram/SourceFiles/mtproto/file_download.h index f64ac4d45..c3097b57c 100644 --- a/Telegram/SourceFiles/mtproto/mtpFileLoader.h +++ b/Telegram/SourceFiles/mtproto/file_download.h @@ -321,7 +321,9 @@ public: WebLoadManager(QThread *thread); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY void setProxySettings(const QNetworkProxy &proxy); +#endif void append(webFileLoader *loader, const QString &url); void stop(webFileLoader *reader); @@ -352,7 +354,9 @@ private: void sendRequest(webFileLoaderPrivate *loader, const QString &redirect = QString()); bool handleReplyResult(webFileLoaderPrivate *loader, WebReplyProcessResult result); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY QNetworkProxy _proxySettings; +#endif QNetworkAccessManager _manager; typedef QMap LoaderPointers; LoaderPointers _loaderPointers; diff --git a/Telegram/SourceFiles/mtproto/generate.py b/Telegram/SourceFiles/mtproto/generate.py index de413ceae..b5edcf7a7 100644 --- a/Telegram/SourceFiles/mtproto/generate.py +++ b/Telegram/SourceFiles/mtproto/generate.py @@ -21,6 +21,28 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org import glob import re +# define some checked flag convertions +# the key flag type should be a subset of the value flag type +# with exact the same names, then the key flag can be implicitly +# casted to the value flag type +parentFlags = {}; +parentFlagsList = []; +def addChildParentFlags(child, parent): + parentFlagsList.append(child); + parentFlags[child] = parent; +addChildParentFlags('MTPDmessageService', 'MTPDmessage'); +addChildParentFlags('MTPDupdateShortMessage', 'MTPDmessage'); +addChildParentFlags('MTPDupdateShortChatMessage', 'MTPDmessage'); +addChildParentFlags('MTPDupdateShortSentMessage', 'MTPDmessage'); +addChildParentFlags('MTPDreplyKeyboardHide', 'MTPDreplyKeyboardMarkup'); +addChildParentFlags('MTPDreplyKeyboardForceReply', 'MTPDreplyKeyboardMarkup'); +addChildParentFlags('MTPDinputPeerNotifySettings', 'MTPDpeerNotifySettings'); +addChildParentFlags('MTPDpeerNotifySettings', 'MTPDinputPeerNotifySettings'); + +# this is a map (key flags -> map (flag name -> flag bit)) +# each key flag of parentFlags should be a subset of the value flag here +parentFlagsCheck = {}; + funcs = 0 types = 0; consts = 0 @@ -35,12 +57,13 @@ boxed = {}; funcsText = ''; typesText = ''; dataTexts = ''; +creatorProxyText = ''; inlineMethods = ''; textSerializeInit = ''; textSerializeMethods = ''; forwards = ''; forwTypedefs = ''; -out = open('mtpScheme.h', 'w') +out = open('scheme_auto.h', 'w') out.write('/*\n'); out.write('Created from \'/SourceFiles/mtproto/scheme.tl\' by \'/SourceFiles/mtproto/generate.py\' script\n\n'); out.write('WARNING! All changes made in this file will be lost!\n\n'); @@ -63,7 +86,7 @@ out.write('\n'); out.write('Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n'); out.write('Copyright (c) 2014 John Preston, https://desktop.telegram.org\n'); out.write('*/\n'); -out.write('#pragma once\n\n#include "mtpCoreTypes.h"\n'); +out.write('#pragma once\n\n#include "mtproto/core_types.h"\n'); with open('scheme.tl') as f: for line in f: nocomment = re.match(r'^(.*?)//', line) @@ -150,7 +173,10 @@ with open('scheme.tl') as f: continue; elif (ptypewide == '#'): hasFlags = pname; - ptype = 'int'; + if funcsNow: + ptype = 'flags'; + else: + ptype = 'flags'; else: ptype = ptypewide; if (ptype.find('?') >= 0): @@ -195,6 +221,27 @@ with open('scheme.tl') as f: prmsStr = []; prmsInit = []; prmsNames = []; + if (len(conditions)): + funcsText += '\tenum class Flag : int32 {\n'; + maxbit = 0; + parentFlagsCheck['MTP' + name] = {}; + for paramName in conditionsList: + funcsText += '\t\tf_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n'; + parentFlagsCheck['MTP' + name][paramName] = conditions[paramName]; + maxbit = max(maxbit, int(conditions[paramName])); + if (maxbit > 0): + funcsText += '\n\t\tMAX_FIELD = (1 << ' + str(maxbit) + '),\n'; + funcsText += '\t};\n'; + funcsText += '\tQ_DECLARE_FLAGS(Flags, Flag);\n'; + funcsText += '\tfriend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); }\n'; + funcsText += '\n'; + for paramName in conditionsList: + if (paramName in trivialConditions): + funcsText += '\tbool is_' + paramName + '() const { return v' + hasFlags + '.v & Flag::f_' + paramName + '; }\n'; + else: + funcsText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & Flag::f_' + paramName + '; }\n'; + funcsText += '\n'; + if (len(prms) > len(trivialConditions)): for paramName in prmsList: if (paramName in trivialConditions): @@ -207,7 +254,7 @@ with open('scheme.tl') as f: else: ptypeFull = 'MTP' + paramType; funcsText += '\t' + ptypeFull + ' v' + paramName + ';\n'; - if (paramType in ['int', 'Int', 'bool', 'Bool']): + if (paramType in ['int', 'Int', 'bool', 'Bool', 'flags']): prmsStr.append(ptypeFull + ' _' + paramName); else: prmsStr.append('const ' + ptypeFull + ' &_' + paramName); @@ -218,19 +265,6 @@ with open('scheme.tl') as f: if (len(prms) > len(trivialConditions)): funcsText += '\tMTP' + name + '(' + ', '.join(prmsStr) + ') : ' + ', '.join(prmsInit) + ' {\n\t}\n'; - if (len(conditions)): - funcsText += '\n'; - funcsText += '\tenum {\n'; - for paramName in conditionsList: - funcsText += '\t\tflag_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n'; - funcsText += '\t};\n'; - funcsText += '\n'; - for paramName in conditionsList: - if (paramName in trivialConditions): - funcsText += '\tbool is_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n'; - else: - funcsText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n'; - funcsText += '\n'; funcsText += '\tuint32 innerLength() const {\n'; # count size size = []; @@ -274,6 +308,8 @@ with open('scheme.tl') as f: funcsText += '\n\ttypedef MTP' + resType + ' ResponseType;\n'; # method return type funcsText += '};\n'; # class ending + if (len(conditionsList)): + funcsText += 'Q_DECLARE_OPERATORS_FOR_FLAGS(MTP' + name + '::Flags)\n\n'; if (isTemplate != ''): funcsText += 'template \n'; funcsText += 'class MTP' + Name + ' : public MTPBoxed > {\n'; @@ -325,7 +361,9 @@ def addTextSerialize(lst, dct, dataLetter): conditions = data[6]; trivialConditions = data[7]; - result += 'void _serialize_' + name + '(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) {\n'; + result += 'void _serialize_' + name + '(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n'; + if (len(conditions)): + result += '\tMTP' + dataLetter + name + '::Flags flag(iflag);\n\n'; if (len(prms)): result += '\tif (stage) {\n'; result += '\t\tto.add(",\\n").addSpaces(lev);\n'; @@ -341,12 +379,12 @@ def addTextSerialize(lst, dct, dataLetter): if (k == hasFlags): result += 'if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; '; if (k in trivialConditions): - result += 'if (flag & MTP' + dataLetter + name + '::flag_' + k + ') { '; + result += 'if (flag & MTP' + dataLetter + name + '::Flag::f_' + k + ') { '; result += 'to.add("YES [ BY BIT ' + conditions[k] + ' IN FIELD ' + hasFlags + ' ]"); '; result += '} else { to.add("[ SKIPPED BY BIT ' + conditions[k] + ' IN FIELD ' + hasFlags + ' ]"); } '; else: if (k in conditions): - result += 'if (flag & MTP' + dataLetter + name + '::flag_' + k + ') { '; + result += 'if (flag & MTP' + dataLetter + name + '::Flag::f_' + k + ') { '; result += 'types.push_back('; vtypeget = re.match(r'^[Vv]ector', v); if (vtypeget): @@ -383,7 +421,10 @@ def addTextSerialize(lst, dct, dataLetter): except KeyError: if (vtypeget): result += '); vtypes.push_back('; - result += 'mtpc_' + restype; + if (re.match(r'^flags<', restype)): + result += 'mtpc_flags'; + else: + result += 'mtpc_' + restype + '+0'; if (not vtypeget): result += '); vtypes.push_back(0'; else: @@ -455,6 +496,28 @@ for restype in typesList: creatorParamsList = []; readText = ''; writeText = ''; + + if (len(conditions)): + dataText += '\tenum class Flag : int32 {\n'; + maxbit = 0; + parentFlagsCheck['MTPD' + name] = {}; + for paramName in conditionsList: + dataText += '\t\tf_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n'; + parentFlagsCheck['MTPD' + name][paramName] = conditions[paramName]; + maxbit = max(maxbit, int(conditions[paramName])); + if (maxbit > 0): + dataText += '\n\t\tMAX_FIELD = (1 << ' + str(maxbit) + '),\n'; + dataText += '\t};\n'; + dataText += '\tQ_DECLARE_FLAGS(Flags, Flag);\n'; + dataText += '\tfriend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); }\n'; + dataText += '\n'; + for paramName in conditionsList: + if (paramName in trivialConditions): + dataText += '\tbool is_' + paramName + '() const { return v' + hasFlags + '.v & Flag::f_' + paramName + '; }\n'; + else: + dataText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & Flag::f_' + paramName + '; }\n'; + dataText += '\n'; + dataText += '\tMTPD' + name + '() {\n\t}\n'; # default constructor switchLines += '\t\tcase mtpc_' + name + ': '; # for by-type-id type constructor if (len(prms) > len(trivialConditions)): @@ -530,33 +593,26 @@ for restype in typesList: sizeFast = '\treturn 0;\n'; switchLines += 'break;\n'; - - if (len(conditions)): - dataText += '\n'; - dataText += '\tenum {\n'; - for paramName in conditionsList: - dataText += '\t\tflag_' + paramName + ' = (1 << ' + conditions[paramName] + '),\n'; - dataText += '\t};\n'; - dataText += '\n'; - for paramName in conditionsList: - if (paramName in trivialConditions): - dataText += '\tbool is_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n'; - else: - dataText += '\tbool has_' + paramName + '() const { return v' + hasFlags + '.v & flag_' + paramName + '; }\n'; dataText += '};\n'; # class ending if (len(prms) > len(trivialConditions)): dataTexts += dataText; # add data class - friendDecl += '\tfriend MTP' + restype + ' MTP_' + name + '(' + ', '.join(creatorParams) + ');\n'; - creatorsText += 'inline MTP' + restype + ' MTP_' + name + '(' + ', '.join(creatorParams) + ') {\n'; + if (not friendDecl): + friendDecl += '\tfriend class MTP::internal::TypeCreator;\n'; + creatorProxyText += '\tinline static MTP' + restype + ' new_' + name + '(' + ', '.join(creatorParams) + ') {\n'; if (len(prms) > len(trivialConditions)): # creator with params - creatorsText += '\treturn MTP' + restype + '(new MTPD' + name + '(' + ', '.join(creatorParamsList) + '));\n'; + creatorProxyText += '\t\treturn MTP' + restype + '(new MTPD' + name + '(' + ', '.join(creatorParamsList) + '));\n'; else: if (withType): # creator by type - creatorsText += '\treturn MTP' + restype + '(mtpc_' + name + ');\n'; + creatorProxyText += '\t\treturn MTP' + restype + '(mtpc_' + name + ');\n'; else: # single creator - creatorsText += '\treturn MTP' + restype + '();\n'; + creatorProxyText += '\t\treturn MTP' + restype + '();\n'; + creatorProxyText += '\t}\n'; + if (len(conditionsList)): + creatorsText += 'Q_DECLARE_OPERATORS_FOR_FLAGS(MTPD' + name + '::Flags)\n'; + creatorsText += 'inline MTP' + restype + ' MTP_' + name + '(' + ', '.join(creatorParams) + ') {\n'; + creatorsText += '\treturn MTP::internal::TypeCreator::new_' + name + '(' + ', '.join(creatorParamsList) + ');\n'; creatorsText += '}\n'; if (withType): @@ -667,7 +723,7 @@ for restype in typesList: typesText += '\tvoid write(mtpBuffer &to) const;\n'; # write method inlineMethods += 'inline void MTP' + restype + '::write(mtpBuffer &to) const {\n'; - if (withType): + if (withType and writer != ''): inlineMethods += '\tswitch (_type) {\n'; inlineMethods += writer; inlineMethods += '\t}\n'; @@ -705,8 +761,19 @@ for restype in typesList: inlineMethods += creatorsText; typesText += 'typedef MTPBoxed MTP' + resType + ';\n'; # boxed type definition +for childName in parentFlagsList: + parentName = parentFlags[childName]; + for flag in parentFlagsCheck[childName]: + if (not flag in parentFlagsCheck[parentName]): + print('Flag ' + flag + ' not found in ' + parentName + ' which should be a flags-parent of ' + childName); + error + elif (parentFlagsCheck[childName][flag] != parentFlagsCheck[parentName][flag]): + print('Flag ' + flag + ' has different value in ' + parentName + ' which should be a flags-parent of ' + childName); + error + inlineMethods += 'inline ' + parentName + '::Flags mtpCastFlags(' + childName + '::Flags flags) { return ' + parentName + '::Flags(QFlag(flags)); }\n'; + # manual types added here -textSerializeMethods += 'void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) {\n'; +textSerializeMethods += 'void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n'; textSerializeMethods += '\tif (stage) {\n'; textSerializeMethods += '\t\tto.add(",\\n").addSpaces(lev);\n'; textSerializeMethods += '\t} else {\n'; @@ -721,7 +788,7 @@ textSerializeMethods += '\t}\n'; textSerializeMethods += '}\n\n'; textSerializeInit += '\t\t_serializers.insert(mtpc_rpc_result, _serialize_rpc_result);\n'; -textSerializeMethods += 'void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) {\n'; +textSerializeMethods += 'void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n'; textSerializeMethods += '\tif (stage) {\n'; textSerializeMethods += '\t\tto.add(",\\n").addSpaces(lev);\n'; textSerializeMethods += '\t} else {\n'; @@ -735,7 +802,7 @@ textSerializeMethods += '\t}\n'; textSerializeMethods += '}\n\n'; textSerializeInit += '\t\t_serializers.insert(mtpc_msg_container, _serialize_msg_container);\n'; -textSerializeMethods += 'void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) {\n'; +textSerializeMethods += 'void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {\n'; textSerializeMethods += '\tif (stage) {\n'; textSerializeMethods += '\t\tto.add(",\\n").addSpaces(lev);\n'; textSerializeMethods += '\t} else {\n'; @@ -786,16 +853,18 @@ textSerializeFull += '\t\t}\n'; textSerializeFull += '\t}\n'; textSerializeFull += '}\n'; +out.write('\n// Creator proxy class declaration\nnamespace MTP {\nnamespace internal {\n\nclass TypeCreator;\n\n} // namespace internal\n} // namespace MTP\n'); out.write('\n// Type id constants\nenum {\n' + ',\n'.join(enums) + '\n};\n'); out.write('\n// Type forward declarations\n' + forwards); out.write('\n// Boxed types definitions\n' + forwTypedefs); out.write('\n// Type classes definitions\n' + typesText); out.write('\n// Type constructors with data\n' + dataTexts); out.write('\n// RPC methods\n' + funcsText); +out.write('\n// Creator proxy class definition\nnamespace MTP {\nnamespace internal {\n\nclass TypeCreator {\npublic:\n' + creatorProxyText + '\t};\n\n} // namespace internal\n} // namespace MTP\n'); out.write('\n// Inline methods definition\n' + inlineMethods); out.write('\n// Human-readable text serialization\nvoid mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, uint32 level, mtpPrime vcons);\n'); -outCpp = open('mtpScheme.cpp', 'w'); +outCpp = open('scheme_auto.cpp', 'w'); outCpp.write('/*\n'); outCpp.write('Created from \'/SourceFiles/mtproto/scheme.tl\' by \'/SourceFiles/mtproto/generate.py\' script\n\n'); outCpp.write('WARNING! All changes made in this file will be lost!\n\n'); @@ -815,11 +884,11 @@ outCpp.write('\n'); outCpp.write('Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE\n'); outCpp.write('Copyright (c) 2014 John Preston, https://desktop.telegram.org\n'); outCpp.write('*/\n'); -outCpp.write('#include "stdafx.h"\n#include "mtpScheme.h"\n\n'); +outCpp.write('#include "stdafx.h"\n\n#include "mtproto/scheme_auto.h"\n\n'); outCpp.write('typedef QVector Types;\ntypedef QVector StagesFlags;\n\n'); outCpp.write(textSerializeMethods); outCpp.write('namespace {\n'); -outCpp.write('\ttypedef void(*mtpTextSerializer)(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag);\n'); +outCpp.write('\ttypedef void(*mtpTextSerializer)(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag);\n'); outCpp.write('\ttypedef QMap TextSerializers;\n\tTextSerializers _serializers;\n\n'); outCpp.write('\tvoid initTextSerializers() {\n'); outCpp.write(textSerializeInit); diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp deleted file mode 100644 index 86493e522..000000000 --- a/Telegram/SourceFiles/mtproto/mtp.cpp +++ /dev/null @@ -1,911 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#include "stdafx.h" -#include "mtp.h" - -#include "localstorage.h" - -namespace { - typedef QMap Sessions; - Sessions sessions; - MTProtoSession *mainSession; - - typedef QMap RequestsByDC; // holds dcWithShift for request to this dc or -dc for request to main dc - RequestsByDC requestsByDC; - QMutex requestByDCLock; - - typedef QMap AuthExportRequests; // holds target dcWithShift for auth export request - AuthExportRequests authExportRequests; - - bool _started = false; - - uint32 layer; - - typedef QMap ParserMap; - ParserMap parserMap; - QMutex parserMapLock; - - typedef QMap RequestMap; - RequestMap requestMap; - QReadWriteLock requestMapLock; - - typedef QPair DelayedRequest; - typedef QList DelayedRequestsList; - DelayedRequestsList delayedRequests; - - typedef QMap RequestsDelays; - RequestsDelays requestsDelays; - - typedef QSet BadGuestDCRequests; - BadGuestDCRequests badGuestDCRequests; - - typedef QVector DCAuthWaiters; - typedef QMap AuthWaiters; // holds request ids waiting for auth import to specific dc - AuthWaiters authWaiters; - - typedef OrderedSet MTPQuittingConnections; - MTPQuittingConnections quittingConnections; - - QMutex toClearLock; - RPCCallbackClears toClear; - - RPCResponseHandler globalHandler; - MTPStateChangedHandler stateChangedHandler = 0; - MTPSessionResetHandler sessionResetHandler = 0; - _mtp_internal::GlobalSlotCarrier *_globalSlotCarrier = 0; - - void importDone(const MTPauth_Authorization &result, mtpRequestId req) { - QMutexLocker locker1(&requestByDCLock); - - RequestsByDC::iterator i = requestsByDC.find(req); - if (i == requestsByDC.end()) { - LOG(("MTP Error: auth import request not found in requestsByDC, requestId: %1").arg(req)); - RPCError error(rpcClientError("AUTH_IMPORT_FAIL", QString("did not find import request in requestsByDC, request %1").arg(req))); - if (globalHandler.onFail && MTP::authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc - return; - } - int32 newdc = i.value() % _mtp_internal::dcShift; - - DEBUG_LOG(("MTP Info: auth import to dc %1 succeeded").arg(newdc)); - - DCAuthWaiters &waiters(authWaiters[newdc]); - if (waiters.size()) { - QReadLocker locker(&requestMapLock); - for (DCAuthWaiters::iterator i = waiters.begin(), e = waiters.end(); i != e; ++i) { - mtpRequestId requestId = *i; - RequestMap::const_iterator j = requestMap.constFind(requestId); - if (j == requestMap.cend()) { - LOG(("MTP Error: could not find request %1 for resending").arg(requestId)); - continue; - } - int32 dcWithShift = newdc; - { - RequestsByDC::iterator k = requestsByDC.find(requestId); - if (k == requestsByDC.cend()) { - LOG(("MTP Error: could not find request %1 by dc for resending").arg(requestId)); - continue; - } - if (k.value() < 0) { - MTP::setdc(newdc); - k.value() = -newdc; - } else { - int32 shift = k.value() - (k.value() % _mtp_internal::dcShift); - dcWithShift += shift; - k.value() = dcWithShift; - } - DEBUG_LOG(("MTP Info: resending request %1 to dc %2 after import auth").arg(requestId).arg(k.value())); - } - if (MTProtoSession *session = _mtp_internal::getSession(dcWithShift)) { - session->sendPrepared(j.value()); - } - } - waiters.clear(); - } - } - - bool importFail(const RPCError &error, mtpRequestId req) { - if (mtpIsFlood(error)) return false; - - if (globalHandler.onFail && MTP::authedId()) (*globalHandler.onFail)(req, error); // auth import failed - return true; - } - - void exportDone(const MTPauth_ExportedAuthorization &result, mtpRequestId req) { - AuthExportRequests::const_iterator i = authExportRequests.constFind(req); - if (i == authExportRequests.cend()) { - LOG(("MTP Error: auth export request target dcWithShift not found, requestId: %1").arg(req)); - RPCError error(rpcClientError("AUTH_IMPORT_FAIL", QString("did not find target dcWithShift, request %1").arg(req))); - if (globalHandler.onFail && MTP::authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc - return; - } - - const MTPDauth_exportedAuthorization &data(result.c_auth_exportedAuthorization()); - MTP::send(MTPauth_ImportAuthorization(data.vid, data.vbytes), rpcDone(importDone), rpcFail(importFail), i.value()); - authExportRequests.remove(req); - } - - bool exportFail(const RPCError &error, mtpRequestId req) { - if (mtpIsFlood(error)) return false; - - AuthExportRequests::const_iterator i = authExportRequests.constFind(req); - if (i != authExportRequests.cend()) { - authWaiters[i.value() % _mtp_internal::dcShift].clear(); - } - if (globalHandler.onFail && MTP::authedId()) (*globalHandler.onFail)(req, error); // auth failed in main dc - return true; - } - - bool onErrorDefault(mtpRequestId requestId, const RPCError &error) { - const QString &err(error.type()); - int32 code = error.code(); - if (!mtpIsFlood(error) && err != qsl("AUTH_KEY_UNREGISTERED")) { - int breakpoint = 0; - } - bool badGuestDC = (code == 400) && (err == qsl("FILE_ID_INVALID")); - QRegularExpressionMatch m; - if ((m = QRegularExpression("^(FILE|PHONE|NETWORK|USER)_MIGRATE_(\\d+)$").match(err)).hasMatch()) { - if (!requestId) return false; - - int32 dcWithShift = 0, newdcWithShift = m.captured(2).toInt(); - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId); - if (i == requestsByDC.end()) { - LOG(("MTP Error: could not find request %1 for migrating to %2").arg(requestId).arg(newdcWithShift)); - } else { - dcWithShift = i.value(); - } - } - if (!dcWithShift || !newdcWithShift) return false; - - DEBUG_LOG(("MTP Info: changing request %1 from dcWithShift%2 to dc%3").arg(requestId).arg(dcWithShift).arg(newdcWithShift)); - if (dcWithShift < 0) { // newdc shift = 0 - if (false && MTP::authedId() && !authExportRequests.contains(requestId)) { // migrate not supported at this moment - DEBUG_LOG(("MTP Info: importing auth to dc %1").arg(newdcWithShift)); - DCAuthWaiters &waiters(authWaiters[newdcWithShift]); - if (!waiters.size()) { - authExportRequests.insert(MTP::send(MTPauth_ExportAuthorization(MTP_int(newdcWithShift)), rpcDone(exportDone), rpcFail(exportFail)), newdcWithShift); - } - waiters.push_back(requestId); - return true; - } else { - MTP::setdc(newdcWithShift); - } - } else { - int32 shift = dcWithShift - (dcWithShift % _mtp_internal::dcShift); - newdcWithShift += shift; - } - - mtpRequest req; - { - QReadLocker locker(&requestMapLock); - RequestMap::const_iterator i = requestMap.constFind(requestId); - if (i == requestMap.cend()) { - LOG(("MTP Error: could not find request %1").arg(requestId)); - return false; - } - req = i.value(); - } - if (MTProtoSession *session = _mtp_internal::getSession(newdcWithShift)) { - _mtp_internal::registerRequest(requestId, (dcWithShift < 0) ? -newdcWithShift : newdcWithShift); - session->sendPrepared(req); - } - return true; - } else if (code < 0 || code >= 500 || (m = QRegularExpression("^FLOOD_WAIT_(\\d+)$").match(err)).hasMatch()) { - if (!requestId) return false; - - int32 secs = 1; - if (code < 0 || code >= 500) { - RequestsDelays::iterator i = requestsDelays.find(requestId); - if (i != requestsDelays.cend()) { - secs = (i.value() > 60) ? i.value() : (i.value() *= 2); - } else { - requestsDelays.insert(requestId, secs); - } - } else { - secs = m.captured(1).toInt(); - if (secs >= 60) return false; - } - uint64 sendAt = getms(true) + secs * 1000 + 10; - DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end(); - for (; i != e; ++i) { - if (i->first == requestId) return true; - if (i->second > sendAt) break; - } - delayedRequests.insert(i, DelayedRequest(requestId, sendAt)); - - if (_globalSlotCarrier) _globalSlotCarrier->checkDelayed(); - - return true; - } else if (code == 401 || (badGuestDC && badGuestDCRequests.constFind(requestId) == badGuestDCRequests.cend())) { - int32 dcWithShift = 0; - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId); - if (i != requestsByDC.end()) { - dcWithShift = i.value(); - } else { - LOG(("MTP Error: unauthorized request without dc info, requestId %1").arg(requestId)); - } - } - int32 newdc = abs(dcWithShift) % _mtp_internal::dcShift; - if (!newdc || newdc == mtpMainDC() || !MTP::authedId()) { - if (!badGuestDC && globalHandler.onFail) (*globalHandler.onFail)(requestId, error); // auth failed in main dc - return false; - } - - DEBUG_LOG(("MTP Info: importing auth to dcWithShift %1").arg(dcWithShift)); - DCAuthWaiters &waiters(authWaiters[newdc]); - if (!waiters.size()) { - authExportRequests.insert(MTP::send(MTPauth_ExportAuthorization(MTP_int(newdc)), rpcDone(exportDone), rpcFail(exportFail)), abs(dcWithShift)); - } - waiters.push_back(requestId); - if (badGuestDC) badGuestDCRequests.insert(requestId); - return true; - } else if (err == qsl("CONNECTION_NOT_INITED") || err == qsl("CONNECTION_LAYER_INVALID")) { - mtpRequest req; - { - QReadLocker locker(&requestMapLock); - RequestMap::const_iterator i = requestMap.constFind(requestId); - if (i == requestMap.cend()) { - LOG(("MTP Error: could not find request %1").arg(requestId)); - return false; - } - req = i.value(); - } - int32 dcWithShift = 0; - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId); - if (i == requestsByDC.end()) { - LOG(("MTP Error: could not find request %1 for resending with init connection").arg(requestId)); - } else { - dcWithShift = i.value(); - } - } - if (!dcWithShift) return false; - - if (MTProtoSession *session = _mtp_internal::getSession(dcWithShift < 0 ? (-dcWithShift) : dcWithShift)) { - req->needsLayer = true; - session->sendPrepared(req); - } - return true; - } else if (err == qsl("MSG_WAIT_FAILED")) { - mtpRequest req; - { - QReadLocker locker(&requestMapLock); - RequestMap::const_iterator i = requestMap.constFind(requestId); - if (i == requestMap.cend()) { - LOG(("MTP Error: could not find request %1").arg(requestId)); - return false; - } - req = i.value(); - } - if (!req->after) { - LOG(("MTP Error: wait failed for not dependent request %1").arg(requestId)); - return false; - } - int32 dcWithShift = 0; - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId), j = requestsByDC.find(req->after->requestId); - if (i == requestsByDC.end()) { - LOG(("MTP Error: could not find request %1 by dc").arg(requestId)); - } else if (j == requestsByDC.end()) { - LOG(("MTP Error: could not find dependent request %1 by dc").arg(req->after->requestId)); - } else { - dcWithShift = i.value(); - if (i.value() != j.value()) { - req->after = mtpRequest(); - } - } - } - if (!dcWithShift) return false; - - if (!req->after) { - if (MTProtoSession *session = _mtp_internal::getSession(dcWithShift < 0 ? (-dcWithShift) : dcWithShift)) { - req->needsLayer = true; - session->sendPrepared(req); - } - } else { - int32 newdc = abs(dcWithShift) % _mtp_internal::dcShift; - DCAuthWaiters &waiters(authWaiters[newdc]); - if (waiters.indexOf(req->after->requestId) >= 0) { - if (waiters.indexOf(requestId) < 0) { - waiters.push_back(requestId); - } - if (badGuestDCRequests.constFind(req->after->requestId) != badGuestDCRequests.cend()) { - if (badGuestDCRequests.constFind(requestId) == badGuestDCRequests.cend()) { - badGuestDCRequests.insert(requestId); - } - } - } else { - uint64 at = 0; - DelayedRequestsList::iterator i = delayedRequests.begin(), e = delayedRequests.end(); - for (; i != e; ++i) { - if (i->first == requestId) return true; - if (i->first == req->after->requestId) break; - } - if (i != e) { - delayedRequests.insert(i, DelayedRequest(requestId, i->second)); - } - - if (_globalSlotCarrier) _globalSlotCarrier->checkDelayed(); - } - } - return true; - } - if (badGuestDC) badGuestDCRequests.remove(requestId); - return false; - } - - bool _paused = false; - -} - -namespace _mtp_internal { - MTProtoSession *getSession(int32 dcWithShift) { - if (!_started) return 0; - if (!dcWithShift) return mainSession; - if (!(dcWithShift % _mtp_internal::dcShift)) { - dcWithShift += (mainSession->getDcWithShift() % _mtp_internal::dcShift); - } - - Sessions::const_iterator i = sessions.constFind(dcWithShift); - if (i == sessions.cend()) { - i = sessions.insert(dcWithShift, new MTProtoSession(dcWithShift)); - } - return i.value(); - } - - bool paused() { - return _paused; - } - - void registerRequest(mtpRequestId requestId, int32 dcWithShift) { - { - QMutexLocker locker(&requestByDCLock); - requestsByDC.insert(requestId, dcWithShift); - } - _mtp_internal::performDelayedClear(); // need to do it somewhere.. - } - - void unregisterRequest(mtpRequestId requestId) { - requestsDelays.remove(requestId); - - { - QWriteLocker locker(&requestMapLock); - requestMap.remove(requestId); - } - - QMutexLocker locker(&requestByDCLock); - requestsByDC.remove(requestId); - } - - mtpRequestId storeRequest(mtpRequest &request, const RPCResponseHandler &parser) { - mtpRequestId res = reqid(); - request->requestId = res; - if (parser.onDone || parser.onFail) { - QMutexLocker locker(&parserMapLock); - parserMap.insert(res, parser); - } - { - QWriteLocker locker(&requestMapLock); - requestMap.insert(res, request); - } - return res; - } - - mtpRequest getRequest(mtpRequestId reqId) { - static mtpRequest zero; - mtpRequest req; - { - QReadLocker locker(&requestMapLock); - RequestMap::const_iterator i = requestMap.constFind(reqId); - req = (i == requestMap.cend()) ? zero : i.value(); - } - return req; - } - - void wrapInvokeAfter(mtpRequest &to, const mtpRequest &from, const mtpRequestMap &haveSent, int32 skipBeforeRequest) { - mtpMsgId afterId(*(mtpMsgId*)(from->after->data() + 4)); - mtpRequestMap::const_iterator i = afterId ? haveSent.constFind(afterId) : haveSent.cend(); - int32 size = to->size(), lenInInts = (from.innerLength() >> 2), headlen = 4, fulllen = headlen + lenInInts; - if (i == haveSent.constEnd()) { // no invoke after or such msg was not sent or was completed recently - to->resize(size + fulllen + skipBeforeRequest); - if (skipBeforeRequest) { - memcpy(to->data() + size, from->constData() + 4, headlen * sizeof(mtpPrime)); - memcpy(to->data() + size + headlen + skipBeforeRequest, from->constData() + 4 + headlen, lenInInts * sizeof(mtpPrime)); - } else { - memcpy(to->data() + size, from->constData() + 4, fulllen * sizeof(mtpPrime)); - } - } else { - to->resize(size + fulllen + skipBeforeRequest + 3); - memcpy(to->data() + size, from->constData() + 4, headlen * sizeof(mtpPrime)); - (*to)[size + 3] += 3 * sizeof(mtpPrime); - *((mtpTypeId*)&((*to)[size + headlen + skipBeforeRequest])) = mtpc_invokeAfterMsg; - memcpy(to->data() + size + headlen + skipBeforeRequest + 1, &afterId, 2 * sizeof(mtpPrime)); - memcpy(to->data() + size + headlen + skipBeforeRequest + 3, from->constData() + 4 + headlen, lenInInts * sizeof(mtpPrime)); - if (size + 3 != 7) (*to)[7] += 3 * sizeof(mtpPrime); - } - } - - void clearCallbacks(mtpRequestId requestId, int32 errorCode) { - RPCResponseHandler h; - bool found = false; - { - QMutexLocker locker(&parserMapLock); - ParserMap::iterator i = parserMap.find(requestId); - if (i != parserMap.end()) { - h = i.value(); - found = true; - - parserMap.erase(i); - } - } - if (errorCode && found) { - rpcErrorOccured(requestId, h, rpcClientError("CLEAR_CALLBACK", QString("did not handle request %1, error code %2").arg(requestId).arg(errorCode))); - } - } - - void clearCallbacksDelayed(const RPCCallbackClears &requestIds) { - uint32 idsCount = requestIds.size(); - if (!idsCount) return; - - if (cDebug()) { - QString idsStr = QString("%1").arg(requestIds[0].requestId); - for (uint32 i = 1; i < idsCount; ++i) { - idsStr += QString(", %1").arg(requestIds[i].requestId); - } - DEBUG_LOG(("RPC Info: clear callbacks delayed, msgIds: %1").arg(idsStr)); - } - - QMutexLocker lock(&toClearLock); - uint32 toClearNow = toClear.size(); - if (toClearNow) { - toClear.resize(toClearNow + idsCount); - memcpy(toClear.data() + toClearNow, requestIds.constData(), idsCount * sizeof(RPCCallbackClear)); - } else { - toClear = requestIds; - } - } - - void performDelayedClear() { - QMutexLocker lock(&toClearLock); - if (!toClear.isEmpty()) { - for (RPCCallbackClears::iterator i = toClear.begin(), e = toClear.end(); i != e; ++i) { - if (cDebug()) { - QMutexLocker locker(&parserMapLock); - if (parserMap.find(i->requestId) != parserMap.end()) { - DEBUG_LOG(("RPC Info: clearing delayed callback %1, error code %2").arg(i->requestId).arg(i->errorCode)); - } - } - clearCallbacks(i->requestId, i->errorCode); - _mtp_internal::unregisterRequest(i->requestId); - } - toClear.clear(); - } - } - - void execCallback(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) { - RPCResponseHandler h; - { - QMutexLocker locker(&parserMapLock); - ParserMap::iterator i = parserMap.find(requestId); - if (i != parserMap.cend()) { - h = i.value(); - parserMap.erase(i); - - DEBUG_LOG(("RPC Info: found parser for request %1, trying to parse response..").arg(requestId)); - } - } - if (h.onDone || h.onFail) { - try { - if (from >= end) throw mtpErrorInsufficient(); - - if (*from == mtpc_rpc_error) { - RPCError err(MTPRpcError(from, end)); - DEBUG_LOG(("RPC Info: error received, code %1, type %2, description: %3").arg(err.code()).arg(err.type()).arg(err.description())); - if (!rpcErrorOccured(requestId, h, err)) { - QMutexLocker locker(&parserMapLock); - parserMap.insert(requestId, h); - return; - } - } else { - if (h.onDone) { -// t_assert(App::app() != 0); - (*h.onDone)(requestId, from, end); - } - } - } catch (Exception &e) { - if (!rpcErrorOccured(requestId, h, rpcClientError("RESPONSE_PARSE_FAILED", QString("exception text: ") + e.what()))) { - QMutexLocker locker(&parserMapLock); - parserMap.insert(requestId, h); - return; - } - } - } else { - DEBUG_LOG(("RPC Info: parser not found for %1").arg(requestId)); - } - unregisterRequest(requestId); - } - - bool hasCallbacks(mtpRequestId requestId) { - QMutexLocker locker(&parserMapLock); - ParserMap::iterator i = parserMap.find(requestId); - return (i != parserMap.cend()); - } - - void globalCallback(const mtpPrime *from, const mtpPrime *end) { - if (globalHandler.onDone) (*globalHandler.onDone)(0, from, end); // some updates were received - } - - void onStateChange(int32 dcWithShift, int32 state) { - if (stateChangedHandler) stateChangedHandler(dcWithShift, state); - } - - void onSessionReset(int32 dcWithShift) { - if (sessionResetHandler) sessionResetHandler(dcWithShift); - } - - bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err) { // return true if need to clean request data - if (mtpIsFlood(err)) { - if (onFail && (*onFail)(requestId, err)) return true; - } - - if (onErrorDefault(requestId, err)) { - return false; - } - LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg(requestId).arg(err.code()).arg(err.type()).arg(err.description().isEmpty() ? QString() : QString(": %1").arg(err.description()))); - onFail && (*onFail)(requestId, err); - return true; - } - - GlobalSlotCarrier::GlobalSlotCarrier() { - connect(&_timer, SIGNAL(timeout()), this, SLOT(checkDelayed())); - } - - void GlobalSlotCarrier::checkDelayed() { - uint64 now = getms(true); - while (!delayedRequests.isEmpty() && now >= delayedRequests.front().second) { - mtpRequestId requestId = delayedRequests.front().first; - delayedRequests.pop_front(); - - int32 dcWithShift = 0; - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::const_iterator i = requestsByDC.constFind(requestId); - if (i != requestsByDC.cend()) { - dcWithShift = i.value(); - } else { - LOG(("MTP Error: could not find request dc for delayed resend, requestId %1").arg(requestId)); - continue; - } - } - - mtpRequest req; - { - QReadLocker locker(&requestMapLock); - RequestMap::const_iterator j = requestMap.constFind(requestId); - if (j == requestMap.cend()) { - DEBUG_LOG(("MTP Error: could not find request %1").arg(requestId)); - continue; - } - req = j.value(); - } - if (MTProtoSession *session = _mtp_internal::getSession(dcWithShift < 0 ? (-dcWithShift) : dcWithShift)) { - session->sendPrepared(req); - } - } - - if (!delayedRequests.isEmpty()) { - _timer.start(delayedRequests.front().second - now); - } - } - - void GlobalSlotCarrier::connectionFinished(MTProtoConnection *connection) { - MTPQuittingConnections::iterator i = quittingConnections.find(connection); - if (i != quittingConnections.cend()) { - quittingConnections.erase(i); - } - - connection->waitTillFinish(); - delete connection; - } - - GlobalSlotCarrier *globalSlotCarrier() { - return _globalSlotCarrier; - } - - void queueQuittingConnection(MTProtoConnection *connection) { - quittingConnections.insert(connection); - } - -}; - -namespace MTP { - - const uint32 cfg = 1 * _mtp_internal::dcShift; // send(MTPhelp_GetConfig(), MTP::cfg + dc) - for dc enum - const uint32 lgt = 2 * _mtp_internal::dcShift; // send(MTPauth_LogOut(), MTP::lgt + dc) - for logout of guest dcs enum - const uint32 dldStart = dld(0), dldEnd = dld(MTPDownloadSessionsCount - 1) + _mtp_internal::dcShift; - const uint32 uplStart = upl(0), uplEnd = upl(MTPUploadSessionsCount - 1) + _mtp_internal::dcShift; - - void start() { - if (started()) return; - - unixtimeInit(); - - MTProtoDCMap &dcs(mtpDCMap()); - - _globalSlotCarrier = new _mtp_internal::GlobalSlotCarrier(); - - mainSession = new MTProtoSession(mtpMainDC()); - sessions.insert(mainSession->getDcWithShift(), mainSession); - - _started = true; - - if (mtpNeedConfig()) { - mtpConfigLoader()->load(); - } - } - - bool started() { - return _started; - } - - void restart() { - if (!_started) return; - - for (Sessions::const_iterator i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { - i.value()->restart(); - } - } - - void restart(int32 dcMask) { - if (!_started) return; - - dcMask %= _mtp_internal::dcShift; - for (Sessions::const_iterator i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { - if ((i.value()->getDcWithShift() % int(_mtp_internal::dcShift)) == dcMask) { - i.value()->restart(); - } - } - } - - void pause() { - if (!_started) return; - _paused = true; - } - - void unpause() { - if (!_started) return; - _paused = false; - for (Sessions::const_iterator i = sessions.cbegin(), e = sessions.cend(); i != e; ++i) { - i.value()->unpaused(); - } - } - - void configure(int32 dc, int32 user) { - if (_started) return; - mtpSetDC(dc); - mtpAuthed(user); - } - - void setdc(int32 dc, bool fromZeroOnly) { - if (!dc || !_started) return; - mtpSetDC(dc, fromZeroOnly); - int32 oldMainDc = mainSession->getDcWithShift(); - if (maindc() != oldMainDc) { - killSession(oldMainDc); - } - Local::writeMtpData(); - } - - int32 maindc() { - return mtpMainDC(); - } - - int32 dcstate(int32 dc) { - if (!_started) return 0; - - if (!dc) return mainSession->getState(); - if (!(dc % _mtp_internal::dcShift)) { - dc += (mainSession->getDcWithShift() % _mtp_internal::dcShift); - } - - Sessions::const_iterator i = sessions.constFind(dc); - if (i != sessions.cend()) return i.value()->getState(); - - return MTProtoConnection::Disconnected; - } - - QString dctransport(int32 dc) { - if (!_started) return QString(); - - if (!dc) return mainSession->transport(); - if (!(dc % _mtp_internal::dcShift)) { - dc += (mainSession->getDcWithShift() % _mtp_internal::dcShift); - } - - Sessions::const_iterator i = sessions.constFind(dc); - if (i != sessions.cend()) return i.value()->transport(); - - return QString(); - } - - void ping() { - if (MTProtoSession *session = _mtp_internal::getSession(0)) { - session->ping(); - } - } - - void cancel(mtpRequestId requestId) { - if (!_started) return; - - mtpMsgId msgId = 0; - requestsDelays.remove(requestId); - { - QWriteLocker locker(&requestMapLock); - RequestMap::iterator i = requestMap.find(requestId); - if (i != requestMap.end()) { - msgId = *(mtpMsgId*)(i.value()->constData() + 4); - requestMap.erase(i); - } - } - { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId); - if (i != requestsByDC.end()) { - if (MTProtoSession *session = _mtp_internal::getSession(abs(i.value()))) { - session->cancel(requestId, msgId); - } - requestsByDC.erase(i); - } - } - _mtp_internal::clearCallbacks(requestId); - } - - void killSession(int32 dc) { - Sessions::iterator i = sessions.find(dc); - if (i != sessions.cend()) { - bool wasMain = (i.value() == mainSession); - - i.value()->kill(); - i.value()->deleteLater(); - sessions.erase(i); - - if (wasMain) { - mainSession = new MTProtoSession(mtpMainDC()); - int32 newdc = mainSession->getDcWithShift(); - i = sessions.find(newdc); - if (i != sessions.cend()) { - i.value()->kill(); - i.value()->deleteLater(); - sessions.erase(i); - } - sessions.insert(newdc, mainSession); - } - } - } - - void stopSession(int32 dc) { - Sessions::iterator i = sessions.find(dc); - if (i != sessions.end()) { - if (i.value() != mainSession) { // don't stop main session - i.value()->stop(); - } - } - } - - int32 state(mtpRequestId requestId) { - if (requestId > 0) { - QMutexLocker locker(&requestByDCLock); - RequestsByDC::iterator i = requestsByDC.find(requestId); - if (i != requestsByDC.end()) { - if (MTProtoSession *session = _mtp_internal::getSession(abs(i.value()))) { - return session->requestState(requestId); - } - return MTP::RequestConnecting; - } - return MTP::RequestSent; - } - if (MTProtoSession *session = _mtp_internal::getSession(-requestId)) { - return session->requestState(0); - } - return MTP::RequestConnecting; - } - - void finish() { - for (Sessions::iterator i = sessions.begin(), e = sessions.end(); i != e; ++i) { - i.value()->kill(); - delete i.value(); - } - sessions.clear(); - mainSession = nullptr; - - for (MTPQuittingConnections::const_iterator i = quittingConnections.cbegin(), e = quittingConnections.cend(); i != e; ++i) { - i.key()->waitTillFinish(); - delete i.key(); - } - quittingConnections.clear(); - - delete _globalSlotCarrier; - _globalSlotCarrier = nullptr; - - mtpDestroyConfigLoader(); - - _started = false; - } - - void authed(int32 uid) { - mtpAuthed(uid); - } - - int32 authedId() { - return mtpAuthed(); - } - - void logoutKeys(RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) { - mtpRequestId req = MTP::send(MTPauth_LogOut(), onDone, onFail); - mtpLogoutOtherDCs(); - } - - void setGlobalDoneHandler(RPCDoneHandlerPtr handler) { - globalHandler.onDone = handler; - } - - void setGlobalFailHandler(RPCFailHandlerPtr handler) { - globalHandler.onFail = handler; - } - - void setStateChangedHandler(MTPStateChangedHandler handler) { - stateChangedHandler = handler; - } - - void setSessionResetHandler(MTPSessionResetHandler handler) { - sessionResetHandler = handler; - } - - void clearGlobalHandlers() { - setGlobalDoneHandler(RPCDoneHandlerPtr()); - setGlobalFailHandler(RPCFailHandlerPtr()); - setStateChangedHandler(0); - setSessionResetHandler(0); - } - - void updateDcOptions(const QVector &options) { - mtpUpdateDcOptions(options); - Local::writeSettings(); - } - - mtpKeysMap getKeys() { - return mtpGetKeys(); - } - - void setKey(int32 dc, mtpAuthKeyPtr key) { - return mtpSetKey(dc, key); - } - - QReadWriteLock *dcOptionsMutex() { - return mtpDcOptionsMutex(); - } - -}; diff --git a/Telegram/SourceFiles/mtproto/mtp.h b/Telegram/SourceFiles/mtproto/mtp.h deleted file mode 100644 index 689665b81..000000000 --- a/Telegram/SourceFiles/mtproto/mtp.h +++ /dev/null @@ -1,163 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#pragma once - -#include "mtproto/mtpSession.h" -#include "mtproto/mtpFileLoader.h" - -namespace _mtp_internal { - MTProtoSession *getSession(int32 dc); // 0 - current set dc - - bool paused(); - - void registerRequest(mtpRequestId requestId, int32 dc); - void unregisterRequest(mtpRequestId requestId); - - static const uint32 dcShift = 10000; - - mtpRequestId storeRequest(mtpRequest &request, const RPCResponseHandler &parser); - mtpRequest getRequest(mtpRequestId req); - void wrapInvokeAfter(mtpRequest &to, const mtpRequest &from, const mtpRequestMap &haveSent, int32 skipBeforeRequest = 0); - void clearCallbacks(mtpRequestId requestId, int32 errorCode = RPCError::NoError); // 0 - do not toggle onError callback - void clearCallbacksDelayed(const RPCCallbackClears &requestIds); - void performDelayedClear(); - void execCallback(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end); - bool hasCallbacks(mtpRequestId requestId); - void globalCallback(const mtpPrime *from, const mtpPrime *end); - void onStateChange(int32 dcWithShift, int32 state); - void onSessionReset(int32 dcWithShift); - bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err); // return true if need to clean request data - inline bool rpcErrorOccured(mtpRequestId requestId, const RPCResponseHandler &handler, const RPCError &err) { - return rpcErrorOccured(requestId, handler.onFail, err); - } - - // used for: - // - resending requests by timer which were postponed by flood delay - // - destroying MTProtoConnections whose thread has finished - class GlobalSlotCarrier : public QObject { - Q_OBJECT - - public: - - GlobalSlotCarrier(); - - public slots: - - void checkDelayed(); - void connectionFinished(MTProtoConnection *connection); - - private: - - SingleTimer _timer; - }; - - GlobalSlotCarrier *globalSlotCarrier(); - void queueQuittingConnection(MTProtoConnection *connection); -}; - -namespace MTP { - - extern const uint32 cfg; // send(MTPhelp_GetConfig(), MTP::cfg + dc) - for dc enum - extern const uint32 lgt; // send(MTPauth_LogOut(), MTP::lgt + dc) - for logout of guest dcs enum - inline uint32 dld(int32 index) { // send(req, callbacks, MTP::dld(i) + dc) - for download - t_assert(index >= 0 && index < MTPDownloadSessionsCount); - return (0x10 + index) * _mtp_internal::dcShift; - }; - inline uint32 upl(int32 index) { // send(req, callbacks, MTP::upl(i) + dc) - for upload - t_assert(index >= 0 && index < MTPUploadSessionsCount); - return (0x20 + index) * _mtp_internal::dcShift; - }; - extern const uint32 dldStart, dldEnd; // dc >= dldStart && dc < dldEnd => dc in dld - extern const uint32 uplStart, uplEnd; // dc >= uplStart && dc < uplEnd => dc in upl - - void start(); - bool started(); - void restart(); - void restart(int32 dcMask); - - void pause(); - void unpause(); - - void configure(int32 dc, int32 user); - - void setdc(int32 dc, bool fromZeroOnly = false); - int32 maindc(); - - int32 dcstate(int32 dc = 0); - QString dctransport(int32 dc = 0); - - template - inline mtpRequestId send(const TRequest &request, RPCResponseHandler callbacks = RPCResponseHandler(), int32 dc = 0, uint64 msCanWait = 0, mtpRequestId after = 0) { - if (MTProtoSession *session = _mtp_internal::getSession(dc)) { - return session->send(request, callbacks, msCanWait, true, !dc, after); - } - return 0; - } - template - inline mtpRequestId send(const TRequest &request, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail = RPCFailHandlerPtr(), int32 dc = 0, uint64 msCanWait = 0, mtpRequestId after = 0) { - return send(request, RPCResponseHandler(onDone, onFail), dc, msCanWait, after); - } - inline void sendAnything(int32 dc = 0, uint64 msCanWait = 0) { - if (MTProtoSession *session = _mtp_internal::getSession(dc)) { - return session->sendAnything(msCanWait); - } - } - void ping(); - void cancel(mtpRequestId req); - void killSession(int32 dc); - void stopSession(int32 dc); - - enum { - RequestSent = 0, - RequestConnecting = 1, - RequestSending = 2 - }; - int32 state(mtpRequestId req); // < 0 means waiting for such count of ms - - void finish(); - - void authed(int32 uid); - int32 authedId(); - void logoutKeys(RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail); - - void setGlobalDoneHandler(RPCDoneHandlerPtr handler); - void setGlobalFailHandler(RPCFailHandlerPtr handler); - void setStateChangedHandler(MTPStateChangedHandler handler); - void setSessionResetHandler(MTPSessionResetHandler handler); - void clearGlobalHandlers(); - - void updateDcOptions(const QVector &options); - - template - T nonce() { - T result; - memset_rand(&result, sizeof(T)); - return result; - } - - mtpKeysMap getKeys(); - void setKey(int32 dc, mtpAuthKeyPtr key); - - QReadWriteLock *dcOptionsMutex(); - -}; - -#include "mtproto/mtpSessionImpl.h" diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.h b/Telegram/SourceFiles/mtproto/mtpConnection.h deleted file mode 100644 index 8ac08b94b..000000000 --- a/Telegram/SourceFiles/mtproto/mtpConnection.h +++ /dev/null @@ -1,524 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#pragma once - -#include "mtproto/mtpCoreTypes.h" -#include "mtproto/mtpPublicRSA.h" -#include "mtproto/mtpAuthKey.h" - -inline bool mtpRequestData::isSentContainer(const mtpRequest &request) { // "request-like" wrap for msgIds vector - if (request->size() < 9) return false; - return (!request->msDate && !(*request)[6]); // msDate = 0, seqNo = 0 -} -inline bool mtpRequestData::isStateRequest(const mtpRequest &request) { - if (request->size() < 9) return false; - return (mtpTypeId((*request)[8]) == mtpc_msgs_state_req); -} -inline bool mtpRequestData::needAck(const mtpRequest &request) { - if (request->size() < 9) return false; - return mtpRequestData::needAckByType((*request)[8]); -} -inline bool mtpRequestData::needAckByType(mtpTypeId type) { - switch (type) { - case mtpc_msg_container: - case mtpc_msgs_ack: - case mtpc_http_wait: - case mtpc_bad_msg_notification: - case mtpc_msgs_all_info: - case mtpc_msgs_state_info: - case mtpc_msg_detailed_info: - case mtpc_msg_new_detailed_info: - return false; - } - return true; -} - -class MTProtoConnectionPrivate; -class MTPSessionData; - -class MTPThread : public QThread { - Q_OBJECT - -public: - MTPThread(); - uint32 getThreadId() const; - ~MTPThread(); - -private: - uint32 _threadId; - -}; - -class MTProtoConnection { -public: - - enum ConnectionType { - TcpConnection, - HttpConnection - }; - - MTProtoConnection(); - int32 start(MTPSessionData *data, int32 dc = 0); // return dc - void kill(); - void waitTillFinish(); - ~MTProtoConnection(); - - enum { - Disconnected = 0, - Connecting = 1, - Connected = 2, - - UpdateAlways = 666 - }; - - int32 state() const; - QString transport() const; - -private: - - QThread *thread; - MTProtoConnectionPrivate *data; - -}; - -class MTPabstractConnection : public QObject { - Q_OBJECT - - typedef QList BuffersQueue; - -public: - - MTPabstractConnection() : _sentEncrypted(false) { - } - - void setSentEncrypted() { - _sentEncrypted = true; - } - - virtual void sendData(mtpBuffer &buffer) = 0; // has size + 3, buffer[0] = len, buffer[1] = packetnum, buffer[last] = crc32 - virtual void disconnectFromServer() = 0; - virtual void connectTcp(const QString &addr, int32 port, int32 flags) = 0; - virtual void connectHttp(const QString &addr, int32 port, int32 flags) = 0; - virtual bool isConnected() const = 0; - virtual bool usingHttpWait() { - return false; - } - virtual bool needHttpWait() { - return false; - } - - virtual int32 debugState() const = 0; - - virtual QString transport() const = 0; - - BuffersQueue &received() { - return receivedQueue; - } - -signals: - - void receivedData(); - void receivedSome(); // to stop restart timer - - void error(bool mayBeBadKey = false); - - void connected(); - void disconnected(); - -protected: - - BuffersQueue receivedQueue; // list of received packets, not processed yet - bool _sentEncrypted; - -}; - -class MTPabstractTcpConnection : public MTPabstractConnection { - Q_OBJECT - -public: - - MTPabstractTcpConnection(); - -public slots: - - void socketRead(); - -protected: - - QTcpSocket sock; - uint32 packetNum; // sent packet number - - uint32 packetRead, packetLeft; // reading from socket - bool readingToShort; - char *currentPos; - mtpBuffer longBuffer; - mtpPrime shortBuffer[MTPShortBufferSize]; - virtual void socketPacket(const char *packet, uint32 length) = 0; - -}; - -class MTPautoConnection : public MTPabstractTcpConnection { - Q_OBJECT - -public: - - MTPautoConnection(QThread *thread); - - void sendData(mtpBuffer &buffer); - void disconnectFromServer(); - void connectTcp(const QString &addr, int32 port, int32 flags); - void connectHttp(const QString &addr, int32 port, int32 flags); - bool isConnected() const; - bool usingHttpWait(); - bool needHttpWait(); - - int32 debugState() const; - - QString transport() const; - -public slots: - - void socketError(QAbstractSocket::SocketError e); - void requestFinished(QNetworkReply *reply); - - void onSocketConnected(); - void onSocketDisconnected(); - void onHttpStart(); - - void onTcpTimeoutTimer(); - -protected: - - void socketPacket(const char *packet, uint32 length); - -private: - - void tcpSend(mtpBuffer &buffer); - void httpSend(mtpBuffer &buffer); - enum Status { - WaitingBoth = 0, - WaitingHttp, - WaitingTcp, - HttpReady, - UsingHttp, - UsingTcp, - FinishedWork - }; - Status status; - MTPint128 tcpNonce, httpNonce; - QTimer httpStartTimer; - - QNetworkAccessManager manager; - QUrl address; - - typedef QSet Requests; - Requests requests; - - QString _addrTcp, _addrHttp; - int32 _portTcp, _portHttp, _flagsTcp, _flagsHttp; - int32 _tcpTimeout; - QTimer tcpTimeoutTimer; - -}; - -class MTPtcpConnection : public MTPabstractTcpConnection { - Q_OBJECT - -public: - - MTPtcpConnection(QThread *thread); - - void sendData(mtpBuffer &buffer); - void disconnectFromServer(); - void connectTcp(const QString &addr, int32 port, int32 flags); - void connectHttp(const QString &addr, int32 port, int32 flags) { // not supported - } - bool isConnected() const; - - int32 debugState() const; - - QString transport() const; - -public slots: - - void socketError(QAbstractSocket::SocketError e); - - void onSocketConnected(); - void onSocketDisconnected(); - - void onTcpTimeoutTimer(); - -protected: - - void socketPacket(const char *packet, uint32 length); - -private: - - enum Status { - WaitingTcp = 0, - UsingTcp, - FinishedWork - }; - Status status; - MTPint128 tcpNonce; - - QString _addr; - int32 _port, _tcpTimeout, _flags; - QTimer tcpTimeoutTimer; - -}; - -class MTPhttpConnection : public MTPabstractConnection { - Q_OBJECT - -public: - - MTPhttpConnection(QThread *thread); - - void sendData(mtpBuffer &buffer); - void disconnectFromServer(); - void connectTcp(const QString &addr, int32 port, int32 flags) { // not supported - } - void connectHttp(const QString &addr, int32 port, int32 flags); - bool isConnected() const; - bool usingHttpWait(); - bool needHttpWait(); - - int32 debugState() const; - - QString transport() const; - -public slots: - - void requestFinished(QNetworkReply *reply); - -private: - - enum Status { - WaitingHttp = 0, - UsingHttp, - FinishedWork - }; - Status status; - MTPint128 httpNonce; - int32 _flags; - - QNetworkAccessManager manager; - QUrl address; - - typedef QSet Requests; - Requests requests; - -}; - -class MTProtoConnectionPrivate : public QObject { - Q_OBJECT - -public: - - MTProtoConnectionPrivate(QThread *thread, MTProtoConnection *owner, MTPSessionData *data, uint32 dc); - ~MTProtoConnectionPrivate(); - - void stop(); - - int32 getDC() const; - - int32 getState() const; - QString transport() const; - -signals: - - void needToReceive(); - void needToRestart(); - void stateChanged(qint32 newState); - void sessionResetDone(); - - void needToSendAsync(); - void sendAnythingAsync(quint64 msWait); - void sendHttpWaitAsync(); - void sendPongAsync(quint64 msgId, quint64 pingId); - void sendMsgsStateInfoAsync(quint64 msgId, QByteArray data); - void resendAsync(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo); - void resendManyAsync(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo); - void resendAllAsync(); - - void finished(MTProtoConnection *connection); - -public slots: - - void retryByTimer(); - void restartNow(); - void restart(bool mayBeBadKey = false); - - void onPingSender(); - void onPingSendForce(); - - void onWaitConnectedFailed(); - void onWaitReceivedFailed(); - void onWaitIPv4Failed(); - - void onOldConnection(); - void onSentSome(uint64 size); - void onReceivedSome(); - - void onReadyData(); - void socketStart(bool afterConfig = false); - - void onConnected4(); - void onConnected6(); - void onDisconnected4(); - void onDisconnected6(); - void onError4(bool mayBeBadKey = false); - void onError6(bool mayBeBadKey = false); - - void doFinish(); - - // Auth key creation packet receive slots - void pqAnswered(); - void dhParamsAnswered(); - void dhClientParamsAnswered(); - - // General packet receive slot, connected to conn->receivedData signal - void handleReceived(); - - // Sessions signals, when we need to send something - void tryToSend(); - - void updateAuthKey(); - - void onConfigLoaded(); - -private: - - void doDisconnect(); - - void createConn(bool createIPv4, bool createIPv6); - void destroyConn(MTPabstractConnection **conn = 0); // 0 - destory all - - mtpMsgId placeToContainer(mtpRequest &toSendRequest, mtpMsgId &bigMsgId, mtpMsgId *&haveSentArr, mtpRequest &req); - mtpMsgId prepareToSend(mtpRequest &request, mtpMsgId currentLastId); - mtpMsgId replaceMsgId(mtpRequest &request, mtpMsgId newId); - - bool sendRequest(mtpRequest &request, bool needAnyResponse, QReadLocker &lockFinished); - mtpRequestId wasSent(mtpMsgId msgId) const; - - int32 handleOneReceived(const mtpPrime *from, const mtpPrime *end, uint64 msgId, int32 serverTime, uint64 serverSalt, bool badTime); - mtpBuffer ungzip(const mtpPrime *from, const mtpPrime *end) const; - void handleMsgsStates(const QVector &ids, const string &states, QVector &acked); - - void clearMessages(); - - bool setState(int32 state, int32 ifState = MTProtoConnection::UpdateAlways); - mutable QReadWriteLock stateConnMutex; - int32 _state; - - bool _needSessionReset; - void resetSession(); - - uint32 dc; - MTProtoConnection *_owner; - MTPabstractConnection *_conn, *_conn4, *_conn6; - - SingleTimer retryTimer; // exp retry timer - uint32 retryTimeout; - quint64 retryWillFinish; - - SingleTimer oldConnectionTimer; - bool oldConnection; - - SingleTimer _waitForConnectedTimer, _waitForReceivedTimer, _waitForIPv4Timer; - uint32 _waitForReceived, _waitForConnected; - int64 firstSentAt; - - QVector ackRequestData, resendRequestData; - - // if badTime received - search for ids in sessionData->haveSent and sessionData->wereAcked and sync time/salt, return true if found - bool requestsFixTimeSalt(const QVector &ids, int32 serverTime, uint64 serverSalt); - - // remove msgs with such ids from sessionData->haveSent, add to sessionData->wereAcked - void requestsAcked(const QVector &ids, bool byResponse = false); - - mtpPingId _pingId, _pingIdToSend; - uint64 _pingSendAt; - mtpMsgId _pingMsgId; - SingleTimer _pingSender; - - void resend(quint64 msgId, quint64 msCanWait = 0, bool forceContainer = false, bool sendMsgStateInfo = false); - void resendMany(QVector msgIds, quint64 msCanWait = 0, bool forceContainer = false, bool sendMsgStateInfo = false); - - template - void sendRequestNotSecure(const TRequest &request); - - template - bool readResponseNotSecure(TResponse &response); - - bool restarted, _finished; - - uint64 keyId; - QReadWriteLock sessionDataMutex; - MTPSessionData *sessionData; - bool myKeyLock; - void lockKey(); - void unlockKey(); - - // Auth key creation fields and methods - struct AuthKeyCreateData { - AuthKeyCreateData() - : new_nonce(*(MTPint256*)((uchar*)new_nonce_buf)) - , auth_key_aux_hash(*(MTPlong*)((uchar*)new_nonce_buf + 33)) - , retries(0) - , g(0) - , req_num(0) - , msgs_sent(0) { - memset(new_nonce_buf, 0, sizeof(new_nonce_buf)); - memset(aesKey, 0, sizeof(aesKey)); - memset(aesIV, 0, sizeof(aesIV)); - memset(auth_key, 0, sizeof(auth_key)); - } - MTPint128 nonce, server_nonce; - uchar new_nonce_buf[41]; // 32 bytes new_nonce + 1 check byte + 8 bytes of auth_key_aux_hash - MTPint256 &new_nonce; - MTPlong &auth_key_aux_hash; - - uint32 retries; - MTPlong retry_id; - - int32 g; - - uchar aesKey[32], aesIV[32]; - uint32 auth_key[64]; - MTPlong auth_key_hash; - - uint32 req_num; // sent not encrypted request number - uint32 msgs_sent; - }; - struct AuthKeyCreateStrings { - QByteArray dh_prime; - QByteArray g_a; - }; - AuthKeyCreateData *authKeyData; - AuthKeyCreateStrings *authKeyStrings; - - void dhClientParamsSend(); - void authKeyCreated(); - void clearAuthKeyData(); - -}; diff --git a/Telegram/SourceFiles/mtproto/mtpPublicRSA.h b/Telegram/SourceFiles/mtproto/mtpPublicRSA.h deleted file mode 100644 index 0827ebfac..000000000 --- a/Telegram/SourceFiles/mtproto/mtpPublicRSA.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#pragma once - -class mtpPublicRSA { -public: - mtpPublicRSA(const char *key) : data(new mtpPublicRSAInner(PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast(key), -1), 0, 0, 0), 0)) { - if (!data->prsa) return; - - int32 nBytes = BN_num_bytes(data->prsa->n); - int32 eBytes = BN_num_bytes(data->prsa->e); - string nStr(nBytes, 0), eStr(eBytes, 0); - BN_bn2bin(data->prsa->n, (uchar*)&nStr[0]); - BN_bn2bin(data->prsa->e, (uchar*)&eStr[0]); - - mtpBuffer tmp; - MTP_string(nStr).write(tmp); - MTP_string(eStr).write(tmp); - - uchar sha1Buffer[20]; - data->fp = *(uint64*)(hashSha1(&tmp[0], tmp.size() * sizeof(mtpPrime), sha1Buffer) + 3); - } - - mtpPublicRSA(const mtpPublicRSA &v) : data(v.data) { - ++data->cnt; - } - - mtpPublicRSA &operator=(const mtpPublicRSA &v) { - if (data != v.data) { - destroy(); - data = v.data; - ++data->cnt; - } - return *this; - } - - uint64 fingerPrint() const { - return data->fp; - } - - RSA *key() { - return data->prsa; - } - - ~mtpPublicRSA() { - destroy(); - } - -private: - void destroy() { - if (!--data->cnt) { - delete data; - } - } - - struct mtpPublicRSAInner { - mtpPublicRSAInner(RSA *_prsa, uint64 _fp) : prsa(_prsa), cnt(1), fp(_fp) { - } - ~mtpPublicRSAInner() { - RSA_free(prsa); - } - RSA *prsa; - uint32 cnt; - uint64 fp; - }; - mtpPublicRSAInner *data; -}; diff --git a/Telegram/SourceFiles/mtproto/mtpSessionImpl.h b/Telegram/SourceFiles/mtproto/mtpSessionImpl.h deleted file mode 100644 index 465a2f7f8..000000000 --- a/Telegram/SourceFiles/mtproto/mtpSessionImpl.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop version of Telegram messaging app, see https://telegram.org - -Telegram Desktop is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -It is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -In addition, as a special exception, the copyright holders give permission -to link the code of portions of this program with the OpenSSL library. - -Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE -Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org -*/ -#pragma once - -template -mtpRequestId MTProtoSession::send(const TRequest &request, RPCResponseHandler callbacks, uint64 msCanWait, bool needsLayer, bool toMainDC, mtpRequestId after) { - mtpRequestId requestId = 0; - try { - uint32 requestSize = request.innerLength() >> 2; - mtpRequest reqSerialized(mtpRequestData::prepare(requestSize)); - request.write(*reqSerialized); - - DEBUG_LOG(("MTP Info: adding request to toSendMap, msCanWait %1").arg(msCanWait)); - - reqSerialized->msDate = getms(true); // > 0 - can send without container - reqSerialized->needsLayer = needsLayer; - if (after) reqSerialized->after = _mtp_internal::getRequest(after); - requestId = _mtp_internal::storeRequest(reqSerialized, callbacks); - - sendPrepared(reqSerialized, msCanWait); - } catch (Exception &e) { - requestId = 0; - _mtp_internal::rpcErrorOccured(requestId, callbacks, rpcClientError("NO_REQUEST_ID", QString("send() failed to queue request, exception: %1").arg(e.what()))); - } - if (requestId) _mtp_internal::registerRequest(requestId, toMainDC ? -getDcWithShift() : getDcWithShift()); - return requestId; -} diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.cpp b/Telegram/SourceFiles/mtproto/rpc_sender.cpp similarity index 97% rename from Telegram/SourceFiles/mtproto/mtpRPC.cpp rename to Telegram/SourceFiles/mtproto/rpc_sender.cpp index c0c861750..7cf9339a9 100644 --- a/Telegram/SourceFiles/mtproto/mtpRPC.cpp +++ b/Telegram/SourceFiles/mtproto/rpc_sender.cpp @@ -19,7 +19,8 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "mtproto/mtpRPC.h" + +#include "mtproto/rpc_sender.h" RPCOwnedDoneHandler::RPCOwnedDoneHandler(RPCSender *owner) : _owner(owner) { _owner->_rpcRegHandler(this); diff --git a/Telegram/SourceFiles/mtproto/mtpRPC.h b/Telegram/SourceFiles/mtproto/rpc_sender.h similarity index 100% rename from Telegram/SourceFiles/mtproto/mtpRPC.h rename to Telegram/SourceFiles/mtproto/rpc_sender.h diff --git a/Telegram/SourceFiles/mtproto/rsa_public_key.cpp b/Telegram/SourceFiles/mtproto/rsa_public_key.cpp new file mode 100644 index 000000000..7d9e196c8 --- /dev/null +++ b/Telegram/SourceFiles/mtproto/rsa_public_key.cpp @@ -0,0 +1,84 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" + +#include "mtproto/rsa_public_key.h" + +#include +#include +#include +#include + +using std::string; + +namespace MTP { +namespace internal { + +struct RSAPublicKey::Impl { + Impl(const char *key) : rsa(PEM_read_bio_RSAPublicKey(BIO_new_mem_buf(const_cast(key), -1), 0, 0, 0)) { + } + ~Impl() { + RSA_free(rsa); + } + RSA *rsa; + uint64 fp = 0; +}; + +RSAPublicKey::RSAPublicKey(const char *key) : impl_(new Impl(key)) { + if (!impl_->rsa) return; + + int nBytes = BN_num_bytes(impl_->rsa->n); + int eBytes = BN_num_bytes(impl_->rsa->e); + string nStr(nBytes, 0), eStr(eBytes, 0); + BN_bn2bin(impl_->rsa->n, (uchar*)&nStr[0]); + BN_bn2bin(impl_->rsa->e, (uchar*)&eStr[0]); + + mtpBuffer tmp; + MTP_string(nStr).write(tmp); + MTP_string(eStr).write(tmp); + + uchar sha1Buffer[20]; + impl_->fp = *(uint64*)(hashSha1(&tmp[0], tmp.size() * sizeof(mtpPrime), sha1Buffer) + 3); +} + +uint64 RSAPublicKey::getFingerPrint() const { + return impl_->fp; +} + +bool RSAPublicKey::isValid() const { + return impl_->rsa != nullptr; +} + +bool RSAPublicKey::encrypt(const void *data, string &result) const { + t_assert(isValid()); + + result.resize(256); + int res = RSA_public_encrypt(256, reinterpret_cast(data), reinterpret_cast(&result[0]), impl_->rsa, RSA_NO_PADDING); + if (res != 256) { + ERR_load_crypto_strings(); + LOG(("RSA Error: RSA_public_encrypt failed, key fp: %1, result: %2, error: %3").arg(getFingerPrint()).arg(res).arg(ERR_error_string(ERR_get_error(), 0))); + return false; + } + return true; +} + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpAuthKey.cpp b/Telegram/SourceFiles/mtproto/rsa_public_key.h similarity index 58% rename from Telegram/SourceFiles/mtproto/mtpAuthKey.cpp rename to Telegram/SourceFiles/mtproto/rsa_public_key.h index 7e2470e7a..b59deec79 100644 --- a/Telegram/SourceFiles/mtproto/mtpAuthKey.cpp +++ b/Telegram/SourceFiles/mtproto/rsa_public_key.h @@ -18,24 +18,31 @@ to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ -#include "stdafx.h" +#pragma once -void aesEncrypt(const void *src, void *dst, uint32 len, void *key, void *iv) { - uchar aes_key[32], aes_iv[32]; - memcpy(aes_key, key, 32); - memcpy(aes_iv, iv, 32); +namespace MTP { +namespace internal { - AES_KEY aes; - AES_set_encrypt_key(aes_key, 256, &aes); - AES_ige_encrypt((const uchar*)src, (uchar*)dst, len, &aes, aes_iv, AES_ENCRYPT); -} +// this class holds an RSA public key and can encrypt fixed-size messages with it +class RSAPublicKey final { +public: -void aesDecrypt(const void *src, void *dst, uint32 len, void *key, void *iv) { - uchar aes_key[32], aes_iv[32]; - memcpy(aes_key, key, 32); - memcpy(aes_iv, iv, 32); + // key in RSAPublicKey "-----BEGIN RSA PUBLIC KEY----- ..." format + RSAPublicKey(const char *key); - AES_KEY aes; - AES_set_decrypt_key(aes_key, 256, &aes); - AES_ige_encrypt((const uchar*)src, (uchar*)dst, len, &aes, aes_iv, AES_DECRYPT); -} + bool isValid() const; + uint64 getFingerPrint() const; + + // data has exactly 256 chars to be encrypted + bool encrypt(const void *data, string &result) const; + +private: + + struct Impl; + typedef QSharedPointer ImplPtr; + ImplPtr impl_; + +}; + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/scheme.tl b/Telegram/SourceFiles/mtproto/scheme.tl index f071798e6..e01da730d 100644 --- a/Telegram/SourceFiles/mtproto/scheme.tl +++ b/Telegram/SourceFiles/mtproto/scheme.tl @@ -266,8 +266,7 @@ geoPoint#2049d70c long:double lat:double = GeoPoint; auth.checkedPhone#811ea28e phone_registered:Bool = auth.CheckedPhone; -auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; -auth.sentAppCode#e325edcf phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; +auth.sentCode#5e002502 flags:# phone_registered:flags.0?true type:auth.SentCodeType phone_code_hash:string next_type:flags.1?auth.CodeType timeout:flags.2?int = auth.SentCode; auth.authorization#ff036af1 user:User = auth.Authorization; @@ -496,8 +495,6 @@ account.privacyRules#554abb6f rules:Vector users:Vector = acc accountDaysTTL#b8d0afdf days:int = AccountDaysTTL; -account.sentChangePhoneCode#a4f58c4c phone_code_hash:string send_call_timeout:int = account.SentChangePhoneCode; - documentAttributeImageSize#6c37c15c w:int h:int = DocumentAttribute; documentAttributeAnimated#11b58939 = DocumentAttribute; documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute; @@ -649,6 +646,15 @@ messageFwdHeader#c786ddcb flags:# from_id:flags.0?int date:int channel_id:flags. channels.messageEditData#67e1255f flags:# caption:flags.0?true = channels.MessageEditData; +auth.codeTypeSms#72a3158c = auth.CodeType; +auth.codeTypeCall#741cd3e3 = auth.CodeType; +auth.codeTypeFlashCall#226ccefb = auth.CodeType; + +auth.sentCodeTypeApp#3dbb5986 length:int = auth.SentCodeType; +auth.sentCodeTypeSms#c000bba2 length:int = auth.SentCodeType; +auth.sentCodeTypeCall#5353e5a7 length:int = auth.SentCodeType; +auth.sentCodeTypeFlashCall#ab03c6d9 pattern:string = auth.SentCodeType; + ---functions--- invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X; @@ -658,8 +664,7 @@ invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; invokeWithoutUpdates#bf9459b7 {X:Type} query:!X = X; auth.checkPhone#6fe51dfb phone_number:string = auth.CheckedPhone; -auth.sendCode#768d5f4d phone_number:string sms_type:int api_id:int api_hash:string lang_code:string = auth.SentCode; -auth.sendCall#3c51564 phone_number:string phone_code_hash:string = Bool; +auth.sendCode#ccfd70cf flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool api_id:int api_hash:string lang_code:string = auth.SentCode; auth.signUp#1b067634 phone_number:string phone_code_hash:string phone_code:string first_name:string last_name:string = auth.Authorization; auth.signIn#bcd51581 phone_number:string phone_code_hash:string phone_code:string = auth.Authorization; auth.logOut#5717da40 = Bool; @@ -668,11 +673,12 @@ auth.sendInvites#771c1d97 phone_numbers:Vector message:string = Bool; auth.exportAuthorization#e5bfffcd dc_id:int = auth.ExportedAuthorization; auth.importAuthorization#e3ef9613 id:int bytes:bytes = auth.Authorization; auth.bindTempAuthKey#cdd42a05 perm_auth_key_id:long nonce:long expires_at:int encrypted_message:bytes = Bool; -auth.sendSms#da9f3e8 phone_number:string phone_code_hash:string = Bool; auth.importBotAuthorization#67a3ff2c flags:int api_id:int api_hash:string bot_auth_token:string = auth.Authorization; auth.checkPassword#a63011e password_hash:bytes = auth.Authorization; auth.requestPasswordRecovery#d897bc66 = auth.PasswordRecovery; auth.recoverPassword#4ea56e92 code:string = auth.Authorization; +auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode; +auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool; account.registerDevice#446c712c token_type:int token:string device_model:string system_version:string app_version:string app_sandbox:Bool lang_code:string = Bool; account.unregisterDevice#65c55b40 token_type:int token:string = Bool; @@ -690,7 +696,7 @@ account.setPrivacy#c9f81ce8 key:InputPrivacyKey rules:Vector = account.deleteAccount#418d4e0b reason:string = Bool; account.getAccountTTL#8fc711d = AccountDaysTTL; account.setAccountTTL#2442485e ttl:AccountDaysTTL = Bool; -account.sendChangePhoneCode#a407a8f4 phone_number:string = account.SentChangePhoneCode; +account.sendChangePhoneCode#8e57deb flags:# allow_flashcall:flags.0?true phone_number:string current_number:flags.0?Bool = auth.SentCode; account.changePhone#70c32edb phone_number:string phone_code_hash:string phone_code:string = User; account.updateDeviceLocked#38df3532 period:int = Bool; account.getAuthorizations#e320c158 = account.Authorizations; diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.cpp b/Telegram/SourceFiles/mtproto/scheme_auto.cpp similarity index 78% rename from Telegram/SourceFiles/mtproto/mtpScheme.cpp rename to Telegram/SourceFiles/mtproto/scheme_auto.cpp index 3133d7062..272945bd8 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.cpp +++ b/Telegram/SourceFiles/mtproto/scheme_auto.cpp @@ -20,12 +20,13 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "mtpScheme.h" + +#include "mtproto/scheme_auto.h" typedef QVector Types; typedef QVector StagesFlags; -void _serialize_resPQ(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_resPQ(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -33,15 +34,15 @@ void _serialize_resPQ(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pq: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" server_public_key_fingerprints: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pq: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" server_public_key_fingerprints: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_p_q_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_p_q_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -49,17 +50,17 @@ void _serialize_p_q_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pq: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" p: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" new_nonce: "); ++stages.back(); types.push_back(mtpc_int256); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" pq: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" p: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" new_nonce: "); ++stages.back(); types.push_back(mtpc_int256+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_server_DH_params_fail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_server_DH_params_fail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -67,14 +68,14 @@ void _serialize_server_DH_params_fail(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" new_nonce_hash: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" new_nonce_hash: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_server_DH_params_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_server_DH_params_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -82,14 +83,14 @@ void _serialize_server_DH_params_ok(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" encrypted_answer: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" encrypted_answer: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_server_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_server_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -97,17 +98,17 @@ void _serialize_server_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" g: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" dh_prime: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" server_time: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" g: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" dh_prime: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" server_time: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_client_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_client_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -115,15 +116,15 @@ void _serialize_client_DH_inner_data(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" retry_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" g_b: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" retry_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" g_b: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_dh_gen_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dh_gen_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -131,14 +132,14 @@ void _serialize_dh_gen_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" new_nonce_hash1: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" new_nonce_hash1: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_dh_gen_retry(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dh_gen_retry(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -146,14 +147,14 @@ void _serialize_dh_gen_retry(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" new_nonce_hash2: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" new_nonce_hash2: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_dh_gen_fail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dh_gen_fail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -161,14 +162,14 @@ void _serialize_dh_gen_fail(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" new_nonce_hash3: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" new_nonce_hash3: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msgs_ack(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msgs_ack(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -176,12 +177,12 @@ void _serialize_msgs_ack(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_bad_msg_notification(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_bad_msg_notification(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -189,14 +190,14 @@ void _serialize_bad_msg_notification(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" bad_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" bad_msg_seqno: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" bad_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" bad_msg_seqno: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_bad_server_salt(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_bad_server_salt(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -204,15 +205,15 @@ void _serialize_bad_server_salt(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" bad_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" bad_msg_seqno: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" new_server_salt: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" bad_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" bad_msg_seqno: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" new_server_salt: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msgs_state_req(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msgs_state_req(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -220,12 +221,12 @@ void _serialize_msgs_state_req(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msgs_state_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msgs_state_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -233,13 +234,13 @@ void _serialize_msgs_state_info(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" info: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" info: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msgs_all_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msgs_all_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -247,13 +248,13 @@ void _serialize_msgs_all_info(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" info: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" info: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msg_detailed_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msg_detailed_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -261,15 +262,15 @@ void _serialize_msg_detailed_info(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" answer_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" status: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" answer_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" status: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msg_new_detailed_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msg_new_detailed_info(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -277,14 +278,14 @@ void _serialize_msg_new_detailed_info(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" answer_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" status: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" answer_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" status: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_msg_resend_req(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msg_resend_req(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -292,12 +293,12 @@ void _serialize_msg_resend_req(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_rpc_error(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_error(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -305,21 +306,21 @@ void _serialize_rpc_error(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" error_message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" error_code: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" error_message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_rpc_answer_unknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_answer_unknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ rpc_answer_unknown }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_rpc_answer_dropped_running(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_answer_dropped_running(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ rpc_answer_dropped_running }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_rpc_answer_dropped(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_answer_dropped(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -327,14 +328,14 @@ void _serialize_rpc_answer_dropped(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" seq_no: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" seq_no: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_future_salt(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_future_salt(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -342,14 +343,14 @@ void _serialize_future_salt(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" valid_since: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" valid_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" salt: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" valid_since: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" valid_until: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" salt: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -357,14 +358,14 @@ void _serialize_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" now: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" now: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" salts: "); ++stages.back(); types.push_back(mtpc_vector); vtypes.push_back(mtpc_future_salt); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_pong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_pong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -372,13 +373,13 @@ void _serialize_pong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_destroy_session_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_destroy_session_ok(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -386,12 +387,12 @@ void _serialize_destroy_session_ok(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_destroy_session_none(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_destroy_session_none(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -399,12 +400,12 @@ void _serialize_destroy_session_none(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_new_session_created(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_new_session_created(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -412,14 +413,14 @@ void _serialize_new_session_created(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" first_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unique_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" server_salt: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" first_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unique_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" server_salt: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_http_wait(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_http_wait(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -427,26 +428,26 @@ void _serialize_http_wait(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" max_delay: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" wait_after: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" max_wait: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" max_delay: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" wait_after: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" max_wait: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_boolFalse(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_boolFalse(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ boolFalse }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_boolTrue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_boolTrue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ boolTrue }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_true(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_true(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ true }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_error(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_error(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -454,25 +455,25 @@ void _serialize_error(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" code: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" code: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_null(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_null(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ null }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPeerEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPeerSelf }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -480,12 +481,12 @@ void _serialize_inputPeerChat(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputPeerUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -493,13 +494,13 @@ void _serialize_inputPeerUser(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputPeerChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -507,21 +508,21 @@ void _serialize_inputPeerChannel(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputUserEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputUserEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputUserEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputUserSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputUserSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputUserSelf }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -529,13 +530,13 @@ void _serialize_inputUser(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputPhoneContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPhoneContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -543,15 +544,15 @@ void _serialize_inputPhoneContact(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" client_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" client_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -559,15 +560,15 @@ void _serialize_inputFile(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" md5_checksum: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" md5_checksum: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputFileBig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputFileBig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -575,18 +576,18 @@ void _serialize_inputFileBig(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMediaEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMediaUploadedPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaUploadedPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -595,12 +596,12 @@ void _serialize_inputMediaUploadedPhoto(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -609,12 +610,12 @@ void _serialize_inputMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, Typ } switch (stage) { case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -627,7 +628,7 @@ void _serialize_inputMediaGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_inputMediaContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -635,14 +636,14 @@ void _serialize_inputMediaContact(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaUploadedDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaUploadedDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -651,14 +652,14 @@ void _serialize_inputMediaUploadedDocument(MTPStringLogger &to, int32 stage, int } switch (stage) { case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" attributes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaUploadedThumbDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaUploadedThumbDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -668,14 +669,14 @@ void _serialize_inputMediaUploadedThumbDocument(MTPStringLogger &to, int32 stage switch (stage) { case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" attributes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -684,12 +685,12 @@ void _serialize_inputMediaDocument(MTPStringLogger &to, int32 stage, int32 lev, } switch (stage) { case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -698,15 +699,15 @@ void _serialize_inputMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, Typ } switch (stage) { case 0: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMediaGifExternal(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMediaGifExternal(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -714,17 +715,17 @@ void _serialize_inputMediaGifExternal(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputChatPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputChatPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputChatPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputChatUploadedPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputChatUploadedPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -738,7 +739,7 @@ void _serialize_inputChatUploadedPhoto(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_inputChatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputChatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -752,11 +753,11 @@ void _serialize_inputChatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Type } } -void _serialize_inputGeoPointEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputGeoPointEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputGeoPointEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -764,17 +765,17 @@ void _serialize_inputGeoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" lat: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" long: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" lat: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" long: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -782,13 +783,13 @@ void _serialize_inputPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &t to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -796,14 +797,14 @@ void _serialize_inputFileLocation(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputEncryptedFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -811,13 +812,13 @@ void _serialize_inputEncryptedFileLocation(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputDocumentFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputDocumentFileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -825,17 +826,17 @@ void _serialize_inputDocumentFileLocation(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputPhotoCropAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPhotoCropAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPhotoCropAuto }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPhotoCrop(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPhotoCrop(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -843,14 +844,14 @@ void _serialize_inputPhotoCrop(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" crop_left: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" crop_top: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" crop_width: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" crop_left: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" crop_top: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" crop_width: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputAppEvent(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputAppEvent(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -858,15 +859,15 @@ void _serialize_inputAppEvent(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" time: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" peer: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" data: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" time: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" peer: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" data: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_peerUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -874,12 +875,12 @@ void _serialize_peerUser(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_peerChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -887,12 +888,12 @@ void _serialize_peerChat(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_peerChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -900,52 +901,52 @@ void _serialize_peerChannel(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_storage_fileUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileUnknown }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileJpeg(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileJpeg(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileJpeg }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileGif }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_filePng(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_filePng(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_filePng }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_filePdf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_filePdf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_filePdf }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileMp3(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileMp3(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileMp3 }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileMov(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileMov(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileMov }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_filePartial(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_filePartial(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_filePartial }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileMp4(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileMp4(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileMp4 }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_storage_fileWebp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_storage_fileWebp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ storage_fileWebp }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_fileLocationUnavailable(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_fileLocationUnavailable(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -953,14 +954,14 @@ void _serialize_fileLocationUnavailable(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_fileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_fileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -968,15 +969,15 @@ void _serialize_fileLocation(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" volume_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" local_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" secret: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -984,12 +985,14 @@ void _serialize_userEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_user(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_user(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDuser::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -997,37 +1000,37 @@ void _serialize_user(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" self: "); ++stages.back(); if (flag & MTPDuser::flag_self) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; - case 2: to.add(" contact: "); ++stages.back(); if (flag & MTPDuser::flag_contact) { to.add("YES [ BY BIT 11 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 3: to.add(" mutual_contact: "); ++stages.back(); if (flag & MTPDuser::flag_mutual_contact) { to.add("YES [ BY BIT 12 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 12 IN FIELD flags ]"); } break; - case 4: to.add(" deleted: "); ++stages.back(); if (flag & MTPDuser::flag_deleted) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 5: to.add(" bot: "); ++stages.back(); if (flag & MTPDuser::flag_bot) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 6: to.add(" bot_chat_history: "); ++stages.back(); if (flag & MTPDuser::flag_bot_chat_history) { to.add("YES [ BY BIT 15 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; - case 7: to.add(" bot_nochats: "); ++stages.back(); if (flag & MTPDuser::flag_bot_nochats) { to.add("YES [ BY BIT 16 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 16 IN FIELD flags ]"); } break; - case 8: to.add(" verified: "); ++stages.back(); if (flag & MTPDuser::flag_verified) { to.add("YES [ BY BIT 17 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 17 IN FIELD flags ]"); } break; - case 9: to.add(" restricted: "); ++stages.back(); if (flag & MTPDuser::flag_restricted) { to.add("YES [ BY BIT 18 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 18 IN FIELD flags ]"); } break; - case 10: to.add(" min: "); ++stages.back(); if (flag & MTPDuser::flag_min) { to.add("YES [ BY BIT 20 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 20 IN FIELD flags ]"); } break; - case 11: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" access_hash: "); ++stages.back(); if (flag & MTPDuser::flag_access_hash) { types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 13: to.add(" first_name: "); ++stages.back(); if (flag & MTPDuser::flag_first_name) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 14: to.add(" last_name: "); ++stages.back(); if (flag & MTPDuser::flag_last_name) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 15: to.add(" username: "); ++stages.back(); if (flag & MTPDuser::flag_username) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 16: to.add(" phone: "); ++stages.back(); if (flag & MTPDuser::flag_phone) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 17: to.add(" photo: "); ++stages.back(); if (flag & MTPDuser::flag_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 18: to.add(" status: "); ++stages.back(); if (flag & MTPDuser::flag_status) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 19: to.add(" bot_info_version: "); ++stages.back(); if (flag & MTPDuser::flag_bot_info_version) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 20: to.add(" restriction_reason: "); ++stages.back(); if (flag & MTPDuser::flag_restriction_reason) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 18 IN FIELD flags ]"); } break; - case 21: to.add(" bot_inline_placeholder: "); ++stages.back(); if (flag & MTPDuser::flag_bot_inline_placeholder) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 19 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" self: "); ++stages.back(); if (flag & MTPDuser::Flag::f_self) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 2: to.add(" contact: "); ++stages.back(); if (flag & MTPDuser::Flag::f_contact) { to.add("YES [ BY BIT 11 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 3: to.add(" mutual_contact: "); ++stages.back(); if (flag & MTPDuser::Flag::f_mutual_contact) { to.add("YES [ BY BIT 12 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 12 IN FIELD flags ]"); } break; + case 4: to.add(" deleted: "); ++stages.back(); if (flag & MTPDuser::Flag::f_deleted) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 5: to.add(" bot: "); ++stages.back(); if (flag & MTPDuser::Flag::f_bot) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 6: to.add(" bot_chat_history: "); ++stages.back(); if (flag & MTPDuser::Flag::f_bot_chat_history) { to.add("YES [ BY BIT 15 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; + case 7: to.add(" bot_nochats: "); ++stages.back(); if (flag & MTPDuser::Flag::f_bot_nochats) { to.add("YES [ BY BIT 16 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 16 IN FIELD flags ]"); } break; + case 8: to.add(" verified: "); ++stages.back(); if (flag & MTPDuser::Flag::f_verified) { to.add("YES [ BY BIT 17 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 17 IN FIELD flags ]"); } break; + case 9: to.add(" restricted: "); ++stages.back(); if (flag & MTPDuser::Flag::f_restricted) { to.add("YES [ BY BIT 18 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 18 IN FIELD flags ]"); } break; + case 10: to.add(" min: "); ++stages.back(); if (flag & MTPDuser::Flag::f_min) { to.add("YES [ BY BIT 20 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 20 IN FIELD flags ]"); } break; + case 11: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" access_hash: "); ++stages.back(); if (flag & MTPDuser::Flag::f_access_hash) { types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 13: to.add(" first_name: "); ++stages.back(); if (flag & MTPDuser::Flag::f_first_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 14: to.add(" last_name: "); ++stages.back(); if (flag & MTPDuser::Flag::f_last_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 15: to.add(" username: "); ++stages.back(); if (flag & MTPDuser::Flag::f_username) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 16: to.add(" phone: "); ++stages.back(); if (flag & MTPDuser::Flag::f_phone) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 17: to.add(" photo: "); ++stages.back(); if (flag & MTPDuser::Flag::f_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 18: to.add(" status: "); ++stages.back(); if (flag & MTPDuser::Flag::f_status) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 19: to.add(" bot_info_version: "); ++stages.back(); if (flag & MTPDuser::Flag::f_bot_info_version) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 20: to.add(" restriction_reason: "); ++stages.back(); if (flag & MTPDuser::Flag::f_restriction_reason) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 18 IN FIELD flags ]"); } break; + case 21: to.add(" bot_inline_placeholder: "); ++stages.back(); if (flag & MTPDuser::Flag::f_bot_inline_placeholder) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 19 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userProfilePhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userProfilePhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ userProfilePhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_userProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1035,18 +1038,18 @@ void _serialize_userProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" photo_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" photo_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" photo_small: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" photo_big: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userStatusEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ userStatusEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_userStatusOnline(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusOnline(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1054,12 +1057,12 @@ void _serialize_userStatusOnline(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" expires: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" expires: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userStatusOffline(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusOffline(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1067,24 +1070,24 @@ void _serialize_userStatusOffline(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" was_online: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" was_online: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userStatusRecently(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusRecently(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ userStatusRecently }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_userStatusLastWeek(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusLastWeek(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ userStatusLastWeek }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_userStatusLastMonth(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userStatusLastMonth(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ userStatusLastMonth }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_chatEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1092,12 +1095,14 @@ void _serialize_chatEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchat::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1105,25 +1110,25 @@ void _serialize_chat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" creator: "); ++stages.back(); if (flag & MTPDchat::flag_creator) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" kicked: "); ++stages.back(); if (flag & MTPDchat::flag_kicked) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" left: "); ++stages.back(); if (flag & MTPDchat::flag_left) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 4: to.add(" admins_enabled: "); ++stages.back(); if (flag & MTPDchat::flag_admins_enabled) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 5: to.add(" admin: "); ++stages.back(); if (flag & MTPDchat::flag_admin) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 6: to.add(" deactivated: "); ++stages.back(); if (flag & MTPDchat::flag_deactivated) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" creator: "); ++stages.back(); if (flag & MTPDchat::Flag::f_creator) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" kicked: "); ++stages.back(); if (flag & MTPDchat::Flag::f_kicked) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" left: "); ++stages.back(); if (flag & MTPDchat::Flag::f_left) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" admins_enabled: "); ++stages.back(); if (flag & MTPDchat::Flag::f_admins_enabled) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 5: to.add(" admin: "); ++stages.back(); if (flag & MTPDchat::Flag::f_admin) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 6: to.add(" deactivated: "); ++stages.back(); if (flag & MTPDchat::Flag::f_deactivated) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 9: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" participants_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 13: to.add(" migrated_to: "); ++stages.back(); if (flag & MTPDchat::flag_migrated_to) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 10: to.add(" participants_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 13: to.add(" migrated_to: "); ++stages.back(); if (flag & MTPDchat::Flag::f_migrated_to) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1131,13 +1136,15 @@ void _serialize_chatForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchannel::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1145,32 +1152,32 @@ void _serialize_channel(MTPStringLogger &to, int32 stage, int32 lev, Types &type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" creator: "); ++stages.back(); if (flag & MTPDchannel::flag_creator) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" kicked: "); ++stages.back(); if (flag & MTPDchannel::flag_kicked) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" left: "); ++stages.back(); if (flag & MTPDchannel::flag_left) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 4: to.add(" editor: "); ++stages.back(); if (flag & MTPDchannel::flag_editor) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 5: to.add(" moderator: "); ++stages.back(); if (flag & MTPDchannel::flag_moderator) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 6: to.add(" broadcast: "); ++stages.back(); if (flag & MTPDchannel::flag_broadcast) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 7: to.add(" verified: "); ++stages.back(); if (flag & MTPDchannel::flag_verified) { to.add("YES [ BY BIT 7 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; - case 8: to.add(" megagroup: "); ++stages.back(); if (flag & MTPDchannel::flag_megagroup) { to.add("YES [ BY BIT 8 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; - case 9: to.add(" restricted: "); ++stages.back(); if (flag & MTPDchannel::flag_restricted) { to.add("YES [ BY BIT 9 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; - case 10: to.add(" democracy: "); ++stages.back(); if (flag & MTPDchannel::flag_democracy) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; - case 11: to.add(" signatures: "); ++stages.back(); if (flag & MTPDchannel::flag_signatures) { to.add("YES [ BY BIT 11 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 12: to.add(" min: "); ++stages.back(); if (flag & MTPDchannel::flag_min) { to.add("YES [ BY BIT 12 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 12 IN FIELD flags ]"); } break; - case 13: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 14: to.add(" access_hash: "); ++stages.back(); if (flag & MTPDchannel::flag_access_hash) { types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 15: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 16: to.add(" username: "); ++stages.back(); if (flag & MTPDchannel::flag_username) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" creator: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_creator) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" kicked: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_kicked) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" left: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_left) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" editor: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_editor) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 5: to.add(" moderator: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_moderator) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 6: to.add(" broadcast: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_broadcast) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 7: to.add(" verified: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_verified) { to.add("YES [ BY BIT 7 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 8: to.add(" megagroup: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_megagroup) { to.add("YES [ BY BIT 8 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 9: to.add(" restricted: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_restricted) { to.add("YES [ BY BIT 9 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 10: to.add(" democracy: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_democracy) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 11: to.add(" signatures: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_signatures) { to.add("YES [ BY BIT 11 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 12: to.add(" min: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_min) { to.add("YES [ BY BIT 12 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 12 IN FIELD flags ]"); } break; + case 13: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 14: to.add(" access_hash: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_access_hash) { types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 15: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 16: to.add(" username: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_username) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; case 17: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 18: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 19: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 20: to.add(" restriction_reason: "); ++stages.back(); if (flag & MTPDchannel::flag_restriction_reason) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 18: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 19: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 20: to.add(" restriction_reason: "); ++stages.back(); if (flag & MTPDchannel::Flag::f_restriction_reason) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1178,14 +1185,14 @@ void _serialize_channelForbidden(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1193,7 +1200,7 @@ void _serialize_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" participants: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" chat_photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -1203,7 +1210,9 @@ void _serialize_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &typ } } -void _serialize_channelFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchannelFull::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1211,29 +1220,29 @@ void _serialize_channelFull(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" can_view_participants: "); ++stages.back(); if (flag & MTPDchannelFull::flag_can_view_participants) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 2: to.add(" can_set_username: "); ++stages.back(); if (flag & MTPDchannelFull::flag_can_set_username) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" participants_count: "); ++stages.back(); if (flag & MTPDchannelFull::flag_participants_count) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 6: to.add(" admins_count: "); ++stages.back(); if (flag & MTPDchannelFull::flag_admins_count) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 7: to.add(" kicked_count: "); ++stages.back(); if (flag & MTPDchannelFull::flag_kicked_count) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 8: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" can_view_participants: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_can_view_participants) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 2: to.add(" can_set_username: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_can_set_username) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" participants_count: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_participants_count) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" admins_count: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_admins_count) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 7: to.add(" kicked_count: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_kicked_count) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 8: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 11: to.add(" chat_photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 12: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 13: to.add(" exported_invite: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 14: to.add(" bot_info: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 15: to.add(" migrated_from_chat_id: "); ++stages.back(); if (flag & MTPDchannelFull::flag_migrated_from_chat_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 16: to.add(" migrated_from_max_id: "); ++stages.back(); if (flag & MTPDchannelFull::flag_migrated_from_max_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 17: to.add(" pinned_msg_id: "); ++stages.back(); if (flag & MTPDchannelFull::flag_pinned_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 15: to.add(" migrated_from_chat_id: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_migrated_from_chat_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 16: to.add(" migrated_from_max_id: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_migrated_from_max_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 17: to.add(" pinned_msg_id: "); ++stages.back(); if (flag & MTPDchannelFull::Flag::f_pinned_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1241,14 +1250,14 @@ void _serialize_chatParticipant(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatParticipantCreator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatParticipantCreator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1256,12 +1265,12 @@ void _serialize_chatParticipantCreator(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatParticipantAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatParticipantAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1269,14 +1278,16 @@ void _serialize_chatParticipantAdmin(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatParticipantsForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatParticipantsForbidden(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchatParticipantsForbidden::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1284,14 +1295,14 @@ void _serialize_chatParticipantsForbidden(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" self_participant: "); ++stages.back(); if (flag & MTPDchatParticipantsForbidden::flag_self_participant) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" self_participant: "); ++stages.back(); if (flag & MTPDchatParticipantsForbidden::Flag::f_self_participant) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1299,18 +1310,18 @@ void _serialize_chatParticipants(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" participants: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatPhotoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ chatPhotoEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_chatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1324,7 +1335,7 @@ void _serialize_chatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &ty } } -void _serialize_messageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1332,12 +1343,14 @@ void _serialize_messageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1345,31 +1358,33 @@ void _serialize_message(MTPStringLogger &to, int32 stage, int32 lev, Types &type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDmessage::flag_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessage::flag_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessage::flag_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessage::flag_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessage::flag_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessage::flag_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessage::flag_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_from_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; case 9: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDmessage::flag_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 11: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDmessage::flag_via_bot_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 12: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 13: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 14: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 15: to.add(" media: "); ++stages.back(); if (flag & MTPDmessage::flag_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; - case 16: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPDmessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 17: to.add(" entities: "); ++stages.back(); if (flag & MTPDmessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; - case 18: to.add(" views: "); ++stages.back(); if (flag & MTPDmessage::flag_views) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; - case 19: to.add(" edit_date: "); ++stages.back(); if (flag & MTPDmessage::flag_edit_date) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; + case 10: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 11: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 12: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 13: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 14: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 15: to.add(" media: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 16: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 17: to.add(" entities: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 18: to.add(" views: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_views) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 19: to.add(" edit_date: "); ++stages.back(); if (flag & MTPDmessage::Flag::f_edit_date) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 15 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessageService::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1377,28 +1392,28 @@ void _serialize_messageService(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDmessageService::flag_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessageService::flag_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessageService::flag_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessageService::flag_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessageService::flag_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessageService::flag_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; - case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageService::flag_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 6: to.add(" post: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_post) { to.add("YES [ BY BIT 14 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 14 IN FIELD flags ]"); } break; + case 7: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_from_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; case 9: to.add(" to_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessageService::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDmessageService::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 12: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageMediaEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messageMediaEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messageMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1407,12 +1422,12 @@ void _serialize_messageMediaPhoto(MTPStringLogger &to, int32 stage, int32 lev, T } switch (stage) { case 0: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageMediaGeo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaGeo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1425,7 +1440,7 @@ void _serialize_messageMediaGeo(MTPStringLogger &to, int32 stage, int32 lev, Typ } } -void _serialize_messageMediaContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1433,19 +1448,19 @@ void _serialize_messageMediaContact(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageMediaUnsupported(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaUnsupported(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messageMediaUnsupported }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messageMediaDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1454,12 +1469,12 @@ void _serialize_messageMediaDocument(MTPStringLogger &to, int32 stage, int32 lev } switch (stage) { case 0: to.add(" document: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageMediaWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1472,7 +1487,7 @@ void _serialize_messageMediaWebPage(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_messageMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1481,19 +1496,19 @@ void _serialize_messageMediaVenue(MTPStringLogger &to, int32 stage, int32 lev, T } switch (stage) { case 0: to.add(" geo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" address: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" provider: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" venue_id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messageActionEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messageActionChatCreate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatCreate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1501,13 +1516,13 @@ void _serialize_messageActionChatCreate(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChatEditTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatEditTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1515,12 +1530,12 @@ void _serialize_messageActionChatEditTitle(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChatEditPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatEditPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1533,11 +1548,11 @@ void _serialize_messageActionChatEditPhoto(MTPStringLogger &to, int32 stage, int } } -void _serialize_messageActionChatDeletePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatDeletePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messageActionChatDeletePhoto }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messageActionChatAddUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatAddUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1545,12 +1560,12 @@ void _serialize_messageActionChatAddUser(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChatDeleteUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatDeleteUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1558,12 +1573,12 @@ void _serialize_messageActionChatDeleteUser(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChatJoinedByLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatJoinedByLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1571,12 +1586,12 @@ void _serialize_messageActionChatJoinedByLink(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChannelCreate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChannelCreate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1584,12 +1599,12 @@ void _serialize_messageActionChannelCreate(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChatMigrateTo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChatMigrateTo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1597,12 +1612,12 @@ void _serialize_messageActionChatMigrateTo(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionChannelMigrateFrom(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionChannelMigrateFrom(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1610,17 +1625,17 @@ void _serialize_messageActionChannelMigrateFrom(MTPStringLogger &to, int32 stage to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageActionPinMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageActionPinMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messageActionPinMessage }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1629,15 +1644,15 @@ void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_dialogChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dialogChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1646,18 +1661,18 @@ void _serialize_dialogChannel(MTPStringLogger &to, int32 stage, int32 lev, Types } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 6: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1665,12 +1680,12 @@ void _serialize_photoEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &t to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1678,15 +1693,15 @@ void _serialize_photo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" sizes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photoSizeEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photoSizeEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1694,12 +1709,12 @@ void _serialize_photoSizeEmpty(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photoSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photoSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1707,16 +1722,16 @@ void _serialize_photoSize(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" location: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photoCachedSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photoCachedSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1724,20 +1739,20 @@ void _serialize_photoCachedSize(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" location: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_geoPointEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_geoPointEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ geoPointEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_geoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_geoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1745,13 +1760,13 @@ void _serialize_geoPoint(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" long: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" lat: "); ++stages.back(); types.push_back(mtpc_double); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" long: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" lat: "); ++stages.back(); types.push_back(mtpc_double+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_checkedPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_checkedPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1764,7 +1779,9 @@ void _serialize_auth_checkedPhone(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_auth_sentCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_sentCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDauth_sentCode::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1772,31 +1789,17 @@ void _serialize_auth_sentCode(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_registered: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" send_call_timeout: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" is_password: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_registered: "); ++stages.back(); if (flag & MTPDauth_sentCode::Flag::f_phone_registered) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" type: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" next_type: "); ++stages.back(); if (flag & MTPDauth_sentCode::Flag::f_next_type) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 5: to.add(" timeout: "); ++stages.back(); if (flag & MTPDauth_sentCode::Flag::f_timeout) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_sentAppCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ auth_sentAppCode"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_registered: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" send_call_timeout: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" is_password: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } -} - -void _serialize_auth_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1809,7 +1812,7 @@ void _serialize_auth_authorization(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_auth_exportedAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_exportedAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1817,13 +1820,13 @@ void _serialize_auth_exportedAuthorization(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputNotifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputNotifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1836,27 +1839,29 @@ void _serialize_inputNotifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Typ } } -void _serialize_inputNotifyUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputNotifyUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputNotifyUsers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputNotifyChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputNotifyChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputNotifyChats }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputNotifyAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputNotifyAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputNotifyAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerNotifyEventsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerNotifyEventsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPeerNotifyEventsEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerNotifyEventsAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerNotifyEventsAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPeerNotifyEventsAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPeerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPeerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDinputPeerNotifySettings::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1864,28 +1869,30 @@ void _serialize_inputPeerNotifySettings(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" show_previews: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::flag_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::flag_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" show_previews: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::Flag::f_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDinputPeerNotifySettings::Flag::f_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_peerNotifyEventsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerNotifyEventsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ peerNotifyEventsEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_peerNotifyEventsAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerNotifyEventsAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ peerNotifyEventsAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_peerNotifySettingsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerNotifySettingsEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ peerNotifySettingsEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_peerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDpeerNotifySettings::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1893,16 +1900,18 @@ void _serialize_peerNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" show_previews: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::flag_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::flag_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" show_previews: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::Flag::f_show_previews) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPDpeerNotifySettings::Flag::f_silent) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mute_until: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" sound: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_peerSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_peerSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDpeerSettings::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1910,13 +1919,13 @@ void _serialize_peerSettings(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" report_spam: "); ++stages.back(); if (flag & MTPDpeerSettings::flag_report_spam) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" report_spam: "); ++stages.back(); if (flag & MTPDpeerSettings::Flag::f_report_spam) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_wallPaper(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_wallPaper(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1924,15 +1933,15 @@ void _serialize_wallPaper(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" sizes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" color: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" color: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_wallPaperSolid(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_wallPaperSolid(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1940,27 +1949,27 @@ void _serialize_wallPaperSolid(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bg_color: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" color: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bg_color: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" color: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputReportReasonSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputReportReasonSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputReportReasonSpam }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputReportReasonViolence(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputReportReasonViolence(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputReportReasonViolence }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputReportReasonPornography(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputReportReasonPornography(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputReportReasonPornography }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputReportReasonOther(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputReportReasonOther(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1968,12 +1977,14 @@ void _serialize_inputReportReasonOther(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_userFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_userFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDuserFull::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -1981,19 +1992,19 @@ void _serialize_userFull(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" blocked: "); ++stages.back(); if (flag & MTPDuserFull::flag_blocked) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" blocked: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_blocked) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 2: to.add(" user: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" about: "); ++stages.back(); if (flag & MTPDuserFull::flag_about) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" about: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_about) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 4: to.add(" link: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" profile_photo: "); ++stages.back(); if (flag & MTPDuserFull::flag_profile_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" profile_photo: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_profile_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; case 6: to.add(" notify_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" bot_info: "); ++stages.back(); if (flag & MTPDuserFull::flag_bot_info) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 7: to.add(" bot_info: "); ++stages.back(); if (flag & MTPDuserFull::Flag::f_bot_info) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2001,13 +2012,13 @@ void _serialize_contact(MTPStringLogger &to, int32 stage, int32 lev, Types &type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" mutual: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_importedContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_importedContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2015,13 +2026,13 @@ void _serialize_importedContact(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" client_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" client_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contactBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2029,13 +2040,13 @@ void _serialize_contactBlocked(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contactStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2043,13 +2054,13 @@ void _serialize_contactStatus(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" status: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_link(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_link(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2064,11 +2075,11 @@ void _serialize_contacts_link(MTPStringLogger &to, int32 stage, int32 lev, Types } } -void _serialize_contacts_contactsNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_contactsNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contacts_contactsNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contacts_contacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_contacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2082,7 +2093,7 @@ void _serialize_contacts_contacts(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_contacts_importedContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_importedContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2091,13 +2102,13 @@ void _serialize_contacts_importedContacts(MTPStringLogger &to, int32 stage, int3 } switch (stage) { case 0: to.add(" imported: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" retry_contacts: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" retry_contacts: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_blocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_blocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2111,7 +2122,7 @@ void _serialize_contacts_blocked(MTPStringLogger &to, int32 stage, int32 lev, Ty } } -void _serialize_contacts_blockedSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_blockedSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2119,14 +2130,14 @@ void _serialize_contacts_blockedSlice(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" blocked: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_dialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_dialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2142,7 +2153,7 @@ void _serialize_messages_dialogs(MTPStringLogger &to, int32 stage, int32 lev, Ty } } -void _serialize_messages_dialogsSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_dialogsSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2150,7 +2161,7 @@ void _serialize_messages_dialogsSlice(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" dialogs: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -2159,7 +2170,7 @@ void _serialize_messages_dialogsSlice(MTPStringLogger &to, int32 stage, int32 le } } -void _serialize_messages_messages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_messages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2174,7 +2185,7 @@ void _serialize_messages_messages(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_messages_messagesSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_messagesSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2182,7 +2193,7 @@ void _serialize_messages_messagesSlice(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -2190,7 +2201,9 @@ void _serialize_messages_messagesSlice(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_messages_channelMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_channelMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessages_channelMessages::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2198,18 +2211,18 @@ void _serialize_messages_channelMessages(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" collapsed: "); ++stages.back(); if (flag & MTPDmessages_channelMessages::flag_collapsed) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 4: to.add(" collapsed: "); ++stages.back(); if (flag & MTPDmessages_channelMessages::Flag::f_collapsed) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 5: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 6: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_chats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_chats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2222,7 +2235,7 @@ void _serialize_messages_chats(MTPStringLogger &to, int32 stage, int32 lev, Type } } -void _serialize_messages_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_chatFull(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2237,7 +2250,7 @@ void _serialize_messages_chatFull(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_messages_affectedHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_affectedHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2245,54 +2258,54 @@ void _serialize_messages_affectedHistory(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputMessagesFilterEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterPhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterPhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterPhotos }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterVideo }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterPhotoVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterPhotoVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterPhotoVideo }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterPhotoVideoDocuments(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterPhotoVideoDocuments(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterPhotoVideoDocuments }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterDocument }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterUrl }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterGif }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterVoice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterVoice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterVoice }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputMessagesFilterMusic(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputMessagesFilterMusic(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputMessagesFilterMusic }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_updateNewMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNewMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2301,13 +2314,13 @@ void _serialize_updateNewMessage(MTPStringLogger &to, int32 stage, int32 lev, Ty } switch (stage) { case 0: to.add(" message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateMessageID(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateMessageID(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2315,13 +2328,13 @@ void _serialize_updateMessageID(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateDeleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateDeleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2329,14 +2342,14 @@ void _serialize_updateDeleteMessages(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateUserTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2344,13 +2357,13 @@ void _serialize_updateUserTyping(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatUserTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatUserTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2358,14 +2371,14 @@ void _serialize_updateChatUserTyping(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" action: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2378,7 +2391,7 @@ void _serialize_updateChatParticipants(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_updateUserStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2386,13 +2399,13 @@ void _serialize_updateUserStatus(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" status: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateUserName(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserName(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2400,15 +2413,15 @@ void _serialize_updateUserName(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateUserPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2416,15 +2429,15 @@ void _serialize_updateUserPhoto(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" previous: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateContactRegistered(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateContactRegistered(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2432,13 +2445,13 @@ void _serialize_updateContactRegistered(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateContactLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateContactLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2446,14 +2459,14 @@ void _serialize_updateContactLink(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" my_link: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" foreign_link: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateNewAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNewAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2461,15 +2474,15 @@ void _serialize_updateNewAuthorization(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" auth_key_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" device: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" location: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" auth_key_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" device: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" location: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateNewEncryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNewEncryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2478,12 +2491,12 @@ void _serialize_updateNewEncryptedMessage(MTPStringLogger &to, int32 stage, int3 } switch (stage) { case 0: to.add(" message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateEncryptedChatTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateEncryptedChatTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2491,12 +2504,12 @@ void _serialize_updateEncryptedChatTyping(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2505,12 +2518,12 @@ void _serialize_updateEncryption(MTPStringLogger &to, int32 stage, int32 lev, Ty } switch (stage) { case 0: to.add(" chat: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateEncryptedMessagesRead(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateEncryptedMessagesRead(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2518,14 +2531,14 @@ void _serialize_updateEncryptedMessagesRead(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatParticipantAdd(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatParticipantAdd(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2533,16 +2546,16 @@ void _serialize_updateChatParticipantAdd(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatParticipantDelete(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatParticipantDelete(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2550,14 +2563,14 @@ void _serialize_updateChatParticipantDelete(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateDcOptions(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateDcOptions(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2570,7 +2583,7 @@ void _serialize_updateDcOptions(MTPStringLogger &to, int32 stage, int32 lev, Typ } } -void _serialize_updateUserBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2578,13 +2591,13 @@ void _serialize_updateUserBlocked(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" blocked: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2598,7 +2611,7 @@ void _serialize_updateNotifySettings(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_updateServiceNotification(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateServiceNotification(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2606,15 +2619,15 @@ void _serialize_updateServiceNotification(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" popup: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updatePrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updatePrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2628,7 +2641,7 @@ void _serialize_updatePrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types } } -void _serialize_updateUserPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateUserPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2636,13 +2649,13 @@ void _serialize_updateUserPhone(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateReadHistoryInbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateReadHistoryInbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2651,14 +2664,14 @@ void _serialize_updateReadHistoryInbox(MTPStringLogger &to, int32 stage, int32 l } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateReadHistoryOutbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateReadHistoryOutbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2667,14 +2680,14 @@ void _serialize_updateReadHistoryOutbox(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2683,13 +2696,13 @@ void _serialize_updateWebPage(MTPStringLogger &to, int32 stage, int32 lev, Types } switch (stage) { case 0: to.add(" webpage: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateReadMessagesContents(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateReadMessagesContents(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2697,14 +2710,16 @@ void _serialize_updateReadMessagesContents(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChannelTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChannelTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateChannelTooLong::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2712,14 +2727,14 @@ void _serialize_updateChannelTooLong(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); if (flag & MTPDupdateChannelTooLong::flag_pts) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); if (flag & MTPDupdateChannelTooLong::Flag::f_pts) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2727,12 +2742,12 @@ void _serialize_updateChannel(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChannelGroup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChannelGroup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2740,13 +2755,13 @@ void _serialize_updateChannelGroup(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" group: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateNewChannelMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNewChannelMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2755,13 +2770,13 @@ void _serialize_updateNewChannelMessage(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateReadChannelInbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateReadChannelInbox(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2769,13 +2784,13 @@ void _serialize_updateReadChannelInbox(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateDeleteChannelMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateDeleteChannelMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2783,15 +2798,15 @@ void _serialize_updateDeleteChannelMessages(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" messages: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChannelMessageViews(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChannelMessageViews(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2799,14 +2814,14 @@ void _serialize_updateChannelMessageViews(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" views: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" views: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2814,14 +2829,14 @@ void _serialize_updateChatAdmins(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" enabled: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChatParticipantAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChatParticipantAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2829,15 +2844,15 @@ void _serialize_updateChatParticipantAdmin(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" is_admin: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateNewStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateNewStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2850,7 +2865,7 @@ void _serialize_updateNewStickerSet(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_updateStickerSetsOrder(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateStickerSetsOrder(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2858,20 +2873,20 @@ void _serialize_updateStickerSetsOrder(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateStickerSets(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateStickerSets(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updateStickerSets }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_updateSavedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateSavedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updateSavedGifs }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_updateBotInlineQuery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateBotInlineQuery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2879,15 +2894,15 @@ void _serialize_updateBotInlineQuery(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateBotInlineSend(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateBotInlineSend(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2895,14 +2910,14 @@ void _serialize_updateBotInlineSend(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateEditChannelMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateEditChannelMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2911,13 +2926,13 @@ void _serialize_updateEditChannelMessage(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateChannelPinnedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateChannelPinnedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2925,13 +2940,13 @@ void _serialize_updateChannelPinnedMessage(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_state(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_state(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2939,16 +2954,16 @@ void _serialize_updates_state(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_differenceEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_differenceEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2956,13 +2971,13 @@ void _serialize_updates_differenceEmpty(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_difference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_difference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2980,7 +2995,7 @@ void _serialize_updates_difference(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_updates_differenceSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_differenceSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -2998,11 +3013,13 @@ void _serialize_updates_differenceSlice(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_updatesTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updatesTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updatesTooLong }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_updateShortMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateShortMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateShortMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3010,27 +3027,29 @@ void _serialize_updateShortMessage(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 13: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_via_bot_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 14: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 15: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 11: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 13: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 14: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 15: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateShortChatMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateShortChatMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateShortChatMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3038,28 +3057,28 @@ void _serialize_updateShortChatMessage(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; - case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 13: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 14: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_via_bot_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; - case 15: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 16: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" mentioned: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_mentioned) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 4: to.add(" media_unread: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_media_unread) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 5: to.add(" silent: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_silent) { to.add("YES [ BY BIT 13 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 13 IN FIELD flags ]"); } break; + case 6: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" from_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 11: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 13: to.add(" fwd_from: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_fwd_from) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 14: to.add(" via_bot_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_via_bot_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 11 IN FIELD flags ]"); } break; + case 15: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 16: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortChatMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateShort(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateShort(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3068,12 +3087,12 @@ void _serialize_updateShort(MTPStringLogger &to, int32 stage, int32 lev, Types & } switch (stage) { case 0: to.add(" update: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updatesCombined(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updatesCombined(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3084,14 +3103,14 @@ void _serialize_updatesCombined(MTPStringLogger &to, int32 stage, int32 lev, Typ case 0: to.add(" updates: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" seq_start: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" seq_start: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3102,13 +3121,15 @@ void _serialize_updates(MTPStringLogger &to, int32 stage, int32 lev, Types &type case 0: to.add(" updates: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" seq: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updateShortSentMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updateShortSentMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdateShortSentMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3116,20 +3137,20 @@ void _serialize_updateShortSentMessage(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" media: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; - case 8: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" unread: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_unread) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" out: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_out) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" media: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_media) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 8: to.add(" entities: "); ++stages.back(); if (flag & MTPDupdateShortSentMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photos_photos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_photos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3143,7 +3164,7 @@ void _serialize_photos_photos(MTPStringLogger &to, int32 stage, int32 lev, Types } } -void _serialize_photos_photosSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_photosSlice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3151,14 +3172,14 @@ void _serialize_photos_photosSlice(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" photos: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photos_photo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_photo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3172,7 +3193,7 @@ void _serialize_photos_photo(MTPStringLogger &to, int32 stage, int32 lev, Types } } -void _serialize_upload_file(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_upload_file(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3181,13 +3202,15 @@ void _serialize_upload_file(MTPStringLogger &to, int32 stage, int32 lev, Types & } switch (stage) { case 0: to.add(" type: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" mtime: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" mtime: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_dcOption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_dcOption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDdcOption::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3195,18 +3218,18 @@ void _serialize_dcOption(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" ipv6: "); ++stages.back(); if (flag & MTPDdcOption::flag_ipv6) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" media_only: "); ++stages.back(); if (flag & MTPDdcOption::flag_media_only) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" tcpo_only: "); ++stages.back(); if (flag & MTPDdcOption::flag_tcpo_only) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 4: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" ip_address: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" port: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" ipv6: "); ++stages.back(); if (flag & MTPDdcOption::Flag::f_ipv6) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" media_only: "); ++stages.back(); if (flag & MTPDdcOption::Flag::f_media_only) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" tcpo_only: "); ++stages.back(); if (flag & MTPDdcOption::Flag::f_tcpo_only) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" ip_address: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" port: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_config(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_config(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3214,31 +3237,31 @@ void _serialize_config(MTPStringLogger &to, int32 stage, int32 lev, Types &types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" expires: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" expires: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" test_mode: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" this_dc: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" this_dc: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" dc_options: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" chat_size_max: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" megagroup_size_max: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" forwarded_count_max: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" online_update_period_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" offline_blur_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" offline_idle_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" online_cloud_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" notify_cloud_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 13: to.add(" notify_default_delay_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 14: to.add(" chat_big_size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 15: to.add(" push_chat_period_ms: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 16: to.add(" push_chat_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 17: to.add(" saved_gifs_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 18: to.add(" edit_time_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" chat_size_max: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" megagroup_size_max: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" forwarded_count_max: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" online_update_period_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" offline_blur_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" offline_idle_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 11: to.add(" online_cloud_timeout_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" notify_cloud_delay_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 13: to.add(" notify_default_delay_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 14: to.add(" chat_big_size: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 15: to.add(" push_chat_period_ms: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 16: to.add(" push_chat_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 17: to.add(" saved_gifs_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 18: to.add(" edit_time_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 19: to.add(" disabled_features: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_nearestDc(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_nearestDc(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3246,14 +3269,14 @@ void _serialize_nearestDc(MTPStringLogger &to, int32 stage, int32 lev, Types &ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" country: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" this_dc: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" nearest_dc: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" country: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" this_dc: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" nearest_dc: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_appUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_appUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3261,19 +3284,19 @@ void _serialize_help_appUpdate(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" critical: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_noAppUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_noAppUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ help_noAppUpdate }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_help_inviteText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_inviteText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3281,12 +3304,12 @@ void _serialize_help_inviteText(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedChatEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedChatEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3294,12 +3317,12 @@ void _serialize_encryptedChatEmpty(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedChatWaiting(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedChatWaiting(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3307,16 +3330,16 @@ void _serialize_encryptedChatWaiting(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedChatRequested(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedChatRequested(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3324,17 +3347,17 @@ void _serialize_encryptedChatRequested(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3342,18 +3365,18 @@ void _serialize_encryptedChat(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" g_a_or_b: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" admin_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" participant_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" g_a_or_b: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedChatDiscarded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedChatDiscarded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3361,12 +3384,12 @@ void _serialize_encryptedChatDiscarded(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputEncryptedChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3374,17 +3397,17 @@ void _serialize_inputEncryptedChat(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedFileEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedFileEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ encryptedFileEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_encryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3392,20 +3415,20 @@ void _serialize_encryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputEncryptedFileEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedFileEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputEncryptedFileEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputEncryptedFileUploaded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedFileUploaded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3413,15 +3436,15 @@ void _serialize_inputEncryptedFileUploaded(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" md5_checksum: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" md5_checksum: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3429,13 +3452,13 @@ void _serialize_inputEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputEncryptedFileBigUploaded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputEncryptedFileBigUploaded(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3443,14 +3466,14 @@ void _serialize_inputEncryptedFileBigUploaded(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" parts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3458,16 +3481,16 @@ void _serialize_encryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_encryptedMessageService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_encryptedMessageService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3475,15 +3498,15 @@ void _serialize_encryptedMessageService(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_dhConfigNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_dhConfigNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3491,12 +3514,12 @@ void _serialize_messages_dhConfigNotModified(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" random: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" random: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_dhConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_dhConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3504,15 +3527,15 @@ void _serialize_messages_dhConfig(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" g: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" p: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" random: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" g: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" p: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" random: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sentEncryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sentEncryptedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3520,12 +3543,12 @@ void _serialize_messages_sentEncryptedMessage(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sentEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sentEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3533,17 +3556,17 @@ void _serialize_messages_sentEncryptedFile(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputDocumentEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputDocumentEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputDocumentEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3551,13 +3574,13 @@ void _serialize_inputDocument(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_documentEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3565,12 +3588,12 @@ void _serialize_documentEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_document(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_document(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3578,19 +3601,19 @@ void _serialize_document(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" thumb: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 7: to.add(" attributes: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_support(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_support(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3598,13 +3621,13 @@ void _serialize_help_support(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_notifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_notifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3617,31 +3640,31 @@ void _serialize_notifyPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &t } } -void _serialize_notifyUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_notifyUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ notifyUsers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_notifyChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_notifyChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ notifyChats }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_notifyAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_notifyAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ notifyAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageTypingAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageTypingAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageTypingAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageCancelAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageCancelAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageCancelAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageRecordVideoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageRecordVideoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageRecordVideoAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageUploadVideoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageUploadVideoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3649,16 +3672,16 @@ void _serialize_sendMessageUploadVideoAction(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_sendMessageRecordAudioAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageRecordAudioAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageRecordAudioAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageUploadAudioAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageUploadAudioAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3666,12 +3689,12 @@ void _serialize_sendMessageUploadAudioAction(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_sendMessageUploadPhotoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageUploadPhotoAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3679,12 +3702,12 @@ void _serialize_sendMessageUploadPhotoAction(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_sendMessageUploadDocumentAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageUploadDocumentAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3692,20 +3715,20 @@ void _serialize_sendMessageUploadDocumentAction(MTPStringLogger &to, int32 stage to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" progress: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_sendMessageGeoLocationAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageGeoLocationAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageGeoLocationAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_sendMessageChooseContactAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_sendMessageChooseContactAction(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ sendMessageChooseContactAction }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contacts_found(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_found(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3720,31 +3743,31 @@ void _serialize_contacts_found(MTPStringLogger &to, int32 stage, int32 lev, Type } } -void _serialize_inputPrivacyKeyStatusTimestamp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyKeyStatusTimestamp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyKeyStatusTimestamp }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyKeyChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyKeyChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyKeyChatInvite }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyKeyStatusTimestamp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyKeyStatusTimestamp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyKeyStatusTimestamp }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyKeyChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyKeyChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyKeyChatInvite }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyValueAllowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueAllowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyValueAllowContacts }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyValueAllowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueAllowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyValueAllowAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyValueAllowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueAllowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3757,15 +3780,15 @@ void _serialize_inputPrivacyValueAllowUsers(MTPStringLogger &to, int32 stage, in } } -void _serialize_inputPrivacyValueDisallowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueDisallowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyValueDisallowContacts }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyValueDisallowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueDisallowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputPrivacyValueDisallowAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputPrivacyValueDisallowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputPrivacyValueDisallowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3778,15 +3801,15 @@ void _serialize_inputPrivacyValueDisallowUsers(MTPStringLogger &to, int32 stage, } } -void _serialize_privacyValueAllowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueAllowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyValueAllowContacts }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyValueAllowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueAllowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyValueAllowAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyValueAllowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueAllowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3794,20 +3817,20 @@ void _serialize_privacyValueAllowUsers(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_privacyValueDisallowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueDisallowContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyValueDisallowContacts }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyValueDisallowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueDisallowAll(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ privacyValueDisallowAll }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_privacyValueDisallowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_privacyValueDisallowUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3815,12 +3838,12 @@ void _serialize_privacyValueDisallowUsers(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" users: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_privacyRules(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_privacyRules(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3834,7 +3857,7 @@ void _serialize_account_privacyRules(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_accountDaysTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_accountDaysTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3842,26 +3865,12 @@ void _serialize_accountDaysTTL(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" days: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" days: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_sentChangePhoneCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ account_sentChangePhoneCode"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" send_call_timeout: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } -} - -void _serialize_documentAttributeImageSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeImageSize(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3869,17 +3878,17 @@ void _serialize_documentAttributeImageSize(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_documentAttributeAnimated(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeAnimated(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ documentAttributeAnimated }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_documentAttributeSticker(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeSticker(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3887,13 +3896,13 @@ void _serialize_documentAttributeSticker(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" alt: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" alt: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" stickerset: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_documentAttributeVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeVideo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3901,14 +3910,16 @@ void _serialize_documentAttributeVideo(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_documentAttributeAudio(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeAudio(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDdocumentAttributeAudio::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3916,17 +3927,17 @@ void _serialize_documentAttributeAudio(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" voice: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::flag_voice) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; - case 2: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::flag_title) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 4: to.add(" performer: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::flag_performer) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 5: to.add(" waveform: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::flag_waveform) { types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" voice: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::Flag::f_voice) { to.add("YES [ BY BIT 10 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 10 IN FIELD flags ]"); } break; + case 2: to.add(" duration: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 4: to.add(" performer: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::Flag::f_performer) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 5: to.add(" waveform: "); ++stages.back(); if (flag & MTPDdocumentAttributeAudio::Flag::f_waveform) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_documentAttributeFilename(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_documentAttributeFilename(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3934,16 +3945,16 @@ void _serialize_documentAttributeFilename(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" file_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" file_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_stickersNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_stickersNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messages_stickersNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messages_stickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_stickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3951,13 +3962,13 @@ void _serialize_messages_stickers(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" stickers: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_stickerPack(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_stickerPack(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3965,17 +3976,17 @@ void _serialize_stickerPack(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" emoticon: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" documents: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" emoticon: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" documents: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_allStickersNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_allStickersNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messages_allStickersNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messages_allStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_allStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3983,13 +3994,13 @@ void _serialize_messages_allStickers(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" sets: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_disabledFeature(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_disabledFeature(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -3997,13 +4008,13 @@ void _serialize_disabledFeature(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" feature: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" feature: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_affectedMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_affectedMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4011,29 +4022,29 @@ void _serialize_messages_affectedMessages(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" pts_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contactLinkUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactLinkUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contactLinkUnknown }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contactLinkNone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactLinkNone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contactLinkNone }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contactLinkHasPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactLinkHasPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contactLinkHasPhone }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contactLinkContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contactLinkContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contactLinkContact }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_webPageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_webPageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4041,12 +4052,12 @@ void _serialize_webPageEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_webPagePending(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_webPagePending(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4054,13 +4065,15 @@ void _serialize_webPagePending(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_webPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_webPage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDwebPage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4068,27 +4081,27 @@ void _serialize_webPage(MTPStringLogger &to, int32 stage, int32 lev, Types &type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" display_url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" type: "); ++stages.back(); if (flag & MTPDwebPage::flag_type) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 5: to.add(" site_name: "); ++stages.back(); if (flag & MTPDwebPage::flag_site_name) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 6: to.add(" title: "); ++stages.back(); if (flag & MTPDwebPage::flag_title) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 7: to.add(" description: "); ++stages.back(); if (flag & MTPDwebPage::flag_description) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 8: to.add(" photo: "); ++stages.back(); if (flag & MTPDwebPage::flag_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 9: to.add(" embed_url: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 10: to.add(" embed_type: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_type) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 11: to.add(" embed_width: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_width) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 12: to.add(" embed_height: "); ++stages.back(); if (flag & MTPDwebPage::flag_embed_height) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 13: to.add(" duration: "); ++stages.back(); if (flag & MTPDwebPage::flag_duration) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; - case 14: to.add(" author: "); ++stages.back(); if (flag & MTPDwebPage::flag_author) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; - case 15: to.add(" document: "); ++stages.back(); if (flag & MTPDwebPage::flag_document) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" display_url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 5: to.add(" site_name: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_site_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 6: to.add(" title: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 7: to.add(" description: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_description) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 8: to.add(" photo: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_photo) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 9: to.add(" embed_url: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 10: to.add(" embed_type: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 11: to.add(" embed_width: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_width) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 12: to.add(" embed_height: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_embed_height) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 13: to.add(" duration: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 14: to.add(" author: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_author) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 8 IN FIELD flags ]"); } break; + case 15: to.add(" document: "); ++stages.back(); if (flag & MTPDwebPage::Flag::f_document) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 9 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4096,24 +4109,24 @@ void _serialize_authorization(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" platform: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" app_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" date_created: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" date_active: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 10: to.add(" ip: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 11: to.add(" country: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 12: to.add(" region: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" platform: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" app_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" date_created: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" date_active: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 10: to.add(" ip: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 11: to.add(" country: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 12: to.add(" region: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_authorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_authorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4126,7 +4139,7 @@ void _serialize_account_authorizations(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_account_noPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_noPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4134,13 +4147,13 @@ void _serialize_account_noPassword(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" new_salt: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" email_unconfirmed_pattern: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" new_salt: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" email_unconfirmed_pattern: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_password(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_password(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4148,16 +4161,16 @@ void _serialize_account_password(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" current_salt: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" new_salt: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" hint: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" current_salt: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" new_salt: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" hint: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" has_recovery: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" email_unconfirmed_pattern: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" email_unconfirmed_pattern: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_passwordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_passwordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4165,12 +4178,14 @@ void _serialize_account_passwordSettings(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" email: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" email: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_passwordInputSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_passwordInputSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDaccount_passwordInputSettings::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4178,16 +4193,16 @@ void _serialize_account_passwordInputSettings(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" new_salt: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::flag_new_salt) { types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" new_password_hash: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::flag_new_password_hash) { types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 3: to.add(" hint: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::flag_hint) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 4: to.add(" email: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::flag_email) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" new_salt: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::Flag::f_new_salt) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" new_password_hash: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::Flag::f_new_password_hash) { types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 3: to.add(" hint: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::Flag::f_hint) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 4: to.add(" email: "); ++stages.back(); if (flag & MTPDaccount_passwordInputSettings::Flag::f_email) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_passwordRecovery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_passwordRecovery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4195,12 +4210,12 @@ void _serialize_auth_passwordRecovery(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" email_pattern: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" email_pattern: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_receivedNotifyMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_receivedNotifyMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4208,17 +4223,17 @@ void _serialize_receivedNotifyMessage(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatInviteEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatInviteEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ chatInviteEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_chatInviteExported(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatInviteExported(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4226,12 +4241,12 @@ void _serialize_chatInviteExported(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_chatInviteAlready(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatInviteAlready(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4244,7 +4259,9 @@ void _serialize_chatInviteAlready(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_chatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_chatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchatInvite::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4252,21 +4269,21 @@ void _serialize_chatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &t to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" channel: "); ++stages.back(); if (flag & MTPDchatInvite::flag_channel) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" broadcast: "); ++stages.back(); if (flag & MTPDchatInvite::flag_broadcast) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" public: "); ++stages.back(); if (flag & MTPDchatInvite::flag_public) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 4: to.add(" megagroup: "); ++stages.back(); if (flag & MTPDchatInvite::flag_megagroup) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 5: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" channel: "); ++stages.back(); if (flag & MTPDchatInvite::Flag::f_channel) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" broadcast: "); ++stages.back(); if (flag & MTPDchatInvite::Flag::f_broadcast) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" public: "); ++stages.back(); if (flag & MTPDchatInvite::Flag::f_public) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" megagroup: "); ++stages.back(); if (flag & MTPDchatInvite::Flag::f_megagroup) { to.add("YES [ BY BIT 3 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 5: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputStickerSetEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputStickerSetEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputStickerSetEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputStickerSetID(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputStickerSetID(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4274,13 +4291,13 @@ void _serialize_inputStickerSetID(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputStickerSetShortName(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputStickerSetShortName(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4288,12 +4305,14 @@ void _serialize_inputStickerSetShortName(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDstickerSet::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4301,21 +4320,21 @@ void _serialize_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &t to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" installed: "); ++stages.back(); if (flag & MTPDstickerSet::flag_installed) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" disabled: "); ++stages.back(); if (flag & MTPDstickerSet::flag_disabled) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" official: "); ++stages.back(); if (flag & MTPDstickerSet::flag_official) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 4: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" installed: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_installed) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" disabled: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_disabled) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" official: "); ++stages.back(); if (flag & MTPDstickerSet::Flag::f_official) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 4: to.add(" id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" short_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4330,7 +4349,7 @@ void _serialize_messages_stickerSet(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_botCommand(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botCommand(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4338,13 +4357,13 @@ void _serialize_botCommand(MTPStringLogger &to, int32 stage, int32 lev, Types &t to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" command: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" command: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInfo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInfo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4352,14 +4371,14 @@ void _serialize_botInfo(MTPStringLogger &to, int32 stage, int32 lev, Types &type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" description: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" commands: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_keyboardButton(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_keyboardButton(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4367,12 +4386,12 @@ void _serialize_keyboardButton(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_keyboardButtonRow(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_keyboardButtonRow(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4385,7 +4404,9 @@ void _serialize_keyboardButtonRow(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_replyKeyboardHide(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_replyKeyboardHide(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDreplyKeyboardHide::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4393,13 +4414,15 @@ void _serialize_replyKeyboardHide(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardHide::flag_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardHide::Flag::f_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_replyKeyboardForceReply(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_replyKeyboardForceReply(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDreplyKeyboardForceReply::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4407,14 +4430,16 @@ void _serialize_replyKeyboardForceReply(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" single_use: "); ++stages.back(); if (flag & MTPDreplyKeyboardForceReply::flag_single_use) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 2: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardForceReply::flag_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" single_use: "); ++stages.back(); if (flag & MTPDreplyKeyboardForceReply::Flag::f_single_use) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardForceReply::Flag::f_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_replyKeyboardMarkup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_replyKeyboardMarkup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDreplyKeyboardMarkup::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4422,20 +4447,20 @@ void _serialize_replyKeyboardMarkup(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" resize: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::flag_resize) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" single_use: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::flag_single_use) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::flag_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" resize: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::Flag::f_resize) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" single_use: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::Flag::f_single_use) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" selective: "); ++stages.back(); if (flag & MTPDreplyKeyboardMarkup::Flag::f_selective) { to.add("YES [ BY BIT 2 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; case 4: to.add(" rows: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_appChangelogEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_appChangelogEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ help_appChangelogEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_help_appChangelog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_appChangelog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4443,12 +4468,12 @@ void _serialize_help_appChangelog(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityUnknown(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4456,13 +4481,13 @@ void _serialize_messageEntityUnknown(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityMention(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityMention(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4470,13 +4495,13 @@ void _serialize_messageEntityMention(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityHashtag(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityHashtag(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4484,13 +4509,13 @@ void _serialize_messageEntityHashtag(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityBotCommand(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityBotCommand(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4498,13 +4523,13 @@ void _serialize_messageEntityBotCommand(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4512,13 +4537,13 @@ void _serialize_messageEntityUrl(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityEmail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityEmail(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4526,13 +4551,13 @@ void _serialize_messageEntityEmail(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityBold(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityBold(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4540,13 +4565,13 @@ void _serialize_messageEntityBold(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityItalic(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityItalic(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4554,13 +4579,13 @@ void _serialize_messageEntityItalic(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4568,13 +4593,13 @@ void _serialize_messageEntityCode(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityPre(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityPre(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4582,14 +4607,14 @@ void _serialize_messageEntityPre(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" language: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" language: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageEntityTextUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageEntityTextUrl(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4597,18 +4622,18 @@ void _serialize_messageEntityTextUrl(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputChannelEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputChannelEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ inputChannelEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_inputChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4616,13 +4641,13 @@ void _serialize_inputChannel(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" channel_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" access_hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_resolvedPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_resolvedPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4637,7 +4662,7 @@ void _serialize_contacts_resolvedPeer(MTPStringLogger &to, int32 stage, int32 le } } -void _serialize_messageRange(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageRange(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4645,13 +4670,13 @@ void _serialize_messageRange(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageGroup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageGroup(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4659,15 +4684,17 @@ void _serialize_messageGroup(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_channelDifferenceEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_channelDifferenceEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdates_channelDifferenceEmpty::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4675,15 +4702,17 @@ void _serialize_updates_channelDifferenceEmpty(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceEmpty::flag_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceEmpty::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceEmpty::Flag::f_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceEmpty::Flag::f_timeout) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_channelDifferenceTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_channelDifferenceTooLong(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdates_channelDifferenceTooLong::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4691,15 +4720,15 @@ void _serialize_updates_channelDifferenceTooLong(MTPStringLogger &to, int32 stag to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceTooLong::flag_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceTooLong::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 4: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceTooLong::Flag::f_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifferenceTooLong::Flag::f_timeout) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 4: to.add(" top_message: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" top_important_message: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" read_inbox_max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" unread_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" unread_important_count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 9: to.add(" messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 10: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 11: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -4707,7 +4736,9 @@ void _serialize_updates_channelDifferenceTooLong(MTPStringLogger &to, int32 stag } } -void _serialize_updates_channelDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_channelDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDupdates_channelDifference::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4715,10 +4746,10 @@ void _serialize_updates_channelDifference(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifference::flag_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifference::flag_timeout) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" final: "); ++stages.back(); if (flag & MTPDupdates_channelDifference::Flag::f_final) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" timeout: "); ++stages.back(); if (flag & MTPDupdates_channelDifference::Flag::f_timeout) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 4: to.add(" new_messages: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" other_updates: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 6: to.add(" chats: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; @@ -4727,11 +4758,13 @@ void _serialize_updates_channelDifference(MTPStringLogger &to, int32 stage, int3 } } -void _serialize_channelMessagesFilterEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelMessagesFilterEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelMessagesFilterEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelMessagesFilter(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelMessagesFilter(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchannelMessagesFilter::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4739,19 +4772,19 @@ void _serialize_channelMessagesFilter(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" important_only: "); ++stages.back(); if (flag & MTPDchannelMessagesFilter::flag_important_only) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" exclude_new_messages: "); ++stages.back(); if (flag & MTPDchannelMessagesFilter::flag_exclude_new_messages) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" important_only: "); ++stages.back(); if (flag & MTPDchannelMessagesFilter::Flag::f_important_only) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" exclude_new_messages: "); ++stages.back(); if (flag & MTPDchannelMessagesFilter::Flag::f_exclude_new_messages) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 3: to.add(" ranges: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelMessagesFilterCollapsed(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelMessagesFilterCollapsed(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelMessagesFilterCollapsed }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4759,13 +4792,13 @@ void _serialize_channelParticipant(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantSelf(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4773,14 +4806,14 @@ void _serialize_channelParticipantSelf(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantModerator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantModerator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4788,14 +4821,14 @@ void _serialize_channelParticipantModerator(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantEditor(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantEditor(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4803,14 +4836,14 @@ void _serialize_channelParticipantEditor(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" inviter_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantKicked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantKicked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4818,14 +4851,14 @@ void _serialize_channelParticipantKicked(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" kicked_by: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" kicked_by: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantCreator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantCreator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4833,40 +4866,40 @@ void _serialize_channelParticipantCreator(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" user_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channelParticipantsRecent(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantsRecent(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelParticipantsRecent }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelParticipantsAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantsAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelParticipantsAdmins }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelParticipantsKicked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantsKicked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelParticipantsKicked }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelParticipantsBots(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelParticipantsBots(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelParticipantsBots }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelRoleEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelRoleEmpty(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelRoleEmpty }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelRoleModerator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelRoleModerator(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelRoleModerator }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channelRoleEditor(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channelRoleEditor(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ channelRoleEditor }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_channels_channelParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_channelParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4874,14 +4907,14 @@ void _serialize_channels_channelParticipants(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" count: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" participants: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_channelParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_channelParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4895,7 +4928,7 @@ void _serialize_channels_channelParticipant(MTPStringLogger &to, int32 stage, in } } -void _serialize_help_termsOfService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_termsOfService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4903,12 +4936,12 @@ void _serialize_help_termsOfService(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" text: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_foundGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_foundGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4916,17 +4949,17 @@ void _serialize_foundGif(MTPStringLogger &to, int32 stage, int32 lev, Types &typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" thumb_url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" content_url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" content_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" thumb_url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" content_url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" content_type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" w: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" h: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_foundGifCached(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_foundGifCached(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4934,14 +4967,14 @@ void _serialize_foundGifCached(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" url: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" document: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_foundGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_foundGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4949,17 +4982,17 @@ void _serialize_messages_foundGifs(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" next_offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" next_offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_savedGifsNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_savedGifsNotModified(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ messages_savedGifsNotModified }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messages_savedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_savedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4967,13 +5000,13 @@ void _serialize_messages_savedGifs(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" gifs: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputBotInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputBotInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4981,12 +5014,14 @@ void _serialize_inputBotInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputBotInlineMessageText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputBotInlineMessageText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDinputBotInlineMessageText::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -4994,15 +5029,17 @@ void _serialize_inputBotInlineMessageText(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPDinputBotInlineMessageText::flag_no_webpage) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" entities: "); ++stages.back(); if (flag & MTPDinputBotInlineMessageText::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPDinputBotInlineMessageText::Flag::f_no_webpage) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" entities: "); ++stages.back(); if (flag & MTPDinputBotInlineMessageText::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_inputBotInlineResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_inputBotInlineResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDinputBotInlineResult::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5010,24 +5047,24 @@ void _serialize_inputBotInlineResult(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_title) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 4: to.add(" description: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_description) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 5: to.add(" url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 6: to.add(" thumb_url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_thumb_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 7: to.add(" content_url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_content_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 8: to.add(" content_type: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_content_type) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 9: to.add(" w: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_w) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 10: to.add(" h: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_h) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 11: to.add(" duration: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::flag_duration) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 4: to.add(" description: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_description) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 6: to.add(" thumb_url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_thumb_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 7: to.add(" content_url: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_content_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 8: to.add(" content_type: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_content_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 9: to.add(" w: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_w) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 10: to.add(" h: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_h) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 11: to.add(" duration: "); ++stages.back(); if (flag & MTPDinputBotInlineResult::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; case 12: to.add(" send_message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5035,12 +5072,14 @@ void _serialize_botInlineMessageMediaAuto(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInlineMessageText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInlineMessageText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDbotInlineMessageText::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5048,15 +5087,15 @@ void _serialize_botInlineMessageText(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPDbotInlineMessageText::flag_no_webpage) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" entities: "); ++stages.back(); if (flag & MTPDbotInlineMessageText::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPDbotInlineMessageText::Flag::f_no_webpage) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" entities: "); ++stages.back(); if (flag & MTPDbotInlineMessageText::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInlineMediaResultDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInlineMediaResultDocument(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5064,15 +5103,15 @@ void _serialize_botInlineMediaResultDocument(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" document: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" send_message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInlineMediaResultPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInlineMediaResultPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5080,15 +5119,17 @@ void _serialize_botInlineMediaResultPhoto(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" send_message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_botInlineResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_botInlineResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDbotInlineResult::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5096,24 +5137,26 @@ void _serialize_botInlineResult(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_title) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 4: to.add(" description: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_description) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 5: to.add(" url: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; - case 6: to.add(" thumb_url: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_thumb_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 7: to.add(" content_url: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_content_url) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 8: to.add(" content_type: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_content_type) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 9: to.add(" w: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_w) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 10: to.add(" h: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_h) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; - case 11: to.add(" duration: "); ++stages.back(); if (flag & MTPDbotInlineResult::flag_duration) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" title: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_title) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 4: to.add(" description: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_description) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" url: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 6: to.add(" thumb_url: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_thumb_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 7: to.add(" content_url: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_content_url) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 8: to.add(" content_type: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_content_type) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 9: to.add(" w: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_w) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 10: to.add(" h: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_h) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 11: to.add(" duration: "); ++stages.back(); if (flag & MTPDbotInlineResult::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 7 IN FIELD flags ]"); } break; case 12: to.add(" send_message: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_botResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_botResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessages_botResults::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5121,16 +5164,16 @@ void _serialize_messages_botResults(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" gallery: "); ++stages.back(); if (flag & MTPDmessages_botResults::flag_gallery) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" next_offset: "); ++stages.back(); if (flag & MTPDmessages_botResults::flag_next_offset) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" gallery: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_gallery) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" next_offset: "); ++stages.back(); if (flag & MTPDmessages_botResults::Flag::f_next_offset) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 4: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_exportedMessageLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_exportedMessageLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5138,12 +5181,14 @@ void _serialize_exportedMessageLink(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" link: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messageFwdHeader(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messageFwdHeader(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDmessageFwdHeader::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5151,16 +5196,18 @@ void _serialize_messageFwdHeader(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::flag_from_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" channel_id: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::flag_channel_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 4: to.add(" channel_post: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::flag_channel_post) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" from_id: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::Flag::f_from_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" channel_id: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::Flag::f_channel_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 4: to.add(" channel_post: "); ++stages.back(); if (flag & MTPDmessageFwdHeader::Flag::f_channel_post) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_messageEditData(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_messageEditData(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPDchannels_messageEditData::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5168,13 +5215,77 @@ void _serialize_channels_messageEditData(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::flag_caption) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); if (flag & MTPDchannels_messageEditData::Flag::f_caption) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_req_pq(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_codeTypeSms(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ auth_codeTypeSms }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_auth_codeTypeCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ auth_codeTypeCall }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_auth_codeTypeFlashCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + to.add("{ auth_codeTypeFlashCall }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); +} + +void _serialize_auth_sentCodeTypeApp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_sentCodeTypeApp"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_auth_sentCodeTypeSms(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_sentCodeTypeSms"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_auth_sentCodeTypeCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_sentCodeTypeCall"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_auth_sentCodeTypeFlashCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_sentCodeTypeFlashCall"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" pattern: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_req_pq(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5182,12 +5293,12 @@ void _serialize_req_pq(MTPStringLogger &to, int32 stage, int32 lev, Types &types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_req_DH_params(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_req_DH_params(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5195,17 +5306,17 @@ void _serialize_req_DH_params(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" p: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" public_key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" encrypted_data: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" p: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" public_key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" encrypted_data: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_set_client_DH_params(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_set_client_DH_params(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5213,14 +5324,14 @@ void _serialize_set_client_DH_params(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" encrypted_data: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" server_nonce: "); ++stages.back(); types.push_back(mtpc_int128+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" encrypted_data: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_rpc_drop_answer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_drop_answer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5228,12 +5339,12 @@ void _serialize_rpc_drop_answer(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" req_msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_get_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_get_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5241,12 +5352,12 @@ void _serialize_get_future_salts(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" num: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" num: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_ping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_ping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5254,12 +5365,12 @@ void _serialize_ping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_ping_delay_disconnect(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_ping_delay_disconnect(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5267,13 +5378,13 @@ void _serialize_ping_delay_disconnect(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" disconnect_delay: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" ping_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" disconnect_delay: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_destroy_session(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_destroy_session(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5281,12 +5392,12 @@ void _serialize_destroy_session(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" session_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_register_saveDeveloperInfo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_register_saveDeveloperInfo(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5294,38 +5405,24 @@ void _serialize_register_saveDeveloperInfo(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" email: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" age: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" city: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" email: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" age: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" city: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_sendCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ auth_sendCall"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } -} - -void _serialize_auth_logOut(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_logOut(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ auth_logOut }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_auth_resetAuthorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_resetAuthorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ auth_resetAuthorizations }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_auth_sendInvites(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_sendInvites(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5333,13 +5430,13 @@ void _serialize_auth_sendInvites(MTPStringLogger &to, int32 stage, int32 lev, Ty to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_numbers: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_string); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_numbers: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_string+0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_bindTempAuthKey(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_bindTempAuthKey(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5347,29 +5444,29 @@ void _serialize_auth_bindTempAuthKey(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" perm_auth_key_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" expires_at: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" encrypted_message: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" perm_auth_key_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" nonce: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" expires_at: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" encrypted_message: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_sendSms(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_cancelCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { - to.add("{ auth_sendSms"); + to.add("{ auth_cancelCode"); to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_registerDevice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_registerDevice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5377,18 +5474,18 @@ void _serialize_account_registerDevice(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" token_type: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" token: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" token_type: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" token: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" app_sandbox: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_unregisterDevice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_unregisterDevice(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5396,13 +5493,13 @@ void _serialize_account_unregisterDevice(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" token_type: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" token: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" token_type: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" token: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_updateNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updateNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5416,11 +5513,11 @@ void _serialize_account_updateNotifySettings(MTPStringLogger &to, int32 stage, i } } -void _serialize_account_resetNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_resetNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ account_resetNotifySettings }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_updateStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updateStatus(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5433,7 +5530,7 @@ void _serialize_account_updateStatus(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_account_reportPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_reportPeer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5447,7 +5544,7 @@ void _serialize_account_reportPeer(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_account_checkUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_checkUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5455,12 +5552,12 @@ void _serialize_account_checkUsername(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_deleteAccount(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_deleteAccount(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5468,12 +5565,12 @@ void _serialize_account_deleteAccount(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" reason: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" reason: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_setAccountTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_setAccountTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5486,7 +5583,7 @@ void _serialize_account_setAccountTTL(MTPStringLogger &to, int32 stage, int32 le } } -void _serialize_account_updateDeviceLocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updateDeviceLocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5494,12 +5591,12 @@ void _serialize_account_updateDeviceLocked(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" period: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" period: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_resetAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_resetAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5507,12 +5604,12 @@ void _serialize_account_resetAuthorization(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_updatePasswordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updatePasswordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5520,13 +5617,13 @@ void _serialize_account_updatePasswordSettings(MTPStringLogger &to, int32 stage, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" new_settings: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_deleteContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_deleteContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5539,7 +5636,7 @@ void _serialize_contacts_deleteContacts(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_contacts_block(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_block(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5552,7 +5649,7 @@ void _serialize_contacts_block(MTPStringLogger &to, int32 stage, int32 lev, Type } } -void _serialize_contacts_unblock(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_unblock(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5565,7 +5662,7 @@ void _serialize_contacts_unblock(MTPStringLogger &to, int32 stage, int32 lev, Ty } } -void _serialize_messages_setTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_setTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5579,7 +5676,7 @@ void _serialize_messages_setTyping(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_messages_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5592,7 +5689,7 @@ void _serialize_messages_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_messages_hideReportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_hideReportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5605,7 +5702,7 @@ void _serialize_messages_hideReportSpam(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_messages_discardEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_discardEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5613,12 +5710,12 @@ void _serialize_messages_discardEncryption(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_setEncryptedTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_setEncryptedTyping(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5632,7 +5729,7 @@ void _serialize_messages_setEncryptedTyping(MTPStringLogger &to, int32 stage, in } } -void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5641,12 +5738,12 @@ void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage, } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_installStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_installStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5660,7 +5757,7 @@ void _serialize_messages_installStickerSet(MTPStringLogger &to, int32 stage, int } } -void _serialize_messages_uninstallStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_uninstallStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5673,7 +5770,7 @@ void _serialize_messages_uninstallStickerSet(MTPStringLogger &to, int32 stage, i } } -void _serialize_messages_editChatAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_editChatAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5681,14 +5778,14 @@ void _serialize_messages_editChatAdmin(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" is_admin: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_reorderStickerSets(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_reorderStickerSets(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5696,12 +5793,12 @@ void _serialize_messages_reorderStickerSets(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" order: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_saveGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_saveGif(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5715,7 +5812,9 @@ void _serialize_messages_saveGif(MTPStringLogger &to, int32 stage, int32 lev, Ty } } -void _serialize_messages_setInlineBotResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_setInlineBotResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_setInlineBotResults::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5723,18 +5822,18 @@ void _serialize_messages_setInlineBotResults(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" gallery: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::flag_gallery) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" private: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::flag_private) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" gallery: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::Flag::f_gallery) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" private: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::Flag::f_private) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" results: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" cache_time: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" next_offset: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::flag_next_offset) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 5: to.add(" cache_time: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" next_offset: "); ++stages.back(); if (flag & MTPmessages_setInlineBotResults::Flag::f_next_offset) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_upload_saveFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_upload_saveFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5742,14 +5841,14 @@ void _serialize_upload_saveFilePart(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_upload_saveBigFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_upload_saveBigFilePart(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5757,15 +5856,15 @@ void _serialize_upload_saveBigFilePart(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" file_total_parts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" file_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" file_part: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" file_total_parts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_saveAppLog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_saveAppLog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5778,7 +5877,7 @@ void _serialize_help_saveAppLog(MTPStringLogger &to, int32 stage, int32 lev, Typ } } -void _serialize_channels_readHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_readHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5787,12 +5886,12 @@ void _serialize_channels_readHistory(MTPStringLogger &to, int32 stage, int32 lev } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5802,12 +5901,12 @@ void _serialize_channels_reportSpam(MTPStringLogger &to, int32 stage, int32 lev, switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_editAbout(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_editAbout(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5816,12 +5915,12 @@ void _serialize_channels_editAbout(MTPStringLogger &to, int32 stage, int32 lev, } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_checkUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_checkUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5830,12 +5929,12 @@ void _serialize_channels_checkUsername(MTPStringLogger &to, int32 stage, int32 l } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_updateUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_updateUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5844,12 +5943,12 @@ void _serialize_channels_updateUsername(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_invokeAfterMsg(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_invokeAfterMsg(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5857,13 +5956,13 @@ void _serialize_invokeAfterMsg(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" query: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_invokeAfterMsgs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_invokeAfterMsgs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5871,13 +5970,13 @@ void _serialize_invokeAfterMsgs(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" msg_ids: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" query: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_initConnection(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_initConnection(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5885,17 +5984,17 @@ void _serialize_initConnection(MTPStringLogger &to, int32 stage, int32 lev, Type to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 5: to.add(" query: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_invokeWithLayer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_invokeWithLayer(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5903,13 +6002,13 @@ void _serialize_invokeWithLayer(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" layer: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" layer: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" query: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_invokeWithoutUpdates(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_invokeWithoutUpdates(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5922,7 +6021,7 @@ void _serialize_invokeWithoutUpdates(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_auth_checkPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_checkPhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5930,12 +6029,14 @@ void _serialize_auth_checkPhone(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_sendCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_sendCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPauth_sendCode::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5943,16 +6044,50 @@ void _serialize_auth_sendCode(MTPStringLogger &to, int32 stage, int32 lev, Types to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" sms_type: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" api_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" allow_flashcall: "); ++stages.back(); if (flag & MTPauth_sendCode::Flag::f_allow_flashcall) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" current_number: "); ++stages.back(); if (flag & MTPauth_sendCode::Flag::f_current_number) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 4: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" api_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_signUp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_resendCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ auth_resendCode"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_account_sendChangePhoneCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPaccount_sendChangePhoneCode::Flags flag(iflag); + + if (stage) { + to.add(",\n").addSpaces(lev); + } else { + to.add("{ account_sendChangePhoneCode"); + to.add("\n").addSpaces(lev); + } + switch (stage) { + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" allow_flashcall: "); ++stages.back(); if (flag & MTPaccount_sendChangePhoneCode::Flag::f_allow_flashcall) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" current_number: "); ++stages.back(); if (flag & MTPaccount_sendChangePhoneCode::Flag::f_current_number) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; + } +} + +void _serialize_auth_signUp(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5960,16 +6095,16 @@ void _serialize_auth_signUp(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" first_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" last_name: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_signIn(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_signIn(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5977,14 +6112,14 @@ void _serialize_auth_signIn(MTPStringLogger &to, int32 stage, int32 lev, Types & to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_importAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_importAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -5992,13 +6127,13 @@ void _serialize_auth_importAuthorization(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" bytes: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_importBotAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_importBotAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6006,15 +6141,15 @@ void _serialize_auth_importBotAuthorization(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" api_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" bot_auth_token: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" api_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" api_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" bot_auth_token: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_checkPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_checkPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6022,12 +6157,12 @@ void _serialize_auth_checkPassword(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" password_hash: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" password_hash: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_recoverPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_recoverPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6035,12 +6170,12 @@ void _serialize_auth_recoverPassword(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_exportAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_exportAuthorization(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6048,16 +6183,16 @@ void _serialize_auth_exportAuthorization(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" dc_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_auth_requestPasswordRecovery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_auth_requestPasswordRecovery(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ auth_requestPasswordRecovery }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_getNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getNotifySettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6070,7 +6205,9 @@ void _serialize_account_getNotifySettings(MTPStringLogger &to, int32 stage, int3 } } -void _serialize_account_updateProfile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updateProfile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPaccount_updateProfile::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6078,15 +6215,15 @@ void _serialize_account_updateProfile(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" first_name: "); ++stages.back(); if (flag & MTPaccount_updateProfile::flag_first_name) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" last_name: "); ++stages.back(); if (flag & MTPaccount_updateProfile::flag_last_name) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" about: "); ++stages.back(); if (flag & MTPaccount_updateProfile::flag_about) { types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" first_name: "); ++stages.back(); if (flag & MTPaccount_updateProfile::Flag::f_first_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" last_name: "); ++stages.back(); if (flag & MTPaccount_updateProfile::Flag::f_last_name) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" about: "); ++stages.back(); if (flag & MTPaccount_updateProfile::Flag::f_about) { types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_updateUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_updateUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6094,12 +6231,12 @@ void _serialize_account_updateUsername(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_changePhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_changePhone(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6107,14 +6244,14 @@ void _serialize_account_changePhone(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" phone_code_hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" phone_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_importCard(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_importCard(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6122,16 +6259,16 @@ void _serialize_contacts_importCard(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" export_card: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" export_card: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_account_getWallPapers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getWallPapers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ account_getWallPapers }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_getPrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getPrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6144,7 +6281,7 @@ void _serialize_account_getPrivacy(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_account_setPrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_setPrivacy(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6158,32 +6295,19 @@ void _serialize_account_setPrivacy(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_account_getAccountTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getAccountTTL(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ account_getAccountTTL }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_sendChangePhoneCode(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { - if (stage) { - to.add(",\n").addSpaces(lev); - } else { - to.add("{ account_sendChangePhoneCode"); - to.add("\n").addSpaces(lev); - } - switch (stage) { - case 0: to.add(" phone_number: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; - } -} - -void _serialize_account_getAuthorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getAuthorizations(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ account_getAuthorizations }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_getPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getPassword(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ account_getPassword }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_account_getPasswordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_account_getPasswordSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6191,12 +6315,12 @@ void _serialize_account_getPasswordSettings(MTPStringLogger &to, int32 stage, in to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" current_password_hash: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_users_getUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_users_getUsers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6209,7 +6333,7 @@ void _serialize_users_getUsers(MTPStringLogger &to, int32 stage, int32 lev, Type } } -void _serialize_users_getFullUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_users_getFullUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6222,11 +6346,11 @@ void _serialize_users_getFullUser(MTPStringLogger &to, int32 stage, int32 lev, T } } -void _serialize_contacts_getStatuses(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_getStatuses(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contacts_getStatuses }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_contacts_getContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_getContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6234,12 +6358,12 @@ void _serialize_contacts_getContacts(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_importContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_importContacts(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6253,7 +6377,7 @@ void _serialize_contacts_importContacts(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_contacts_deleteContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_deleteContact(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6266,7 +6390,7 @@ void _serialize_contacts_deleteContact(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_contacts_getBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_getBlocked(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6274,17 +6398,17 @@ void _serialize_contacts_getBlocked(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_exportCard(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_exportCard(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ contacts_exportCard }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_messages_getMessagesViews(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getMessagesViews(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6293,13 +6417,13 @@ void _serialize_messages_getMessagesViews(MTPStringLogger &to, int32 stage, int3 } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" increment: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_search(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_search(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6307,13 +6431,13 @@ void _serialize_contacts_search(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_contacts_resolveUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_contacts_resolveUsername(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6321,12 +6445,12 @@ void _serialize_contacts_resolveUsername(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" username: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6334,12 +6458,12 @@ void _serialize_messages_getMessages(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6348,17 +6472,19 @@ void _serialize_messages_getHistory(MTPStringLogger &to, int32 stage, int32 lev, } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" add_offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" add_offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_search(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_search(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_search::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6366,21 +6492,21 @@ void _serialize_messages_search(MTPStringLogger &to, int32 stage, int32 lev, Typ to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" important_only: "); ++stages.back(); if (flag & MTPmessages_search::flag_important_only) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" important_only: "); ++stages.back(); if (flag & MTPmessages_search::Flag::f_important_only) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 2: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 4: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" min_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" min_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" max_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_searchGlobal(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_searchGlobal(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6388,16 +6514,16 @@ void _serialize_messages_searchGlobal(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" offset_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getImportantHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getImportantHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6406,17 +6532,17 @@ void _serialize_channels_getImportantHistory(MTPStringLogger &to, int32 stage, i } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" add_offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" add_offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" min_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6425,12 +6551,12 @@ void _serialize_channels_getMessages(MTPStringLogger &to, int32 stage, int32 lev } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6438,15 +6564,15 @@ void _serialize_messages_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset_date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" offset_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6454,13 +6580,13 @@ void _serialize_channels_getDialogs(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_readHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_readHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6469,12 +6595,12 @@ void _serialize_messages_readHistory(MTPStringLogger &to, int32 stage, int32 lev } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6482,12 +6608,12 @@ void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_readMessageContents(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_readMessageContents(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6495,12 +6621,12 @@ void _serialize_messages_readMessageContents(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6509,12 +6635,12 @@ void _serialize_channels_deleteMessages(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_deleteHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_deleteHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6523,12 +6649,12 @@ void _serialize_messages_deleteHistory(MTPStringLogger &to, int32 stage, int32 l } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_deleteUserHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_deleteUserHistory(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6542,7 +6668,7 @@ void _serialize_channels_deleteUserHistory(MTPStringLogger &to, int32 stage, int } } -void _serialize_messages_receivedMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_receivedMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6550,12 +6676,14 @@ void _serialize_messages_receivedMessages(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_sendMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6563,22 +6691,24 @@ void _serialize_messages_sendMessage(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 2: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 3: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 4: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 2: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 3: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 4: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; case 5: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 7: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 9: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; - case 10: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_sendMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 6: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 7: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 9: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 10: to.add(" entities: "); ++stages.back(); if (flag & MTPmessages_sendMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendMedia(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendMedia(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_sendMedia::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6586,20 +6716,22 @@ void _serialize_messages_sendMedia(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendMedia::Flag::f_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendMedia::Flag::f_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendMedia::Flag::f_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; case 4: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendMedia::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 6: to.add(" media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMedia::flag_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; + case 7: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" reply_markup: "); ++stages.back(); if (flag & MTPmessages_sendMedia::Flag::f_reply_markup) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 2 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_forwardMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_forwardMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_forwardMessages::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6607,19 +6739,19 @@ void _serialize_messages_forwardMessages(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_forwardMessages::Flag::f_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; case 4: to.add(" from_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; - case 6: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; + case 6: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; case 7: to.add(" to_peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_editChatTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_editChatTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6627,13 +6759,13 @@ void _serialize_messages_editChatTitle(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_editChatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_editChatPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6641,13 +6773,13 @@ void _serialize_messages_editChatPhoto(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" photo: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_addChatUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_addChatUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6655,14 +6787,14 @@ void _serialize_messages_addChatUser(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" fwd_limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" fwd_limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_deleteChatUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_deleteChatUser(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6670,13 +6802,13 @@ void _serialize_messages_deleteChatUser(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_createChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_createChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6685,12 +6817,12 @@ void _serialize_messages_createChat(MTPStringLogger &to, int32 stage, int32 lev, } switch (stage) { case 0: to.add(" users: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_forwardMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_forwardMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6699,13 +6831,13 @@ void _serialize_messages_forwardMessage(MTPStringLogger &to, int32 stage, int32 } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendBroadcast(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendBroadcast(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6714,14 +6846,14 @@ void _serialize_messages_sendBroadcast(MTPStringLogger &to, int32 stage, int32 l } switch (stage) { case 0: to.add(" contacts: "); ++stages.back(); types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_long+0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" media: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_importChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_importChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6729,12 +6861,12 @@ void _serialize_messages_importChatInvite(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_startBot(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_startBot(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6744,13 +6876,13 @@ void _serialize_messages_startBot(MTPStringLogger &to, int32 stage, int32 lev, T switch (stage) { case 0: to.add(" bot: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" start_param: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" start_param: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_toggleChatAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_toggleChatAdmins(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6758,13 +6890,13 @@ void _serialize_messages_toggleChatAdmins(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" enabled: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_migrateChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_migrateChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6772,12 +6904,14 @@ void _serialize_messages_migrateChat(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendInlineBotResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendInlineBotResult(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPmessages_sendInlineBotResult::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6785,20 +6919,22 @@ void _serialize_messages_sendInlineBotResult(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; - case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; - case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::Flag::f_broadcast) { to.add("YES [ BY BIT 4 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 4 IN FIELD flags ]"); } break; + case 2: to.add(" silent: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::Flag::f_silent) { to.add("YES [ BY BIT 5 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 5 IN FIELD flags ]"); } break; + case 3: to.add(" background: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::Flag::f_background) { to.add("YES [ BY BIT 6 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 6 IN FIELD flags ]"); } break; case 4: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::flag_reply_to_msg_id) { types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 6: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 7: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 8: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" reply_to_msg_id: "); ++stages.back(); if (flag & MTPmessages_sendInlineBotResult::Flag::f_reply_to_msg_id) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 6: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 7: to.add(" query_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 8: to.add(" id: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_createChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_createChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPchannels_createChannel::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6806,16 +6942,16 @@ void _serialize_channels_createChannel(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPchannels_createChannel::flag_broadcast) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; - case 2: to.add(" megagroup: "); ++stages.back(); if (flag & MTPchannels_createChannel::flag_megagroup) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; - case 3: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" broadcast: "); ++stages.back(); if (flag & MTPchannels_createChannel::Flag::f_broadcast) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 2: to.add(" megagroup: "); ++stages.back(); if (flag & MTPchannels_createChannel::Flag::f_megagroup) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 3: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" about: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_editAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_editAdmin(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6830,7 +6966,7 @@ void _serialize_channels_editAdmin(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_channels_editTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_editTitle(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6839,12 +6975,12 @@ void _serialize_channels_editTitle(MTPStringLogger &to, int32 stage, int32 lev, } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" title: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_editPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_editPhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6858,7 +6994,7 @@ void _serialize_channels_editPhoto(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_channels_toggleComments(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_toggleComments(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6872,7 +7008,7 @@ void _serialize_channels_toggleComments(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_channels_joinChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_joinChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6885,7 +7021,7 @@ void _serialize_channels_joinChannel(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_channels_leaveChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_leaveChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6898,7 +7034,7 @@ void _serialize_channels_leaveChannel(MTPStringLogger &to, int32 stage, int32 le } } -void _serialize_channels_inviteToChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_inviteToChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6912,7 +7048,7 @@ void _serialize_channels_inviteToChannel(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_channels_kickFromChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_kickFromChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6927,7 +7063,7 @@ void _serialize_channels_kickFromChannel(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_channels_deleteChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_deleteChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6940,7 +7076,7 @@ void _serialize_channels_deleteChannel(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_channels_toggleInvites(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_toggleInvites(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6954,7 +7090,7 @@ void _serialize_channels_toggleInvites(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_channels_toggleSignatures(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_toggleSignatures(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6968,7 +7104,9 @@ void _serialize_channels_toggleSignatures(MTPStringLogger &to, int32 stage, int3 } } -void _serialize_channels_editMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_editMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPchannels_editMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6976,17 +7114,19 @@ void _serialize_channels_editMessage(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPchannels_editMessage::flag_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" no_webpage: "); ++stages.back(); if (flag & MTPchannels_editMessage::Flag::f_no_webpage) { to.add("YES [ BY BIT 1 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break; case 2: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 4: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 5: to.add(" entities: "); ++stages.back(); if (flag & MTPchannels_editMessage::flag_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; + case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 4: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 5: to.add(" entities: "); ++stages.back(); if (flag & MTPchannels_editMessage::Flag::f_entities) { types.push_back(00); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 3 IN FIELD flags ]"); } break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_updatePinnedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_updatePinnedMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { + MTPchannels_updatePinnedMessage::Flags flag(iflag); + if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -6994,15 +7134,15 @@ void _serialize_channels_updatePinnedMessage(MTPStringLogger &to, int32 stage, i to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" silent: "); ++stages.back(); if (flag & MTPchannels_updatePinnedMessage::flag_silent) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; + case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" silent: "); ++stages.back(); if (flag & MTPchannels_updatePinnedMessage::Flag::f_silent) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break; case 2: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getPeerSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getPeerSettings(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7015,7 +7155,7 @@ void _serialize_messages_getPeerSettings(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_messages_getChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getChats(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7023,12 +7163,12 @@ void _serialize_messages_getChats(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getChannels(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getChannels(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7041,7 +7181,7 @@ void _serialize_channels_getChannels(MTPStringLogger &to, int32 stage, int32 lev } } -void _serialize_messages_getFullChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getFullChat(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7049,12 +7189,12 @@ void _serialize_messages_getFullChat(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getFullChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getFullChannel(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7067,7 +7207,7 @@ void _serialize_channels_getFullChannel(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_messages_getDhConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getDhConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7075,13 +7215,13 @@ void _serialize_messages_getDhConfig(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_length: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" version: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_length: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_requestEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_requestEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7090,13 +7230,13 @@ void _serialize_messages_requestEncryption(MTPStringLogger &to, int32 stage, int } switch (stage) { case 0: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" g_a: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_acceptEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_acceptEncryption(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7105,13 +7245,13 @@ void _serialize_messages_acceptEncryption(MTPStringLogger &to, int32 stage, int3 } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" g_b: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" g_b: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" key_fingerprint: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendEncrypted(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendEncrypted(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7120,13 +7260,13 @@ void _serialize_messages_sendEncrypted(MTPStringLogger &to, int32 stage, int32 l } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendEncryptedFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7135,14 +7275,14 @@ void _serialize_messages_sendEncryptedFile(MTPStringLogger &to, int32 stage, int } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_sendEncryptedService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_sendEncryptedService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7151,13 +7291,13 @@ void _serialize_messages_sendEncryptedService(MTPStringLogger &to, int32 stage, } switch (stage) { case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" random_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" data: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_receivedQueue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_receivedQueue(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7165,12 +7305,12 @@ void _serialize_messages_receivedQueue(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" max_qts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" max_qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photos_deletePhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_deletePhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7183,7 +7323,7 @@ void _serialize_photos_deletePhotos(MTPStringLogger &to, int32 stage, int32 lev, } } -void _serialize_messages_getStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7191,13 +7331,13 @@ void _serialize_messages_getStickers(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" emoticon: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" emoticon: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getAllStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getAllStickers(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7205,12 +7345,12 @@ void _serialize_messages_getAllStickers(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getWebPagePreview(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getWebPagePreview(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7218,12 +7358,12 @@ void _serialize_messages_getWebPagePreview(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" message: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_exportChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_exportChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7231,12 +7371,12 @@ void _serialize_messages_exportChatInvite(MTPStringLogger &to, int32 stage, int3 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" chat_id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_exportInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_exportInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7249,7 +7389,7 @@ void _serialize_channels_exportInvite(MTPStringLogger &to, int32 stage, int32 le } } -void _serialize_messages_checkChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_checkChatInvite(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7257,12 +7397,12 @@ void _serialize_messages_checkChatInvite(MTPStringLogger &to, int32 stage, int32 to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7275,7 +7415,7 @@ void _serialize_messages_getStickerSet(MTPStringLogger &to, int32 stage, int32 l } } -void _serialize_messages_getDocumentByHash(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getDocumentByHash(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7283,14 +7423,14 @@ void _serialize_messages_getDocumentByHash(MTPStringLogger &to, int32 stage, int to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" sha256: "); ++stages.back(); types.push_back(mtpc_bytes); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" sha256: "); ++stages.back(); types.push_back(mtpc_bytes+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" size: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" mime_type: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_searchGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_searchGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7298,13 +7438,13 @@ void _serialize_messages_searchGifs(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" q: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getSavedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getSavedGifs(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7312,12 +7452,12 @@ void _serialize_messages_getSavedGifs(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" hash: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_messages_getInlineBotResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_messages_getInlineBotResults(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7326,17 +7466,17 @@ void _serialize_messages_getInlineBotResults(MTPStringLogger &to, int32 stage, i } switch (stage) { case 0: to.add(" bot: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" query: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_getState(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_getState(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ updates_getState }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_updates_getDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_getDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7344,14 +7484,14 @@ void _serialize_updates_getDifference(MTPStringLogger &to, int32 stage, int32 le to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" date: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" qts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_updates_getChannelDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_updates_getChannelDifference(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7361,13 +7501,13 @@ void _serialize_updates_getChannelDifference(MTPStringLogger &to, int32 stage, i switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" pts: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photos_updateProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_updateProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7381,7 +7521,7 @@ void _serialize_photos_updateProfilePhoto(MTPStringLogger &to, int32 stage, int3 } } -void _serialize_photos_uploadProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_uploadProfilePhoto(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7390,14 +7530,14 @@ void _serialize_photos_uploadProfilePhoto(MTPStringLogger &to, int32 stage, int3 } switch (stage) { case 0: to.add(" file: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" caption: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 2: to.add(" geo_point: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 3: to.add(" crop: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_photos_getUserPhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_photos_getUserPhotos(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7406,14 +7546,14 @@ void _serialize_photos_getUserPhotos(MTPStringLogger &to, int32 stage, int32 lev } switch (stage) { case 0: to.add(" user_id: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_long); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" max_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_upload_getFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_upload_getFile(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7422,21 +7562,21 @@ void _serialize_upload_getFile(MTPStringLogger &to, int32 stage, int32 lev, Type } switch (stage) { case 0: to.add(" location: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_getConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getConfig(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ help_getConfig }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_help_getNearestDc(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getNearestDc(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ help_getNearestDc }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_help_getAppUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getAppUpdate(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7444,15 +7584,15 @@ void _serialize_help_getAppUpdate(MTPStringLogger &to, int32 stage, int32 lev, T to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_getInviteText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getInviteText(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7460,16 +7600,16 @@ void _serialize_help_getInviteText(MTPStringLogger &to, int32 stage, int32 lev, to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_getSupport(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getSupport(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { to.add("{ help_getSupport }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); } -void _serialize_help_getAppChangelog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getAppChangelog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7477,15 +7617,15 @@ void _serialize_help_getAppChangelog(MTPStringLogger &to, int32 stage, int32 lev to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" device_model: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" system_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" app_version: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_help_getTermsOfService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_help_getTermsOfService(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7493,12 +7633,12 @@ void _serialize_help_getTermsOfService(MTPStringLogger &to, int32 stage, int32 l to.add("\n").addSpaces(lev); } switch (stage) { - case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 0: to.add(" lang_code: "); ++stages.back(); types.push_back(mtpc_string+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getParticipants(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7508,13 +7648,13 @@ void _serialize_channels_getParticipants(MTPStringLogger &to, int32 stage, int32 switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; case 1: to.add(" filter: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 2: to.add(" offset: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 3: to.add(" limit: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getParticipant(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7528,7 +7668,7 @@ void _serialize_channels_getParticipant(MTPStringLogger &to, int32 stage, int32 } } -void _serialize_channels_exportMessageLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_exportMessageLink(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7537,12 +7677,12 @@ void _serialize_channels_exportMessageLink(MTPStringLogger &to, int32 stage, int } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_channels_getMessageEditData(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_channels_getMessageEditData(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7551,12 +7691,12 @@ void _serialize_channels_getMessageEditData(MTPStringLogger &to, int32 stage, in } switch (stage) { case 0: to.add(" channel: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; - case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; + case 1: to.add(" id: "); ++stages.back(); types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break; default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break; } } -void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7570,7 +7710,7 @@ void _serialize_rpc_result(MTPStringLogger &to, int32 stage, int32 lev, Types &t } } -void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7583,7 +7723,7 @@ void _serialize_msg_container(MTPStringLogger &to, int32 stage, int32 lev, Types } } -void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag) { +void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) { if (stage) { to.add(",\n").addSpaces(lev); } else { @@ -7600,7 +7740,7 @@ void _serialize_core_message(MTPStringLogger &to, int32 stage, int32 lev, Types } namespace { - typedef void(*mtpTextSerializer)(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 flag); + typedef void(*mtpTextSerializer)(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag); typedef QMap TextSerializers; TextSerializers _serializers; @@ -7746,7 +7886,6 @@ namespace { _serializers.insert(mtpc_geoPoint, _serialize_geoPoint); _serializers.insert(mtpc_auth_checkedPhone, _serialize_auth_checkedPhone); _serializers.insert(mtpc_auth_sentCode, _serialize_auth_sentCode); - _serializers.insert(mtpc_auth_sentAppCode, _serialize_auth_sentAppCode); _serializers.insert(mtpc_auth_authorization, _serialize_auth_authorization); _serializers.insert(mtpc_auth_exportedAuthorization, _serialize_auth_exportedAuthorization); _serializers.insert(mtpc_inputNotifyPeer, _serialize_inputNotifyPeer); @@ -7918,7 +8057,6 @@ namespace { _serializers.insert(mtpc_privacyValueDisallowUsers, _serialize_privacyValueDisallowUsers); _serializers.insert(mtpc_account_privacyRules, _serialize_account_privacyRules); _serializers.insert(mtpc_accountDaysTTL, _serialize_accountDaysTTL); - _serializers.insert(mtpc_account_sentChangePhoneCode, _serialize_account_sentChangePhoneCode); _serializers.insert(mtpc_documentAttributeImageSize, _serialize_documentAttributeImageSize); _serializers.insert(mtpc_documentAttributeAnimated, _serialize_documentAttributeAnimated); _serializers.insert(mtpc_documentAttributeSticker, _serialize_documentAttributeSticker); @@ -8020,6 +8158,13 @@ namespace { _serializers.insert(mtpc_exportedMessageLink, _serialize_exportedMessageLink); _serializers.insert(mtpc_messageFwdHeader, _serialize_messageFwdHeader); _serializers.insert(mtpc_channels_messageEditData, _serialize_channels_messageEditData); + _serializers.insert(mtpc_auth_codeTypeSms, _serialize_auth_codeTypeSms); + _serializers.insert(mtpc_auth_codeTypeCall, _serialize_auth_codeTypeCall); + _serializers.insert(mtpc_auth_codeTypeFlashCall, _serialize_auth_codeTypeFlashCall); + _serializers.insert(mtpc_auth_sentCodeTypeApp, _serialize_auth_sentCodeTypeApp); + _serializers.insert(mtpc_auth_sentCodeTypeSms, _serialize_auth_sentCodeTypeSms); + _serializers.insert(mtpc_auth_sentCodeTypeCall, _serialize_auth_sentCodeTypeCall); + _serializers.insert(mtpc_auth_sentCodeTypeFlashCall, _serialize_auth_sentCodeTypeFlashCall); _serializers.insert(mtpc_req_pq, _serialize_req_pq); _serializers.insert(mtpc_req_DH_params, _serialize_req_DH_params); @@ -8030,12 +8175,11 @@ namespace { _serializers.insert(mtpc_ping_delay_disconnect, _serialize_ping_delay_disconnect); _serializers.insert(mtpc_destroy_session, _serialize_destroy_session); _serializers.insert(mtpc_register_saveDeveloperInfo, _serialize_register_saveDeveloperInfo); - _serializers.insert(mtpc_auth_sendCall, _serialize_auth_sendCall); _serializers.insert(mtpc_auth_logOut, _serialize_auth_logOut); _serializers.insert(mtpc_auth_resetAuthorizations, _serialize_auth_resetAuthorizations); _serializers.insert(mtpc_auth_sendInvites, _serialize_auth_sendInvites); _serializers.insert(mtpc_auth_bindTempAuthKey, _serialize_auth_bindTempAuthKey); - _serializers.insert(mtpc_auth_sendSms, _serialize_auth_sendSms); + _serializers.insert(mtpc_auth_cancelCode, _serialize_auth_cancelCode); _serializers.insert(mtpc_account_registerDevice, _serialize_account_registerDevice); _serializers.insert(mtpc_account_unregisterDevice, _serialize_account_unregisterDevice); _serializers.insert(mtpc_account_updateNotifySettings, _serialize_account_updateNotifySettings); @@ -8078,6 +8222,8 @@ namespace { _serializers.insert(mtpc_invokeWithoutUpdates, _serialize_invokeWithoutUpdates); _serializers.insert(mtpc_auth_checkPhone, _serialize_auth_checkPhone); _serializers.insert(mtpc_auth_sendCode, _serialize_auth_sendCode); + _serializers.insert(mtpc_auth_resendCode, _serialize_auth_resendCode); + _serializers.insert(mtpc_account_sendChangePhoneCode, _serialize_account_sendChangePhoneCode); _serializers.insert(mtpc_auth_signUp, _serialize_auth_signUp); _serializers.insert(mtpc_auth_signIn, _serialize_auth_signIn); _serializers.insert(mtpc_auth_importAuthorization, _serialize_auth_importAuthorization); @@ -8095,7 +8241,6 @@ namespace { _serializers.insert(mtpc_account_getPrivacy, _serialize_account_getPrivacy); _serializers.insert(mtpc_account_setPrivacy, _serialize_account_setPrivacy); _serializers.insert(mtpc_account_getAccountTTL, _serialize_account_getAccountTTL); - _serializers.insert(mtpc_account_sendChangePhoneCode, _serialize_account_sendChangePhoneCode); _serializers.insert(mtpc_account_getAuthorizations, _serialize_account_getAuthorizations); _serializers.insert(mtpc_account_getPassword, _serialize_account_getPassword); _serializers.insert(mtpc_account_getPasswordSettings, _serialize_account_getPasswordSettings); diff --git a/Telegram/SourceFiles/mtproto/mtpScheme.h b/Telegram/SourceFiles/mtproto/scheme_auto.h similarity index 83% rename from Telegram/SourceFiles/mtproto/mtpScheme.h rename to Telegram/SourceFiles/mtproto/scheme_auto.h index 04b2c42cf..69f6e3311 100644 --- a/Telegram/SourceFiles/mtproto/mtpScheme.h +++ b/Telegram/SourceFiles/mtproto/scheme_auto.h @@ -24,7 +24,16 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once -#include "mtpCoreTypes.h" +#include "mtproto/core_types.h" + +// Creator proxy class declaration +namespace MTP { +namespace internal { + +class TypeCreator; + +} // namespace internal +} // namespace MTP // Type id constants enum { @@ -177,8 +186,7 @@ enum { mtpc_geoPointEmpty = 0x1117dd5f, mtpc_geoPoint = 0x2049d70c, mtpc_auth_checkedPhone = 0x811ea28e, - mtpc_auth_sentCode = 0xefed51d9, - mtpc_auth_sentAppCode = 0xe325edcf, + mtpc_auth_sentCode = 0x5e002502, mtpc_auth_authorization = 0xff036af1, mtpc_auth_exportedAuthorization = 0xdf969c2d, mtpc_inputNotifyPeer = 0xb8bc5b0c, @@ -350,7 +358,6 @@ enum { mtpc_privacyValueDisallowUsers = 0xc7f49b7, mtpc_account_privacyRules = 0x554abb6f, mtpc_accountDaysTTL = 0xb8d0afdf, - mtpc_account_sentChangePhoneCode = 0xa4f58c4c, mtpc_documentAttributeImageSize = 0x6c37c15c, mtpc_documentAttributeAnimated = 0x11b58939, mtpc_documentAttributeSticker = 0x3a556302, @@ -452,14 +459,20 @@ enum { mtpc_exportedMessageLink = 0x1f486803, mtpc_messageFwdHeader = 0xc786ddcb, mtpc_channels_messageEditData = 0x67e1255f, + mtpc_auth_codeTypeSms = 0x72a3158c, + mtpc_auth_codeTypeCall = 0x741cd3e3, + mtpc_auth_codeTypeFlashCall = 0x226ccefb, + mtpc_auth_sentCodeTypeApp = 0x3dbb5986, + mtpc_auth_sentCodeTypeSms = 0xc000bba2, + mtpc_auth_sentCodeTypeCall = 0x5353e5a7, + mtpc_auth_sentCodeTypeFlashCall = 0xab03c6d9, mtpc_invokeAfterMsg = 0xcb9f372d, mtpc_invokeAfterMsgs = 0x3dc4b4f0, mtpc_initConnection = 0x69796de9, mtpc_invokeWithLayer = 0xda9b0d0d, mtpc_invokeWithoutUpdates = 0xbf9459b7, mtpc_auth_checkPhone = 0x6fe51dfb, - mtpc_auth_sendCode = 0x768d5f4d, - mtpc_auth_sendCall = 0x3c51564, + mtpc_auth_sendCode = 0xccfd70cf, mtpc_auth_signUp = 0x1b067634, mtpc_auth_signIn = 0xbcd51581, mtpc_auth_logOut = 0x5717da40, @@ -468,11 +481,12 @@ enum { mtpc_auth_exportAuthorization = 0xe5bfffcd, mtpc_auth_importAuthorization = 0xe3ef9613, mtpc_auth_bindTempAuthKey = 0xcdd42a05, - mtpc_auth_sendSms = 0xda9f3e8, mtpc_auth_importBotAuthorization = 0x67a3ff2c, mtpc_auth_checkPassword = 0xa63011e, mtpc_auth_requestPasswordRecovery = 0xd897bc66, mtpc_auth_recoverPassword = 0x4ea56e92, + mtpc_auth_resendCode = 0x3ef1a9bf, + mtpc_auth_cancelCode = 0x1f040578, mtpc_account_registerDevice = 0x446c712c, mtpc_account_unregisterDevice = 0x65c55b40, mtpc_account_updateNotifySettings = 0x84be5b93, @@ -489,7 +503,7 @@ enum { mtpc_account_deleteAccount = 0x418d4e0b, mtpc_account_getAccountTTL = 0x8fc711d, mtpc_account_setAccountTTL = 0x2442485e, - mtpc_account_sendChangePhoneCode = 0xa407a8f4, + mtpc_account_sendChangePhoneCode = 0x8e57deb, mtpc_account_changePhone = 0x70c32edb, mtpc_account_updateDeviceLocked = 0x38df3532, mtpc_account_getAuthorizations = 0xe320c158, @@ -836,7 +850,6 @@ class MTPDauth_checkedPhone; class MTPauth_sentCode; class MTPDauth_sentCode; -class MTPDauth_sentAppCode; class MTPauth_authorization; class MTPDauth_authorization; @@ -1071,9 +1084,6 @@ class MTPDaccount_privacyRules; class MTPaccountDaysTTL; class MTPDaccountDaysTTL; -class MTPaccount_sentChangePhoneCode; -class MTPDaccount_sentChangePhoneCode; - class MTPdocumentAttribute; class MTPDdocumentAttributeImageSize; class MTPDdocumentAttributeSticker; @@ -1254,6 +1264,14 @@ class MTPDmessageFwdHeader; class MTPchannels_messageEditData; class MTPDchannels_messageEditData; +class MTPauth_codeType; + +class MTPauth_sentCodeType; +class MTPDauth_sentCodeTypeApp; +class MTPDauth_sentCodeTypeSms; +class MTPDauth_sentCodeTypeCall; +class MTPDauth_sentCodeTypeFlashCall; + // Boxed types definitions typedef MTPBoxed MTPResPQ; @@ -1368,7 +1386,6 @@ typedef MTPBoxed MTPInputPrivacyRule; typedef MTPBoxed MTPPrivacyRule; typedef MTPBoxed MTPaccount_PrivacyRules; typedef MTPBoxed MTPAccountDaysTTL; -typedef MTPBoxed MTPaccount_SentChangePhoneCode; typedef MTPBoxed MTPDocumentAttribute; typedef MTPBoxed MTPmessages_Stickers; typedef MTPBoxed MTPStickerPack; @@ -1419,6 +1436,8 @@ typedef MTPBoxed MTPmessages_BotResults; typedef MTPBoxed MTPExportedMessageLink; typedef MTPBoxed MTPMessageFwdHeader; typedef MTPBoxed MTPchannels_MessageEditData; +typedef MTPBoxed MTPauth_CodeType; +typedef MTPBoxed MTPauth_SentCodeType; // Type classes definitions @@ -1449,7 +1468,7 @@ public: private: explicit MTPresPQ(MTPDresPQ *_data); - friend MTPresPQ MTP_resPQ(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_pq, const MTPVector &_server_public_key_fingerprints); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPResPQ; @@ -1480,7 +1499,7 @@ public: private: explicit MTPp_Q_inner_data(MTPDp_q_inner_data *_data); - friend MTPp_Q_inner_data MTP_p_q_inner_data(const MTPstring &_pq, const MTPstring &_p, const MTPstring &_q, const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint256 &_new_nonce); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPP_Q_inner_data; @@ -1528,8 +1547,7 @@ private: explicit MTPserver_DH_Params(MTPDserver_DH_params_fail *_data); explicit MTPserver_DH_Params(MTPDserver_DH_params_ok *_data); - friend MTPserver_DH_Params MTP_server_DH_params_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash); - friend MTPserver_DH_Params MTP_server_DH_params_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_encrypted_answer); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -1562,7 +1580,7 @@ public: private: explicit MTPserver_DH_inner_data(MTPDserver_DH_inner_data *_data); - friend MTPserver_DH_inner_data MTP_server_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, MTPint _g, const MTPstring &_dh_prime, const MTPstring &_g_a, MTPint _server_time); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPServer_DH_inner_data; @@ -1593,7 +1611,7 @@ public: private: explicit MTPclient_DH_Inner_Data(MTPDclient_DH_inner_data *_data); - friend MTPclient_DH_Inner_Data MTP_client_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPlong &_retry_id, const MTPstring &_g_b); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPClient_DH_Inner_Data; @@ -1654,9 +1672,7 @@ private: explicit MTPset_client_DH_params_answer(MTPDdh_gen_retry *_data); explicit MTPset_client_DH_params_answer(MTPDdh_gen_fail *_data); - friend MTPset_client_DH_params_answer MTP_dh_gen_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash1); - friend MTPset_client_DH_params_answer MTP_dh_gen_retry(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash2); - friend MTPset_client_DH_params_answer MTP_dh_gen_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash3); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -1689,7 +1705,7 @@ public: private: explicit MTPmsgsAck(MTPDmsgs_ack *_data); - friend MTPmsgsAck MTP_msgs_ack(const MTPVector &_msg_ids); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMsgsAck; @@ -1737,8 +1753,7 @@ private: explicit MTPbadMsgNotification(MTPDbad_msg_notification *_data); explicit MTPbadMsgNotification(MTPDbad_server_salt *_data); - friend MTPbadMsgNotification MTP_bad_msg_notification(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code); - friend MTPbadMsgNotification MTP_bad_server_salt(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code, const MTPlong &_new_server_salt); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -1771,7 +1786,7 @@ public: private: explicit MTPmsgsStateReq(MTPDmsgs_state_req *_data); - friend MTPmsgsStateReq MTP_msgs_state_req(const MTPVector &_msg_ids); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMsgsStateReq; @@ -1802,7 +1817,7 @@ public: private: explicit MTPmsgsStateInfo(MTPDmsgs_state_info *_data); - friend MTPmsgsStateInfo MTP_msgs_state_info(const MTPlong &_req_msg_id, const MTPstring &_info); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMsgsStateInfo; @@ -1833,7 +1848,7 @@ public: private: explicit MTPmsgsAllInfo(MTPDmsgs_all_info *_data); - friend MTPmsgsAllInfo MTP_msgs_all_info(const MTPVector &_msg_ids, const MTPstring &_info); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMsgsAllInfo; @@ -1881,8 +1896,7 @@ private: explicit MTPmsgDetailedInfo(MTPDmsg_detailed_info *_data); explicit MTPmsgDetailedInfo(MTPDmsg_new_detailed_info *_data); - friend MTPmsgDetailedInfo MTP_msg_detailed_info(const MTPlong &_msg_id, const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status); - friend MTPmsgDetailedInfo MTP_msg_new_detailed_info(const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -1915,7 +1929,7 @@ public: private: explicit MTPmsgResendReq(MTPDmsg_resend_req *_data); - friend MTPmsgResendReq MTP_msg_resend_req(const MTPVector &_msg_ids); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMsgResendReq; @@ -1946,7 +1960,7 @@ public: private: explicit MTPrpcError(MTPDrpc_error *_data); - friend MTPrpcError MTP_rpc_error(MTPint _error_code, const MTPstring &_error_message); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPRpcError; @@ -1981,9 +1995,7 @@ private: explicit MTPrpcDropAnswer(mtpTypeId type); explicit MTPrpcDropAnswer(MTPDrpc_answer_dropped *_data); - friend MTPrpcDropAnswer MTP_rpc_answer_unknown(); - friend MTPrpcDropAnswer MTP_rpc_answer_dropped_running(); - friend MTPrpcDropAnswer MTP_rpc_answer_dropped(const MTPlong &_msg_id, MTPint _seq_no, MTPint _bytes); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2016,7 +2028,7 @@ public: private: explicit MTPfutureSalt(MTPDfuture_salt *_data); - friend MTPfutureSalt MTP_future_salt(MTPint _valid_since, MTPint _valid_until, const MTPlong &_salt); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPFutureSalt; @@ -2047,7 +2059,7 @@ public: private: explicit MTPfutureSalts(MTPDfuture_salts *_data); - friend MTPfutureSalts MTP_future_salts(const MTPlong &_req_msg_id, MTPint _now, const MTPvector &_salts); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPFutureSalts; @@ -2078,7 +2090,7 @@ public: private: explicit MTPpong(MTPDpong *_data); - friend MTPpong MTP_pong(const MTPlong &_msg_id, const MTPlong &_ping_id); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPPong; @@ -2126,8 +2138,7 @@ private: explicit MTPdestroySessionRes(MTPDdestroy_session_ok *_data); explicit MTPdestroySessionRes(MTPDdestroy_session_none *_data); - friend MTPdestroySessionRes MTP_destroy_session_ok(const MTPlong &_session_id); - friend MTPdestroySessionRes MTP_destroy_session_none(const MTPlong &_session_id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2160,7 +2171,7 @@ public: private: explicit MTPnewSession(MTPDnew_session_created *_data); - friend MTPnewSession MTP_new_session_created(const MTPlong &_first_msg_id, const MTPlong &_unique_id, const MTPlong &_server_salt); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPNewSession; @@ -2191,7 +2202,7 @@ public: private: explicit MTPhttpWait(MTPDhttp_wait *_data); - friend MTPhttpWait MTP_http_wait(MTPint _max_delay, MTPint _wait_after, MTPint _max_wait); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPHttpWait; @@ -2213,8 +2224,7 @@ public: private: explicit MTPbool(mtpTypeId type); - friend MTPbool MTP_boolFalse(); - friend MTPbool MTP_boolTrue(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2237,7 +2247,7 @@ public: private: - friend MTPtrue MTP_true(); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPTrue; @@ -2268,7 +2278,7 @@ public: private: explicit MTPerror(MTPDerror *_data); - friend MTPerror MTP_error(MTPint _code, const MTPstring &_text); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPError; @@ -2289,7 +2299,7 @@ public: private: - friend MTPnull MTP_null(); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPNull; @@ -2350,11 +2360,7 @@ private: explicit MTPinputPeer(MTPDinputPeerUser *_data); explicit MTPinputPeer(MTPDinputPeerChannel *_data); - friend MTPinputPeer MTP_inputPeerEmpty(); - friend MTPinputPeer MTP_inputPeerSelf(); - friend MTPinputPeer MTP_inputPeerChat(MTPint _chat_id); - friend MTPinputPeer MTP_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash); - friend MTPinputPeer MTP_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2391,9 +2397,7 @@ private: explicit MTPinputUser(mtpTypeId type); explicit MTPinputUser(MTPDinputUser *_data); - friend MTPinputUser MTP_inputUserEmpty(); - friend MTPinputUser MTP_inputUserSelf(); - friend MTPinputUser MTP_inputUser(MTPint _user_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2426,7 +2430,7 @@ public: private: explicit MTPinputContact(MTPDinputPhoneContact *_data); - friend MTPinputContact MTP_inputPhoneContact(const MTPlong &_client_id, const MTPstring &_phone, const MTPstring &_first_name, const MTPstring &_last_name); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPInputContact; @@ -2474,8 +2478,7 @@ private: explicit MTPinputFile(MTPDinputFile *_data); explicit MTPinputFile(MTPDinputFileBig *_data); - friend MTPinputFile MTP_inputFile(const MTPlong &_id, MTPint _parts, const MTPstring &_name, const MTPstring &_md5_checksum); - friend MTPinputFile MTP_inputFileBig(const MTPlong &_id, MTPint _parts, const MTPstring &_name); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2616,16 +2619,7 @@ private: explicit MTPinputMedia(MTPDinputMediaVenue *_data); explicit MTPinputMedia(MTPDinputMediaGifExternal *_data); - friend MTPinputMedia MTP_inputMediaEmpty(); - friend MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file, const MTPstring &_caption); - friend MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption); - friend MTPinputMedia MTP_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point); - friend MTPinputMedia MTP_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name); - friend MTPinputMedia MTP_inputMediaUploadedDocument(const MTPInputFile &_file, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption); - friend MTPinputMedia MTP_inputMediaUploadedThumbDocument(const MTPInputFile &_file, const MTPInputFile &_thumb, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption); - friend MTPinputMedia MTP_inputMediaDocument(const MTPInputDocument &_id, const MTPstring &_caption); - friend MTPinputMedia MTP_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id); - friend MTPinputMedia MTP_inputMediaGifExternal(const MTPstring &_url, const MTPstring &_q); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2675,9 +2669,7 @@ private: explicit MTPinputChatPhoto(MTPDinputChatUploadedPhoto *_data); explicit MTPinputChatPhoto(MTPDinputChatPhoto *_data); - friend MTPinputChatPhoto MTP_inputChatPhotoEmpty(); - friend MTPinputChatPhoto MTP_inputChatUploadedPhoto(const MTPInputFile &_file, const MTPInputPhotoCrop &_crop); - friend MTPinputChatPhoto MTP_inputChatPhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2714,8 +2706,7 @@ private: explicit MTPinputGeoPoint(mtpTypeId type); explicit MTPinputGeoPoint(MTPDinputGeoPoint *_data); - friend MTPinputGeoPoint MTP_inputGeoPointEmpty(); - friend MTPinputGeoPoint MTP_inputGeoPoint(const MTPdouble &_lat, const MTPdouble &_long); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2752,8 +2743,7 @@ private: explicit MTPinputPhoto(mtpTypeId type); explicit MTPinputPhoto(MTPDinputPhoto *_data); - friend MTPinputPhoto MTP_inputPhotoEmpty(); - friend MTPinputPhoto MTP_inputPhoto(const MTPlong &_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2816,9 +2806,7 @@ private: explicit MTPinputFileLocation(MTPDinputEncryptedFileLocation *_data); explicit MTPinputFileLocation(MTPDinputDocumentFileLocation *_data); - friend MTPinputFileLocation MTP_inputFileLocation(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret); - friend MTPinputFileLocation MTP_inputEncryptedFileLocation(const MTPlong &_id, const MTPlong &_access_hash); - friend MTPinputFileLocation MTP_inputDocumentFileLocation(const MTPlong &_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2855,8 +2843,7 @@ private: explicit MTPinputPhotoCrop(mtpTypeId type); explicit MTPinputPhotoCrop(MTPDinputPhotoCrop *_data); - friend MTPinputPhotoCrop MTP_inputPhotoCropAuto(); - friend MTPinputPhotoCrop MTP_inputPhotoCrop(const MTPdouble &_crop_left, const MTPdouble &_crop_top, const MTPdouble &_crop_width); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2889,7 +2876,7 @@ public: private: explicit MTPinputAppEvent(MTPDinputAppEvent *_data); - friend MTPinputAppEvent MTP_inputAppEvent(const MTPdouble &_time, const MTPstring &_type, const MTPlong &_peer, const MTPstring &_data); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPInputAppEvent; @@ -2950,9 +2937,7 @@ private: explicit MTPpeer(MTPDpeerChat *_data); explicit MTPpeer(MTPDpeerChannel *_data); - friend MTPpeer MTP_peerUser(MTPint _user_id); - friend MTPpeer MTP_peerChat(MTPint _chat_id); - friend MTPpeer MTP_peerChannel(MTPint _channel_id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -2976,16 +2961,7 @@ public: private: explicit MTPstorage_fileType(mtpTypeId type); - friend MTPstorage_fileType MTP_storage_fileUnknown(); - friend MTPstorage_fileType MTP_storage_fileJpeg(); - friend MTPstorage_fileType MTP_storage_fileGif(); - friend MTPstorage_fileType MTP_storage_filePng(); - friend MTPstorage_fileType MTP_storage_filePdf(); - friend MTPstorage_fileType MTP_storage_fileMp3(); - friend MTPstorage_fileType MTP_storage_fileMov(); - friend MTPstorage_fileType MTP_storage_filePartial(); - friend MTPstorage_fileType MTP_storage_fileMp4(); - friend MTPstorage_fileType MTP_storage_fileWebp(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3035,8 +3011,7 @@ private: explicit MTPfileLocation(MTPDfileLocationUnavailable *_data); explicit MTPfileLocation(MTPDfileLocation *_data); - friend MTPfileLocation MTP_fileLocationUnavailable(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret); - friend MTPfileLocation MTP_fileLocation(MTPint _dc_id, const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3086,8 +3061,7 @@ private: explicit MTPuser(MTPDuserEmpty *_data); explicit MTPuser(MTPDuser *_data); - friend MTPuser MTP_userEmpty(MTPint _id); - friend MTPuser MTP_user(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3124,8 +3098,7 @@ private: explicit MTPuserProfilePhoto(mtpTypeId type); explicit MTPuserProfilePhoto(MTPDuserProfilePhoto *_data); - friend MTPuserProfilePhoto MTP_userProfilePhotoEmpty(); - friend MTPuserProfilePhoto MTP_userProfilePhoto(const MTPlong &_photo_id, const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3175,12 +3148,7 @@ private: explicit MTPuserStatus(MTPDuserStatusOnline *_data); explicit MTPuserStatus(MTPDuserStatusOffline *_data); - friend MTPuserStatus MTP_userStatusEmpty(); - friend MTPuserStatus MTP_userStatusOnline(MTPint _expires); - friend MTPuserStatus MTP_userStatusOffline(MTPint _was_online); - friend MTPuserStatus MTP_userStatusRecently(); - friend MTPuserStatus MTP_userStatusLastWeek(); - friend MTPuserStatus MTP_userStatusLastMonth(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3269,11 +3237,7 @@ private: explicit MTPchat(MTPDchannel *_data); explicit MTPchat(MTPDchannelForbidden *_data); - friend MTPchat MTP_chatEmpty(MTPint _id); - friend MTPchat MTP_chat(MTPint _flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to); - friend MTPchat MTP_chatForbidden(MTPint _id, const MTPstring &_title); - friend MTPchat MTP_channel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason); - friend MTPchat MTP_channelForbidden(MTPint _id, const MTPlong &_access_hash, const MTPstring &_title); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3323,8 +3287,7 @@ private: explicit MTPchatFull(MTPDchatFull *_data); explicit MTPchatFull(MTPDchannelFull *_data); - friend MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info); - friend MTPchatFull MTP_channelFull(MTPint _flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3387,9 +3350,7 @@ private: explicit MTPchatParticipant(MTPDchatParticipantCreator *_data); explicit MTPchatParticipant(MTPDchatParticipantAdmin *_data); - friend MTPchatParticipant MTP_chatParticipant(MTPint _user_id, MTPint _inviter_id, MTPint _date); - friend MTPchatParticipant MTP_chatParticipantCreator(MTPint _user_id); - friend MTPchatParticipant MTP_chatParticipantAdmin(MTPint _user_id, MTPint _inviter_id, MTPint _date); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3439,8 +3400,7 @@ private: explicit MTPchatParticipants(MTPDchatParticipantsForbidden *_data); explicit MTPchatParticipants(MTPDchatParticipants *_data); - friend MTPchatParticipants MTP_chatParticipantsForbidden(MTPint _flags, MTPint _chat_id, const MTPChatParticipant &_self_participant); - friend MTPchatParticipants MTP_chatParticipants(MTPint _chat_id, const MTPVector &_participants, MTPint _version); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3477,8 +3437,7 @@ private: explicit MTPchatPhoto(mtpTypeId type); explicit MTPchatPhoto(MTPDchatPhoto *_data); - friend MTPchatPhoto MTP_chatPhotoEmpty(); - friend MTPchatPhoto MTP_chatPhoto(const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3541,9 +3500,7 @@ private: explicit MTPmessage(MTPDmessage *_data); explicit MTPmessage(MTPDmessageService *_data); - friend MTPmessage MTP_messageEmpty(MTPint _id); - friend MTPmessage MTP_message(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date); - friend MTPmessage MTP_messageService(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3645,14 +3602,7 @@ private: explicit MTPmessageMedia(MTPDmessageMediaWebPage *_data); explicit MTPmessageMedia(MTPDmessageMediaVenue *_data); - friend MTPmessageMedia MTP_messageMediaEmpty(); - friend MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption); - friend MTPmessageMedia MTP_messageMediaGeo(const MTPGeoPoint &_geo); - friend MTPmessageMedia MTP_messageMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, MTPint _user_id); - friend MTPmessageMedia MTP_messageMediaUnsupported(); - friend MTPmessageMedia MTP_messageMediaDocument(const MTPDocument &_document, const MTPstring &_caption); - friend MTPmessageMedia MTP_messageMediaWebPage(const MTPWebPage &_webpage); - friend MTPmessageMedia MTP_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3793,18 +3743,7 @@ private: explicit MTPmessageAction(MTPDmessageActionChatMigrateTo *_data); explicit MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data); - friend MTPmessageAction MTP_messageActionEmpty(); - friend MTPmessageAction MTP_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users); - friend MTPmessageAction MTP_messageActionChatEditTitle(const MTPstring &_title); - friend MTPmessageAction MTP_messageActionChatEditPhoto(const MTPPhoto &_photo); - friend MTPmessageAction MTP_messageActionChatDeletePhoto(); - friend MTPmessageAction MTP_messageActionChatAddUser(const MTPVector &_users); - friend MTPmessageAction MTP_messageActionChatDeleteUser(MTPint _user_id); - friend MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id); - friend MTPmessageAction MTP_messageActionChannelCreate(const MTPstring &_title); - friend MTPmessageAction MTP_messageActionChatMigrateTo(MTPint _channel_id); - friend MTPmessageAction MTP_messageActionChannelMigrateFrom(const MTPstring &_title, MTPint _chat_id); - friend MTPmessageAction MTP_messageActionPinMessage(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3854,8 +3793,7 @@ private: explicit MTPdialog(MTPDdialog *_data); explicit MTPdialog(MTPDdialogChannel *_data); - friend MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings); - friend MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3905,8 +3843,7 @@ private: explicit MTPphoto(MTPDphotoEmpty *_data); explicit MTPphoto(MTPDphoto *_data); - friend MTPphoto MTP_photoEmpty(const MTPlong &_id); - friend MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPVector &_sizes); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -3969,9 +3906,7 @@ private: explicit MTPphotoSize(MTPDphotoSize *_data); explicit MTPphotoSize(MTPDphotoCachedSize *_data); - friend MTPphotoSize MTP_photoSizeEmpty(const MTPstring &_type); - friend MTPphotoSize MTP_photoSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, MTPint _size); - friend MTPphotoSize MTP_photoCachedSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, const MTPbytes &_bytes); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4008,8 +3943,7 @@ private: explicit MTPgeoPoint(mtpTypeId type); explicit MTPgeoPoint(MTPDgeoPoint *_data); - friend MTPgeoPoint MTP_geoPointEmpty(); - friend MTPgeoPoint MTP_geoPoint(const MTPdouble &_long, const MTPdouble &_lat); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4042,58 +3976,38 @@ public: private: explicit MTPauth_checkedPhone(MTPDauth_checkedPhone *_data); - friend MTPauth_checkedPhone MTP_auth_checkedPhone(MTPBool _phone_registered); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPauth_CheckedPhone; class MTPauth_sentCode : private mtpDataOwner { public: - MTPauth_sentCode() : mtpDataOwner(0), _type(0) { - } - MTPauth_sentCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + MTPauth_sentCode(); + MTPauth_sentCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sentCode) : mtpDataOwner(0) { read(from, end, cons); } MTPDauth_sentCode &_auth_sentCode() { if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_auth_sentCode) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCode); split(); return *(MTPDauth_sentCode*)data; } const MTPDauth_sentCode &c_auth_sentCode() const { if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_auth_sentCode) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCode); return *(const MTPDauth_sentCode*)data; } - MTPDauth_sentAppCode &_auth_sentAppCode() { - if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_auth_sentAppCode) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentAppCode); - split(); - return *(MTPDauth_sentAppCode*)data; - } - const MTPDauth_sentAppCode &c_auth_sentAppCode() const { - if (!data) throw mtpErrorUninitialized(); - if (_type != mtpc_auth_sentAppCode) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentAppCode); - return *(const MTPDauth_sentAppCode*)data; - } - uint32 innerLength() const; mtpTypeId type() const; - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sentCode); void write(mtpBuffer &to) const; typedef void ResponseType; private: - explicit MTPauth_sentCode(mtpTypeId type); explicit MTPauth_sentCode(MTPDauth_sentCode *_data); - explicit MTPauth_sentCode(MTPDauth_sentAppCode *_data); - friend MTPauth_sentCode MTP_auth_sentCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password); - friend MTPauth_sentCode MTP_auth_sentAppCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password); - - mtpTypeId _type; + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPauth_SentCode; @@ -4124,7 +4038,7 @@ public: private: explicit MTPauth_authorization(MTPDauth_authorization *_data); - friend MTPauth_authorization MTP_auth_authorization(const MTPUser &_user); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPauth_Authorization; @@ -4155,7 +4069,7 @@ public: private: explicit MTPauth_exportedAuthorization(MTPDauth_exportedAuthorization *_data); - friend MTPauth_exportedAuthorization MTP_auth_exportedAuthorization(MTPint _id, const MTPbytes &_bytes); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPauth_ExportedAuthorization; @@ -4190,10 +4104,7 @@ private: explicit MTPinputNotifyPeer(mtpTypeId type); explicit MTPinputNotifyPeer(MTPDinputNotifyPeer *_data); - friend MTPinputNotifyPeer MTP_inputNotifyPeer(const MTPInputPeer &_peer); - friend MTPinputNotifyPeer MTP_inputNotifyUsers(); - friend MTPinputNotifyPeer MTP_inputNotifyChats(); - friend MTPinputNotifyPeer MTP_inputNotifyAll(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4217,8 +4128,7 @@ public: private: explicit MTPinputPeerNotifyEvents(mtpTypeId type); - friend MTPinputPeerNotifyEvents MTP_inputPeerNotifyEventsEmpty(); - friend MTPinputPeerNotifyEvents MTP_inputPeerNotifyEventsAll(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4251,7 +4161,7 @@ public: private: explicit MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data); - friend MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPInputPeerNotifySettings; @@ -4273,8 +4183,7 @@ public: private: explicit MTPpeerNotifyEvents(mtpTypeId type); - friend MTPpeerNotifyEvents MTP_peerNotifyEventsEmpty(); - friend MTPpeerNotifyEvents MTP_peerNotifyEventsAll(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4311,8 +4220,7 @@ private: explicit MTPpeerNotifySettings(mtpTypeId type); explicit MTPpeerNotifySettings(MTPDpeerNotifySettings *_data); - friend MTPpeerNotifySettings MTP_peerNotifySettingsEmpty(); - friend MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4345,7 +4253,7 @@ public: private: explicit MTPpeerSettings(MTPDpeerSettings *_data); - friend MTPpeerSettings MTP_peerSettings(MTPint _flags); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPPeerSettings; @@ -4393,8 +4301,7 @@ private: explicit MTPwallPaper(MTPDwallPaper *_data); explicit MTPwallPaper(MTPDwallPaperSolid *_data); - friend MTPwallPaper MTP_wallPaper(MTPint _id, const MTPstring &_title, const MTPVector &_sizes, MTPint _color); - friend MTPwallPaper MTP_wallPaperSolid(MTPint _id, const MTPstring &_title, MTPint _bg_color, MTPint _color); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4431,10 +4338,7 @@ private: explicit MTPreportReason(mtpTypeId type); explicit MTPreportReason(MTPDinputReportReasonOther *_data); - friend MTPreportReason MTP_inputReportReasonSpam(); - friend MTPreportReason MTP_inputReportReasonViolence(); - friend MTPreportReason MTP_inputReportReasonPornography(); - friend MTPreportReason MTP_inputReportReasonOther(const MTPstring &_text); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4467,7 +4371,7 @@ public: private: explicit MTPuserFull(MTPDuserFull *_data); - friend MTPuserFull MTP_userFull(MTPint _flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPUserFull; @@ -4498,7 +4402,7 @@ public: private: explicit MTPcontact(MTPDcontact *_data); - friend MTPcontact MTP_contact(MTPint _user_id, MTPBool _mutual); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPContact; @@ -4529,7 +4433,7 @@ public: private: explicit MTPimportedContact(MTPDimportedContact *_data); - friend MTPimportedContact MTP_importedContact(MTPint _user_id, const MTPlong &_client_id); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPImportedContact; @@ -4560,7 +4464,7 @@ public: private: explicit MTPcontactBlocked(MTPDcontactBlocked *_data); - friend MTPcontactBlocked MTP_contactBlocked(MTPint _user_id, MTPint _date); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPContactBlocked; @@ -4591,7 +4495,7 @@ public: private: explicit MTPcontactStatus(MTPDcontactStatus *_data); - friend MTPcontactStatus MTP_contactStatus(MTPint _user_id, const MTPUserStatus &_status); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPContactStatus; @@ -4622,7 +4526,7 @@ public: private: explicit MTPcontacts_link(MTPDcontacts_link *_data); - friend MTPcontacts_link MTP_contacts_link(const MTPContactLink &_my_link, const MTPContactLink &_foreign_link, const MTPUser &_user); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPcontacts_Link; @@ -4657,8 +4561,7 @@ private: explicit MTPcontacts_contacts(mtpTypeId type); explicit MTPcontacts_contacts(MTPDcontacts_contacts *_data); - friend MTPcontacts_contacts MTP_contacts_contactsNotModified(); - friend MTPcontacts_contacts MTP_contacts_contacts(const MTPVector &_contacts, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4691,7 +4594,7 @@ public: private: explicit MTPcontacts_importedContacts(MTPDcontacts_importedContacts *_data); - friend MTPcontacts_importedContacts MTP_contacts_importedContacts(const MTPVector &_imported, const MTPVector &_retry_contacts, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPcontacts_ImportedContacts; @@ -4739,8 +4642,7 @@ private: explicit MTPcontacts_blocked(MTPDcontacts_blocked *_data); explicit MTPcontacts_blocked(MTPDcontacts_blockedSlice *_data); - friend MTPcontacts_blocked MTP_contacts_blocked(const MTPVector &_blocked, const MTPVector &_users); - friend MTPcontacts_blocked MTP_contacts_blockedSlice(MTPint _count, const MTPVector &_blocked, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4790,8 +4692,7 @@ private: explicit MTPmessages_dialogs(MTPDmessages_dialogs *_data); explicit MTPmessages_dialogs(MTPDmessages_dialogsSlice *_data); - friend MTPmessages_dialogs MTP_messages_dialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); - friend MTPmessages_dialogs MTP_messages_dialogsSlice(MTPint _count, const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4854,9 +4755,7 @@ private: explicit MTPmessages_messages(MTPDmessages_messagesSlice *_data); explicit MTPmessages_messages(MTPDmessages_channelMessages *_data); - friend MTPmessages_messages MTP_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); - friend MTPmessages_messages MTP_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); - friend MTPmessages_messages MTP_messages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -4889,7 +4788,7 @@ public: private: explicit MTPmessages_chats(MTPDmessages_chats *_data); - friend MTPmessages_chats MTP_messages_chats(const MTPVector &_chats); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_Chats; @@ -4920,7 +4819,7 @@ public: private: explicit MTPmessages_chatFull(MTPDmessages_chatFull *_data); - friend MTPmessages_chatFull MTP_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_ChatFull; @@ -4951,7 +4850,7 @@ public: private: explicit MTPmessages_affectedHistory(MTPDmessages_affectedHistory *_data); - friend MTPmessages_affectedHistory MTP_messages_affectedHistory(MTPint _pts, MTPint _pts_count, MTPint _offset); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_AffectedHistory; @@ -4973,16 +4872,7 @@ public: private: explicit MTPmessagesFilter(mtpTypeId type); - friend MTPmessagesFilter MTP_inputMessagesFilterEmpty(); - friend MTPmessagesFilter MTP_inputMessagesFilterPhotos(); - friend MTPmessagesFilter MTP_inputMessagesFilterVideo(); - friend MTPmessagesFilter MTP_inputMessagesFilterPhotoVideo(); - friend MTPmessagesFilter MTP_inputMessagesFilterPhotoVideoDocuments(); - friend MTPmessagesFilter MTP_inputMessagesFilterDocument(); - friend MTPmessagesFilter MTP_inputMessagesFilterUrl(); - friend MTPmessagesFilter MTP_inputMessagesFilterGif(); - friend MTPmessagesFilter MTP_inputMessagesFilterVoice(); - friend MTPmessagesFilter MTP_inputMessagesFilterMusic(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -5565,51 +5455,7 @@ private: explicit MTPupdate(MTPDupdateEditChannelMessage *_data); explicit MTPupdate(MTPDupdateChannelPinnedMessage *_data); - friend MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateMessageID(MTPint _id, const MTPlong &_random_id); - friend MTPupdate MTP_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateUserTyping(MTPint _user_id, const MTPSendMessageAction &_action); - friend MTPupdate MTP_updateChatUserTyping(MTPint _chat_id, MTPint _user_id, const MTPSendMessageAction &_action); - friend MTPupdate MTP_updateChatParticipants(const MTPChatParticipants &_participants); - friend MTPupdate MTP_updateUserStatus(MTPint _user_id, const MTPUserStatus &_status); - friend MTPupdate MTP_updateUserName(MTPint _user_id, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username); - friend MTPupdate MTP_updateUserPhoto(MTPint _user_id, MTPint _date, const MTPUserProfilePhoto &_photo, MTPBool _previous); - friend MTPupdate MTP_updateContactRegistered(MTPint _user_id, MTPint _date); - friend MTPupdate MTP_updateContactLink(MTPint _user_id, const MTPContactLink &_my_link, const MTPContactLink &_foreign_link); - friend MTPupdate MTP_updateNewAuthorization(const MTPlong &_auth_key_id, MTPint _date, const MTPstring &_device, const MTPstring &_location); - friend MTPupdate MTP_updateNewEncryptedMessage(const MTPEncryptedMessage &_message, MTPint _qts); - friend MTPupdate MTP_updateEncryptedChatTyping(MTPint _chat_id); - friend MTPupdate MTP_updateEncryption(const MTPEncryptedChat &_chat, MTPint _date); - friend MTPupdate MTP_updateEncryptedMessagesRead(MTPint _chat_id, MTPint _max_date, MTPint _date); - friend MTPupdate MTP_updateChatParticipantAdd(MTPint _chat_id, MTPint _user_id, MTPint _inviter_id, MTPint _date, MTPint _version); - friend MTPupdate MTP_updateChatParticipantDelete(MTPint _chat_id, MTPint _user_id, MTPint _version); - friend MTPupdate MTP_updateDcOptions(const MTPVector &_dc_options); - friend MTPupdate MTP_updateUserBlocked(MTPint _user_id, MTPBool _blocked); - friend MTPupdate MTP_updateNotifySettings(const MTPNotifyPeer &_peer, const MTPPeerNotifySettings &_notify_settings); - friend MTPupdate MTP_updateServiceNotification(const MTPstring &_type, const MTPstring &_message, const MTPMessageMedia &_media, MTPBool _popup); - friend MTPupdate MTP_updatePrivacy(const MTPPrivacyKey &_key, const MTPVector &_rules); - friend MTPupdate MTP_updateUserPhone(MTPint _user_id, const MTPstring &_phone); - friend MTPupdate MTP_updateReadHistoryInbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateChannelTooLong(MTPint _flags, MTPint _channel_id, MTPint _pts); - friend MTPupdate MTP_updateChannel(MTPint _channel_id); - friend MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group); - friend MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateReadChannelInbox(MTPint _channel_id, MTPint _max_id); - friend MTPupdate MTP_updateDeleteChannelMessages(MTPint _channel_id, const MTPVector &_messages, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateChannelMessageViews(MTPint _channel_id, MTPint _id, MTPint _views); - friend MTPupdate MTP_updateChatAdmins(MTPint _chat_id, MTPBool _enabled, MTPint _version); - friend MTPupdate MTP_updateChatParticipantAdmin(MTPint _chat_id, MTPint _user_id, MTPBool _is_admin, MTPint _version); - friend MTPupdate MTP_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset); - friend MTPupdate MTP_updateStickerSetsOrder(const MTPVector &_order); - friend MTPupdate MTP_updateStickerSets(); - friend MTPupdate MTP_updateSavedGifs(); - friend MTPupdate MTP_updateBotInlineQuery(const MTPlong &_query_id, MTPint _user_id, const MTPstring &_query, const MTPstring &_offset); - friend MTPupdate MTP_updateBotInlineSend(MTPint _user_id, const MTPstring &_query, const MTPstring &_id); - friend MTPupdate MTP_updateEditChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count); - friend MTPupdate MTP_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -5642,7 +5488,7 @@ public: private: explicit MTPupdates_state(MTPDupdates_state *_data); - friend MTPupdates_state MTP_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPupdates_State; @@ -5703,9 +5549,7 @@ private: explicit MTPupdates_difference(MTPDupdates_difference *_data); explicit MTPupdates_difference(MTPDupdates_differenceSlice *_data); - friend MTPupdates_difference MTP_updates_differenceEmpty(MTPint _date, MTPint _seq); - friend MTPupdates_difference MTP_updates_difference(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state); - friend MTPupdates_difference MTP_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -5807,13 +5651,7 @@ private: explicit MTPupdates(MTPDupdates *_data); explicit MTPupdates(MTPDupdateShortSentMessage *_data); - friend MTPupdates MTP_updatesTooLong(); - friend MTPupdates MTP_updateShortMessage(MTPint _flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities); - friend MTPupdates MTP_updateShortChatMessage(MTPint _flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities); - friend MTPupdates MTP_updateShort(const MTPUpdate &_update, MTPint _date); - friend MTPupdates MTP_updatesCombined(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq_start, MTPint _seq); - friend MTPupdates MTP_updates(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq); - friend MTPupdates MTP_updateShortSentMessage(MTPint _flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -5863,8 +5701,7 @@ private: explicit MTPphotos_photos(MTPDphotos_photos *_data); explicit MTPphotos_photos(MTPDphotos_photosSlice *_data); - friend MTPphotos_photos MTP_photos_photos(const MTPVector &_photos, const MTPVector &_users); - friend MTPphotos_photos MTP_photos_photosSlice(MTPint _count, const MTPVector &_photos, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -5897,7 +5734,7 @@ public: private: explicit MTPphotos_photo(MTPDphotos_photo *_data); - friend MTPphotos_photo MTP_photos_photo(const MTPPhoto &_photo, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPphotos_Photo; @@ -5928,7 +5765,7 @@ public: private: explicit MTPupload_file(MTPDupload_file *_data); - friend MTPupload_file MTP_upload_file(const MTPstorage_FileType &_type, MTPint _mtime, const MTPbytes &_bytes); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPupload_File; @@ -5959,7 +5796,7 @@ public: private: explicit MTPdcOption(MTPDdcOption *_data); - friend MTPdcOption MTP_dcOption(MTPint _flags, MTPint _id, const MTPstring &_ip_address, MTPint _port); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPDcOption; @@ -5990,7 +5827,7 @@ public: private: explicit MTPconfig(MTPDconfig *_data); - friend MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, const MTPVector &_disabled_features); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPConfig; @@ -6021,7 +5858,7 @@ public: private: explicit MTPnearestDc(MTPDnearestDc *_data); - friend MTPnearestDc MTP_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPNearestDc; @@ -6056,8 +5893,7 @@ private: explicit MTPhelp_appUpdate(mtpTypeId type); explicit MTPhelp_appUpdate(MTPDhelp_appUpdate *_data); - friend MTPhelp_appUpdate MTP_help_appUpdate(MTPint _id, MTPBool _critical, const MTPstring &_url, const MTPstring &_text); - friend MTPhelp_appUpdate MTP_help_noAppUpdate(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6090,7 +5926,7 @@ public: private: explicit MTPhelp_inviteText(MTPDhelp_inviteText *_data); - friend MTPhelp_inviteText MTP_help_inviteText(const MTPstring &_message); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPhelp_InviteText; @@ -6177,11 +6013,7 @@ private: explicit MTPencryptedChat(MTPDencryptedChat *_data); explicit MTPencryptedChat(MTPDencryptedChatDiscarded *_data); - friend MTPencryptedChat MTP_encryptedChatEmpty(MTPint _id); - friend MTPencryptedChat MTP_encryptedChatWaiting(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id); - friend MTPencryptedChat MTP_encryptedChatRequested(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a); - friend MTPencryptedChat MTP_encryptedChat(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a_or_b, const MTPlong &_key_fingerprint); - friend MTPencryptedChat MTP_encryptedChatDiscarded(MTPint _id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6214,7 +6046,7 @@ public: private: explicit MTPinputEncryptedChat(MTPDinputEncryptedChat *_data); - friend MTPinputEncryptedChat MTP_inputEncryptedChat(MTPint _chat_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPInputEncryptedChat; @@ -6249,8 +6081,7 @@ private: explicit MTPencryptedFile(mtpTypeId type); explicit MTPencryptedFile(MTPDencryptedFile *_data); - friend MTPencryptedFile MTP_encryptedFileEmpty(); - friend MTPencryptedFile MTP_encryptedFile(const MTPlong &_id, const MTPlong &_access_hash, MTPint _size, MTPint _dc_id, MTPint _key_fingerprint); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6313,10 +6144,7 @@ private: explicit MTPinputEncryptedFile(MTPDinputEncryptedFile *_data); explicit MTPinputEncryptedFile(MTPDinputEncryptedFileBigUploaded *_data); - friend MTPinputEncryptedFile MTP_inputEncryptedFileEmpty(); - friend MTPinputEncryptedFile MTP_inputEncryptedFileUploaded(const MTPlong &_id, MTPint _parts, const MTPstring &_md5_checksum, MTPint _key_fingerprint); - friend MTPinputEncryptedFile MTP_inputEncryptedFile(const MTPlong &_id, const MTPlong &_access_hash); - friend MTPinputEncryptedFile MTP_inputEncryptedFileBigUploaded(const MTPlong &_id, MTPint _parts, MTPint _key_fingerprint); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6366,8 +6194,7 @@ private: explicit MTPencryptedMessage(MTPDencryptedMessage *_data); explicit MTPencryptedMessage(MTPDencryptedMessageService *_data); - friend MTPencryptedMessage MTP_encryptedMessage(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes, const MTPEncryptedFile &_file); - friend MTPencryptedMessage MTP_encryptedMessageService(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6417,8 +6244,7 @@ private: explicit MTPmessages_dhConfig(MTPDmessages_dhConfigNotModified *_data); explicit MTPmessages_dhConfig(MTPDmessages_dhConfig *_data); - friend MTPmessages_dhConfig MTP_messages_dhConfigNotModified(const MTPbytes &_random); - friend MTPmessages_dhConfig MTP_messages_dhConfig(MTPint _g, const MTPbytes &_p, MTPint _version, const MTPbytes &_random); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6468,8 +6294,7 @@ private: explicit MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedMessage *_data); explicit MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedFile *_data); - friend MTPmessages_sentEncryptedMessage MTP_messages_sentEncryptedMessage(MTPint _date); - friend MTPmessages_sentEncryptedMessage MTP_messages_sentEncryptedFile(MTPint _date, const MTPEncryptedFile &_file); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6506,8 +6331,7 @@ private: explicit MTPinputDocument(mtpTypeId type); explicit MTPinputDocument(MTPDinputDocument *_data); - friend MTPinputDocument MTP_inputDocumentEmpty(); - friend MTPinputDocument MTP_inputDocument(const MTPlong &_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6557,8 +6381,7 @@ private: explicit MTPdocument(MTPDdocumentEmpty *_data); explicit MTPdocument(MTPDdocument *_data); - friend MTPdocument MTP_documentEmpty(const MTPlong &_id); - friend MTPdocument MTP_document(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, const MTPVector &_attributes); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6591,7 +6414,7 @@ public: private: explicit MTPhelp_support(MTPDhelp_support *_data); - friend MTPhelp_support MTP_help_support(const MTPstring &_phone_number, const MTPUser &_user); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPhelp_Support; @@ -6626,10 +6449,7 @@ private: explicit MTPnotifyPeer(mtpTypeId type); explicit MTPnotifyPeer(MTPDnotifyPeer *_data); - friend MTPnotifyPeer MTP_notifyPeer(const MTPPeer &_peer); - friend MTPnotifyPeer MTP_notifyUsers(); - friend MTPnotifyPeer MTP_notifyChats(); - friend MTPnotifyPeer MTP_notifyAll(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6705,16 +6525,7 @@ private: explicit MTPsendMessageAction(MTPDsendMessageUploadPhotoAction *_data); explicit MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data); - friend MTPsendMessageAction MTP_sendMessageTypingAction(); - friend MTPsendMessageAction MTP_sendMessageCancelAction(); - friend MTPsendMessageAction MTP_sendMessageRecordVideoAction(); - friend MTPsendMessageAction MTP_sendMessageUploadVideoAction(MTPint _progress); - friend MTPsendMessageAction MTP_sendMessageRecordAudioAction(); - friend MTPsendMessageAction MTP_sendMessageUploadAudioAction(MTPint _progress); - friend MTPsendMessageAction MTP_sendMessageUploadPhotoAction(MTPint _progress); - friend MTPsendMessageAction MTP_sendMessageUploadDocumentAction(MTPint _progress); - friend MTPsendMessageAction MTP_sendMessageGeoLocationAction(); - friend MTPsendMessageAction MTP_sendMessageChooseContactAction(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6747,7 +6558,7 @@ public: private: explicit MTPcontacts_found(MTPDcontacts_found *_data); - friend MTPcontacts_found MTP_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPcontacts_Found; @@ -6769,8 +6580,7 @@ public: private: explicit MTPinputPrivacyKey(mtpTypeId type); - friend MTPinputPrivacyKey MTP_inputPrivacyKeyStatusTimestamp(); - friend MTPinputPrivacyKey MTP_inputPrivacyKeyChatInvite(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6794,8 +6604,7 @@ public: private: explicit MTPprivacyKey(mtpTypeId type); - friend MTPprivacyKey MTP_privacyKeyStatusTimestamp(); - friend MTPprivacyKey MTP_privacyKeyChatInvite(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6845,12 +6654,7 @@ private: explicit MTPinputPrivacyRule(MTPDinputPrivacyValueAllowUsers *_data); explicit MTPinputPrivacyRule(MTPDinputPrivacyValueDisallowUsers *_data); - friend MTPinputPrivacyRule MTP_inputPrivacyValueAllowContacts(); - friend MTPinputPrivacyRule MTP_inputPrivacyValueAllowAll(); - friend MTPinputPrivacyRule MTP_inputPrivacyValueAllowUsers(const MTPVector &_users); - friend MTPinputPrivacyRule MTP_inputPrivacyValueDisallowContacts(); - friend MTPinputPrivacyRule MTP_inputPrivacyValueDisallowAll(); - friend MTPinputPrivacyRule MTP_inputPrivacyValueDisallowUsers(const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6900,12 +6704,7 @@ private: explicit MTPprivacyRule(MTPDprivacyValueAllowUsers *_data); explicit MTPprivacyRule(MTPDprivacyValueDisallowUsers *_data); - friend MTPprivacyRule MTP_privacyValueAllowContacts(); - friend MTPprivacyRule MTP_privacyValueAllowAll(); - friend MTPprivacyRule MTP_privacyValueAllowUsers(const MTPVector &_users); - friend MTPprivacyRule MTP_privacyValueDisallowContacts(); - friend MTPprivacyRule MTP_privacyValueDisallowAll(); - friend MTPprivacyRule MTP_privacyValueDisallowUsers(const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -6938,7 +6737,7 @@ public: private: explicit MTPaccount_privacyRules(MTPDaccount_privacyRules *_data); - friend MTPaccount_privacyRules MTP_account_privacyRules(const MTPVector &_rules, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPaccount_PrivacyRules; @@ -6969,41 +6768,10 @@ public: private: explicit MTPaccountDaysTTL(MTPDaccountDaysTTL *_data); - friend MTPaccountDaysTTL MTP_accountDaysTTL(MTPint _days); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPAccountDaysTTL; -class MTPaccount_sentChangePhoneCode : private mtpDataOwner { -public: - MTPaccount_sentChangePhoneCode(); - MTPaccount_sentChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sentChangePhoneCode) : mtpDataOwner(0) { - read(from, end, cons); - } - - MTPDaccount_sentChangePhoneCode &_account_sentChangePhoneCode() { - if (!data) throw mtpErrorUninitialized(); - split(); - return *(MTPDaccount_sentChangePhoneCode*)data; - } - const MTPDaccount_sentChangePhoneCode &c_account_sentChangePhoneCode() const { - if (!data) throw mtpErrorUninitialized(); - return *(const MTPDaccount_sentChangePhoneCode*)data; - } - - uint32 innerLength() const; - mtpTypeId type() const; - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sentChangePhoneCode); - void write(mtpBuffer &to) const; - - typedef void ResponseType; - -private: - explicit MTPaccount_sentChangePhoneCode(MTPDaccount_sentChangePhoneCode *_data); - - friend MTPaccount_sentChangePhoneCode MTP_account_sentChangePhoneCode(const MTPstring &_phone_code_hash, MTPint _send_call_timeout); -}; -typedef MTPBoxed MTPaccount_SentChangePhoneCode; - class MTPdocumentAttribute : private mtpDataOwner { public: MTPdocumentAttribute() : mtpDataOwner(0), _type(0) { @@ -7087,12 +6855,7 @@ private: explicit MTPdocumentAttribute(MTPDdocumentAttributeAudio *_data); explicit MTPdocumentAttribute(MTPDdocumentAttributeFilename *_data); - friend MTPdocumentAttribute MTP_documentAttributeImageSize(MTPint _w, MTPint _h); - friend MTPdocumentAttribute MTP_documentAttributeAnimated(); - friend MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset); - friend MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h); - friend MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform); - friend MTPdocumentAttribute MTP_documentAttributeFilename(const MTPstring &_file_name); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7129,8 +6892,7 @@ private: explicit MTPmessages_stickers(mtpTypeId type); explicit MTPmessages_stickers(MTPDmessages_stickers *_data); - friend MTPmessages_stickers MTP_messages_stickersNotModified(); - friend MTPmessages_stickers MTP_messages_stickers(const MTPstring &_hash, const MTPVector &_stickers); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7163,7 +6925,7 @@ public: private: explicit MTPstickerPack(MTPDstickerPack *_data); - friend MTPstickerPack MTP_stickerPack(const MTPstring &_emoticon, const MTPVector &_documents); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPStickerPack; @@ -7198,8 +6960,7 @@ private: explicit MTPmessages_allStickers(mtpTypeId type); explicit MTPmessages_allStickers(MTPDmessages_allStickers *_data); - friend MTPmessages_allStickers MTP_messages_allStickersNotModified(); - friend MTPmessages_allStickers MTP_messages_allStickers(MTPint _hash, const MTPVector &_sets); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7232,7 +6993,7 @@ public: private: explicit MTPdisabledFeature(MTPDdisabledFeature *_data); - friend MTPdisabledFeature MTP_disabledFeature(const MTPstring &_feature, const MTPstring &_description); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPDisabledFeature; @@ -7263,7 +7024,7 @@ public: private: explicit MTPmessages_affectedMessages(MTPDmessages_affectedMessages *_data); - friend MTPmessages_affectedMessages MTP_messages_affectedMessages(MTPint _pts, MTPint _pts_count); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_AffectedMessages; @@ -7285,10 +7046,7 @@ public: private: explicit MTPcontactLink(mtpTypeId type); - friend MTPcontactLink MTP_contactLinkUnknown(); - friend MTPcontactLink MTP_contactLinkNone(); - friend MTPcontactLink MTP_contactLinkHasPhone(); - friend MTPcontactLink MTP_contactLinkContact(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7351,9 +7109,7 @@ private: explicit MTPwebPage(MTPDwebPagePending *_data); explicit MTPwebPage(MTPDwebPage *_data); - friend MTPwebPage MTP_webPageEmpty(const MTPlong &_id); - friend MTPwebPage MTP_webPagePending(const MTPlong &_id, MTPint _date); - friend MTPwebPage MTP_webPage(MTPint _flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7386,7 +7142,7 @@ public: private: explicit MTPauthorization(MTPDauthorization *_data); - friend MTPauthorization MTP_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPAuthorization; @@ -7417,7 +7173,7 @@ public: private: explicit MTPaccount_authorizations(MTPDaccount_authorizations *_data); - friend MTPaccount_authorizations MTP_account_authorizations(const MTPVector &_authorizations); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPaccount_Authorizations; @@ -7465,8 +7221,7 @@ private: explicit MTPaccount_password(MTPDaccount_noPassword *_data); explicit MTPaccount_password(MTPDaccount_password *_data); - friend MTPaccount_password MTP_account_noPassword(const MTPbytes &_new_salt, const MTPstring &_email_unconfirmed_pattern); - friend MTPaccount_password MTP_account_password(const MTPbytes &_current_salt, const MTPbytes &_new_salt, const MTPstring &_hint, MTPBool _has_recovery, const MTPstring &_email_unconfirmed_pattern); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7499,7 +7254,7 @@ public: private: explicit MTPaccount_passwordSettings(MTPDaccount_passwordSettings *_data); - friend MTPaccount_passwordSettings MTP_account_passwordSettings(const MTPstring &_email); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPaccount_PasswordSettings; @@ -7530,7 +7285,7 @@ public: private: explicit MTPaccount_passwordInputSettings(MTPDaccount_passwordInputSettings *_data); - friend MTPaccount_passwordInputSettings MTP_account_passwordInputSettings(MTPint _flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPaccount_PasswordInputSettings; @@ -7561,7 +7316,7 @@ public: private: explicit MTPauth_passwordRecovery(MTPDauth_passwordRecovery *_data); - friend MTPauth_passwordRecovery MTP_auth_passwordRecovery(const MTPstring &_email_pattern); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPauth_PasswordRecovery; @@ -7592,7 +7347,7 @@ public: private: explicit MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data); - friend MTPreceivedNotifyMessage MTP_receivedNotifyMessage(MTPint _id, MTPint _flags); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPReceivedNotifyMessage; @@ -7627,8 +7382,7 @@ private: explicit MTPexportedChatInvite(mtpTypeId type); explicit MTPexportedChatInvite(MTPDchatInviteExported *_data); - friend MTPexportedChatInvite MTP_chatInviteEmpty(); - friend MTPexportedChatInvite MTP_chatInviteExported(const MTPstring &_link); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7678,8 +7432,7 @@ private: explicit MTPchatInvite(MTPDchatInviteAlready *_data); explicit MTPchatInvite(MTPDchatInvite *_data); - friend MTPchatInvite MTP_chatInviteAlready(const MTPChat &_chat); - friend MTPchatInvite MTP_chatInvite(MTPint _flags, const MTPstring &_title); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7729,9 +7482,7 @@ private: explicit MTPinputStickerSet(MTPDinputStickerSetID *_data); explicit MTPinputStickerSet(MTPDinputStickerSetShortName *_data); - friend MTPinputStickerSet MTP_inputStickerSetEmpty(); - friend MTPinputStickerSet MTP_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash); - friend MTPinputStickerSet MTP_inputStickerSetShortName(const MTPstring &_short_name); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -7764,7 +7515,7 @@ public: private: explicit MTPstickerSet(MTPDstickerSet *_data); - friend MTPstickerSet MTP_stickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPStickerSet; @@ -7795,7 +7546,7 @@ public: private: explicit MTPmessages_stickerSet(MTPDmessages_stickerSet *_data); - friend MTPmessages_stickerSet MTP_messages_stickerSet(const MTPStickerSet &_set, const MTPVector &_packs, const MTPVector &_documents); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_StickerSet; @@ -7826,7 +7577,7 @@ public: private: explicit MTPbotCommand(MTPDbotCommand *_data); - friend MTPbotCommand MTP_botCommand(const MTPstring &_command, const MTPstring &_description); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPBotCommand; @@ -7857,7 +7608,7 @@ public: private: explicit MTPbotInfo(MTPDbotInfo *_data); - friend MTPbotInfo MTP_botInfo(MTPint _user_id, const MTPstring &_description, const MTPVector &_commands); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPBotInfo; @@ -7888,7 +7639,7 @@ public: private: explicit MTPkeyboardButton(MTPDkeyboardButton *_data); - friend MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPKeyboardButton; @@ -7919,7 +7670,7 @@ public: private: explicit MTPkeyboardButtonRow(MTPDkeyboardButtonRow *_data); - friend MTPkeyboardButtonRow MTP_keyboardButtonRow(const MTPVector &_buttons); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPKeyboardButtonRow; @@ -7980,9 +7731,7 @@ private: explicit MTPreplyMarkup(MTPDreplyKeyboardForceReply *_data); explicit MTPreplyMarkup(MTPDreplyKeyboardMarkup *_data); - friend MTPreplyMarkup MTP_replyKeyboardHide(MTPint _flags); - friend MTPreplyMarkup MTP_replyKeyboardForceReply(MTPint _flags); - friend MTPreplyMarkup MTP_replyKeyboardMarkup(MTPint _flags, const MTPVector &_rows); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8019,8 +7768,7 @@ private: explicit MTPhelp_appChangelog(mtpTypeId type); explicit MTPhelp_appChangelog(MTPDhelp_appChangelog *_data); - friend MTPhelp_appChangelog MTP_help_appChangelogEmpty(); - friend MTPhelp_appChangelog MTP_help_appChangelog(const MTPstring &_text); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8187,17 +7935,7 @@ private: explicit MTPmessageEntity(MTPDmessageEntityPre *_data); explicit MTPmessageEntity(MTPDmessageEntityTextUrl *_data); - friend MTPmessageEntity MTP_messageEntityUnknown(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityMention(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityHashtag(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityBotCommand(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityUrl(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityEmail(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityBold(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityItalic(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityCode(MTPint _offset, MTPint _length); - friend MTPmessageEntity MTP_messageEntityPre(MTPint _offset, MTPint _length, const MTPstring &_language); - friend MTPmessageEntity MTP_messageEntityTextUrl(MTPint _offset, MTPint _length, const MTPstring &_url); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8234,8 +7972,7 @@ private: explicit MTPinputChannel(mtpTypeId type); explicit MTPinputChannel(MTPDinputChannel *_data); - friend MTPinputChannel MTP_inputChannelEmpty(); - friend MTPinputChannel MTP_inputChannel(MTPint _channel_id, const MTPlong &_access_hash); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8268,7 +8005,7 @@ public: private: explicit MTPcontacts_resolvedPeer(MTPDcontacts_resolvedPeer *_data); - friend MTPcontacts_resolvedPeer MTP_contacts_resolvedPeer(const MTPPeer &_peer, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPcontacts_ResolvedPeer; @@ -8299,7 +8036,7 @@ public: private: explicit MTPmessageRange(MTPDmessageRange *_data); - friend MTPmessageRange MTP_messageRange(MTPint _min_id, MTPint _max_id); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMessageRange; @@ -8330,7 +8067,7 @@ public: private: explicit MTPmessageGroup(MTPDmessageGroup *_data); - friend MTPmessageGroup MTP_messageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMessageGroup; @@ -8391,9 +8128,7 @@ private: explicit MTPupdates_channelDifference(MTPDupdates_channelDifferenceTooLong *_data); explicit MTPupdates_channelDifference(MTPDupdates_channelDifference *_data); - friend MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout); - friend MTPupdates_channelDifference MTP_updates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users); - friend MTPupdates_channelDifference MTP_updates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8430,9 +8165,7 @@ private: explicit MTPchannelMessagesFilter(mtpTypeId type); explicit MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data); - friend MTPchannelMessagesFilter MTP_channelMessagesFilterEmpty(); - friend MTPchannelMessagesFilter MTP_channelMessagesFilter(MTPint _flags, const MTPVector &_ranges); - friend MTPchannelMessagesFilter MTP_channelMessagesFilterCollapsed(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8534,12 +8267,7 @@ private: explicit MTPchannelParticipant(MTPDchannelParticipantKicked *_data); explicit MTPchannelParticipant(MTPDchannelParticipantCreator *_data); - friend MTPchannelParticipant MTP_channelParticipant(MTPint _user_id, MTPint _date); - friend MTPchannelParticipant MTP_channelParticipantSelf(MTPint _user_id, MTPint _inviter_id, MTPint _date); - friend MTPchannelParticipant MTP_channelParticipantModerator(MTPint _user_id, MTPint _inviter_id, MTPint _date); - friend MTPchannelParticipant MTP_channelParticipantEditor(MTPint _user_id, MTPint _inviter_id, MTPint _date); - friend MTPchannelParticipant MTP_channelParticipantKicked(MTPint _user_id, MTPint _kicked_by, MTPint _date); - friend MTPchannelParticipant MTP_channelParticipantCreator(MTPint _user_id); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8563,10 +8291,7 @@ public: private: explicit MTPchannelParticipantsFilter(mtpTypeId type); - friend MTPchannelParticipantsFilter MTP_channelParticipantsRecent(); - friend MTPchannelParticipantsFilter MTP_channelParticipantsAdmins(); - friend MTPchannelParticipantsFilter MTP_channelParticipantsKicked(); - friend MTPchannelParticipantsFilter MTP_channelParticipantsBots(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8590,9 +8315,7 @@ public: private: explicit MTPchannelParticipantRole(mtpTypeId type); - friend MTPchannelParticipantRole MTP_channelRoleEmpty(); - friend MTPchannelParticipantRole MTP_channelRoleModerator(); - friend MTPchannelParticipantRole MTP_channelRoleEditor(); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8625,7 +8348,7 @@ public: private: explicit MTPchannels_channelParticipants(MTPDchannels_channelParticipants *_data); - friend MTPchannels_channelParticipants MTP_channels_channelParticipants(MTPint _count, const MTPVector &_participants, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPchannels_ChannelParticipants; @@ -8656,7 +8379,7 @@ public: private: explicit MTPchannels_channelParticipant(MTPDchannels_channelParticipant *_data); - friend MTPchannels_channelParticipant MTP_channels_channelParticipant(const MTPChannelParticipant &_participant, const MTPVector &_users); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPchannels_ChannelParticipant; @@ -8687,7 +8410,7 @@ public: private: explicit MTPhelp_termsOfService(MTPDhelp_termsOfService *_data); - friend MTPhelp_termsOfService MTP_help_termsOfService(const MTPstring &_text); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPhelp_TermsOfService; @@ -8735,8 +8458,7 @@ private: explicit MTPfoundGif(MTPDfoundGif *_data); explicit MTPfoundGif(MTPDfoundGifCached *_data); - friend MTPfoundGif MTP_foundGif(const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h); - friend MTPfoundGif MTP_foundGifCached(const MTPstring &_url, const MTPPhoto &_photo, const MTPDocument &_document); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8769,7 +8491,7 @@ public: private: explicit MTPmessages_foundGifs(MTPDmessages_foundGifs *_data); - friend MTPmessages_foundGifs MTP_messages_foundGifs(MTPint _next_offset, const MTPVector &_results); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_FoundGifs; @@ -8804,8 +8526,7 @@ private: explicit MTPmessages_savedGifs(mtpTypeId type); explicit MTPmessages_savedGifs(MTPDmessages_savedGifs *_data); - friend MTPmessages_savedGifs MTP_messages_savedGifsNotModified(); - friend MTPmessages_savedGifs MTP_messages_savedGifs(MTPint _hash, const MTPVector &_gifs); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8855,8 +8576,7 @@ private: explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageMediaAuto *_data); explicit MTPinputBotInlineMessage(MTPDinputBotInlineMessageText *_data); - friend MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaAuto(const MTPstring &_caption); - friend MTPinputBotInlineMessage MTP_inputBotInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -8889,7 +8609,7 @@ public: private: explicit MTPinputBotInlineResult(MTPDinputBotInlineResult *_data); - friend MTPinputBotInlineResult MTP_inputBotInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPInputBotInlineResult; @@ -8937,8 +8657,7 @@ private: explicit MTPbotInlineMessage(MTPDbotInlineMessageMediaAuto *_data); explicit MTPbotInlineMessage(MTPDbotInlineMessageText *_data); - friend MTPbotInlineMessage MTP_botInlineMessageMediaAuto(const MTPstring &_caption); - friend MTPbotInlineMessage MTP_botInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -9001,9 +8720,7 @@ private: explicit MTPbotInlineResult(MTPDbotInlineMediaResultPhoto *_data); explicit MTPbotInlineResult(MTPDbotInlineResult *_data); - friend MTPbotInlineResult MTP_botInlineMediaResultDocument(const MTPstring &_id, const MTPstring &_type, const MTPDocument &_document, const MTPBotInlineMessage &_send_message); - friend MTPbotInlineResult MTP_botInlineMediaResultPhoto(const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPBotInlineMessage &_send_message); - friend MTPbotInlineResult MTP_botInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message); + friend class MTP::internal::TypeCreator; mtpTypeId _type; }; @@ -9036,7 +8753,7 @@ public: private: explicit MTPmessages_botResults(MTPDmessages_botResults *_data); - friend MTPmessages_botResults MTP_messages_botResults(MTPint _flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPmessages_BotResults; @@ -9067,7 +8784,7 @@ public: private: explicit MTPexportedMessageLink(MTPDexportedMessageLink *_data); - friend MTPexportedMessageLink MTP_exportedMessageLink(const MTPstring &_link); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPExportedMessageLink; @@ -9098,7 +8815,7 @@ public: private: explicit MTPmessageFwdHeader(MTPDmessageFwdHeader *_data); - friend MTPmessageFwdHeader MTP_messageFwdHeader(MTPint _flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPMessageFwdHeader; @@ -9129,10 +8846,110 @@ public: private: explicit MTPchannels_messageEditData(MTPDchannels_messageEditData *_data); - friend MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags); + friend class MTP::internal::TypeCreator; }; typedef MTPBoxed MTPchannels_MessageEditData; +class MTPauth_codeType { +public: + MTPauth_codeType() : _type(0) { + } + MTPauth_codeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) { + read(from, end, cons); + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPauth_codeType(mtpTypeId type); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPauth_CodeType; + +class MTPauth_sentCodeType : private mtpDataOwner { +public: + MTPauth_sentCodeType() : mtpDataOwner(0), _type(0) { + } + MTPauth_sentCodeType(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) { + read(from, end, cons); + } + + MTPDauth_sentCodeTypeApp &_auth_sentCodeTypeApp() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeApp) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeApp); + split(); + return *(MTPDauth_sentCodeTypeApp*)data; + } + const MTPDauth_sentCodeTypeApp &c_auth_sentCodeTypeApp() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeApp) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeApp); + return *(const MTPDauth_sentCodeTypeApp*)data; + } + + MTPDauth_sentCodeTypeSms &_auth_sentCodeTypeSms() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeSms) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeSms); + split(); + return *(MTPDauth_sentCodeTypeSms*)data; + } + const MTPDauth_sentCodeTypeSms &c_auth_sentCodeTypeSms() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeSms) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeSms); + return *(const MTPDauth_sentCodeTypeSms*)data; + } + + MTPDauth_sentCodeTypeCall &_auth_sentCodeTypeCall() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeCall) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeCall); + split(); + return *(MTPDauth_sentCodeTypeCall*)data; + } + const MTPDauth_sentCodeTypeCall &c_auth_sentCodeTypeCall() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeCall) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeCall); + return *(const MTPDauth_sentCodeTypeCall*)data; + } + + MTPDauth_sentCodeTypeFlashCall &_auth_sentCodeTypeFlashCall() { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeFlashCall) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeFlashCall); + split(); + return *(MTPDauth_sentCodeTypeFlashCall*)data; + } + const MTPDauth_sentCodeTypeFlashCall &c_auth_sentCodeTypeFlashCall() const { + if (!data) throw mtpErrorUninitialized(); + if (_type != mtpc_auth_sentCodeTypeFlashCall) throw mtpErrorWrongTypeId(_type, mtpc_auth_sentCodeTypeFlashCall); + return *(const MTPDauth_sentCodeTypeFlashCall*)data; + } + + uint32 innerLength() const; + mtpTypeId type() const; + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons); + void write(mtpBuffer &to) const; + + typedef void ResponseType; + +private: + explicit MTPauth_sentCodeType(mtpTypeId type); + explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeApp *_data); + explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeSms *_data); + explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeCall *_data); + explicit MTPauth_sentCodeType(MTPDauth_sentCodeTypeFlashCall *_data); + + friend class MTP::internal::TypeCreator; + + mtpTypeId _type; +}; +typedef MTPBoxed MTPauth_SentCodeType; + // Type constructors with data class MTPDresPQ : public mtpDataImpl { @@ -9824,12 +9641,60 @@ public: class MTPDuser : public mtpDataImpl { public: + enum class Flag : int32 { + f_self = (1 << 10), + f_contact = (1 << 11), + f_mutual_contact = (1 << 12), + f_deleted = (1 << 13), + f_bot = (1 << 14), + f_bot_chat_history = (1 << 15), + f_bot_nochats = (1 << 16), + f_verified = (1 << 17), + f_restricted = (1 << 18), + f_min = (1 << 20), + f_access_hash = (1 << 0), + f_first_name = (1 << 1), + f_last_name = (1 << 2), + f_username = (1 << 3), + f_phone = (1 << 4), + f_photo = (1 << 5), + f_status = (1 << 6), + f_bot_info_version = (1 << 14), + f_restriction_reason = (1 << 18), + f_bot_inline_placeholder = (1 << 19), + + MAX_FIELD = (1 << 20), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_self() const { return vflags.v & Flag::f_self; } + bool is_contact() const { return vflags.v & Flag::f_contact; } + bool is_mutual_contact() const { return vflags.v & Flag::f_mutual_contact; } + bool is_deleted() const { return vflags.v & Flag::f_deleted; } + bool is_bot() const { return vflags.v & Flag::f_bot; } + bool is_bot_chat_history() const { return vflags.v & Flag::f_bot_chat_history; } + bool is_bot_nochats() const { return vflags.v & Flag::f_bot_nochats; } + bool is_verified() const { return vflags.v & Flag::f_verified; } + bool is_restricted() const { return vflags.v & Flag::f_restricted; } + bool is_min() const { return vflags.v & Flag::f_min; } + bool has_access_hash() const { return vflags.v & Flag::f_access_hash; } + bool has_first_name() const { return vflags.v & Flag::f_first_name; } + bool has_last_name() const { return vflags.v & Flag::f_last_name; } + bool has_username() const { return vflags.v & Flag::f_username; } + bool has_phone() const { return vflags.v & Flag::f_phone; } + bool has_photo() const { return vflags.v & Flag::f_photo; } + bool has_status() const { return vflags.v & Flag::f_status; } + bool has_bot_info_version() const { return vflags.v & Flag::f_bot_info_version; } + bool has_restriction_reason() const { return vflags.v & Flag::f_restriction_reason; } + bool has_bot_inline_placeholder() const { return vflags.v & Flag::f_bot_inline_placeholder; } + MTPDuser() { } - MTPDuser(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vfirst_name(_first_name), vlast_name(_last_name), vusername(_username), vphone(_phone), vphoto(_photo), vstatus(_status), vbot_info_version(_bot_info_version), vrestriction_reason(_restriction_reason), vbot_inline_placeholder(_bot_inline_placeholder) { + MTPDuser(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vfirst_name(_first_name), vlast_name(_last_name), vusername(_username), vphone(_phone), vphoto(_photo), vstatus(_status), vbot_info_version(_bot_info_version), vrestriction_reason(_restriction_reason), vbot_inline_placeholder(_bot_inline_placeholder) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPlong vaccess_hash; MTPstring vfirst_name; @@ -9841,50 +9706,6 @@ public: MTPint vbot_info_version; MTPstring vrestriction_reason; MTPstring vbot_inline_placeholder; - - enum { - flag_self = (1 << 10), - flag_contact = (1 << 11), - flag_mutual_contact = (1 << 12), - flag_deleted = (1 << 13), - flag_bot = (1 << 14), - flag_bot_chat_history = (1 << 15), - flag_bot_nochats = (1 << 16), - flag_verified = (1 << 17), - flag_restricted = (1 << 18), - flag_min = (1 << 20), - flag_access_hash = (1 << 0), - flag_first_name = (1 << 1), - flag_last_name = (1 << 2), - flag_username = (1 << 3), - flag_phone = (1 << 4), - flag_photo = (1 << 5), - flag_status = (1 << 6), - flag_bot_info_version = (1 << 14), - flag_restriction_reason = (1 << 18), - flag_bot_inline_placeholder = (1 << 19), - }; - - bool is_self() const { return vflags.v & flag_self; } - bool is_contact() const { return vflags.v & flag_contact; } - bool is_mutual_contact() const { return vflags.v & flag_mutual_contact; } - bool is_deleted() const { return vflags.v & flag_deleted; } - bool is_bot() const { return vflags.v & flag_bot; } - bool is_bot_chat_history() const { return vflags.v & flag_bot_chat_history; } - bool is_bot_nochats() const { return vflags.v & flag_bot_nochats; } - bool is_verified() const { return vflags.v & flag_verified; } - bool is_restricted() const { return vflags.v & flag_restricted; } - bool is_min() const { return vflags.v & flag_min; } - bool has_access_hash() const { return vflags.v & flag_access_hash; } - bool has_first_name() const { return vflags.v & flag_first_name; } - bool has_last_name() const { return vflags.v & flag_last_name; } - bool has_username() const { return vflags.v & flag_username; } - bool has_phone() const { return vflags.v & flag_phone; } - bool has_photo() const { return vflags.v & flag_photo; } - bool has_status() const { return vflags.v & flag_status; } - bool has_bot_info_version() const { return vflags.v & flag_bot_info_version; } - bool has_restriction_reason() const { return vflags.v & flag_restriction_reason; } - bool has_bot_inline_placeholder() const { return vflags.v & flag_bot_inline_placeholder; } }; class MTPDuserProfilePhoto : public mtpDataImpl { @@ -9931,12 +9752,34 @@ public: class MTPDchat : public mtpDataImpl { public: + enum class Flag : int32 { + f_creator = (1 << 0), + f_kicked = (1 << 1), + f_left = (1 << 2), + f_admins_enabled = (1 << 3), + f_admin = (1 << 4), + f_deactivated = (1 << 5), + f_migrated_to = (1 << 6), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_creator() const { return vflags.v & Flag::f_creator; } + bool is_kicked() const { return vflags.v & Flag::f_kicked; } + bool is_left() const { return vflags.v & Flag::f_left; } + bool is_admins_enabled() const { return vflags.v & Flag::f_admins_enabled; } + bool is_admin() const { return vflags.v & Flag::f_admin; } + bool is_deactivated() const { return vflags.v & Flag::f_deactivated; } + bool has_migrated_to() const { return vflags.v & Flag::f_migrated_to; } + MTPDchat() { } - MTPDchat(MTPint _flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) : vflags(_flags), vid(_id), vtitle(_title), vphoto(_photo), vparticipants_count(_participants_count), vdate(_date), vversion(_version), vmigrated_to(_migrated_to) { + MTPDchat(const MTPflags &_flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) : vflags(_flags), vid(_id), vtitle(_title), vphoto(_photo), vparticipants_count(_participants_count), vdate(_date), vversion(_version), vmigrated_to(_migrated_to) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPstring vtitle; MTPChatPhoto vphoto; @@ -9944,24 +9787,6 @@ public: MTPint vdate; MTPint vversion; MTPInputChannel vmigrated_to; - - enum { - flag_creator = (1 << 0), - flag_kicked = (1 << 1), - flag_left = (1 << 2), - flag_admins_enabled = (1 << 3), - flag_admin = (1 << 4), - flag_deactivated = (1 << 5), - flag_migrated_to = (1 << 6), - }; - - bool is_creator() const { return vflags.v & flag_creator; } - bool is_kicked() const { return vflags.v & flag_kicked; } - bool is_left() const { return vflags.v & flag_left; } - bool is_admins_enabled() const { return vflags.v & flag_admins_enabled; } - bool is_admin() const { return vflags.v & flag_admin; } - bool is_deactivated() const { return vflags.v & flag_deactivated; } - bool has_migrated_to() const { return vflags.v & flag_migrated_to; } }; class MTPDchatForbidden : public mtpDataImpl { @@ -9977,12 +9802,50 @@ public: class MTPDchannel : public mtpDataImpl { public: + enum class Flag : int32 { + f_creator = (1 << 0), + f_kicked = (1 << 1), + f_left = (1 << 2), + f_editor = (1 << 3), + f_moderator = (1 << 4), + f_broadcast = (1 << 5), + f_verified = (1 << 7), + f_megagroup = (1 << 8), + f_restricted = (1 << 9), + f_democracy = (1 << 10), + f_signatures = (1 << 11), + f_min = (1 << 12), + f_access_hash = (1 << 13), + f_username = (1 << 6), + f_restriction_reason = (1 << 9), + + MAX_FIELD = (1 << 13), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_creator() const { return vflags.v & Flag::f_creator; } + bool is_kicked() const { return vflags.v & Flag::f_kicked; } + bool is_left() const { return vflags.v & Flag::f_left; } + bool is_editor() const { return vflags.v & Flag::f_editor; } + bool is_moderator() const { return vflags.v & Flag::f_moderator; } + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_verified() const { return vflags.v & Flag::f_verified; } + bool is_megagroup() const { return vflags.v & Flag::f_megagroup; } + bool is_restricted() const { return vflags.v & Flag::f_restricted; } + bool is_democracy() const { return vflags.v & Flag::f_democracy; } + bool is_signatures() const { return vflags.v & Flag::f_signatures; } + bool is_min() const { return vflags.v & Flag::f_min; } + bool has_access_hash() const { return vflags.v & Flag::f_access_hash; } + bool has_username() const { return vflags.v & Flag::f_username; } + bool has_restriction_reason() const { return vflags.v & Flag::f_restriction_reason; } + MTPDchannel() { } - MTPDchannel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vusername(_username), vphoto(_photo), vdate(_date), vversion(_version), vrestriction_reason(_restriction_reason) { + MTPDchannel(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vusername(_username), vphoto(_photo), vdate(_date), vversion(_version), vrestriction_reason(_restriction_reason) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPlong vaccess_hash; MTPstring vtitle; @@ -9991,40 +9854,6 @@ public: MTPint vdate; MTPint vversion; MTPstring vrestriction_reason; - - enum { - flag_creator = (1 << 0), - flag_kicked = (1 << 1), - flag_left = (1 << 2), - flag_editor = (1 << 3), - flag_moderator = (1 << 4), - flag_broadcast = (1 << 5), - flag_verified = (1 << 7), - flag_megagroup = (1 << 8), - flag_restricted = (1 << 9), - flag_democracy = (1 << 10), - flag_signatures = (1 << 11), - flag_min = (1 << 12), - flag_access_hash = (1 << 13), - flag_username = (1 << 6), - flag_restriction_reason = (1 << 9), - }; - - bool is_creator() const { return vflags.v & flag_creator; } - bool is_kicked() const { return vflags.v & flag_kicked; } - bool is_left() const { return vflags.v & flag_left; } - bool is_editor() const { return vflags.v & flag_editor; } - bool is_moderator() const { return vflags.v & flag_moderator; } - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_verified() const { return vflags.v & flag_verified; } - bool is_megagroup() const { return vflags.v & flag_megagroup; } - bool is_restricted() const { return vflags.v & flag_restricted; } - bool is_democracy() const { return vflags.v & flag_democracy; } - bool is_signatures() const { return vflags.v & flag_signatures; } - bool is_min() const { return vflags.v & flag_min; } - bool has_access_hash() const { return vflags.v & flag_access_hash; } - bool has_username() const { return vflags.v & flag_username; } - bool has_restriction_reason() const { return vflags.v & flag_restriction_reason; } }; class MTPDchannelForbidden : public mtpDataImpl { @@ -10056,12 +9885,36 @@ public: class MTPDchannelFull : public mtpDataImpl { public: + enum class Flag : int32 { + f_can_view_participants = (1 << 3), + f_can_set_username = (1 << 6), + f_participants_count = (1 << 0), + f_admins_count = (1 << 1), + f_kicked_count = (1 << 2), + f_migrated_from_chat_id = (1 << 4), + f_migrated_from_max_id = (1 << 4), + f_pinned_msg_id = (1 << 5), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_can_view_participants() const { return vflags.v & Flag::f_can_view_participants; } + bool is_can_set_username() const { return vflags.v & Flag::f_can_set_username; } + bool has_participants_count() const { return vflags.v & Flag::f_participants_count; } + bool has_admins_count() const { return vflags.v & Flag::f_admins_count; } + bool has_kicked_count() const { return vflags.v & Flag::f_kicked_count; } + bool has_migrated_from_chat_id() const { return vflags.v & Flag::f_migrated_from_chat_id; } + bool has_migrated_from_max_id() const { return vflags.v & Flag::f_migrated_from_max_id; } + bool has_pinned_msg_id() const { return vflags.v & Flag::f_pinned_msg_id; } + MTPDchannelFull() { } - MTPDchannelFull(MTPint _flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) : vflags(_flags), vid(_id), vabout(_about), vparticipants_count(_participants_count), vadmins_count(_admins_count), vkicked_count(_kicked_count), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vchat_photo(_chat_photo), vnotify_settings(_notify_settings), vexported_invite(_exported_invite), vbot_info(_bot_info), vmigrated_from_chat_id(_migrated_from_chat_id), vmigrated_from_max_id(_migrated_from_max_id), vpinned_msg_id(_pinned_msg_id) { + MTPDchannelFull(const MTPflags &_flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) : vflags(_flags), vid(_id), vabout(_about), vparticipants_count(_participants_count), vadmins_count(_admins_count), vkicked_count(_kicked_count), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vchat_photo(_chat_photo), vnotify_settings(_notify_settings), vexported_invite(_exported_invite), vbot_info(_bot_info), vmigrated_from_chat_id(_migrated_from_chat_id), vmigrated_from_max_id(_migrated_from_max_id), vpinned_msg_id(_pinned_msg_id) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPstring vabout; MTPint vparticipants_count; @@ -10077,26 +9930,6 @@ public: MTPint vmigrated_from_chat_id; MTPint vmigrated_from_max_id; MTPint vpinned_msg_id; - - enum { - flag_can_view_participants = (1 << 3), - flag_can_set_username = (1 << 6), - flag_participants_count = (1 << 0), - flag_admins_count = (1 << 1), - flag_kicked_count = (1 << 2), - flag_migrated_from_chat_id = (1 << 4), - flag_migrated_from_max_id = (1 << 4), - flag_pinned_msg_id = (1 << 5), - }; - - bool is_can_view_participants() const { return vflags.v & flag_can_view_participants; } - bool is_can_set_username() const { return vflags.v & flag_can_set_username; } - bool has_participants_count() const { return vflags.v & flag_participants_count; } - bool has_admins_count() const { return vflags.v & flag_admins_count; } - bool has_kicked_count() const { return vflags.v & flag_kicked_count; } - bool has_migrated_from_chat_id() const { return vflags.v & flag_migrated_from_chat_id; } - bool has_migrated_from_max_id() const { return vflags.v & flag_migrated_from_max_id; } - bool has_pinned_msg_id() const { return vflags.v & flag_pinned_msg_id; } }; class MTPDchatParticipant : public mtpDataImpl { @@ -10135,20 +9968,22 @@ public: class MTPDchatParticipantsForbidden : public mtpDataImpl { public: + enum class Flag : int32 { + f_self_participant = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_self_participant() const { return vflags.v & Flag::f_self_participant; } + MTPDchatParticipantsForbidden() { } - MTPDchatParticipantsForbidden(MTPint _flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) : vflags(_flags), vchat_id(_chat_id), vself_participant(_self_participant) { + MTPDchatParticipantsForbidden(const MTPflags &_flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) : vflags(_flags), vchat_id(_chat_id), vself_participant(_self_participant) { } - MTPint vflags; + MTPflags vflags; MTPint vchat_id; MTPChatParticipant vself_participant; - - enum { - flag_self_participant = (1 << 0), - }; - - bool has_self_participant() const { return vflags.v & flag_self_participant; } }; class MTPDchatParticipants : public mtpDataImpl { @@ -10186,12 +10021,50 @@ public: class MTPDmessage : public mtpDataImpl { public: + enum class Flag : int32 { + f_unread = (1 << 0), + f_out = (1 << 1), + f_mentioned = (1 << 4), + f_media_unread = (1 << 5), + f_silent = (1 << 13), + f_post = (1 << 14), + f_from_id = (1 << 8), + f_fwd_from = (1 << 2), + f_via_bot_id = (1 << 11), + f_reply_to_msg_id = (1 << 3), + f_media = (1 << 9), + f_reply_markup = (1 << 6), + f_entities = (1 << 7), + f_views = (1 << 10), + f_edit_date = (1 << 15), + + MAX_FIELD = (1 << 15), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_unread() const { return vflags.v & Flag::f_unread; } + bool is_out() const { return vflags.v & Flag::f_out; } + bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } + bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_post() const { return vflags.v & Flag::f_post; } + bool has_from_id() const { return vflags.v & Flag::f_from_id; } + bool has_fwd_from() const { return vflags.v & Flag::f_fwd_from; } + bool has_via_bot_id() const { return vflags.v & Flag::f_via_bot_id; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + bool has_media() const { return vflags.v & Flag::f_media; } + bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + bool has_views() const { return vflags.v & Flag::f_views; } + bool has_edit_date() const { return vflags.v & Flag::f_edit_date; } + MTPDmessage() { } - MTPDmessage(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) : vflags(_flags), vid(_id), vfrom_id(_from_id), vto_id(_to_id), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), vdate(_date), vmessage(_message), vmedia(_media), vreply_markup(_reply_markup), ventities(_entities), vviews(_views), vedit_date(_edit_date) { + MTPDmessage(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) : vflags(_flags), vid(_id), vfrom_id(_from_id), vto_id(_to_id), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), vdate(_date), vmessage(_message), vmedia(_media), vreply_markup(_reply_markup), ventities(_entities), vviews(_views), vedit_date(_edit_date) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPint vfrom_id; MTPPeer vto_id; @@ -10205,76 +10078,46 @@ public: MTPVector ventities; MTPint vviews; MTPint vedit_date; - - enum { - flag_unread = (1 << 0), - flag_out = (1 << 1), - flag_mentioned = (1 << 4), - flag_media_unread = (1 << 5), - flag_silent = (1 << 13), - flag_post = (1 << 14), - flag_from_id = (1 << 8), - flag_fwd_from = (1 << 2), - flag_via_bot_id = (1 << 11), - flag_reply_to_msg_id = (1 << 3), - flag_media = (1 << 9), - flag_reply_markup = (1 << 6), - flag_entities = (1 << 7), - flag_views = (1 << 10), - flag_edit_date = (1 << 15), - }; - - bool is_unread() const { return vflags.v & flag_unread; } - bool is_out() const { return vflags.v & flag_out; } - bool is_mentioned() const { return vflags.v & flag_mentioned; } - bool is_media_unread() const { return vflags.v & flag_media_unread; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_post() const { return vflags.v & flag_post; } - bool has_from_id() const { return vflags.v & flag_from_id; } - bool has_fwd_from() const { return vflags.v & flag_fwd_from; } - bool has_via_bot_id() const { return vflags.v & flag_via_bot_id; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - bool has_media() const { return vflags.v & flag_media; } - bool has_reply_markup() const { return vflags.v & flag_reply_markup; } - bool has_entities() const { return vflags.v & flag_entities; } - bool has_views() const { return vflags.v & flag_views; } - bool has_edit_date() const { return vflags.v & flag_edit_date; } }; class MTPDmessageService : public mtpDataImpl { public: + enum class Flag : int32 { + f_unread = (1 << 0), + f_out = (1 << 1), + f_mentioned = (1 << 4), + f_media_unread = (1 << 5), + f_silent = (1 << 13), + f_post = (1 << 14), + f_from_id = (1 << 8), + f_reply_to_msg_id = (1 << 3), + + MAX_FIELD = (1 << 14), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_unread() const { return vflags.v & Flag::f_unread; } + bool is_out() const { return vflags.v & Flag::f_out; } + bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } + bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_post() const { return vflags.v & Flag::f_post; } + bool has_from_id() const { return vflags.v & Flag::f_from_id; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + MTPDmessageService() { } - MTPDmessageService(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) : vflags(_flags), vid(_id), vfrom_id(_from_id), vto_id(_to_id), vreply_to_msg_id(_reply_to_msg_id), vdate(_date), vaction(_action) { + MTPDmessageService(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) : vflags(_flags), vid(_id), vfrom_id(_from_id), vto_id(_to_id), vreply_to_msg_id(_reply_to_msg_id), vdate(_date), vaction(_action) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPint vfrom_id; MTPPeer vto_id; MTPint vreply_to_msg_id; MTPint vdate; MTPMessageAction vaction; - - enum { - flag_unread = (1 << 0), - flag_out = (1 << 1), - flag_mentioned = (1 << 4), - flag_media_unread = (1 << 5), - flag_silent = (1 << 13), - flag_post = (1 << 14), - flag_from_id = (1 << 8), - flag_reply_to_msg_id = (1 << 3), - }; - - bool is_unread() const { return vflags.v & flag_unread; } - bool is_out() const { return vflags.v & flag_out; } - bool is_mentioned() const { return vflags.v & flag_mentioned; } - bool is_media_unread() const { return vflags.v & flag_media_unread; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_post() const { return vflags.v & flag_post; } - bool has_from_id() const { return vflags.v & flag_from_id; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } }; class MTPDmessageMediaPhoto : public mtpDataImpl { @@ -10553,28 +10396,30 @@ public: class MTPDauth_sentCode : public mtpDataImpl { public: + enum class Flag : int32 { + f_phone_registered = (1 << 0), + f_next_type = (1 << 1), + f_timeout = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_phone_registered() const { return vflags.v & Flag::f_phone_registered; } + bool has_next_type() const { return vflags.v & Flag::f_next_type; } + bool has_timeout() const { return vflags.v & Flag::f_timeout; } + MTPDauth_sentCode() { } - MTPDauth_sentCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password) : vphone_registered(_phone_registered), vphone_code_hash(_phone_code_hash), vsend_call_timeout(_send_call_timeout), vis_password(_is_password) { + MTPDauth_sentCode(const MTPflags &_flags, const MTPauth_SentCodeType &_type, const MTPstring &_phone_code_hash, const MTPauth_CodeType &_next_type, MTPint _timeout) : vflags(_flags), vtype(_type), vphone_code_hash(_phone_code_hash), vnext_type(_next_type), vtimeout(_timeout) { } - MTPBool vphone_registered; + MTPflags vflags; + MTPauth_SentCodeType vtype; MTPstring vphone_code_hash; - MTPint vsend_call_timeout; - MTPBool vis_password; -}; - -class MTPDauth_sentAppCode : public mtpDataImpl { -public: - MTPDauth_sentAppCode() { - } - MTPDauth_sentAppCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password) : vphone_registered(_phone_registered), vphone_code_hash(_phone_code_hash), vsend_call_timeout(_send_call_timeout), vis_password(_is_password) { - } - - MTPBool vphone_registered; - MTPstring vphone_code_hash; - MTPint vsend_call_timeout; - MTPBool vis_password; + MTPauth_CodeType vnext_type; + MTPint vtimeout; }; class MTPDauth_authorization : public mtpDataImpl { @@ -10610,58 +10455,68 @@ public: class MTPDinputPeerNotifySettings : public mtpDataImpl { public: + enum class Flag : int32 { + f_show_previews = (1 << 0), + f_silent = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_show_previews() const { return vflags.v & Flag::f_show_previews; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + MTPDinputPeerNotifySettings() { } - MTPDinputPeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) : vflags(_flags), vmute_until(_mute_until), vsound(_sound) { + MTPDinputPeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) : vflags(_flags), vmute_until(_mute_until), vsound(_sound) { } - MTPint vflags; + MTPflags vflags; MTPint vmute_until; MTPstring vsound; - - enum { - flag_show_previews = (1 << 0), - flag_silent = (1 << 1), - }; - - bool is_show_previews() const { return vflags.v & flag_show_previews; } - bool is_silent() const { return vflags.v & flag_silent; } }; class MTPDpeerNotifySettings : public mtpDataImpl { public: + enum class Flag : int32 { + f_show_previews = (1 << 0), + f_silent = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_show_previews() const { return vflags.v & Flag::f_show_previews; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + MTPDpeerNotifySettings() { } - MTPDpeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) : vflags(_flags), vmute_until(_mute_until), vsound(_sound) { + MTPDpeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) : vflags(_flags), vmute_until(_mute_until), vsound(_sound) { } - MTPint vflags; + MTPflags vflags; MTPint vmute_until; MTPstring vsound; - - enum { - flag_show_previews = (1 << 0), - flag_silent = (1 << 1), - }; - - bool is_show_previews() const { return vflags.v & flag_show_previews; } - bool is_silent() const { return vflags.v & flag_silent; } }; class MTPDpeerSettings : public mtpDataImpl { public: + enum class Flag : int32 { + f_report_spam = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_report_spam() const { return vflags.v & Flag::f_report_spam; } + MTPDpeerSettings() { } - MTPDpeerSettings(MTPint _flags) : vflags(_flags) { + MTPDpeerSettings(const MTPflags &_flags) : vflags(_flags) { } - MTPint vflags; - - enum { - flag_report_spam = (1 << 0), - }; - - bool is_report_spam() const { return vflags.v & flag_report_spam; } + MTPflags vflags; }; class MTPDwallPaper : public mtpDataImpl { @@ -10702,30 +10557,34 @@ public: class MTPDuserFull : public mtpDataImpl { public: + enum class Flag : int32 { + f_blocked = (1 << 0), + f_about = (1 << 1), + f_profile_photo = (1 << 2), + f_bot_info = (1 << 3), + + MAX_FIELD = (1 << 3), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_blocked() const { return vflags.v & Flag::f_blocked; } + bool has_about() const { return vflags.v & Flag::f_about; } + bool has_profile_photo() const { return vflags.v & Flag::f_profile_photo; } + bool has_bot_info() const { return vflags.v & Flag::f_bot_info; } + MTPDuserFull() { } - MTPDuserFull(MTPint _flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) : vflags(_flags), vuser(_user), vabout(_about), vlink(_link), vprofile_photo(_profile_photo), vnotify_settings(_notify_settings), vbot_info(_bot_info) { + MTPDuserFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) : vflags(_flags), vuser(_user), vabout(_about), vlink(_link), vprofile_photo(_profile_photo), vnotify_settings(_notify_settings), vbot_info(_bot_info) { } - MTPint vflags; + MTPflags vflags; MTPUser vuser; MTPstring vabout; MTPcontacts_Link vlink; MTPPhoto vprofile_photo; MTPPeerNotifySettings vnotify_settings; MTPBotInfo vbot_info; - - enum { - flag_blocked = (1 << 0), - flag_about = (1 << 1), - flag_profile_photo = (1 << 2), - flag_bot_info = (1 << 3), - }; - - bool is_blocked() const { return vflags.v & flag_blocked; } - bool has_about() const { return vflags.v & flag_about; } - bool has_profile_photo() const { return vflags.v & flag_profile_photo; } - bool has_bot_info() const { return vflags.v & flag_bot_info; } }; class MTPDcontact : public mtpDataImpl { @@ -10884,24 +10743,26 @@ public: class MTPDmessages_channelMessages : public mtpDataImpl { public: + enum class Flag : int32 { + f_collapsed = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_collapsed() const { return vflags.v & Flag::f_collapsed; } + MTPDmessages_channelMessages() { } - MTPDmessages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vcount(_count), vmessages(_messages), vcollapsed(_collapsed), vchats(_chats), vusers(_users) { + MTPDmessages_channelMessages(const MTPflags &_flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vcount(_count), vmessages(_messages), vcollapsed(_collapsed), vchats(_chats), vusers(_users) { } - MTPint vflags; + MTPflags vflags; MTPint vpts; MTPint vcount; MTPVector vmessages; MTPVector vcollapsed; MTPVector vchats; MTPVector vusers; - - enum { - flag_collapsed = (1 << 0), - }; - - bool has_collapsed() const { return vflags.v & flag_collapsed; } }; class MTPDmessages_chats : public mtpDataImpl { @@ -11268,20 +11129,22 @@ public: class MTPDupdateChannelTooLong : public mtpDataImpl { public: + enum class Flag : int32 { + f_pts = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_pts() const { return vflags.v & Flag::f_pts; } + MTPDupdateChannelTooLong() { } - MTPDupdateChannelTooLong(MTPint _flags, MTPint _channel_id, MTPint _pts) : vflags(_flags), vchannel_id(_channel_id), vpts(_pts) { + MTPDupdateChannelTooLong(const MTPflags &_flags, MTPint _channel_id, MTPint _pts) : vflags(_flags), vchannel_id(_channel_id), vpts(_pts) { } - MTPint vflags; + MTPflags vflags; MTPint vchannel_id; MTPint vpts; - - enum { - flag_pts = (1 << 0), - }; - - bool has_pts() const { return vflags.v & flag_pts; } }; class MTPDupdateChannel : public mtpDataImpl { @@ -11503,12 +11366,38 @@ public: class MTPDupdateShortMessage : public mtpDataImpl { public: + enum class Flag : int32 { + f_unread = (1 << 0), + f_out = (1 << 1), + f_mentioned = (1 << 4), + f_media_unread = (1 << 5), + f_silent = (1 << 13), + f_fwd_from = (1 << 2), + f_via_bot_id = (1 << 11), + f_reply_to_msg_id = (1 << 3), + f_entities = (1 << 7), + + MAX_FIELD = (1 << 13), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_unread() const { return vflags.v & Flag::f_unread; } + bool is_out() const { return vflags.v & Flag::f_out; } + bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } + bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool has_fwd_from() const { return vflags.v & Flag::f_fwd_from; } + bool has_via_bot_id() const { return vflags.v & Flag::f_via_bot_id; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + MTPDupdateShortMessage() { } - MTPDupdateShortMessage(MTPint _flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) : vflags(_flags), vid(_id), vuser_id(_user_id), vmessage(_message), vpts(_pts), vpts_count(_pts_count), vdate(_date), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), ventities(_entities) { + MTPDupdateShortMessage(const MTPflags &_flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) : vflags(_flags), vid(_id), vuser_id(_user_id), vmessage(_message), vpts(_pts), vpts_count(_pts_count), vdate(_date), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), ventities(_entities) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPint vuser_id; MTPstring vmessage; @@ -11519,38 +11408,42 @@ public: MTPint vvia_bot_id; MTPint vreply_to_msg_id; MTPVector ventities; - - enum { - flag_unread = (1 << 0), - flag_out = (1 << 1), - flag_mentioned = (1 << 4), - flag_media_unread = (1 << 5), - flag_silent = (1 << 13), - flag_fwd_from = (1 << 2), - flag_via_bot_id = (1 << 11), - flag_reply_to_msg_id = (1 << 3), - flag_entities = (1 << 7), - }; - - bool is_unread() const { return vflags.v & flag_unread; } - bool is_out() const { return vflags.v & flag_out; } - bool is_mentioned() const { return vflags.v & flag_mentioned; } - bool is_media_unread() const { return vflags.v & flag_media_unread; } - bool is_silent() const { return vflags.v & flag_silent; } - bool has_fwd_from() const { return vflags.v & flag_fwd_from; } - bool has_via_bot_id() const { return vflags.v & flag_via_bot_id; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - bool has_entities() const { return vflags.v & flag_entities; } }; class MTPDupdateShortChatMessage : public mtpDataImpl { public: + enum class Flag : int32 { + f_unread = (1 << 0), + f_out = (1 << 1), + f_mentioned = (1 << 4), + f_media_unread = (1 << 5), + f_silent = (1 << 13), + f_fwd_from = (1 << 2), + f_via_bot_id = (1 << 11), + f_reply_to_msg_id = (1 << 3), + f_entities = (1 << 7), + + MAX_FIELD = (1 << 13), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_unread() const { return vflags.v & Flag::f_unread; } + bool is_out() const { return vflags.v & Flag::f_out; } + bool is_mentioned() const { return vflags.v & Flag::f_mentioned; } + bool is_media_unread() const { return vflags.v & Flag::f_media_unread; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool has_fwd_from() const { return vflags.v & Flag::f_fwd_from; } + bool has_via_bot_id() const { return vflags.v & Flag::f_via_bot_id; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + MTPDupdateShortChatMessage() { } - MTPDupdateShortChatMessage(MTPint _flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) : vflags(_flags), vid(_id), vfrom_id(_from_id), vchat_id(_chat_id), vmessage(_message), vpts(_pts), vpts_count(_pts_count), vdate(_date), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), ventities(_entities) { + MTPDupdateShortChatMessage(const MTPflags &_flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) : vflags(_flags), vid(_id), vfrom_id(_from_id), vchat_id(_chat_id), vmessage(_message), vpts(_pts), vpts_count(_pts_count), vdate(_date), vfwd_from(_fwd_from), vvia_bot_id(_via_bot_id), vreply_to_msg_id(_reply_to_msg_id), ventities(_entities) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPint vfrom_id; MTPint vchat_id; @@ -11562,28 +11455,6 @@ public: MTPint vvia_bot_id; MTPint vreply_to_msg_id; MTPVector ventities; - - enum { - flag_unread = (1 << 0), - flag_out = (1 << 1), - flag_mentioned = (1 << 4), - flag_media_unread = (1 << 5), - flag_silent = (1 << 13), - flag_fwd_from = (1 << 2), - flag_via_bot_id = (1 << 11), - flag_reply_to_msg_id = (1 << 3), - flag_entities = (1 << 7), - }; - - bool is_unread() const { return vflags.v & flag_unread; } - bool is_out() const { return vflags.v & flag_out; } - bool is_mentioned() const { return vflags.v & flag_mentioned; } - bool is_media_unread() const { return vflags.v & flag_media_unread; } - bool is_silent() const { return vflags.v & flag_silent; } - bool has_fwd_from() const { return vflags.v & flag_fwd_from; } - bool has_via_bot_id() const { return vflags.v & flag_via_bot_id; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - bool has_entities() const { return vflags.v & flag_entities; } }; class MTPDupdateShort : public mtpDataImpl { @@ -11628,30 +11499,34 @@ public: class MTPDupdateShortSentMessage : public mtpDataImpl { public: + enum class Flag : int32 { + f_unread = (1 << 0), + f_out = (1 << 1), + f_media = (1 << 9), + f_entities = (1 << 7), + + MAX_FIELD = (1 << 9), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_unread() const { return vflags.v & Flag::f_unread; } + bool is_out() const { return vflags.v & Flag::f_out; } + bool has_media() const { return vflags.v & Flag::f_media; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + MTPDupdateShortSentMessage() { } - MTPDupdateShortSentMessage(MTPint _flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) : vflags(_flags), vid(_id), vpts(_pts), vpts_count(_pts_count), vdate(_date), vmedia(_media), ventities(_entities) { + MTPDupdateShortSentMessage(const MTPflags &_flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) : vflags(_flags), vid(_id), vpts(_pts), vpts_count(_pts_count), vdate(_date), vmedia(_media), ventities(_entities) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPint vpts; MTPint vpts_count; MTPint vdate; MTPMessageMedia vmedia; MTPVector ventities; - - enum { - flag_unread = (1 << 0), - flag_out = (1 << 1), - flag_media = (1 << 9), - flag_entities = (1 << 7), - }; - - bool is_unread() const { return vflags.v & flag_unread; } - bool is_out() const { return vflags.v & flag_out; } - bool has_media() const { return vflags.v & flag_media; } - bool has_entities() const { return vflags.v & flag_entities; } }; class MTPDphotos_photos : public mtpDataImpl { @@ -11702,25 +11577,29 @@ public: class MTPDdcOption : public mtpDataImpl { public: + enum class Flag : int32 { + f_ipv6 = (1 << 0), + f_media_only = (1 << 1), + f_tcpo_only = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_ipv6() const { return vflags.v & Flag::f_ipv6; } + bool is_media_only() const { return vflags.v & Flag::f_media_only; } + bool is_tcpo_only() const { return vflags.v & Flag::f_tcpo_only; } + MTPDdcOption() { } - MTPDdcOption(MTPint _flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) : vflags(_flags), vid(_id), vip_address(_ip_address), vport(_port) { + MTPDdcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) : vflags(_flags), vid(_id), vip_address(_ip_address), vport(_port) { } - MTPint vflags; + MTPflags vflags; MTPint vid; MTPstring vip_address; MTPint vport; - - enum { - flag_ipv6 = (1 << 0), - flag_media_only = (1 << 1), - flag_tcpo_only = (1 << 2), - }; - - bool is_ipv6() const { return vflags.v & flag_ipv6; } - bool is_media_only() const { return vflags.v & flag_media_only; } - bool is_tcpo_only() const { return vflags.v & flag_tcpo_only; } }; class MTPDconfig : public mtpDataImpl { @@ -12156,17 +12035,6 @@ public: MTPint vdays; }; -class MTPDaccount_sentChangePhoneCode : public mtpDataImpl { -public: - MTPDaccount_sentChangePhoneCode() { - } - MTPDaccount_sentChangePhoneCode(const MTPstring &_phone_code_hash, MTPint _send_call_timeout) : vphone_code_hash(_phone_code_hash), vsend_call_timeout(_send_call_timeout) { - } - - MTPstring vphone_code_hash; - MTPint vsend_call_timeout; -}; - class MTPDdocumentAttributeImageSize : public mtpDataImpl { public: MTPDdocumentAttributeImageSize() { @@ -12203,28 +12071,32 @@ public: class MTPDdocumentAttributeAudio : public mtpDataImpl { public: + enum class Flag : int32 { + f_voice = (1 << 10), + f_title = (1 << 0), + f_performer = (1 << 1), + f_waveform = (1 << 2), + + MAX_FIELD = (1 << 10), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_voice() const { return vflags.v & Flag::f_voice; } + bool has_title() const { return vflags.v & Flag::f_title; } + bool has_performer() const { return vflags.v & Flag::f_performer; } + bool has_waveform() const { return vflags.v & Flag::f_waveform; } + MTPDdocumentAttributeAudio() { } - MTPDdocumentAttributeAudio(MTPint _flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) : vflags(_flags), vduration(_duration), vtitle(_title), vperformer(_performer), vwaveform(_waveform) { + MTPDdocumentAttributeAudio(const MTPflags &_flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) : vflags(_flags), vduration(_duration), vtitle(_title), vperformer(_performer), vwaveform(_waveform) { } - MTPint vflags; + MTPflags vflags; MTPint vduration; MTPstring vtitle; MTPstring vperformer; MTPbytes vwaveform; - - enum { - flag_voice = (1 << 10), - flag_title = (1 << 0), - flag_performer = (1 << 1), - flag_waveform = (1 << 2), - }; - - bool is_voice() const { return vflags.v & flag_voice; } - bool has_title() const { return vflags.v & flag_title; } - bool has_performer() const { return vflags.v & flag_performer; } - bool has_waveform() const { return vflags.v & flag_waveform; } }; class MTPDdocumentAttributeFilename : public mtpDataImpl { @@ -12315,12 +12187,44 @@ public: class MTPDwebPage : public mtpDataImpl { public: + enum class Flag : int32 { + f_type = (1 << 0), + f_site_name = (1 << 1), + f_title = (1 << 2), + f_description = (1 << 3), + f_photo = (1 << 4), + f_embed_url = (1 << 5), + f_embed_type = (1 << 5), + f_embed_width = (1 << 6), + f_embed_height = (1 << 6), + f_duration = (1 << 7), + f_author = (1 << 8), + f_document = (1 << 9), + + MAX_FIELD = (1 << 9), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_type() const { return vflags.v & Flag::f_type; } + bool has_site_name() const { return vflags.v & Flag::f_site_name; } + bool has_title() const { return vflags.v & Flag::f_title; } + bool has_description() const { return vflags.v & Flag::f_description; } + bool has_photo() const { return vflags.v & Flag::f_photo; } + bool has_embed_url() const { return vflags.v & Flag::f_embed_url; } + bool has_embed_type() const { return vflags.v & Flag::f_embed_type; } + bool has_embed_width() const { return vflags.v & Flag::f_embed_width; } + bool has_embed_height() const { return vflags.v & Flag::f_embed_height; } + bool has_duration() const { return vflags.v & Flag::f_duration; } + bool has_author() const { return vflags.v & Flag::f_author; } + bool has_document() const { return vflags.v & Flag::f_document; } + MTPDwebPage() { } - MTPDwebPage(MTPint _flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) : vflags(_flags), vid(_id), vurl(_url), vdisplay_url(_display_url), vtype(_type), vsite_name(_site_name), vtitle(_title), vdescription(_description), vphoto(_photo), vembed_url(_embed_url), vembed_type(_embed_type), vembed_width(_embed_width), vembed_height(_embed_height), vduration(_duration), vauthor(_author), vdocument(_document) { + MTPDwebPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) : vflags(_flags), vid(_id), vurl(_url), vdisplay_url(_display_url), vtype(_type), vsite_name(_site_name), vtitle(_title), vdescription(_description), vphoto(_photo), vembed_url(_embed_url), vembed_type(_embed_type), vembed_width(_embed_width), vembed_height(_embed_height), vduration(_duration), vauthor(_author), vdocument(_document) { } - MTPint vflags; + MTPflags vflags; MTPlong vid; MTPstring vurl; MTPstring vdisplay_url; @@ -12336,34 +12240,6 @@ public: MTPint vduration; MTPstring vauthor; MTPDocument vdocument; - - enum { - flag_type = (1 << 0), - flag_site_name = (1 << 1), - flag_title = (1 << 2), - flag_description = (1 << 3), - flag_photo = (1 << 4), - flag_embed_url = (1 << 5), - flag_embed_type = (1 << 5), - flag_embed_width = (1 << 6), - flag_embed_height = (1 << 6), - flag_duration = (1 << 7), - flag_author = (1 << 8), - flag_document = (1 << 9), - }; - - bool has_type() const { return vflags.v & flag_type; } - bool has_site_name() const { return vflags.v & flag_site_name; } - bool has_title() const { return vflags.v & flag_title; } - bool has_description() const { return vflags.v & flag_description; } - bool has_photo() const { return vflags.v & flag_photo; } - bool has_embed_url() const { return vflags.v & flag_embed_url; } - bool has_embed_type() const { return vflags.v & flag_embed_type; } - bool has_embed_width() const { return vflags.v & flag_embed_width; } - bool has_embed_height() const { return vflags.v & flag_embed_height; } - bool has_duration() const { return vflags.v & flag_duration; } - bool has_author() const { return vflags.v & flag_author; } - bool has_document() const { return vflags.v & flag_document; } }; class MTPDauthorization : public mtpDataImpl { @@ -12435,28 +12311,32 @@ public: class MTPDaccount_passwordInputSettings : public mtpDataImpl { public: + enum class Flag : int32 { + f_new_salt = (1 << 0), + f_new_password_hash = (1 << 0), + f_hint = (1 << 0), + f_email = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_new_salt() const { return vflags.v & Flag::f_new_salt; } + bool has_new_password_hash() const { return vflags.v & Flag::f_new_password_hash; } + bool has_hint() const { return vflags.v & Flag::f_hint; } + bool has_email() const { return vflags.v & Flag::f_email; } + MTPDaccount_passwordInputSettings() { } - MTPDaccount_passwordInputSettings(MTPint _flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) : vflags(_flags), vnew_salt(_new_salt), vnew_password_hash(_new_password_hash), vhint(_hint), vemail(_email) { + MTPDaccount_passwordInputSettings(const MTPflags &_flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) : vflags(_flags), vnew_salt(_new_salt), vnew_password_hash(_new_password_hash), vhint(_hint), vemail(_email) { } - MTPint vflags; + MTPflags vflags; MTPbytes vnew_salt; MTPbytes vnew_password_hash; MTPstring vhint; MTPstring vemail; - - enum { - flag_new_salt = (1 << 0), - flag_new_password_hash = (1 << 0), - flag_hint = (1 << 0), - flag_email = (1 << 1), - }; - - bool has_new_salt() const { return vflags.v & flag_new_salt; } - bool has_new_password_hash() const { return vflags.v & flag_new_password_hash; } - bool has_hint() const { return vflags.v & flag_hint; } - bool has_email() const { return vflags.v & flag_email; } }; class MTPDauth_passwordRecovery : public mtpDataImpl { @@ -12502,25 +12382,29 @@ public: class MTPDchatInvite : public mtpDataImpl { public: + enum class Flag : int32 { + f_channel = (1 << 0), + f_broadcast = (1 << 1), + f_public = (1 << 2), + f_megagroup = (1 << 3), + + MAX_FIELD = (1 << 3), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_channel() const { return vflags.v & Flag::f_channel; } + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_public() const { return vflags.v & Flag::f_public; } + bool is_megagroup() const { return vflags.v & Flag::f_megagroup; } + MTPDchatInvite() { } - MTPDchatInvite(MTPint _flags, const MTPstring &_title) : vflags(_flags), vtitle(_title) { + MTPDchatInvite(const MTPflags &_flags, const MTPstring &_title) : vflags(_flags), vtitle(_title) { } - MTPint vflags; + MTPflags vflags; MTPstring vtitle; - - enum { - flag_channel = (1 << 0), - flag_broadcast = (1 << 1), - flag_public = (1 << 2), - flag_megagroup = (1 << 3), - }; - - bool is_channel() const { return vflags.v & flag_channel; } - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_public() const { return vflags.v & flag_public; } - bool is_megagroup() const { return vflags.v & flag_megagroup; } }; class MTPDinputStickerSetID : public mtpDataImpl { @@ -12546,28 +12430,32 @@ public: class MTPDstickerSet : public mtpDataImpl { public: + enum class Flag : int32 { + f_installed = (1 << 0), + f_disabled = (1 << 1), + f_official = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_installed() const { return vflags.v & Flag::f_installed; } + bool is_disabled() const { return vflags.v & Flag::f_disabled; } + bool is_official() const { return vflags.v & Flag::f_official; } + MTPDstickerSet() { } - MTPDstickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vshort_name(_short_name), vcount(_count), vhash(_hash) { + MTPDstickerSet(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) : vflags(_flags), vid(_id), vaccess_hash(_access_hash), vtitle(_title), vshort_name(_short_name), vcount(_count), vhash(_hash) { } - MTPint vflags; + MTPflags vflags; MTPlong vid; MTPlong vaccess_hash; MTPstring vtitle; MTPstring vshort_name; MTPint vcount; MTPint vhash; - - enum { - flag_installed = (1 << 0), - flag_disabled = (1 << 1), - flag_official = (1 << 2), - }; - - bool is_installed() const { return vflags.v & flag_installed; } - bool is_disabled() const { return vflags.v & flag_disabled; } - bool is_official() const { return vflags.v & flag_official; } }; class MTPDmessages_stickerSet : public mtpDataImpl { @@ -12627,57 +12515,69 @@ public: class MTPDreplyKeyboardHide : public mtpDataImpl { public: + enum class Flag : int32 { + f_selective = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_selective() const { return vflags.v & Flag::f_selective; } + MTPDreplyKeyboardHide() { } - MTPDreplyKeyboardHide(MTPint _flags) : vflags(_flags) { + MTPDreplyKeyboardHide(const MTPflags &_flags) : vflags(_flags) { } - MTPint vflags; - - enum { - flag_selective = (1 << 2), - }; - - bool is_selective() const { return vflags.v & flag_selective; } + MTPflags vflags; }; class MTPDreplyKeyboardForceReply : public mtpDataImpl { public: + enum class Flag : int32 { + f_single_use = (1 << 1), + f_selective = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_single_use() const { return vflags.v & Flag::f_single_use; } + bool is_selective() const { return vflags.v & Flag::f_selective; } + MTPDreplyKeyboardForceReply() { } - MTPDreplyKeyboardForceReply(MTPint _flags) : vflags(_flags) { + MTPDreplyKeyboardForceReply(const MTPflags &_flags) : vflags(_flags) { } - MTPint vflags; - - enum { - flag_single_use = (1 << 1), - flag_selective = (1 << 2), - }; - - bool is_single_use() const { return vflags.v & flag_single_use; } - bool is_selective() const { return vflags.v & flag_selective; } + MTPflags vflags; }; class MTPDreplyKeyboardMarkup : public mtpDataImpl { public: + enum class Flag : int32 { + f_resize = (1 << 0), + f_single_use = (1 << 1), + f_selective = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_resize() const { return vflags.v & Flag::f_resize; } + bool is_single_use() const { return vflags.v & Flag::f_single_use; } + bool is_selective() const { return vflags.v & Flag::f_selective; } + MTPDreplyKeyboardMarkup() { } - MTPDreplyKeyboardMarkup(MTPint _flags, const MTPVector &_rows) : vflags(_flags), vrows(_rows) { + MTPDreplyKeyboardMarkup(const MTPflags &_flags, const MTPVector &_rows) : vflags(_flags), vrows(_rows) { } - MTPint vflags; + MTPflags vflags; MTPVector vrows; - - enum { - flag_resize = (1 << 0), - flag_single_use = (1 << 1), - flag_selective = (1 << 2), - }; - - bool is_resize() const { return vflags.v & flag_resize; } - bool is_single_use() const { return vflags.v & flag_single_use; } - bool is_selective() const { return vflags.v & flag_selective; } }; class MTPDhelp_appChangelog : public mtpDataImpl { @@ -12862,32 +12762,48 @@ public: class MTPDupdates_channelDifferenceEmpty : public mtpDataImpl { public: + enum class Flag : int32 { + f_final = (1 << 0), + f_timeout = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_final() const { return vflags.v & Flag::f_final; } + bool has_timeout() const { return vflags.v & Flag::f_timeout; } + MTPDupdates_channelDifferenceEmpty() { } - MTPDupdates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout) : vflags(_flags), vpts(_pts), vtimeout(_timeout) { + MTPDupdates_channelDifferenceEmpty(const MTPflags &_flags, MTPint _pts, MTPint _timeout) : vflags(_flags), vpts(_pts), vtimeout(_timeout) { } - MTPint vflags; + MTPflags vflags; MTPint vpts; MTPint vtimeout; - - enum { - flag_final = (1 << 0), - flag_timeout = (1 << 1), - }; - - bool is_final() const { return vflags.v & flag_final; } - bool has_timeout() const { return vflags.v & flag_timeout; } }; class MTPDupdates_channelDifferenceTooLong : public mtpDataImpl { public: + enum class Flag : int32 { + f_final = (1 << 0), + f_timeout = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_final() const { return vflags.v & Flag::f_final; } + bool has_timeout() const { return vflags.v & Flag::f_timeout; } + MTPDupdates_channelDifferenceTooLong() { } - MTPDupdates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vmessages(_messages), vchats(_chats), vusers(_users) { + MTPDupdates_channelDifferenceTooLong(const MTPflags &_flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vtop_message(_top_message), vtop_important_message(_top_important_message), vread_inbox_max_id(_read_inbox_max_id), vunread_count(_unread_count), vunread_important_count(_unread_important_count), vmessages(_messages), vchats(_chats), vusers(_users) { } - MTPint vflags; + MTPflags vflags; MTPint vpts; MTPint vtimeout; MTPint vtop_message; @@ -12898,57 +12814,57 @@ public: MTPVector vmessages; MTPVector vchats; MTPVector vusers; - - enum { - flag_final = (1 << 0), - flag_timeout = (1 << 1), - }; - - bool is_final() const { return vflags.v & flag_final; } - bool has_timeout() const { return vflags.v & flag_timeout; } }; class MTPDupdates_channelDifference : public mtpDataImpl { public: + enum class Flag : int32 { + f_final = (1 << 0), + f_timeout = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_final() const { return vflags.v & Flag::f_final; } + bool has_timeout() const { return vflags.v & Flag::f_timeout; } + MTPDupdates_channelDifference() { } - MTPDupdates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vnew_messages(_new_messages), vother_updates(_other_updates), vchats(_chats), vusers(_users) { + MTPDupdates_channelDifference(const MTPflags &_flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) : vflags(_flags), vpts(_pts), vtimeout(_timeout), vnew_messages(_new_messages), vother_updates(_other_updates), vchats(_chats), vusers(_users) { } - MTPint vflags; + MTPflags vflags; MTPint vpts; MTPint vtimeout; MTPVector vnew_messages; MTPVector vother_updates; MTPVector vchats; MTPVector vusers; - - enum { - flag_final = (1 << 0), - flag_timeout = (1 << 1), - }; - - bool is_final() const { return vflags.v & flag_final; } - bool has_timeout() const { return vflags.v & flag_timeout; } }; class MTPDchannelMessagesFilter : public mtpDataImpl { public: + enum class Flag : int32 { + f_important_only = (1 << 0), + f_exclude_new_messages = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_important_only() const { return vflags.v & Flag::f_important_only; } + bool is_exclude_new_messages() const { return vflags.v & Flag::f_exclude_new_messages; } + MTPDchannelMessagesFilter() { } - MTPDchannelMessagesFilter(MTPint _flags, const MTPVector &_ranges) : vflags(_flags), vranges(_ranges) { + MTPDchannelMessagesFilter(const MTPflags &_flags, const MTPVector &_ranges) : vflags(_flags), vranges(_ranges) { } - MTPint vflags; + MTPflags vflags; MTPVector vranges; - - enum { - flag_important_only = (1 << 0), - flag_exclude_new_messages = (1 << 1), - }; - - bool is_important_only() const { return vflags.v & flag_important_only; } - bool is_exclude_new_messages() const { return vflags.v & flag_exclude_new_messages; } }; class MTPDchannelParticipant : public mtpDataImpl { @@ -13114,32 +13030,62 @@ public: class MTPDinputBotInlineMessageText : public mtpDataImpl { public: + enum class Flag : int32 { + f_no_webpage = (1 << 0), + f_entities = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + MTPDinputBotInlineMessageText() { } - MTPDinputBotInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vmessage(_message), ventities(_entities) { + MTPDinputBotInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vmessage(_message), ventities(_entities) { } - MTPint vflags; + MTPflags vflags; MTPstring vmessage; MTPVector ventities; - - enum { - flag_no_webpage = (1 << 0), - flag_entities = (1 << 1), - }; - - bool is_no_webpage() const { return vflags.v & flag_no_webpage; } - bool has_entities() const { return vflags.v & flag_entities; } }; class MTPDinputBotInlineResult : public mtpDataImpl { public: + enum class Flag : int32 { + f_title = (1 << 1), + f_description = (1 << 2), + f_url = (1 << 3), + f_thumb_url = (1 << 4), + f_content_url = (1 << 5), + f_content_type = (1 << 5), + f_w = (1 << 6), + f_h = (1 << 6), + f_duration = (1 << 7), + + MAX_FIELD = (1 << 7), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_title() const { return vflags.v & Flag::f_title; } + bool has_description() const { return vflags.v & Flag::f_description; } + bool has_url() const { return vflags.v & Flag::f_url; } + bool has_thumb_url() const { return vflags.v & Flag::f_thumb_url; } + bool has_content_url() const { return vflags.v & Flag::f_content_url; } + bool has_content_type() const { return vflags.v & Flag::f_content_type; } + bool has_w() const { return vflags.v & Flag::f_w; } + bool has_h() const { return vflags.v & Flag::f_h; } + bool has_duration() const { return vflags.v & Flag::f_duration; } + MTPDinputBotInlineResult() { } - MTPDinputBotInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) : vflags(_flags), vid(_id), vtype(_type), vtitle(_title), vdescription(_description), vurl(_url), vthumb_url(_thumb_url), vcontent_url(_content_url), vcontent_type(_content_type), vw(_w), vh(_h), vduration(_duration), vsend_message(_send_message) { + MTPDinputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) : vflags(_flags), vid(_id), vtype(_type), vtitle(_title), vdescription(_description), vurl(_url), vthumb_url(_thumb_url), vcontent_url(_content_url), vcontent_type(_content_type), vw(_w), vh(_h), vduration(_duration), vsend_message(_send_message) { } - MTPint vflags; + MTPflags vflags; MTPstring vid; MTPstring vtype; MTPstring vtitle; @@ -13152,28 +13098,6 @@ public: MTPint vh; MTPint vduration; MTPInputBotInlineMessage vsend_message; - - enum { - flag_title = (1 << 1), - flag_description = (1 << 2), - flag_url = (1 << 3), - flag_thumb_url = (1 << 4), - flag_content_url = (1 << 5), - flag_content_type = (1 << 5), - flag_w = (1 << 6), - flag_h = (1 << 6), - flag_duration = (1 << 7), - }; - - bool has_title() const { return vflags.v & flag_title; } - bool has_description() const { return vflags.v & flag_description; } - bool has_url() const { return vflags.v & flag_url; } - bool has_thumb_url() const { return vflags.v & flag_thumb_url; } - bool has_content_url() const { return vflags.v & flag_content_url; } - bool has_content_type() const { return vflags.v & flag_content_type; } - bool has_w() const { return vflags.v & flag_w; } - bool has_h() const { return vflags.v & flag_h; } - bool has_duration() const { return vflags.v & flag_duration; } }; class MTPDbotInlineMessageMediaAuto : public mtpDataImpl { @@ -13188,22 +13112,26 @@ public: class MTPDbotInlineMessageText : public mtpDataImpl { public: + enum class Flag : int32 { + f_no_webpage = (1 << 0), + f_entities = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + MTPDbotInlineMessageText() { } - MTPDbotInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vmessage(_message), ventities(_entities) { + MTPDbotInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vmessage(_message), ventities(_entities) { } - MTPint vflags; + MTPflags vflags; MTPstring vmessage; MTPVector ventities; - - enum { - flag_no_webpage = (1 << 0), - flag_entities = (1 << 1), - }; - - bool is_no_webpage() const { return vflags.v & flag_no_webpage; } - bool has_entities() const { return vflags.v & flag_entities; } }; class MTPDbotInlineMediaResultDocument : public mtpDataImpl { @@ -13234,12 +13162,38 @@ public: class MTPDbotInlineResult : public mtpDataImpl { public: + enum class Flag : int32 { + f_title = (1 << 1), + f_description = (1 << 2), + f_url = (1 << 3), + f_thumb_url = (1 << 4), + f_content_url = (1 << 5), + f_content_type = (1 << 5), + f_w = (1 << 6), + f_h = (1 << 6), + f_duration = (1 << 7), + + MAX_FIELD = (1 << 7), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_title() const { return vflags.v & Flag::f_title; } + bool has_description() const { return vflags.v & Flag::f_description; } + bool has_url() const { return vflags.v & Flag::f_url; } + bool has_thumb_url() const { return vflags.v & Flag::f_thumb_url; } + bool has_content_url() const { return vflags.v & Flag::f_content_url; } + bool has_content_type() const { return vflags.v & Flag::f_content_type; } + bool has_w() const { return vflags.v & Flag::f_w; } + bool has_h() const { return vflags.v & Flag::f_h; } + bool has_duration() const { return vflags.v & Flag::f_duration; } + MTPDbotInlineResult() { } - MTPDbotInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) : vflags(_flags), vid(_id), vtype(_type), vtitle(_title), vdescription(_description), vurl(_url), vthumb_url(_thumb_url), vcontent_url(_content_url), vcontent_type(_content_type), vw(_w), vh(_h), vduration(_duration), vsend_message(_send_message) { + MTPDbotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) : vflags(_flags), vid(_id), vtype(_type), vtitle(_title), vdescription(_description), vurl(_url), vthumb_url(_thumb_url), vcontent_url(_content_url), vcontent_type(_content_type), vw(_w), vh(_h), vduration(_duration), vsend_message(_send_message) { } - MTPint vflags; + MTPflags vflags; MTPstring vid; MTPstring vtype; MTPstring vtitle; @@ -13252,49 +13206,31 @@ public: MTPint vh; MTPint vduration; MTPBotInlineMessage vsend_message; - - enum { - flag_title = (1 << 1), - flag_description = (1 << 2), - flag_url = (1 << 3), - flag_thumb_url = (1 << 4), - flag_content_url = (1 << 5), - flag_content_type = (1 << 5), - flag_w = (1 << 6), - flag_h = (1 << 6), - flag_duration = (1 << 7), - }; - - bool has_title() const { return vflags.v & flag_title; } - bool has_description() const { return vflags.v & flag_description; } - bool has_url() const { return vflags.v & flag_url; } - bool has_thumb_url() const { return vflags.v & flag_thumb_url; } - bool has_content_url() const { return vflags.v & flag_content_url; } - bool has_content_type() const { return vflags.v & flag_content_type; } - bool has_w() const { return vflags.v & flag_w; } - bool has_h() const { return vflags.v & flag_h; } - bool has_duration() const { return vflags.v & flag_duration; } }; class MTPDmessages_botResults : public mtpDataImpl { public: + enum class Flag : int32 { + f_gallery = (1 << 0), + f_next_offset = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_gallery() const { return vflags.v & Flag::f_gallery; } + bool has_next_offset() const { return vflags.v & Flag::f_next_offset; } + MTPDmessages_botResults() { } - MTPDmessages_botResults(MTPint _flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vresults(_results) { + MTPDmessages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) : vflags(_flags), vquery_id(_query_id), vnext_offset(_next_offset), vresults(_results) { } - MTPint vflags; + MTPflags vflags; MTPlong vquery_id; MTPstring vnext_offset; MTPVector vresults; - - enum { - flag_gallery = (1 << 0), - flag_next_offset = (1 << 1), - }; - - bool is_gallery() const { return vflags.v & flag_gallery; } - bool has_next_offset() const { return vflags.v & flag_next_offset; } }; class MTPDexportedMessageLink : public mtpDataImpl { @@ -13309,42 +13245,88 @@ public: class MTPDmessageFwdHeader : public mtpDataImpl { public: + enum class Flag : int32 { + f_from_id = (1 << 0), + f_channel_id = (1 << 1), + f_channel_post = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_from_id() const { return vflags.v & Flag::f_from_id; } + bool has_channel_id() const { return vflags.v & Flag::f_channel_id; } + bool has_channel_post() const { return vflags.v & Flag::f_channel_post; } + MTPDmessageFwdHeader() { } - MTPDmessageFwdHeader(MTPint _flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) : vflags(_flags), vfrom_id(_from_id), vdate(_date), vchannel_id(_channel_id), vchannel_post(_channel_post) { + MTPDmessageFwdHeader(const MTPflags &_flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) : vflags(_flags), vfrom_id(_from_id), vdate(_date), vchannel_id(_channel_id), vchannel_post(_channel_post) { } - MTPint vflags; + MTPflags vflags; MTPint vfrom_id; MTPint vdate; MTPint vchannel_id; MTPint vchannel_post; - - enum { - flag_from_id = (1 << 0), - flag_channel_id = (1 << 1), - flag_channel_post = (1 << 2), - }; - - bool has_from_id() const { return vflags.v & flag_from_id; } - bool has_channel_id() const { return vflags.v & flag_channel_id; } - bool has_channel_post() const { return vflags.v & flag_channel_post; } }; class MTPDchannels_messageEditData : public mtpDataImpl { public: + enum class Flag : int32 { + f_caption = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_caption() const { return vflags.v & Flag::f_caption; } + MTPDchannels_messageEditData() { } - MTPDchannels_messageEditData(MTPint _flags) : vflags(_flags) { + MTPDchannels_messageEditData(const MTPflags &_flags) : vflags(_flags) { } - MTPint vflags; + MTPflags vflags; +}; - enum { - flag_caption = (1 << 0), - }; +class MTPDauth_sentCodeTypeApp : public mtpDataImpl { +public: + MTPDauth_sentCodeTypeApp() { + } + MTPDauth_sentCodeTypeApp(MTPint _length) : vlength(_length) { + } - bool is_caption() const { return vflags.v & flag_caption; } + MTPint vlength; +}; + +class MTPDauth_sentCodeTypeSms : public mtpDataImpl { +public: + MTPDauth_sentCodeTypeSms() { + } + MTPDauth_sentCodeTypeSms(MTPint _length) : vlength(_length) { + } + + MTPint vlength; +}; + +class MTPDauth_sentCodeTypeCall : public mtpDataImpl { +public: + MTPDauth_sentCodeTypeCall() { + } + MTPDauth_sentCodeTypeCall(MTPint _length) : vlength(_length) { + } + + MTPint vlength; +}; + +class MTPDauth_sentCodeTypeFlashCall : public mtpDataImpl { +public: + MTPDauth_sentCodeTypeFlashCall() { + } + MTPDauth_sentCodeTypeFlashCall(const MTPstring &_pattern) : vpattern(_pattern) { + } + + MTPstring vpattern; }; // RPC methods @@ -13996,8 +13978,19 @@ public: class MTPauth_sendCode { // RPC method 'auth.sendCode' public: + enum class Flag : int32 { + f_allow_flashcall = (1 << 0), + f_current_number = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_allow_flashcall() const { return vflags.v & Flag::f_allow_flashcall; } + bool has_current_number() const { return vflags.v & Flag::f_current_number; } + + MTPflags vflags; MTPstring vphone_number; - MTPint vsms_type; + MTPBool vcurrent_number; MTPint vapi_id; MTPstring vapi_hash; MTPstring vlang_code; @@ -14007,25 +14000,27 @@ public: MTPauth_sendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendCode) { read(from, end, cons); } - MTPauth_sendCode(const MTPstring &_phone_number, MTPint _sms_type, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : vphone_number(_phone_number), vsms_type(_sms_type), vapi_id(_api_id), vapi_hash(_api_hash), vlang_code(_lang_code) { + MTPauth_sendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : vflags(_flags), vphone_number(_phone_number), vcurrent_number(_current_number), vapi_id(_api_id), vapi_hash(_api_hash), vlang_code(_lang_code) { } uint32 innerLength() const { - return vphone_number.innerLength() + vsms_type.innerLength() + vapi_id.innerLength() + vapi_hash.innerLength() + vlang_code.innerLength(); + return vflags.innerLength() + vphone_number.innerLength() + (has_current_number() ? vcurrent_number.innerLength() : 0) + vapi_id.innerLength() + vapi_hash.innerLength() + vlang_code.innerLength(); } mtpTypeId type() const { return mtpc_auth_sendCode; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendCode) { + vflags.read(from, end); vphone_number.read(from, end); - vsms_type.read(from, end); + if (has_current_number()) { vcurrent_number.read(from, end); } else { vcurrent_number = MTPBool(); } vapi_id.read(from, end); vapi_hash.read(from, end); vlang_code.read(from, end); } void write(mtpBuffer &to) const { + vflags.write(to); vphone_number.write(to); - vsms_type.write(to); + if (has_current_number()) vcurrent_number.write(to); vapi_id.write(to); vapi_hash.write(to); vlang_code.write(to); @@ -14033,6 +14028,8 @@ public: typedef MTPauth_SentCode ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPauth_sendCode::Flags) + class MTPauth_SendCode : public MTPBoxed { public: MTPauth_SendCode() { @@ -14041,49 +14038,7 @@ public: } MTPauth_SendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPauth_SendCode(const MTPstring &_phone_number, MTPint _sms_type, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : MTPBoxed(MTPauth_sendCode(_phone_number, _sms_type, _api_id, _api_hash, _lang_code)) { - } -}; - -class MTPauth_sendCall { // RPC method 'auth.sendCall' -public: - MTPstring vphone_number; - MTPstring vphone_code_hash; - - MTPauth_sendCall() { - } - MTPauth_sendCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendCall) { - read(from, end, cons); - } - MTPauth_sendCall(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { - } - - uint32 innerLength() const { - return vphone_number.innerLength() + vphone_code_hash.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_sendCall; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendCall) { - vphone_number.read(from, end); - vphone_code_hash.read(from, end); - } - void write(mtpBuffer &to) const { - vphone_number.write(to); - vphone_code_hash.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPauth_SendCall : public MTPBoxed { -public: - MTPauth_SendCall() { - } - MTPauth_SendCall(const MTPauth_sendCall &v) : MTPBoxed(v) { - } - MTPauth_SendCall(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_SendCall(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_sendCall(_phone_number, _phone_code_hash)) { + MTPauth_SendCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number, MTPint _api_id, const MTPstring &_api_hash, const MTPstring &_lang_code) : MTPBoxed(MTPauth_sendCode(_flags, _phone_number, _current_number, _api_id, _api_hash, _lang_code)) { } }; @@ -14416,48 +14371,6 @@ public: } }; -class MTPauth_sendSms { // RPC method 'auth.sendSms' -public: - MTPstring vphone_number; - MTPstring vphone_code_hash; - - MTPauth_sendSms() { - } - MTPauth_sendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { - read(from, end, cons); - } - MTPauth_sendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { - } - - uint32 innerLength() const { - return vphone_number.innerLength() + vphone_code_hash.innerLength(); - } - mtpTypeId type() const { - return mtpc_auth_sendSms; - } - void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_sendSms) { - vphone_number.read(from, end); - vphone_code_hash.read(from, end); - } - void write(mtpBuffer &to) const { - vphone_number.write(to); - vphone_code_hash.write(to); - } - - typedef MTPBool ResponseType; -}; -class MTPauth_SendSms : public MTPBoxed { -public: - MTPauth_SendSms() { - } - MTPauth_SendSms(const MTPauth_sendSms &v) : MTPBoxed(v) { - } - MTPauth_SendSms(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { - } - MTPauth_SendSms(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_sendSms(_phone_number, _phone_code_hash)) { - } -}; - class MTPauth_importBotAuthorization { // RPC method 'auth.importBotAuthorization' public: MTPint vflags; @@ -14615,6 +14528,90 @@ public: } }; +class MTPauth_resendCode { // RPC method 'auth.resendCode' +public: + MTPstring vphone_number; + MTPstring vphone_code_hash; + + MTPauth_resendCode() { + } + MTPauth_resendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_resendCode) { + read(from, end, cons); + } + MTPauth_resendCode(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { + } + + uint32 innerLength() const { + return vphone_number.innerLength() + vphone_code_hash.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_resendCode; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_resendCode) { + vphone_number.read(from, end); + vphone_code_hash.read(from, end); + } + void write(mtpBuffer &to) const { + vphone_number.write(to); + vphone_code_hash.write(to); + } + + typedef MTPauth_SentCode ResponseType; +}; +class MTPauth_ResendCode : public MTPBoxed { +public: + MTPauth_ResendCode() { + } + MTPauth_ResendCode(const MTPauth_resendCode &v) : MTPBoxed(v) { + } + MTPauth_ResendCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_ResendCode(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_resendCode(_phone_number, _phone_code_hash)) { + } +}; + +class MTPauth_cancelCode { // RPC method 'auth.cancelCode' +public: + MTPstring vphone_number; + MTPstring vphone_code_hash; + + MTPauth_cancelCode() { + } + MTPauth_cancelCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_cancelCode) { + read(from, end, cons); + } + MTPauth_cancelCode(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : vphone_number(_phone_number), vphone_code_hash(_phone_code_hash) { + } + + uint32 innerLength() const { + return vphone_number.innerLength() + vphone_code_hash.innerLength(); + } + mtpTypeId type() const { + return mtpc_auth_cancelCode; + } + void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_auth_cancelCode) { + vphone_number.read(from, end); + vphone_code_hash.read(from, end); + } + void write(mtpBuffer &to) const { + vphone_number.write(to); + vphone_code_hash.write(to); + } + + typedef MTPBool ResponseType; +}; +class MTPauth_CancelCode : public MTPBoxed { +public: + MTPauth_CancelCode() { + } + MTPauth_CancelCode(const MTPauth_cancelCode &v) : MTPBoxed(v) { + } + MTPauth_CancelCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { + } + MTPauth_CancelCode(const MTPstring &_phone_number, const MTPstring &_phone_code_hash) : MTPBoxed(MTPauth_cancelCode(_phone_number, _phone_code_hash)) { + } +}; + class MTPaccount_registerDevice { // RPC method 'account.registerDevice' public: MTPint vtoken_type; @@ -14828,7 +14825,21 @@ public: class MTPaccount_updateProfile { // RPC method 'account.updateProfile' public: - MTPint vflags; + enum class Flag : int32 { + f_first_name = (1 << 0), + f_last_name = (1 << 1), + f_about = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool has_first_name() const { return vflags.v & Flag::f_first_name; } + bool has_last_name() const { return vflags.v & Flag::f_last_name; } + bool has_about() const { return vflags.v & Flag::f_about; } + + MTPflags vflags; MTPstring vfirst_name; MTPstring vlast_name; MTPstring vabout; @@ -14838,19 +14849,9 @@ public: MTPaccount_updateProfile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_updateProfile) { read(from, end, cons); } - MTPaccount_updateProfile(MTPint _flags, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_about) : vflags(_flags), vfirst_name(_first_name), vlast_name(_last_name), vabout(_about) { + MTPaccount_updateProfile(const MTPflags &_flags, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_about) : vflags(_flags), vfirst_name(_first_name), vlast_name(_last_name), vabout(_about) { } - enum { - flag_first_name = (1 << 0), - flag_last_name = (1 << 1), - flag_about = (1 << 2), - }; - - bool has_first_name() const { return vflags.v & flag_first_name; } - bool has_last_name() const { return vflags.v & flag_last_name; } - bool has_about() const { return vflags.v & flag_about; } - uint32 innerLength() const { return vflags.innerLength() + (has_first_name() ? vfirst_name.innerLength() : 0) + (has_last_name() ? vlast_name.innerLength() : 0) + (has_about() ? vabout.innerLength() : 0); } @@ -14872,6 +14873,8 @@ public: typedef MTPUser ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPaccount_updateProfile::Flags) + class MTPaccount_UpdateProfile : public MTPBoxed { public: MTPaccount_UpdateProfile() { @@ -14880,7 +14883,7 @@ public: } MTPaccount_UpdateProfile(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPaccount_UpdateProfile(MTPint _flags, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_about) : MTPBoxed(MTPaccount_updateProfile(_flags, _first_name, _last_name, _about)) { + MTPaccount_UpdateProfile(const MTPflags &_flags, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_about) : MTPBoxed(MTPaccount_updateProfile(_flags, _first_name, _last_name, _about)) { } }; @@ -15266,31 +15269,49 @@ public: class MTPaccount_sendChangePhoneCode { // RPC method 'account.sendChangePhoneCode' public: + enum class Flag : int32 { + f_allow_flashcall = (1 << 0), + f_current_number = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_allow_flashcall() const { return vflags.v & Flag::f_allow_flashcall; } + bool has_current_number() const { return vflags.v & Flag::f_current_number; } + + MTPflags vflags; MTPstring vphone_number; + MTPBool vcurrent_number; MTPaccount_sendChangePhoneCode() { } MTPaccount_sendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { read(from, end, cons); } - MTPaccount_sendChangePhoneCode(const MTPstring &_phone_number) : vphone_number(_phone_number) { + MTPaccount_sendChangePhoneCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number) : vflags(_flags), vphone_number(_phone_number), vcurrent_number(_current_number) { } uint32 innerLength() const { - return vphone_number.innerLength(); + return vflags.innerLength() + vphone_number.innerLength() + (has_current_number() ? vcurrent_number.innerLength() : 0); } mtpTypeId type() const { return mtpc_account_sendChangePhoneCode; } void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_account_sendChangePhoneCode) { + vflags.read(from, end); vphone_number.read(from, end); + if (has_current_number()) { vcurrent_number.read(from, end); } else { vcurrent_number = MTPBool(); } } void write(mtpBuffer &to) const { + vflags.write(to); vphone_number.write(to); + if (has_current_number()) vcurrent_number.write(to); } - typedef MTPaccount_SentChangePhoneCode ResponseType; + typedef MTPauth_SentCode ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPaccount_sendChangePhoneCode::Flags) + class MTPaccount_SendChangePhoneCode : public MTPBoxed { public: MTPaccount_SendChangePhoneCode() { @@ -15299,7 +15320,7 @@ public: } MTPaccount_SendChangePhoneCode(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPaccount_SendChangePhoneCode(const MTPstring &_phone_number) : MTPBoxed(MTPaccount_sendChangePhoneCode(_phone_number)) { + MTPaccount_SendChangePhoneCode(const MTPflags &_flags, const MTPstring &_phone_number, MTPBool _current_number) : MTPBoxed(MTPaccount_sendChangePhoneCode(_flags, _phone_number, _current_number)) { } }; @@ -16254,7 +16275,15 @@ public: class MTPmessages_search { // RPC method 'messages.search' public: - MTPint vflags; + enum class Flag : int32 { + f_important_only = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_important_only() const { return vflags.v & Flag::f_important_only; } + + MTPflags vflags; MTPInputPeer vpeer; MTPstring vq; MTPMessagesFilter vfilter; @@ -16269,15 +16298,9 @@ public: MTPmessages_search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_search) { read(from, end, cons); } - MTPmessages_search(MTPint _flags, const MTPInputPeer &_peer, const MTPstring &_q, const MTPMessagesFilter &_filter, MTPint _min_date, MTPint _max_date, MTPint _offset, MTPint _max_id, MTPint _limit) : vflags(_flags), vpeer(_peer), vq(_q), vfilter(_filter), vmin_date(_min_date), vmax_date(_max_date), voffset(_offset), vmax_id(_max_id), vlimit(_limit) { + MTPmessages_search(const MTPflags &_flags, const MTPInputPeer &_peer, const MTPstring &_q, const MTPMessagesFilter &_filter, MTPint _min_date, MTPint _max_date, MTPint _offset, MTPint _max_id, MTPint _limit) : vflags(_flags), vpeer(_peer), vq(_q), vfilter(_filter), vmin_date(_min_date), vmax_date(_max_date), voffset(_offset), vmax_id(_max_id), vlimit(_limit) { } - enum { - flag_important_only = (1 << 0), - }; - - bool is_important_only() const { return vflags.v & flag_important_only; } - uint32 innerLength() const { return vflags.innerLength() + vpeer.innerLength() + vq.innerLength() + vfilter.innerLength() + vmin_date.innerLength() + vmax_date.innerLength() + voffset.innerLength() + vmax_id.innerLength() + vlimit.innerLength(); } @@ -16309,6 +16332,8 @@ public: typedef MTPmessages_Messages ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_search::Flags) + class MTPmessages_Search : public MTPBoxed { public: MTPmessages_Search() { @@ -16317,7 +16342,7 @@ public: } MTPmessages_Search(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_Search(MTPint _flags, const MTPInputPeer &_peer, const MTPstring &_q, const MTPMessagesFilter &_filter, MTPint _min_date, MTPint _max_date, MTPint _offset, MTPint _max_id, MTPint _limit) : MTPBoxed(MTPmessages_search(_flags, _peer, _q, _filter, _min_date, _max_date, _offset, _max_id, _limit)) { + MTPmessages_Search(const MTPflags &_flags, const MTPInputPeer &_peer, const MTPstring &_q, const MTPMessagesFilter &_filter, MTPint _min_date, MTPint _max_date, MTPint _offset, MTPint _max_id, MTPint _limit) : MTPBoxed(MTPmessages_search(_flags, _peer, _q, _filter, _min_date, _max_date, _offset, _max_id, _limit)) { } }; @@ -16527,7 +16552,29 @@ public: class MTPmessages_sendMessage { // RPC method 'messages.sendMessage' public: - MTPint vflags; + enum class Flag : int32 { + f_no_webpage = (1 << 1), + f_broadcast = (1 << 4), + f_silent = (1 << 5), + f_background = (1 << 6), + f_reply_to_msg_id = (1 << 0), + f_reply_markup = (1 << 2), + f_entities = (1 << 3), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_background() const { return vflags.v & Flag::f_background; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + + MTPflags vflags; MTPInputPeer vpeer; MTPint vreply_to_msg_id; MTPstring vmessage; @@ -16540,27 +16587,9 @@ public: MTPmessages_sendMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_sendMessage) { read(from, end, cons); } - MTPmessages_sendMessage(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vmessage(_message), vrandom_id(_random_id), vreply_markup(_reply_markup), ventities(_entities) { + MTPmessages_sendMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vmessage(_message), vrandom_id(_random_id), vreply_markup(_reply_markup), ventities(_entities) { } - enum { - flag_no_webpage = (1 << 1), - flag_broadcast = (1 << 4), - flag_silent = (1 << 5), - flag_background = (1 << 6), - flag_reply_to_msg_id = (1 << 0), - flag_reply_markup = (1 << 2), - flag_entities = (1 << 3), - }; - - bool is_no_webpage() const { return vflags.v & flag_no_webpage; } - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_background() const { return vflags.v & flag_background; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - bool has_reply_markup() const { return vflags.v & flag_reply_markup; } - bool has_entities() const { return vflags.v & flag_entities; } - uint32 innerLength() const { return vflags.innerLength() + vpeer.innerLength() + (has_reply_to_msg_id() ? vreply_to_msg_id.innerLength() : 0) + vmessage.innerLength() + vrandom_id.innerLength() + (has_reply_markup() ? vreply_markup.innerLength() : 0) + (has_entities() ? ventities.innerLength() : 0); } @@ -16588,6 +16617,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_sendMessage::Flags) + class MTPmessages_SendMessage : public MTPBoxed { public: MTPmessages_SendMessage() { @@ -16596,13 +16627,31 @@ public: } MTPmessages_SendMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SendMessage(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : MTPBoxed(MTPmessages_sendMessage(_flags, _peer, _reply_to_msg_id, _message, _random_id, _reply_markup, _entities)) { + MTPmessages_SendMessage(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPstring &_message, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities) : MTPBoxed(MTPmessages_sendMessage(_flags, _peer, _reply_to_msg_id, _message, _random_id, _reply_markup, _entities)) { } }; class MTPmessages_sendMedia { // RPC method 'messages.sendMedia' public: - MTPint vflags; + enum class Flag : int32 { + f_broadcast = (1 << 4), + f_silent = (1 << 5), + f_background = (1 << 6), + f_reply_to_msg_id = (1 << 0), + f_reply_markup = (1 << 2), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_background() const { return vflags.v & Flag::f_background; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + bool has_reply_markup() const { return vflags.v & Flag::f_reply_markup; } + + MTPflags vflags; MTPInputPeer vpeer; MTPint vreply_to_msg_id; MTPInputMedia vmedia; @@ -16614,23 +16663,9 @@ public: MTPmessages_sendMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_sendMedia) { read(from, end, cons); } - MTPmessages_sendMedia(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPInputMedia &_media, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vmedia(_media), vrandom_id(_random_id), vreply_markup(_reply_markup) { + MTPmessages_sendMedia(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPInputMedia &_media, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vmedia(_media), vrandom_id(_random_id), vreply_markup(_reply_markup) { } - enum { - flag_broadcast = (1 << 4), - flag_silent = (1 << 5), - flag_background = (1 << 6), - flag_reply_to_msg_id = (1 << 0), - flag_reply_markup = (1 << 2), - }; - - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_background() const { return vflags.v & flag_background; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - bool has_reply_markup() const { return vflags.v & flag_reply_markup; } - uint32 innerLength() const { return vflags.innerLength() + vpeer.innerLength() + (has_reply_to_msg_id() ? vreply_to_msg_id.innerLength() : 0) + vmedia.innerLength() + vrandom_id.innerLength() + (has_reply_markup() ? vreply_markup.innerLength() : 0); } @@ -16656,6 +16691,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_sendMedia::Flags) + class MTPmessages_SendMedia : public MTPBoxed { public: MTPmessages_SendMedia() { @@ -16664,13 +16701,27 @@ public: } MTPmessages_SendMedia(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SendMedia(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPInputMedia &_media, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup) : MTPBoxed(MTPmessages_sendMedia(_flags, _peer, _reply_to_msg_id, _media, _random_id, _reply_markup)) { + MTPmessages_SendMedia(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPInputMedia &_media, const MTPlong &_random_id, const MTPReplyMarkup &_reply_markup) : MTPBoxed(MTPmessages_sendMedia(_flags, _peer, _reply_to_msg_id, _media, _random_id, _reply_markup)) { } }; class MTPmessages_forwardMessages { // RPC method 'messages.forwardMessages' public: - MTPint vflags; + enum class Flag : int32 { + f_broadcast = (1 << 4), + f_silent = (1 << 5), + f_background = (1 << 6), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_background() const { return vflags.v & Flag::f_background; } + + MTPflags vflags; MTPInputPeer vfrom_peer; MTPVector vid; MTPVector vrandom_id; @@ -16681,19 +16732,9 @@ public: MTPmessages_forwardMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_forwardMessages) { read(from, end, cons); } - MTPmessages_forwardMessages(MTPint _flags, const MTPInputPeer &_from_peer, const MTPVector &_id, const MTPVector &_random_id, const MTPInputPeer &_to_peer) : vflags(_flags), vfrom_peer(_from_peer), vid(_id), vrandom_id(_random_id), vto_peer(_to_peer) { + MTPmessages_forwardMessages(const MTPflags &_flags, const MTPInputPeer &_from_peer, const MTPVector &_id, const MTPVector &_random_id, const MTPInputPeer &_to_peer) : vflags(_flags), vfrom_peer(_from_peer), vid(_id), vrandom_id(_random_id), vto_peer(_to_peer) { } - enum { - flag_broadcast = (1 << 4), - flag_silent = (1 << 5), - flag_background = (1 << 6), - }; - - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_background() const { return vflags.v & flag_background; } - uint32 innerLength() const { return vflags.innerLength() + vfrom_peer.innerLength() + vid.innerLength() + vrandom_id.innerLength() + vto_peer.innerLength(); } @@ -16717,6 +16758,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_forwardMessages::Flags) + class MTPmessages_ForwardMessages : public MTPBoxed { public: MTPmessages_ForwardMessages() { @@ -16725,7 +16768,7 @@ public: } MTPmessages_ForwardMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_ForwardMessages(MTPint _flags, const MTPInputPeer &_from_peer, const MTPVector &_id, const MTPVector &_random_id, const MTPInputPeer &_to_peer) : MTPBoxed(MTPmessages_forwardMessages(_flags, _from_peer, _id, _random_id, _to_peer)) { + MTPmessages_ForwardMessages(const MTPflags &_flags, const MTPInputPeer &_from_peer, const MTPVector &_id, const MTPVector &_random_id, const MTPInputPeer &_to_peer) : MTPBoxed(MTPmessages_forwardMessages(_flags, _from_peer, _id, _random_id, _to_peer)) { } }; @@ -18582,7 +18625,21 @@ public: class MTPmessages_setInlineBotResults { // RPC method 'messages.setInlineBotResults' public: - MTPint vflags; + enum class Flag : int32 { + f_gallery = (1 << 0), + f_private = (1 << 1), + f_next_offset = (1 << 2), + + MAX_FIELD = (1 << 2), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_gallery() const { return vflags.v & Flag::f_gallery; } + bool is_private() const { return vflags.v & Flag::f_private; } + bool has_next_offset() const { return vflags.v & Flag::f_next_offset; } + + MTPflags vflags; MTPlong vquery_id; MTPVector vresults; MTPint vcache_time; @@ -18593,19 +18650,9 @@ public: MTPmessages_setInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_setInlineBotResults) { read(from, end, cons); } - MTPmessages_setInlineBotResults(MTPint _flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : vflags(_flags), vquery_id(_query_id), vresults(_results), vcache_time(_cache_time), vnext_offset(_next_offset) { + MTPmessages_setInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : vflags(_flags), vquery_id(_query_id), vresults(_results), vcache_time(_cache_time), vnext_offset(_next_offset) { } - enum { - flag_gallery = (1 << 0), - flag_private = (1 << 1), - flag_next_offset = (1 << 2), - }; - - bool is_gallery() const { return vflags.v & flag_gallery; } - bool is_private() const { return vflags.v & flag_private; } - bool has_next_offset() const { return vflags.v & flag_next_offset; } - uint32 innerLength() const { return vflags.innerLength() + vquery_id.innerLength() + vresults.innerLength() + vcache_time.innerLength() + (has_next_offset() ? vnext_offset.innerLength() : 0); } @@ -18629,6 +18676,8 @@ public: typedef MTPBool ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_setInlineBotResults::Flags) + class MTPmessages_SetInlineBotResults : public MTPBoxed { public: MTPmessages_SetInlineBotResults() { @@ -18637,13 +18686,29 @@ public: } MTPmessages_SetInlineBotResults(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SetInlineBotResults(MTPint _flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : MTPBoxed(MTPmessages_setInlineBotResults(_flags, _query_id, _results, _cache_time, _next_offset)) { + MTPmessages_SetInlineBotResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPVector &_results, MTPint _cache_time, const MTPstring &_next_offset) : MTPBoxed(MTPmessages_setInlineBotResults(_flags, _query_id, _results, _cache_time, _next_offset)) { } }; class MTPmessages_sendInlineBotResult { // RPC method 'messages.sendInlineBotResult' public: - MTPint vflags; + enum class Flag : int32 { + f_broadcast = (1 << 4), + f_silent = (1 << 5), + f_background = (1 << 6), + f_reply_to_msg_id = (1 << 0), + + MAX_FIELD = (1 << 6), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_silent() const { return vflags.v & Flag::f_silent; } + bool is_background() const { return vflags.v & Flag::f_background; } + bool has_reply_to_msg_id() const { return vflags.v & Flag::f_reply_to_msg_id; } + + MTPflags vflags; MTPInputPeer vpeer; MTPint vreply_to_msg_id; MTPlong vrandom_id; @@ -18655,21 +18720,9 @@ public: MTPmessages_sendInlineBotResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_sendInlineBotResult) { read(from, end, cons); } - MTPmessages_sendInlineBotResult(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPlong &_random_id, const MTPlong &_query_id, const MTPstring &_id) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vrandom_id(_random_id), vquery_id(_query_id), vid(_id) { + MTPmessages_sendInlineBotResult(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPlong &_random_id, const MTPlong &_query_id, const MTPstring &_id) : vflags(_flags), vpeer(_peer), vreply_to_msg_id(_reply_to_msg_id), vrandom_id(_random_id), vquery_id(_query_id), vid(_id) { } - enum { - flag_broadcast = (1 << 4), - flag_silent = (1 << 5), - flag_background = (1 << 6), - flag_reply_to_msg_id = (1 << 0), - }; - - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_silent() const { return vflags.v & flag_silent; } - bool is_background() const { return vflags.v & flag_background; } - bool has_reply_to_msg_id() const { return vflags.v & flag_reply_to_msg_id; } - uint32 innerLength() const { return vflags.innerLength() + vpeer.innerLength() + (has_reply_to_msg_id() ? vreply_to_msg_id.innerLength() : 0) + vrandom_id.innerLength() + vquery_id.innerLength() + vid.innerLength(); } @@ -18695,6 +18748,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_sendInlineBotResult::Flags) + class MTPmessages_SendInlineBotResult : public MTPBoxed { public: MTPmessages_SendInlineBotResult() { @@ -18703,7 +18758,7 @@ public: } MTPmessages_SendInlineBotResult(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPmessages_SendInlineBotResult(MTPint _flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPlong &_random_id, const MTPlong &_query_id, const MTPstring &_id) : MTPBoxed(MTPmessages_sendInlineBotResult(_flags, _peer, _reply_to_msg_id, _random_id, _query_id, _id)) { + MTPmessages_SendInlineBotResult(const MTPflags &_flags, const MTPInputPeer &_peer, MTPint _reply_to_msg_id, const MTPlong &_random_id, const MTPlong &_query_id, const MTPstring &_id) : MTPBoxed(MTPmessages_sendInlineBotResult(_flags, _peer, _reply_to_msg_id, _random_id, _query_id, _id)) { } }; @@ -19934,7 +19989,19 @@ public: class MTPchannels_createChannel { // RPC method 'channels.createChannel' public: - MTPint vflags; + enum class Flag : int32 { + f_broadcast = (1 << 0), + f_megagroup = (1 << 1), + + MAX_FIELD = (1 << 1), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_broadcast() const { return vflags.v & Flag::f_broadcast; } + bool is_megagroup() const { return vflags.v & Flag::f_megagroup; } + + MTPflags vflags; MTPstring vtitle; MTPstring vabout; @@ -19943,17 +20010,9 @@ public: MTPchannels_createChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_createChannel) { read(from, end, cons); } - MTPchannels_createChannel(MTPint _flags, const MTPstring &_title, const MTPstring &_about) : vflags(_flags), vtitle(_title), vabout(_about) { + MTPchannels_createChannel(const MTPflags &_flags, const MTPstring &_title, const MTPstring &_about) : vflags(_flags), vtitle(_title), vabout(_about) { } - enum { - flag_broadcast = (1 << 0), - flag_megagroup = (1 << 1), - }; - - bool is_broadcast() const { return vflags.v & flag_broadcast; } - bool is_megagroup() const { return vflags.v & flag_megagroup; } - uint32 innerLength() const { return vflags.innerLength() + vtitle.innerLength() + vabout.innerLength(); } @@ -19973,6 +20032,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPchannels_createChannel::Flags) + class MTPchannels_CreateChannel : public MTPBoxed { public: MTPchannels_CreateChannel() { @@ -19981,7 +20042,7 @@ public: } MTPchannels_CreateChannel(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPchannels_CreateChannel(MTPint _flags, const MTPstring &_title, const MTPstring &_about) : MTPBoxed(MTPchannels_createChannel(_flags, _title, _about)) { + MTPchannels_CreateChannel(const MTPflags &_flags, const MTPstring &_title, const MTPstring &_about) : MTPBoxed(MTPchannels_createChannel(_flags, _title, _about)) { } }; @@ -20695,7 +20756,19 @@ public: class MTPchannels_editMessage { // RPC method 'channels.editMessage' public: - MTPint vflags; + enum class Flag : int32 { + f_no_webpage = (1 << 1), + f_entities = (1 << 3), + + MAX_FIELD = (1 << 3), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_no_webpage() const { return vflags.v & Flag::f_no_webpage; } + bool has_entities() const { return vflags.v & Flag::f_entities; } + + MTPflags vflags; MTPInputChannel vchannel; MTPint vid; MTPstring vmessage; @@ -20706,17 +20779,9 @@ public: MTPchannels_editMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_editMessage) { read(from, end, cons); } - MTPchannels_editMessage(MTPint _flags, const MTPInputChannel &_channel, MTPint _id, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vchannel(_channel), vid(_id), vmessage(_message), ventities(_entities) { + MTPchannels_editMessage(const MTPflags &_flags, const MTPInputChannel &_channel, MTPint _id, const MTPstring &_message, const MTPVector &_entities) : vflags(_flags), vchannel(_channel), vid(_id), vmessage(_message), ventities(_entities) { } - enum { - flag_no_webpage = (1 << 1), - flag_entities = (1 << 3), - }; - - bool is_no_webpage() const { return vflags.v & flag_no_webpage; } - bool has_entities() const { return vflags.v & flag_entities; } - uint32 innerLength() const { return vflags.innerLength() + vchannel.innerLength() + vid.innerLength() + vmessage.innerLength() + (has_entities() ? ventities.innerLength() : 0); } @@ -20740,6 +20805,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPchannels_editMessage::Flags) + class MTPchannels_EditMessage : public MTPBoxed { public: MTPchannels_EditMessage() { @@ -20748,13 +20815,21 @@ public: } MTPchannels_EditMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPchannels_EditMessage(MTPint _flags, const MTPInputChannel &_channel, MTPint _id, const MTPstring &_message, const MTPVector &_entities) : MTPBoxed(MTPchannels_editMessage(_flags, _channel, _id, _message, _entities)) { + MTPchannels_EditMessage(const MTPflags &_flags, const MTPInputChannel &_channel, MTPint _id, const MTPstring &_message, const MTPVector &_entities) : MTPBoxed(MTPchannels_editMessage(_flags, _channel, _id, _message, _entities)) { } }; class MTPchannels_updatePinnedMessage { // RPC method 'channels.updatePinnedMessage' public: - MTPint vflags; + enum class Flag : int32 { + f_silent = (1 << 0), + }; + Q_DECLARE_FLAGS(Flags, Flag); + friend inline Flags operator~(Flag v) { return QFlag(~static_cast(v)); } + + bool is_silent() const { return vflags.v & Flag::f_silent; } + + MTPflags vflags; MTPInputChannel vchannel; MTPint vid; @@ -20763,15 +20838,9 @@ public: MTPchannels_updatePinnedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_channels_updatePinnedMessage) { read(from, end, cons); } - MTPchannels_updatePinnedMessage(MTPint _flags, const MTPInputChannel &_channel, MTPint _id) : vflags(_flags), vchannel(_channel), vid(_id) { + MTPchannels_updatePinnedMessage(const MTPflags &_flags, const MTPInputChannel &_channel, MTPint _id) : vflags(_flags), vchannel(_channel), vid(_id) { } - enum { - flag_silent = (1 << 0), - }; - - bool is_silent() const { return vflags.v & flag_silent; } - uint32 innerLength() const { return vflags.innerLength() + vchannel.innerLength() + vid.innerLength(); } @@ -20791,6 +20860,8 @@ public: typedef MTPUpdates ResponseType; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPchannels_updatePinnedMessage::Flags) + class MTPchannels_UpdatePinnedMessage : public MTPBoxed { public: MTPchannels_UpdatePinnedMessage() { @@ -20799,10 +20870,1281 @@ public: } MTPchannels_UpdatePinnedMessage(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed(from, end, cons) { } - MTPchannels_UpdatePinnedMessage(MTPint _flags, const MTPInputChannel &_channel, MTPint _id) : MTPBoxed(MTPchannels_updatePinnedMessage(_flags, _channel, _id)) { + MTPchannels_UpdatePinnedMessage(const MTPflags &_flags, const MTPInputChannel &_channel, MTPint _id) : MTPBoxed(MTPchannels_updatePinnedMessage(_flags, _channel, _id)) { } }; +// Creator proxy class definition +namespace MTP { +namespace internal { + +class TypeCreator { +public: + inline static MTPresPQ new_resPQ(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_pq, const MTPVector &_server_public_key_fingerprints) { + return MTPresPQ(new MTPDresPQ(_nonce, _server_nonce, _pq, _server_public_key_fingerprints)); + } + inline static MTPp_Q_inner_data new_p_q_inner_data(const MTPstring &_pq, const MTPstring &_p, const MTPstring &_q, const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint256 &_new_nonce) { + return MTPp_Q_inner_data(new MTPDp_q_inner_data(_pq, _p, _q, _nonce, _server_nonce, _new_nonce)); + } + inline static MTPserver_DH_Params new_server_DH_params_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash) { + return MTPserver_DH_Params(new MTPDserver_DH_params_fail(_nonce, _server_nonce, _new_nonce_hash)); + } + inline static MTPserver_DH_Params new_server_DH_params_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_encrypted_answer) { + return MTPserver_DH_Params(new MTPDserver_DH_params_ok(_nonce, _server_nonce, _encrypted_answer)); + } + inline static MTPserver_DH_inner_data new_server_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, MTPint _g, const MTPstring &_dh_prime, const MTPstring &_g_a, MTPint _server_time) { + return MTPserver_DH_inner_data(new MTPDserver_DH_inner_data(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time)); + } + inline static MTPclient_DH_Inner_Data new_client_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPlong &_retry_id, const MTPstring &_g_b) { + return MTPclient_DH_Inner_Data(new MTPDclient_DH_inner_data(_nonce, _server_nonce, _retry_id, _g_b)); + } + inline static MTPset_client_DH_params_answer new_dh_gen_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash1) { + return MTPset_client_DH_params_answer(new MTPDdh_gen_ok(_nonce, _server_nonce, _new_nonce_hash1)); + } + inline static MTPset_client_DH_params_answer new_dh_gen_retry(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash2) { + return MTPset_client_DH_params_answer(new MTPDdh_gen_retry(_nonce, _server_nonce, _new_nonce_hash2)); + } + inline static MTPset_client_DH_params_answer new_dh_gen_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash3) { + return MTPset_client_DH_params_answer(new MTPDdh_gen_fail(_nonce, _server_nonce, _new_nonce_hash3)); + } + inline static MTPmsgsAck new_msgs_ack(const MTPVector &_msg_ids) { + return MTPmsgsAck(new MTPDmsgs_ack(_msg_ids)); + } + inline static MTPbadMsgNotification new_bad_msg_notification(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code) { + return MTPbadMsgNotification(new MTPDbad_msg_notification(_bad_msg_id, _bad_msg_seqno, _error_code)); + } + inline static MTPbadMsgNotification new_bad_server_salt(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code, const MTPlong &_new_server_salt) { + return MTPbadMsgNotification(new MTPDbad_server_salt(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt)); + } + inline static MTPmsgsStateReq new_msgs_state_req(const MTPVector &_msg_ids) { + return MTPmsgsStateReq(new MTPDmsgs_state_req(_msg_ids)); + } + inline static MTPmsgsStateInfo new_msgs_state_info(const MTPlong &_req_msg_id, const MTPstring &_info) { + return MTPmsgsStateInfo(new MTPDmsgs_state_info(_req_msg_id, _info)); + } + inline static MTPmsgsAllInfo new_msgs_all_info(const MTPVector &_msg_ids, const MTPstring &_info) { + return MTPmsgsAllInfo(new MTPDmsgs_all_info(_msg_ids, _info)); + } + inline static MTPmsgDetailedInfo new_msg_detailed_info(const MTPlong &_msg_id, const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { + return MTPmsgDetailedInfo(new MTPDmsg_detailed_info(_msg_id, _answer_msg_id, _bytes, _status)); + } + inline static MTPmsgDetailedInfo new_msg_new_detailed_info(const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { + return MTPmsgDetailedInfo(new MTPDmsg_new_detailed_info(_answer_msg_id, _bytes, _status)); + } + inline static MTPmsgResendReq new_msg_resend_req(const MTPVector &_msg_ids) { + return MTPmsgResendReq(new MTPDmsg_resend_req(_msg_ids)); + } + inline static MTPrpcError new_rpc_error(MTPint _error_code, const MTPstring &_error_message) { + return MTPrpcError(new MTPDrpc_error(_error_code, _error_message)); + } + inline static MTPrpcDropAnswer new_rpc_answer_unknown() { + return MTPrpcDropAnswer(mtpc_rpc_answer_unknown); + } + inline static MTPrpcDropAnswer new_rpc_answer_dropped_running() { + return MTPrpcDropAnswer(mtpc_rpc_answer_dropped_running); + } + inline static MTPrpcDropAnswer new_rpc_answer_dropped(const MTPlong &_msg_id, MTPint _seq_no, MTPint _bytes) { + return MTPrpcDropAnswer(new MTPDrpc_answer_dropped(_msg_id, _seq_no, _bytes)); + } + inline static MTPfutureSalt new_future_salt(MTPint _valid_since, MTPint _valid_until, const MTPlong &_salt) { + return MTPfutureSalt(new MTPDfuture_salt(_valid_since, _valid_until, _salt)); + } + inline static MTPfutureSalts new_future_salts(const MTPlong &_req_msg_id, MTPint _now, const MTPvector &_salts) { + return MTPfutureSalts(new MTPDfuture_salts(_req_msg_id, _now, _salts)); + } + inline static MTPpong new_pong(const MTPlong &_msg_id, const MTPlong &_ping_id) { + return MTPpong(new MTPDpong(_msg_id, _ping_id)); + } + inline static MTPdestroySessionRes new_destroy_session_ok(const MTPlong &_session_id) { + return MTPdestroySessionRes(new MTPDdestroy_session_ok(_session_id)); + } + inline static MTPdestroySessionRes new_destroy_session_none(const MTPlong &_session_id) { + return MTPdestroySessionRes(new MTPDdestroy_session_none(_session_id)); + } + inline static MTPnewSession new_new_session_created(const MTPlong &_first_msg_id, const MTPlong &_unique_id, const MTPlong &_server_salt) { + return MTPnewSession(new MTPDnew_session_created(_first_msg_id, _unique_id, _server_salt)); + } + inline static MTPhttpWait new_http_wait(MTPint _max_delay, MTPint _wait_after, MTPint _max_wait) { + return MTPhttpWait(new MTPDhttp_wait(_max_delay, _wait_after, _max_wait)); + } + inline static MTPbool new_boolFalse() { + return MTPbool(mtpc_boolFalse); + } + inline static MTPbool new_boolTrue() { + return MTPbool(mtpc_boolTrue); + } + inline static MTPtrue new_true() { + return MTPtrue(); + } + inline static MTPerror new_error(MTPint _code, const MTPstring &_text) { + return MTPerror(new MTPDerror(_code, _text)); + } + inline static MTPnull new_null() { + return MTPnull(); + } + inline static MTPinputPeer new_inputPeerEmpty() { + return MTPinputPeer(mtpc_inputPeerEmpty); + } + inline static MTPinputPeer new_inputPeerSelf() { + return MTPinputPeer(mtpc_inputPeerSelf); + } + inline static MTPinputPeer new_inputPeerChat(MTPint _chat_id) { + return MTPinputPeer(new MTPDinputPeerChat(_chat_id)); + } + inline static MTPinputPeer new_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash) { + return MTPinputPeer(new MTPDinputPeerUser(_user_id, _access_hash)); + } + inline static MTPinputPeer new_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash) { + return MTPinputPeer(new MTPDinputPeerChannel(_channel_id, _access_hash)); + } + inline static MTPinputUser new_inputUserEmpty() { + return MTPinputUser(mtpc_inputUserEmpty); + } + inline static MTPinputUser new_inputUserSelf() { + return MTPinputUser(mtpc_inputUserSelf); + } + inline static MTPinputUser new_inputUser(MTPint _user_id, const MTPlong &_access_hash) { + return MTPinputUser(new MTPDinputUser(_user_id, _access_hash)); + } + inline static MTPinputContact new_inputPhoneContact(const MTPlong &_client_id, const MTPstring &_phone, const MTPstring &_first_name, const MTPstring &_last_name) { + return MTPinputContact(new MTPDinputPhoneContact(_client_id, _phone, _first_name, _last_name)); + } + inline static MTPinputFile new_inputFile(const MTPlong &_id, MTPint _parts, const MTPstring &_name, const MTPstring &_md5_checksum) { + return MTPinputFile(new MTPDinputFile(_id, _parts, _name, _md5_checksum)); + } + inline static MTPinputFile new_inputFileBig(const MTPlong &_id, MTPint _parts, const MTPstring &_name) { + return MTPinputFile(new MTPDinputFileBig(_id, _parts, _name)); + } + inline static MTPinputMedia new_inputMediaEmpty() { + return MTPinputMedia(mtpc_inputMediaEmpty); + } + inline static MTPinputMedia new_inputMediaUploadedPhoto(const MTPInputFile &_file, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedPhoto(_file, _caption)); + } + inline static MTPinputMedia new_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaPhoto(_id, _caption)); + } + inline static MTPinputMedia new_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point) { + return MTPinputMedia(new MTPDinputMediaGeoPoint(_geo_point)); + } + inline static MTPinputMedia new_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name) { + return MTPinputMedia(new MTPDinputMediaContact(_phone_number, _first_name, _last_name)); + } + inline static MTPinputMedia new_inputMediaUploadedDocument(const MTPInputFile &_file, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedDocument(_file, _mime_type, _attributes, _caption)); + } + inline static MTPinputMedia new_inputMediaUploadedThumbDocument(const MTPInputFile &_file, const MTPInputFile &_thumb, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaUploadedThumbDocument(_file, _thumb, _mime_type, _attributes, _caption)); + } + inline static MTPinputMedia new_inputMediaDocument(const MTPInputDocument &_id, const MTPstring &_caption) { + return MTPinputMedia(new MTPDinputMediaDocument(_id, _caption)); + } + inline static MTPinputMedia new_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { + return MTPinputMedia(new MTPDinputMediaVenue(_geo_point, _title, _address, _provider, _venue_id)); + } + inline static MTPinputMedia new_inputMediaGifExternal(const MTPstring &_url, const MTPstring &_q) { + return MTPinputMedia(new MTPDinputMediaGifExternal(_url, _q)); + } + inline static MTPinputChatPhoto new_inputChatPhotoEmpty() { + return MTPinputChatPhoto(mtpc_inputChatPhotoEmpty); + } + inline static MTPinputChatPhoto new_inputChatUploadedPhoto(const MTPInputFile &_file, const MTPInputPhotoCrop &_crop) { + return MTPinputChatPhoto(new MTPDinputChatUploadedPhoto(_file, _crop)); + } + inline static MTPinputChatPhoto new_inputChatPhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) { + return MTPinputChatPhoto(new MTPDinputChatPhoto(_id, _crop)); + } + inline static MTPinputGeoPoint new_inputGeoPointEmpty() { + return MTPinputGeoPoint(mtpc_inputGeoPointEmpty); + } + inline static MTPinputGeoPoint new_inputGeoPoint(const MTPdouble &_lat, const MTPdouble &_long) { + return MTPinputGeoPoint(new MTPDinputGeoPoint(_lat, _long)); + } + inline static MTPinputPhoto new_inputPhotoEmpty() { + return MTPinputPhoto(mtpc_inputPhotoEmpty); + } + inline static MTPinputPhoto new_inputPhoto(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputPhoto(new MTPDinputPhoto(_id, _access_hash)); + } + inline static MTPinputFileLocation new_inputFileLocation(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { + return MTPinputFileLocation(new MTPDinputFileLocation(_volume_id, _local_id, _secret)); + } + inline static MTPinputFileLocation new_inputEncryptedFileLocation(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputFileLocation(new MTPDinputEncryptedFileLocation(_id, _access_hash)); + } + inline static MTPinputFileLocation new_inputDocumentFileLocation(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputFileLocation(new MTPDinputDocumentFileLocation(_id, _access_hash)); + } + inline static MTPinputPhotoCrop new_inputPhotoCropAuto() { + return MTPinputPhotoCrop(mtpc_inputPhotoCropAuto); + } + inline static MTPinputPhotoCrop new_inputPhotoCrop(const MTPdouble &_crop_left, const MTPdouble &_crop_top, const MTPdouble &_crop_width) { + return MTPinputPhotoCrop(new MTPDinputPhotoCrop(_crop_left, _crop_top, _crop_width)); + } + inline static MTPinputAppEvent new_inputAppEvent(const MTPdouble &_time, const MTPstring &_type, const MTPlong &_peer, const MTPstring &_data) { + return MTPinputAppEvent(new MTPDinputAppEvent(_time, _type, _peer, _data)); + } + inline static MTPpeer new_peerUser(MTPint _user_id) { + return MTPpeer(new MTPDpeerUser(_user_id)); + } + inline static MTPpeer new_peerChat(MTPint _chat_id) { + return MTPpeer(new MTPDpeerChat(_chat_id)); + } + inline static MTPpeer new_peerChannel(MTPint _channel_id) { + return MTPpeer(new MTPDpeerChannel(_channel_id)); + } + inline static MTPstorage_fileType new_storage_fileUnknown() { + return MTPstorage_fileType(mtpc_storage_fileUnknown); + } + inline static MTPstorage_fileType new_storage_fileJpeg() { + return MTPstorage_fileType(mtpc_storage_fileJpeg); + } + inline static MTPstorage_fileType new_storage_fileGif() { + return MTPstorage_fileType(mtpc_storage_fileGif); + } + inline static MTPstorage_fileType new_storage_filePng() { + return MTPstorage_fileType(mtpc_storage_filePng); + } + inline static MTPstorage_fileType new_storage_filePdf() { + return MTPstorage_fileType(mtpc_storage_filePdf); + } + inline static MTPstorage_fileType new_storage_fileMp3() { + return MTPstorage_fileType(mtpc_storage_fileMp3); + } + inline static MTPstorage_fileType new_storage_fileMov() { + return MTPstorage_fileType(mtpc_storage_fileMov); + } + inline static MTPstorage_fileType new_storage_filePartial() { + return MTPstorage_fileType(mtpc_storage_filePartial); + } + inline static MTPstorage_fileType new_storage_fileMp4() { + return MTPstorage_fileType(mtpc_storage_fileMp4); + } + inline static MTPstorage_fileType new_storage_fileWebp() { + return MTPstorage_fileType(mtpc_storage_fileWebp); + } + inline static MTPfileLocation new_fileLocationUnavailable(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { + return MTPfileLocation(new MTPDfileLocationUnavailable(_volume_id, _local_id, _secret)); + } + inline static MTPfileLocation new_fileLocation(MTPint _dc_id, const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { + return MTPfileLocation(new MTPDfileLocation(_dc_id, _volume_id, _local_id, _secret)); + } + inline static MTPuser new_userEmpty(MTPint _id) { + return MTPuser(new MTPDuserEmpty(_id)); + } + inline static MTPuser new_user(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) { + return MTPuser(new MTPDuser(_flags, _id, _access_hash, _first_name, _last_name, _username, _phone, _photo, _status, _bot_info_version, _restriction_reason, _bot_inline_placeholder)); + } + inline static MTPuserProfilePhoto new_userProfilePhotoEmpty() { + return MTPuserProfilePhoto(mtpc_userProfilePhotoEmpty); + } + inline static MTPuserProfilePhoto new_userProfilePhoto(const MTPlong &_photo_id, const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { + return MTPuserProfilePhoto(new MTPDuserProfilePhoto(_photo_id, _photo_small, _photo_big)); + } + inline static MTPuserStatus new_userStatusEmpty() { + return MTPuserStatus(mtpc_userStatusEmpty); + } + inline static MTPuserStatus new_userStatusOnline(MTPint _expires) { + return MTPuserStatus(new MTPDuserStatusOnline(_expires)); + } + inline static MTPuserStatus new_userStatusOffline(MTPint _was_online) { + return MTPuserStatus(new MTPDuserStatusOffline(_was_online)); + } + inline static MTPuserStatus new_userStatusRecently() { + return MTPuserStatus(mtpc_userStatusRecently); + } + inline static MTPuserStatus new_userStatusLastWeek() { + return MTPuserStatus(mtpc_userStatusLastWeek); + } + inline static MTPuserStatus new_userStatusLastMonth() { + return MTPuserStatus(mtpc_userStatusLastMonth); + } + inline static MTPchat new_chatEmpty(MTPint _id) { + return MTPchat(new MTPDchatEmpty(_id)); + } + inline static MTPchat new_chat(const MTPflags &_flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) { + return MTPchat(new MTPDchat(_flags, _id, _title, _photo, _participants_count, _date, _version, _migrated_to)); + } + inline static MTPchat new_chatForbidden(MTPint _id, const MTPstring &_title) { + return MTPchat(new MTPDchatForbidden(_id, _title)); + } + inline static MTPchat new_channel(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) { + return MTPchat(new MTPDchannel(_flags, _id, _access_hash, _title, _username, _photo, _date, _version, _restriction_reason)); + } + inline static MTPchat new_channelForbidden(MTPint _id, const MTPlong &_access_hash, const MTPstring &_title) { + return MTPchat(new MTPDchannelForbidden(_id, _access_hash, _title)); + } + inline static MTPchatFull new_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info) { + return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info)); + } + inline static MTPchatFull new_channelFull(const MTPflags &_flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) { + return MTPchatFull(new MTPDchannelFull(_flags, _id, _about, _participants_count, _admins_count, _kicked_count, _read_inbox_max_id, _unread_count, _unread_important_count, _chat_photo, _notify_settings, _exported_invite, _bot_info, _migrated_from_chat_id, _migrated_from_max_id, _pinned_msg_id)); + } + inline static MTPchatParticipant new_chatParticipant(MTPint _user_id, MTPint _inviter_id, MTPint _date) { + return MTPchatParticipant(new MTPDchatParticipant(_user_id, _inviter_id, _date)); + } + inline static MTPchatParticipant new_chatParticipantCreator(MTPint _user_id) { + return MTPchatParticipant(new MTPDchatParticipantCreator(_user_id)); + } + inline static MTPchatParticipant new_chatParticipantAdmin(MTPint _user_id, MTPint _inviter_id, MTPint _date) { + return MTPchatParticipant(new MTPDchatParticipantAdmin(_user_id, _inviter_id, _date)); + } + inline static MTPchatParticipants new_chatParticipantsForbidden(const MTPflags &_flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) { + return MTPchatParticipants(new MTPDchatParticipantsForbidden(_flags, _chat_id, _self_participant)); + } + inline static MTPchatParticipants new_chatParticipants(MTPint _chat_id, const MTPVector &_participants, MTPint _version) { + return MTPchatParticipants(new MTPDchatParticipants(_chat_id, _participants, _version)); + } + inline static MTPchatPhoto new_chatPhotoEmpty() { + return MTPchatPhoto(mtpc_chatPhotoEmpty); + } + inline static MTPchatPhoto new_chatPhoto(const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { + return MTPchatPhoto(new MTPDchatPhoto(_photo_small, _photo_big)); + } + inline static MTPmessage new_messageEmpty(MTPint _id) { + return MTPmessage(new MTPDmessageEmpty(_id)); + } + inline static MTPmessage new_message(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) { + return MTPmessage(new MTPDmessage(_flags, _id, _from_id, _to_id, _fwd_from, _via_bot_id, _reply_to_msg_id, _date, _message, _media, _reply_markup, _entities, _views, _edit_date)); + } + inline static MTPmessage new_messageService(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) { + return MTPmessage(new MTPDmessageService(_flags, _id, _from_id, _to_id, _reply_to_msg_id, _date, _action)); + } + inline static MTPmessageMedia new_messageMediaEmpty() { + return MTPmessageMedia(mtpc_messageMediaEmpty); + } + inline static MTPmessageMedia new_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption) { + return MTPmessageMedia(new MTPDmessageMediaPhoto(_photo, _caption)); + } + inline static MTPmessageMedia new_messageMediaGeo(const MTPGeoPoint &_geo) { + return MTPmessageMedia(new MTPDmessageMediaGeo(_geo)); + } + inline static MTPmessageMedia new_messageMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, MTPint _user_id) { + return MTPmessageMedia(new MTPDmessageMediaContact(_phone_number, _first_name, _last_name, _user_id)); + } + inline static MTPmessageMedia new_messageMediaUnsupported() { + return MTPmessageMedia(mtpc_messageMediaUnsupported); + } + inline static MTPmessageMedia new_messageMediaDocument(const MTPDocument &_document, const MTPstring &_caption) { + return MTPmessageMedia(new MTPDmessageMediaDocument(_document, _caption)); + } + inline static MTPmessageMedia new_messageMediaWebPage(const MTPWebPage &_webpage) { + return MTPmessageMedia(new MTPDmessageMediaWebPage(_webpage)); + } + inline static MTPmessageMedia new_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { + return MTPmessageMedia(new MTPDmessageMediaVenue(_geo, _title, _address, _provider, _venue_id)); + } + inline static MTPmessageAction new_messageActionEmpty() { + return MTPmessageAction(mtpc_messageActionEmpty); + } + inline static MTPmessageAction new_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users) { + return MTPmessageAction(new MTPDmessageActionChatCreate(_title, _users)); + } + inline static MTPmessageAction new_messageActionChatEditTitle(const MTPstring &_title) { + return MTPmessageAction(new MTPDmessageActionChatEditTitle(_title)); + } + inline static MTPmessageAction new_messageActionChatEditPhoto(const MTPPhoto &_photo) { + return MTPmessageAction(new MTPDmessageActionChatEditPhoto(_photo)); + } + inline static MTPmessageAction new_messageActionChatDeletePhoto() { + return MTPmessageAction(mtpc_messageActionChatDeletePhoto); + } + inline static MTPmessageAction new_messageActionChatAddUser(const MTPVector &_users) { + return MTPmessageAction(new MTPDmessageActionChatAddUser(_users)); + } + inline static MTPmessageAction new_messageActionChatDeleteUser(MTPint _user_id) { + return MTPmessageAction(new MTPDmessageActionChatDeleteUser(_user_id)); + } + inline static MTPmessageAction new_messageActionChatJoinedByLink(MTPint _inviter_id) { + return MTPmessageAction(new MTPDmessageActionChatJoinedByLink(_inviter_id)); + } + inline static MTPmessageAction new_messageActionChannelCreate(const MTPstring &_title) { + return MTPmessageAction(new MTPDmessageActionChannelCreate(_title)); + } + inline static MTPmessageAction new_messageActionChatMigrateTo(MTPint _channel_id) { + return MTPmessageAction(new MTPDmessageActionChatMigrateTo(_channel_id)); + } + inline static MTPmessageAction new_messageActionChannelMigrateFrom(const MTPstring &_title, MTPint _chat_id) { + return MTPmessageAction(new MTPDmessageActionChannelMigrateFrom(_title, _chat_id)); + } + inline static MTPmessageAction new_messageActionPinMessage() { + return MTPmessageAction(mtpc_messageActionPinMessage); + } + inline static MTPdialog new_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { + return MTPdialog(new MTPDdialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings)); + } + inline static MTPdialog new_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { + return MTPdialog(new MTPDdialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts)); + } + inline static MTPphoto new_photoEmpty(const MTPlong &_id) { + return MTPphoto(new MTPDphotoEmpty(_id)); + } + inline static MTPphoto new_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPVector &_sizes) { + return MTPphoto(new MTPDphoto(_id, _access_hash, _date, _sizes)); + } + inline static MTPphotoSize new_photoSizeEmpty(const MTPstring &_type) { + return MTPphotoSize(new MTPDphotoSizeEmpty(_type)); + } + inline static MTPphotoSize new_photoSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, MTPint _size) { + return MTPphotoSize(new MTPDphotoSize(_type, _location, _w, _h, _size)); + } + inline static MTPphotoSize new_photoCachedSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, const MTPbytes &_bytes) { + return MTPphotoSize(new MTPDphotoCachedSize(_type, _location, _w, _h, _bytes)); + } + inline static MTPgeoPoint new_geoPointEmpty() { + return MTPgeoPoint(mtpc_geoPointEmpty); + } + inline static MTPgeoPoint new_geoPoint(const MTPdouble &_long, const MTPdouble &_lat) { + return MTPgeoPoint(new MTPDgeoPoint(_long, _lat)); + } + inline static MTPauth_checkedPhone new_auth_checkedPhone(MTPBool _phone_registered) { + return MTPauth_checkedPhone(new MTPDauth_checkedPhone(_phone_registered)); + } + inline static MTPauth_sentCode new_auth_sentCode(const MTPflags &_flags, const MTPauth_SentCodeType &_type, const MTPstring &_phone_code_hash, const MTPauth_CodeType &_next_type, MTPint _timeout) { + return MTPauth_sentCode(new MTPDauth_sentCode(_flags, _type, _phone_code_hash, _next_type, _timeout)); + } + inline static MTPauth_authorization new_auth_authorization(const MTPUser &_user) { + return MTPauth_authorization(new MTPDauth_authorization(_user)); + } + inline static MTPauth_exportedAuthorization new_auth_exportedAuthorization(MTPint _id, const MTPbytes &_bytes) { + return MTPauth_exportedAuthorization(new MTPDauth_exportedAuthorization(_id, _bytes)); + } + inline static MTPinputNotifyPeer new_inputNotifyPeer(const MTPInputPeer &_peer) { + return MTPinputNotifyPeer(new MTPDinputNotifyPeer(_peer)); + } + inline static MTPinputNotifyPeer new_inputNotifyUsers() { + return MTPinputNotifyPeer(mtpc_inputNotifyUsers); + } + inline static MTPinputNotifyPeer new_inputNotifyChats() { + return MTPinputNotifyPeer(mtpc_inputNotifyChats); + } + inline static MTPinputNotifyPeer new_inputNotifyAll() { + return MTPinputNotifyPeer(mtpc_inputNotifyAll); + } + inline static MTPinputPeerNotifyEvents new_inputPeerNotifyEventsEmpty() { + return MTPinputPeerNotifyEvents(mtpc_inputPeerNotifyEventsEmpty); + } + inline static MTPinputPeerNotifyEvents new_inputPeerNotifyEventsAll() { + return MTPinputPeerNotifyEvents(mtpc_inputPeerNotifyEventsAll); + } + inline static MTPinputPeerNotifySettings new_inputPeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { + return MTPinputPeerNotifySettings(new MTPDinputPeerNotifySettings(_flags, _mute_until, _sound)); + } + inline static MTPpeerNotifyEvents new_peerNotifyEventsEmpty() { + return MTPpeerNotifyEvents(mtpc_peerNotifyEventsEmpty); + } + inline static MTPpeerNotifyEvents new_peerNotifyEventsAll() { + return MTPpeerNotifyEvents(mtpc_peerNotifyEventsAll); + } + inline static MTPpeerNotifySettings new_peerNotifySettingsEmpty() { + return MTPpeerNotifySettings(mtpc_peerNotifySettingsEmpty); + } + inline static MTPpeerNotifySettings new_peerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { + return MTPpeerNotifySettings(new MTPDpeerNotifySettings(_flags, _mute_until, _sound)); + } + inline static MTPpeerSettings new_peerSettings(const MTPflags &_flags) { + return MTPpeerSettings(new MTPDpeerSettings(_flags)); + } + inline static MTPwallPaper new_wallPaper(MTPint _id, const MTPstring &_title, const MTPVector &_sizes, MTPint _color) { + return MTPwallPaper(new MTPDwallPaper(_id, _title, _sizes, _color)); + } + inline static MTPwallPaper new_wallPaperSolid(MTPint _id, const MTPstring &_title, MTPint _bg_color, MTPint _color) { + return MTPwallPaper(new MTPDwallPaperSolid(_id, _title, _bg_color, _color)); + } + inline static MTPreportReason new_inputReportReasonSpam() { + return MTPreportReason(mtpc_inputReportReasonSpam); + } + inline static MTPreportReason new_inputReportReasonViolence() { + return MTPreportReason(mtpc_inputReportReasonViolence); + } + inline static MTPreportReason new_inputReportReasonPornography() { + return MTPreportReason(mtpc_inputReportReasonPornography); + } + inline static MTPreportReason new_inputReportReasonOther(const MTPstring &_text) { + return MTPreportReason(new MTPDinputReportReasonOther(_text)); + } + inline static MTPuserFull new_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) { + return MTPuserFull(new MTPDuserFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info)); + } + inline static MTPcontact new_contact(MTPint _user_id, MTPBool _mutual) { + return MTPcontact(new MTPDcontact(_user_id, _mutual)); + } + inline static MTPimportedContact new_importedContact(MTPint _user_id, const MTPlong &_client_id) { + return MTPimportedContact(new MTPDimportedContact(_user_id, _client_id)); + } + inline static MTPcontactBlocked new_contactBlocked(MTPint _user_id, MTPint _date) { + return MTPcontactBlocked(new MTPDcontactBlocked(_user_id, _date)); + } + inline static MTPcontactStatus new_contactStatus(MTPint _user_id, const MTPUserStatus &_status) { + return MTPcontactStatus(new MTPDcontactStatus(_user_id, _status)); + } + inline static MTPcontacts_link new_contacts_link(const MTPContactLink &_my_link, const MTPContactLink &_foreign_link, const MTPUser &_user) { + return MTPcontacts_link(new MTPDcontacts_link(_my_link, _foreign_link, _user)); + } + inline static MTPcontacts_contacts new_contacts_contactsNotModified() { + return MTPcontacts_contacts(mtpc_contacts_contactsNotModified); + } + inline static MTPcontacts_contacts new_contacts_contacts(const MTPVector &_contacts, const MTPVector &_users) { + return MTPcontacts_contacts(new MTPDcontacts_contacts(_contacts, _users)); + } + inline static MTPcontacts_importedContacts new_contacts_importedContacts(const MTPVector &_imported, const MTPVector &_retry_contacts, const MTPVector &_users) { + return MTPcontacts_importedContacts(new MTPDcontacts_importedContacts(_imported, _retry_contacts, _users)); + } + inline static MTPcontacts_blocked new_contacts_blocked(const MTPVector &_blocked, const MTPVector &_users) { + return MTPcontacts_blocked(new MTPDcontacts_blocked(_blocked, _users)); + } + inline static MTPcontacts_blocked new_contacts_blockedSlice(MTPint _count, const MTPVector &_blocked, const MTPVector &_users) { + return MTPcontacts_blocked(new MTPDcontacts_blockedSlice(_count, _blocked, _users)); + } + inline static MTPmessages_dialogs new_messages_dialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_dialogs(new MTPDmessages_dialogs(_dialogs, _messages, _chats, _users)); + } + inline static MTPmessages_dialogs new_messages_dialogsSlice(MTPint _count, const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_dialogs(new MTPDmessages_dialogsSlice(_count, _dialogs, _messages, _chats, _users)); + } + inline static MTPmessages_messages new_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_messages(new MTPDmessages_messages(_messages, _chats, _users)); + } + inline static MTPmessages_messages new_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_messages(new MTPDmessages_messagesSlice(_count, _messages, _chats, _users)); + } + inline static MTPmessages_messages new_messages_channelMessages(const MTPflags &_flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_messages(new MTPDmessages_channelMessages(_flags, _pts, _count, _messages, _collapsed, _chats, _users)); + } + inline static MTPmessages_chats new_messages_chats(const MTPVector &_chats) { + return MTPmessages_chats(new MTPDmessages_chats(_chats)); + } + inline static MTPmessages_chatFull new_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users) { + return MTPmessages_chatFull(new MTPDmessages_chatFull(_full_chat, _chats, _users)); + } + inline static MTPmessages_affectedHistory new_messages_affectedHistory(MTPint _pts, MTPint _pts_count, MTPint _offset) { + return MTPmessages_affectedHistory(new MTPDmessages_affectedHistory(_pts, _pts_count, _offset)); + } + inline static MTPmessagesFilter new_inputMessagesFilterEmpty() { + return MTPmessagesFilter(mtpc_inputMessagesFilterEmpty); + } + inline static MTPmessagesFilter new_inputMessagesFilterPhotos() { + return MTPmessagesFilter(mtpc_inputMessagesFilterPhotos); + } + inline static MTPmessagesFilter new_inputMessagesFilterVideo() { + return MTPmessagesFilter(mtpc_inputMessagesFilterVideo); + } + inline static MTPmessagesFilter new_inputMessagesFilterPhotoVideo() { + return MTPmessagesFilter(mtpc_inputMessagesFilterPhotoVideo); + } + inline static MTPmessagesFilter new_inputMessagesFilterPhotoVideoDocuments() { + return MTPmessagesFilter(mtpc_inputMessagesFilterPhotoVideoDocuments); + } + inline static MTPmessagesFilter new_inputMessagesFilterDocument() { + return MTPmessagesFilter(mtpc_inputMessagesFilterDocument); + } + inline static MTPmessagesFilter new_inputMessagesFilterUrl() { + return MTPmessagesFilter(mtpc_inputMessagesFilterUrl); + } + inline static MTPmessagesFilter new_inputMessagesFilterGif() { + return MTPmessagesFilter(mtpc_inputMessagesFilterGif); + } + inline static MTPmessagesFilter new_inputMessagesFilterVoice() { + return MTPmessagesFilter(mtpc_inputMessagesFilterVoice); + } + inline static MTPmessagesFilter new_inputMessagesFilterMusic() { + return MTPmessagesFilter(mtpc_inputMessagesFilterMusic); + } + inline static MTPupdate new_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); + } + inline static MTPupdate new_updateMessageID(MTPint _id, const MTPlong &_random_id) { + return MTPupdate(new MTPDupdateMessageID(_id, _random_id)); + } + inline static MTPupdate new_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateDeleteMessages(_messages, _pts, _pts_count)); + } + inline static MTPupdate new_updateUserTyping(MTPint _user_id, const MTPSendMessageAction &_action) { + return MTPupdate(new MTPDupdateUserTyping(_user_id, _action)); + } + inline static MTPupdate new_updateChatUserTyping(MTPint _chat_id, MTPint _user_id, const MTPSendMessageAction &_action) { + return MTPupdate(new MTPDupdateChatUserTyping(_chat_id, _user_id, _action)); + } + inline static MTPupdate new_updateChatParticipants(const MTPChatParticipants &_participants) { + return MTPupdate(new MTPDupdateChatParticipants(_participants)); + } + inline static MTPupdate new_updateUserStatus(MTPint _user_id, const MTPUserStatus &_status) { + return MTPupdate(new MTPDupdateUserStatus(_user_id, _status)); + } + inline static MTPupdate new_updateUserName(MTPint _user_id, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username) { + return MTPupdate(new MTPDupdateUserName(_user_id, _first_name, _last_name, _username)); + } + inline static MTPupdate new_updateUserPhoto(MTPint _user_id, MTPint _date, const MTPUserProfilePhoto &_photo, MTPBool _previous) { + return MTPupdate(new MTPDupdateUserPhoto(_user_id, _date, _photo, _previous)); + } + inline static MTPupdate new_updateContactRegistered(MTPint _user_id, MTPint _date) { + return MTPupdate(new MTPDupdateContactRegistered(_user_id, _date)); + } + inline static MTPupdate new_updateContactLink(MTPint _user_id, const MTPContactLink &_my_link, const MTPContactLink &_foreign_link) { + return MTPupdate(new MTPDupdateContactLink(_user_id, _my_link, _foreign_link)); + } + inline static MTPupdate new_updateNewAuthorization(const MTPlong &_auth_key_id, MTPint _date, const MTPstring &_device, const MTPstring &_location) { + return MTPupdate(new MTPDupdateNewAuthorization(_auth_key_id, _date, _device, _location)); + } + inline static MTPupdate new_updateNewEncryptedMessage(const MTPEncryptedMessage &_message, MTPint _qts) { + return MTPupdate(new MTPDupdateNewEncryptedMessage(_message, _qts)); + } + inline static MTPupdate new_updateEncryptedChatTyping(MTPint _chat_id) { + return MTPupdate(new MTPDupdateEncryptedChatTyping(_chat_id)); + } + inline static MTPupdate new_updateEncryption(const MTPEncryptedChat &_chat, MTPint _date) { + return MTPupdate(new MTPDupdateEncryption(_chat, _date)); + } + inline static MTPupdate new_updateEncryptedMessagesRead(MTPint _chat_id, MTPint _max_date, MTPint _date) { + return MTPupdate(new MTPDupdateEncryptedMessagesRead(_chat_id, _max_date, _date)); + } + inline static MTPupdate new_updateChatParticipantAdd(MTPint _chat_id, MTPint _user_id, MTPint _inviter_id, MTPint _date, MTPint _version) { + return MTPupdate(new MTPDupdateChatParticipantAdd(_chat_id, _user_id, _inviter_id, _date, _version)); + } + inline static MTPupdate new_updateChatParticipantDelete(MTPint _chat_id, MTPint _user_id, MTPint _version) { + return MTPupdate(new MTPDupdateChatParticipantDelete(_chat_id, _user_id, _version)); + } + inline static MTPupdate new_updateDcOptions(const MTPVector &_dc_options) { + return MTPupdate(new MTPDupdateDcOptions(_dc_options)); + } + inline static MTPupdate new_updateUserBlocked(MTPint _user_id, MTPBool _blocked) { + return MTPupdate(new MTPDupdateUserBlocked(_user_id, _blocked)); + } + inline static MTPupdate new_updateNotifySettings(const MTPNotifyPeer &_peer, const MTPPeerNotifySettings &_notify_settings) { + return MTPupdate(new MTPDupdateNotifySettings(_peer, _notify_settings)); + } + inline static MTPupdate new_updateServiceNotification(const MTPstring &_type, const MTPstring &_message, const MTPMessageMedia &_media, MTPBool _popup) { + return MTPupdate(new MTPDupdateServiceNotification(_type, _message, _media, _popup)); + } + inline static MTPupdate new_updatePrivacy(const MTPPrivacyKey &_key, const MTPVector &_rules) { + return MTPupdate(new MTPDupdatePrivacy(_key, _rules)); + } + inline static MTPupdate new_updateUserPhone(MTPint _user_id, const MTPstring &_phone) { + return MTPupdate(new MTPDupdateUserPhone(_user_id, _phone)); + } + inline static MTPupdate new_updateReadHistoryInbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateReadHistoryInbox(_peer, _max_id, _pts, _pts_count)); + } + inline static MTPupdate new_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateReadHistoryOutbox(_peer, _max_id, _pts, _pts_count)); + } + inline static MTPupdate new_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateWebPage(_webpage, _pts, _pts_count)); + } + inline static MTPupdate new_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateReadMessagesContents(_messages, _pts, _pts_count)); + } + inline static MTPupdate new_updateChannelTooLong(const MTPflags &_flags, MTPint _channel_id, MTPint _pts) { + return MTPupdate(new MTPDupdateChannelTooLong(_flags, _channel_id, _pts)); + } + inline static MTPupdate new_updateChannel(MTPint _channel_id) { + return MTPupdate(new MTPDupdateChannel(_channel_id)); + } + inline static MTPupdate new_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group) { + return MTPupdate(new MTPDupdateChannelGroup(_channel_id, _group)); + } + inline static MTPupdate new_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateNewChannelMessage(_message, _pts, _pts_count)); + } + inline static MTPupdate new_updateReadChannelInbox(MTPint _channel_id, MTPint _max_id) { + return MTPupdate(new MTPDupdateReadChannelInbox(_channel_id, _max_id)); + } + inline static MTPupdate new_updateDeleteChannelMessages(MTPint _channel_id, const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateDeleteChannelMessages(_channel_id, _messages, _pts, _pts_count)); + } + inline static MTPupdate new_updateChannelMessageViews(MTPint _channel_id, MTPint _id, MTPint _views) { + return MTPupdate(new MTPDupdateChannelMessageViews(_channel_id, _id, _views)); + } + inline static MTPupdate new_updateChatAdmins(MTPint _chat_id, MTPBool _enabled, MTPint _version) { + return MTPupdate(new MTPDupdateChatAdmins(_chat_id, _enabled, _version)); + } + inline static MTPupdate new_updateChatParticipantAdmin(MTPint _chat_id, MTPint _user_id, MTPBool _is_admin, MTPint _version) { + return MTPupdate(new MTPDupdateChatParticipantAdmin(_chat_id, _user_id, _is_admin, _version)); + } + inline static MTPupdate new_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset) { + return MTPupdate(new MTPDupdateNewStickerSet(_stickerset)); + } + inline static MTPupdate new_updateStickerSetsOrder(const MTPVector &_order) { + return MTPupdate(new MTPDupdateStickerSetsOrder(_order)); + } + inline static MTPupdate new_updateStickerSets() { + return MTPupdate(mtpc_updateStickerSets); + } + inline static MTPupdate new_updateSavedGifs() { + return MTPupdate(mtpc_updateSavedGifs); + } + inline static MTPupdate new_updateBotInlineQuery(const MTPlong &_query_id, MTPint _user_id, const MTPstring &_query, const MTPstring &_offset) { + return MTPupdate(new MTPDupdateBotInlineQuery(_query_id, _user_id, _query, _offset)); + } + inline static MTPupdate new_updateBotInlineSend(MTPint _user_id, const MTPstring &_query, const MTPstring &_id) { + return MTPupdate(new MTPDupdateBotInlineSend(_user_id, _query, _id)); + } + inline static MTPupdate new_updateEditChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { + return MTPupdate(new MTPDupdateEditChannelMessage(_message, _pts, _pts_count)); + } + inline static MTPupdate new_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { + return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id)); + } + inline static MTPupdates_state new_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { + return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count)); + } + inline static MTPupdates_difference new_updates_differenceEmpty(MTPint _date, MTPint _seq) { + return MTPupdates_difference(new MTPDupdates_differenceEmpty(_date, _seq)); + } + inline static MTPupdates_difference new_updates_difference(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state) { + return MTPupdates_difference(new MTPDupdates_difference(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _state)); + } + inline static MTPupdates_difference new_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state) { + return MTPupdates_difference(new MTPDupdates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state)); + } + inline static MTPupdates new_updatesTooLong() { + return MTPupdates(mtpc_updatesTooLong); + } + inline static MTPupdates new_updateShortMessage(const MTPflags &_flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { + return MTPupdates(new MTPDupdateShortMessage(_flags, _id, _user_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); + } + inline static MTPupdates new_updateShortChatMessage(const MTPflags &_flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { + return MTPupdates(new MTPDupdateShortChatMessage(_flags, _id, _from_id, _chat_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); + } + inline static MTPupdates new_updateShort(const MTPUpdate &_update, MTPint _date) { + return MTPupdates(new MTPDupdateShort(_update, _date)); + } + inline static MTPupdates new_updatesCombined(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq_start, MTPint _seq) { + return MTPupdates(new MTPDupdatesCombined(_updates, _users, _chats, _date, _seq_start, _seq)); + } + inline static MTPupdates new_updates(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq) { + return MTPupdates(new MTPDupdates(_updates, _users, _chats, _date, _seq)); + } + inline static MTPupdates new_updateShortSentMessage(const MTPflags &_flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) { + return MTPupdates(new MTPDupdateShortSentMessage(_flags, _id, _pts, _pts_count, _date, _media, _entities)); + } + inline static MTPphotos_photos new_photos_photos(const MTPVector &_photos, const MTPVector &_users) { + return MTPphotos_photos(new MTPDphotos_photos(_photos, _users)); + } + inline static MTPphotos_photos new_photos_photosSlice(MTPint _count, const MTPVector &_photos, const MTPVector &_users) { + return MTPphotos_photos(new MTPDphotos_photosSlice(_count, _photos, _users)); + } + inline static MTPphotos_photo new_photos_photo(const MTPPhoto &_photo, const MTPVector &_users) { + return MTPphotos_photo(new MTPDphotos_photo(_photo, _users)); + } + inline static MTPupload_file new_upload_file(const MTPstorage_FileType &_type, MTPint _mtime, const MTPbytes &_bytes) { + return MTPupload_file(new MTPDupload_file(_type, _mtime, _bytes)); + } + inline static MTPdcOption new_dcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { + return MTPdcOption(new MTPDdcOption(_flags, _id, _ip_address, _port)); + } + inline static MTPconfig new_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, const MTPVector &_disabled_features) { + return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _disabled_features)); + } + inline static MTPnearestDc new_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc) { + return MTPnearestDc(new MTPDnearestDc(_country, _this_dc, _nearest_dc)); + } + inline static MTPhelp_appUpdate new_help_appUpdate(MTPint _id, MTPBool _critical, const MTPstring &_url, const MTPstring &_text) { + return MTPhelp_appUpdate(new MTPDhelp_appUpdate(_id, _critical, _url, _text)); + } + inline static MTPhelp_appUpdate new_help_noAppUpdate() { + return MTPhelp_appUpdate(mtpc_help_noAppUpdate); + } + inline static MTPhelp_inviteText new_help_inviteText(const MTPstring &_message) { + return MTPhelp_inviteText(new MTPDhelp_inviteText(_message)); + } + inline static MTPencryptedChat new_encryptedChatEmpty(MTPint _id) { + return MTPencryptedChat(new MTPDencryptedChatEmpty(_id)); + } + inline static MTPencryptedChat new_encryptedChatWaiting(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id) { + return MTPencryptedChat(new MTPDencryptedChatWaiting(_id, _access_hash, _date, _admin_id, _participant_id)); + } + inline static MTPencryptedChat new_encryptedChatRequested(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a) { + return MTPencryptedChat(new MTPDencryptedChatRequested(_id, _access_hash, _date, _admin_id, _participant_id, _g_a)); + } + inline static MTPencryptedChat new_encryptedChat(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a_or_b, const MTPlong &_key_fingerprint) { + return MTPencryptedChat(new MTPDencryptedChat(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint)); + } + inline static MTPencryptedChat new_encryptedChatDiscarded(MTPint _id) { + return MTPencryptedChat(new MTPDencryptedChatDiscarded(_id)); + } + inline static MTPinputEncryptedChat new_inputEncryptedChat(MTPint _chat_id, const MTPlong &_access_hash) { + return MTPinputEncryptedChat(new MTPDinputEncryptedChat(_chat_id, _access_hash)); + } + inline static MTPencryptedFile new_encryptedFileEmpty() { + return MTPencryptedFile(mtpc_encryptedFileEmpty); + } + inline static MTPencryptedFile new_encryptedFile(const MTPlong &_id, const MTPlong &_access_hash, MTPint _size, MTPint _dc_id, MTPint _key_fingerprint) { + return MTPencryptedFile(new MTPDencryptedFile(_id, _access_hash, _size, _dc_id, _key_fingerprint)); + } + inline static MTPinputEncryptedFile new_inputEncryptedFileEmpty() { + return MTPinputEncryptedFile(mtpc_inputEncryptedFileEmpty); + } + inline static MTPinputEncryptedFile new_inputEncryptedFileUploaded(const MTPlong &_id, MTPint _parts, const MTPstring &_md5_checksum, MTPint _key_fingerprint) { + return MTPinputEncryptedFile(new MTPDinputEncryptedFileUploaded(_id, _parts, _md5_checksum, _key_fingerprint)); + } + inline static MTPinputEncryptedFile new_inputEncryptedFile(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputEncryptedFile(new MTPDinputEncryptedFile(_id, _access_hash)); + } + inline static MTPinputEncryptedFile new_inputEncryptedFileBigUploaded(const MTPlong &_id, MTPint _parts, MTPint _key_fingerprint) { + return MTPinputEncryptedFile(new MTPDinputEncryptedFileBigUploaded(_id, _parts, _key_fingerprint)); + } + inline static MTPencryptedMessage new_encryptedMessage(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes, const MTPEncryptedFile &_file) { + return MTPencryptedMessage(new MTPDencryptedMessage(_random_id, _chat_id, _date, _bytes, _file)); + } + inline static MTPencryptedMessage new_encryptedMessageService(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes) { + return MTPencryptedMessage(new MTPDencryptedMessageService(_random_id, _chat_id, _date, _bytes)); + } + inline static MTPmessages_dhConfig new_messages_dhConfigNotModified(const MTPbytes &_random) { + return MTPmessages_dhConfig(new MTPDmessages_dhConfigNotModified(_random)); + } + inline static MTPmessages_dhConfig new_messages_dhConfig(MTPint _g, const MTPbytes &_p, MTPint _version, const MTPbytes &_random) { + return MTPmessages_dhConfig(new MTPDmessages_dhConfig(_g, _p, _version, _random)); + } + inline static MTPmessages_sentEncryptedMessage new_messages_sentEncryptedMessage(MTPint _date) { + return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedMessage(_date)); + } + inline static MTPmessages_sentEncryptedMessage new_messages_sentEncryptedFile(MTPint _date, const MTPEncryptedFile &_file) { + return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedFile(_date, _file)); + } + inline static MTPinputDocument new_inputDocumentEmpty() { + return MTPinputDocument(mtpc_inputDocumentEmpty); + } + inline static MTPinputDocument new_inputDocument(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputDocument(new MTPDinputDocument(_id, _access_hash)); + } + inline static MTPdocument new_documentEmpty(const MTPlong &_id) { + return MTPdocument(new MTPDdocumentEmpty(_id)); + } + inline static MTPdocument new_document(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, const MTPVector &_attributes) { + return MTPdocument(new MTPDdocument(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _attributes)); + } + inline static MTPhelp_support new_help_support(const MTPstring &_phone_number, const MTPUser &_user) { + return MTPhelp_support(new MTPDhelp_support(_phone_number, _user)); + } + inline static MTPnotifyPeer new_notifyPeer(const MTPPeer &_peer) { + return MTPnotifyPeer(new MTPDnotifyPeer(_peer)); + } + inline static MTPnotifyPeer new_notifyUsers() { + return MTPnotifyPeer(mtpc_notifyUsers); + } + inline static MTPnotifyPeer new_notifyChats() { + return MTPnotifyPeer(mtpc_notifyChats); + } + inline static MTPnotifyPeer new_notifyAll() { + return MTPnotifyPeer(mtpc_notifyAll); + } + inline static MTPsendMessageAction new_sendMessageTypingAction() { + return MTPsendMessageAction(mtpc_sendMessageTypingAction); + } + inline static MTPsendMessageAction new_sendMessageCancelAction() { + return MTPsendMessageAction(mtpc_sendMessageCancelAction); + } + inline static MTPsendMessageAction new_sendMessageRecordVideoAction() { + return MTPsendMessageAction(mtpc_sendMessageRecordVideoAction); + } + inline static MTPsendMessageAction new_sendMessageUploadVideoAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadVideoAction(_progress)); + } + inline static MTPsendMessageAction new_sendMessageRecordAudioAction() { + return MTPsendMessageAction(mtpc_sendMessageRecordAudioAction); + } + inline static MTPsendMessageAction new_sendMessageUploadAudioAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadAudioAction(_progress)); + } + inline static MTPsendMessageAction new_sendMessageUploadPhotoAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadPhotoAction(_progress)); + } + inline static MTPsendMessageAction new_sendMessageUploadDocumentAction(MTPint _progress) { + return MTPsendMessageAction(new MTPDsendMessageUploadDocumentAction(_progress)); + } + inline static MTPsendMessageAction new_sendMessageGeoLocationAction() { + return MTPsendMessageAction(mtpc_sendMessageGeoLocationAction); + } + inline static MTPsendMessageAction new_sendMessageChooseContactAction() { + return MTPsendMessageAction(mtpc_sendMessageChooseContactAction); + } + inline static MTPcontacts_found new_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { + return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); + } + inline static MTPinputPrivacyKey new_inputPrivacyKeyStatusTimestamp() { + return MTPinputPrivacyKey(mtpc_inputPrivacyKeyStatusTimestamp); + } + inline static MTPinputPrivacyKey new_inputPrivacyKeyChatInvite() { + return MTPinputPrivacyKey(mtpc_inputPrivacyKeyChatInvite); + } + inline static MTPprivacyKey new_privacyKeyStatusTimestamp() { + return MTPprivacyKey(mtpc_privacyKeyStatusTimestamp); + } + inline static MTPprivacyKey new_privacyKeyChatInvite() { + return MTPprivacyKey(mtpc_privacyKeyChatInvite); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueAllowContacts() { + return MTPinputPrivacyRule(mtpc_inputPrivacyValueAllowContacts); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueAllowAll() { + return MTPinputPrivacyRule(mtpc_inputPrivacyValueAllowAll); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueAllowUsers(const MTPVector &_users) { + return MTPinputPrivacyRule(new MTPDinputPrivacyValueAllowUsers(_users)); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueDisallowContacts() { + return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowContacts); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueDisallowAll() { + return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowAll); + } + inline static MTPinputPrivacyRule new_inputPrivacyValueDisallowUsers(const MTPVector &_users) { + return MTPinputPrivacyRule(new MTPDinputPrivacyValueDisallowUsers(_users)); + } + inline static MTPprivacyRule new_privacyValueAllowContacts() { + return MTPprivacyRule(mtpc_privacyValueAllowContacts); + } + inline static MTPprivacyRule new_privacyValueAllowAll() { + return MTPprivacyRule(mtpc_privacyValueAllowAll); + } + inline static MTPprivacyRule new_privacyValueAllowUsers(const MTPVector &_users) { + return MTPprivacyRule(new MTPDprivacyValueAllowUsers(_users)); + } + inline static MTPprivacyRule new_privacyValueDisallowContacts() { + return MTPprivacyRule(mtpc_privacyValueDisallowContacts); + } + inline static MTPprivacyRule new_privacyValueDisallowAll() { + return MTPprivacyRule(mtpc_privacyValueDisallowAll); + } + inline static MTPprivacyRule new_privacyValueDisallowUsers(const MTPVector &_users) { + return MTPprivacyRule(new MTPDprivacyValueDisallowUsers(_users)); + } + inline static MTPaccount_privacyRules new_account_privacyRules(const MTPVector &_rules, const MTPVector &_users) { + return MTPaccount_privacyRules(new MTPDaccount_privacyRules(_rules, _users)); + } + inline static MTPaccountDaysTTL new_accountDaysTTL(MTPint _days) { + return MTPaccountDaysTTL(new MTPDaccountDaysTTL(_days)); + } + inline static MTPdocumentAttribute new_documentAttributeImageSize(MTPint _w, MTPint _h) { + return MTPdocumentAttribute(new MTPDdocumentAttributeImageSize(_w, _h)); + } + inline static MTPdocumentAttribute new_documentAttributeAnimated() { + return MTPdocumentAttribute(mtpc_documentAttributeAnimated); + } + inline static MTPdocumentAttribute new_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset) { + return MTPdocumentAttribute(new MTPDdocumentAttributeSticker(_alt, _stickerset)); + } + inline static MTPdocumentAttribute new_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h) { + return MTPdocumentAttribute(new MTPDdocumentAttributeVideo(_duration, _w, _h)); + } + inline static MTPdocumentAttribute new_documentAttributeAudio(const MTPflags &_flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) { + return MTPdocumentAttribute(new MTPDdocumentAttributeAudio(_flags, _duration, _title, _performer, _waveform)); + } + inline static MTPdocumentAttribute new_documentAttributeFilename(const MTPstring &_file_name) { + return MTPdocumentAttribute(new MTPDdocumentAttributeFilename(_file_name)); + } + inline static MTPmessages_stickers new_messages_stickersNotModified() { + return MTPmessages_stickers(mtpc_messages_stickersNotModified); + } + inline static MTPmessages_stickers new_messages_stickers(const MTPstring &_hash, const MTPVector &_stickers) { + return MTPmessages_stickers(new MTPDmessages_stickers(_hash, _stickers)); + } + inline static MTPstickerPack new_stickerPack(const MTPstring &_emoticon, const MTPVector &_documents) { + return MTPstickerPack(new MTPDstickerPack(_emoticon, _documents)); + } + inline static MTPmessages_allStickers new_messages_allStickersNotModified() { + return MTPmessages_allStickers(mtpc_messages_allStickersNotModified); + } + inline static MTPmessages_allStickers new_messages_allStickers(MTPint _hash, const MTPVector &_sets) { + return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _sets)); + } + inline static MTPdisabledFeature new_disabledFeature(const MTPstring &_feature, const MTPstring &_description) { + return MTPdisabledFeature(new MTPDdisabledFeature(_feature, _description)); + } + inline static MTPmessages_affectedMessages new_messages_affectedMessages(MTPint _pts, MTPint _pts_count) { + return MTPmessages_affectedMessages(new MTPDmessages_affectedMessages(_pts, _pts_count)); + } + inline static MTPcontactLink new_contactLinkUnknown() { + return MTPcontactLink(mtpc_contactLinkUnknown); + } + inline static MTPcontactLink new_contactLinkNone() { + return MTPcontactLink(mtpc_contactLinkNone); + } + inline static MTPcontactLink new_contactLinkHasPhone() { + return MTPcontactLink(mtpc_contactLinkHasPhone); + } + inline static MTPcontactLink new_contactLinkContact() { + return MTPcontactLink(mtpc_contactLinkContact); + } + inline static MTPwebPage new_webPageEmpty(const MTPlong &_id) { + return MTPwebPage(new MTPDwebPageEmpty(_id)); + } + inline static MTPwebPage new_webPagePending(const MTPlong &_id, MTPint _date) { + return MTPwebPage(new MTPDwebPagePending(_id, _date)); + } + inline static MTPwebPage new_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) { + return MTPwebPage(new MTPDwebPage(_flags, _id, _url, _display_url, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document)); + } + inline static MTPauthorization new_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region) { + return MTPauthorization(new MTPDauthorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region)); + } + inline static MTPaccount_authorizations new_account_authorizations(const MTPVector &_authorizations) { + return MTPaccount_authorizations(new MTPDaccount_authorizations(_authorizations)); + } + inline static MTPaccount_password new_account_noPassword(const MTPbytes &_new_salt, const MTPstring &_email_unconfirmed_pattern) { + return MTPaccount_password(new MTPDaccount_noPassword(_new_salt, _email_unconfirmed_pattern)); + } + inline static MTPaccount_password new_account_password(const MTPbytes &_current_salt, const MTPbytes &_new_salt, const MTPstring &_hint, MTPBool _has_recovery, const MTPstring &_email_unconfirmed_pattern) { + return MTPaccount_password(new MTPDaccount_password(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern)); + } + inline static MTPaccount_passwordSettings new_account_passwordSettings(const MTPstring &_email) { + return MTPaccount_passwordSettings(new MTPDaccount_passwordSettings(_email)); + } + inline static MTPaccount_passwordInputSettings new_account_passwordInputSettings(const MTPflags &_flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) { + return MTPaccount_passwordInputSettings(new MTPDaccount_passwordInputSettings(_flags, _new_salt, _new_password_hash, _hint, _email)); + } + inline static MTPauth_passwordRecovery new_auth_passwordRecovery(const MTPstring &_email_pattern) { + return MTPauth_passwordRecovery(new MTPDauth_passwordRecovery(_email_pattern)); + } + inline static MTPreceivedNotifyMessage new_receivedNotifyMessage(MTPint _id, MTPint _flags) { + return MTPreceivedNotifyMessage(new MTPDreceivedNotifyMessage(_id, _flags)); + } + inline static MTPexportedChatInvite new_chatInviteEmpty() { + return MTPexportedChatInvite(mtpc_chatInviteEmpty); + } + inline static MTPexportedChatInvite new_chatInviteExported(const MTPstring &_link) { + return MTPexportedChatInvite(new MTPDchatInviteExported(_link)); + } + inline static MTPchatInvite new_chatInviteAlready(const MTPChat &_chat) { + return MTPchatInvite(new MTPDchatInviteAlready(_chat)); + } + inline static MTPchatInvite new_chatInvite(const MTPflags &_flags, const MTPstring &_title) { + return MTPchatInvite(new MTPDchatInvite(_flags, _title)); + } + inline static MTPinputStickerSet new_inputStickerSetEmpty() { + return MTPinputStickerSet(mtpc_inputStickerSetEmpty); + } + inline static MTPinputStickerSet new_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash) { + return MTPinputStickerSet(new MTPDinputStickerSetID(_id, _access_hash)); + } + inline static MTPinputStickerSet new_inputStickerSetShortName(const MTPstring &_short_name) { + return MTPinputStickerSet(new MTPDinputStickerSetShortName(_short_name)); + } + inline static MTPstickerSet new_stickerSet(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) { + return MTPstickerSet(new MTPDstickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash)); + } + inline static MTPmessages_stickerSet new_messages_stickerSet(const MTPStickerSet &_set, const MTPVector &_packs, const MTPVector &_documents) { + return MTPmessages_stickerSet(new MTPDmessages_stickerSet(_set, _packs, _documents)); + } + inline static MTPbotCommand new_botCommand(const MTPstring &_command, const MTPstring &_description) { + return MTPbotCommand(new MTPDbotCommand(_command, _description)); + } + inline static MTPbotInfo new_botInfo(MTPint _user_id, const MTPstring &_description, const MTPVector &_commands) { + return MTPbotInfo(new MTPDbotInfo(_user_id, _description, _commands)); + } + inline static MTPkeyboardButton new_keyboardButton(const MTPstring &_text) { + return MTPkeyboardButton(new MTPDkeyboardButton(_text)); + } + inline static MTPkeyboardButtonRow new_keyboardButtonRow(const MTPVector &_buttons) { + return MTPkeyboardButtonRow(new MTPDkeyboardButtonRow(_buttons)); + } + inline static MTPreplyMarkup new_replyKeyboardHide(const MTPflags &_flags) { + return MTPreplyMarkup(new MTPDreplyKeyboardHide(_flags)); + } + inline static MTPreplyMarkup new_replyKeyboardForceReply(const MTPflags &_flags) { + return MTPreplyMarkup(new MTPDreplyKeyboardForceReply(_flags)); + } + inline static MTPreplyMarkup new_replyKeyboardMarkup(const MTPflags &_flags, const MTPVector &_rows) { + return MTPreplyMarkup(new MTPDreplyKeyboardMarkup(_flags, _rows)); + } + inline static MTPhelp_appChangelog new_help_appChangelogEmpty() { + return MTPhelp_appChangelog(mtpc_help_appChangelogEmpty); + } + inline static MTPhelp_appChangelog new_help_appChangelog(const MTPstring &_text) { + return MTPhelp_appChangelog(new MTPDhelp_appChangelog(_text)); + } + inline static MTPmessageEntity new_messageEntityUnknown(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityUnknown(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityMention(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityMention(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityHashtag(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityHashtag(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityBotCommand(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityBotCommand(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityUrl(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityUrl(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityEmail(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityEmail(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityBold(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityBold(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityItalic(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityItalic(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityCode(MTPint _offset, MTPint _length) { + return MTPmessageEntity(new MTPDmessageEntityCode(_offset, _length)); + } + inline static MTPmessageEntity new_messageEntityPre(MTPint _offset, MTPint _length, const MTPstring &_language) { + return MTPmessageEntity(new MTPDmessageEntityPre(_offset, _length, _language)); + } + inline static MTPmessageEntity new_messageEntityTextUrl(MTPint _offset, MTPint _length, const MTPstring &_url) { + return MTPmessageEntity(new MTPDmessageEntityTextUrl(_offset, _length, _url)); + } + inline static MTPinputChannel new_inputChannelEmpty() { + return MTPinputChannel(mtpc_inputChannelEmpty); + } + inline static MTPinputChannel new_inputChannel(MTPint _channel_id, const MTPlong &_access_hash) { + return MTPinputChannel(new MTPDinputChannel(_channel_id, _access_hash)); + } + inline static MTPcontacts_resolvedPeer new_contacts_resolvedPeer(const MTPPeer &_peer, const MTPVector &_chats, const MTPVector &_users) { + return MTPcontacts_resolvedPeer(new MTPDcontacts_resolvedPeer(_peer, _chats, _users)); + } + inline static MTPmessageRange new_messageRange(MTPint _min_id, MTPint _max_id) { + return MTPmessageRange(new MTPDmessageRange(_min_id, _max_id)); + } + inline static MTPmessageGroup new_messageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date) { + return MTPmessageGroup(new MTPDmessageGroup(_min_id, _max_id, _count, _date)); + } + inline static MTPupdates_channelDifference new_updates_channelDifferenceEmpty(const MTPflags &_flags, MTPint _pts, MTPint _timeout) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceEmpty(_flags, _pts, _timeout)); + } + inline static MTPupdates_channelDifference new_updates_channelDifferenceTooLong(const MTPflags &_flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceTooLong(_flags, _pts, _timeout, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _messages, _chats, _users)); + } + inline static MTPupdates_channelDifference new_updates_channelDifference(const MTPflags &_flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) { + return MTPupdates_channelDifference(new MTPDupdates_channelDifference(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users)); + } + inline static MTPchannelMessagesFilter new_channelMessagesFilterEmpty() { + return MTPchannelMessagesFilter(mtpc_channelMessagesFilterEmpty); + } + inline static MTPchannelMessagesFilter new_channelMessagesFilter(const MTPflags &_flags, const MTPVector &_ranges) { + return MTPchannelMessagesFilter(new MTPDchannelMessagesFilter(_flags, _ranges)); + } + inline static MTPchannelMessagesFilter new_channelMessagesFilterCollapsed() { + return MTPchannelMessagesFilter(mtpc_channelMessagesFilterCollapsed); + } + inline static MTPchannelParticipant new_channelParticipant(MTPint _user_id, MTPint _date) { + return MTPchannelParticipant(new MTPDchannelParticipant(_user_id, _date)); + } + inline static MTPchannelParticipant new_channelParticipantSelf(MTPint _user_id, MTPint _inviter_id, MTPint _date) { + return MTPchannelParticipant(new MTPDchannelParticipantSelf(_user_id, _inviter_id, _date)); + } + inline static MTPchannelParticipant new_channelParticipantModerator(MTPint _user_id, MTPint _inviter_id, MTPint _date) { + return MTPchannelParticipant(new MTPDchannelParticipantModerator(_user_id, _inviter_id, _date)); + } + inline static MTPchannelParticipant new_channelParticipantEditor(MTPint _user_id, MTPint _inviter_id, MTPint _date) { + return MTPchannelParticipant(new MTPDchannelParticipantEditor(_user_id, _inviter_id, _date)); + } + inline static MTPchannelParticipant new_channelParticipantKicked(MTPint _user_id, MTPint _kicked_by, MTPint _date) { + return MTPchannelParticipant(new MTPDchannelParticipantKicked(_user_id, _kicked_by, _date)); + } + inline static MTPchannelParticipant new_channelParticipantCreator(MTPint _user_id) { + return MTPchannelParticipant(new MTPDchannelParticipantCreator(_user_id)); + } + inline static MTPchannelParticipantsFilter new_channelParticipantsRecent() { + return MTPchannelParticipantsFilter(mtpc_channelParticipantsRecent); + } + inline static MTPchannelParticipantsFilter new_channelParticipantsAdmins() { + return MTPchannelParticipantsFilter(mtpc_channelParticipantsAdmins); + } + inline static MTPchannelParticipantsFilter new_channelParticipantsKicked() { + return MTPchannelParticipantsFilter(mtpc_channelParticipantsKicked); + } + inline static MTPchannelParticipantsFilter new_channelParticipantsBots() { + return MTPchannelParticipantsFilter(mtpc_channelParticipantsBots); + } + inline static MTPchannelParticipantRole new_channelRoleEmpty() { + return MTPchannelParticipantRole(mtpc_channelRoleEmpty); + } + inline static MTPchannelParticipantRole new_channelRoleModerator() { + return MTPchannelParticipantRole(mtpc_channelRoleModerator); + } + inline static MTPchannelParticipantRole new_channelRoleEditor() { + return MTPchannelParticipantRole(mtpc_channelRoleEditor); + } + inline static MTPchannels_channelParticipants new_channels_channelParticipants(MTPint _count, const MTPVector &_participants, const MTPVector &_users) { + return MTPchannels_channelParticipants(new MTPDchannels_channelParticipants(_count, _participants, _users)); + } + inline static MTPchannels_channelParticipant new_channels_channelParticipant(const MTPChannelParticipant &_participant, const MTPVector &_users) { + return MTPchannels_channelParticipant(new MTPDchannels_channelParticipant(_participant, _users)); + } + inline static MTPhelp_termsOfService new_help_termsOfService(const MTPstring &_text) { + return MTPhelp_termsOfService(new MTPDhelp_termsOfService(_text)); + } + inline static MTPfoundGif new_foundGif(const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h) { + return MTPfoundGif(new MTPDfoundGif(_url, _thumb_url, _content_url, _content_type, _w, _h)); + } + inline static MTPfoundGif new_foundGifCached(const MTPstring &_url, const MTPPhoto &_photo, const MTPDocument &_document) { + return MTPfoundGif(new MTPDfoundGifCached(_url, _photo, _document)); + } + inline static MTPmessages_foundGifs new_messages_foundGifs(MTPint _next_offset, const MTPVector &_results) { + return MTPmessages_foundGifs(new MTPDmessages_foundGifs(_next_offset, _results)); + } + inline static MTPmessages_savedGifs new_messages_savedGifsNotModified() { + return MTPmessages_savedGifs(mtpc_messages_savedGifsNotModified); + } + inline static MTPmessages_savedGifs new_messages_savedGifs(MTPint _hash, const MTPVector &_gifs) { + return MTPmessages_savedGifs(new MTPDmessages_savedGifs(_hash, _gifs)); + } + inline static MTPinputBotInlineMessage new_inputBotInlineMessageMediaAuto(const MTPstring &_caption) { + return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaAuto(_caption)); + } + inline static MTPinputBotInlineMessage new_inputBotInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) { + return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageText(_flags, _message, _entities)); + } + inline static MTPinputBotInlineResult new_inputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { + return MTPinputBotInlineResult(new MTPDinputBotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); + } + inline static MTPbotInlineMessage new_botInlineMessageMediaAuto(const MTPstring &_caption) { + return MTPbotInlineMessage(new MTPDbotInlineMessageMediaAuto(_caption)); + } + inline static MTPbotInlineMessage new_botInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) { + return MTPbotInlineMessage(new MTPDbotInlineMessageText(_flags, _message, _entities)); + } + inline static MTPbotInlineResult new_botInlineMediaResultDocument(const MTPstring &_id, const MTPstring &_type, const MTPDocument &_document, const MTPBotInlineMessage &_send_message) { + return MTPbotInlineResult(new MTPDbotInlineMediaResultDocument(_id, _type, _document, _send_message)); + } + inline static MTPbotInlineResult new_botInlineMediaResultPhoto(const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPBotInlineMessage &_send_message) { + return MTPbotInlineResult(new MTPDbotInlineMediaResultPhoto(_id, _type, _photo, _send_message)); + } + inline static MTPbotInlineResult new_botInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) { + return MTPbotInlineResult(new MTPDbotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); + } + inline static MTPmessages_botResults new_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) { + return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _results)); + } + inline static MTPexportedMessageLink new_exportedMessageLink(const MTPstring &_link) { + return MTPexportedMessageLink(new MTPDexportedMessageLink(_link)); + } + inline static MTPmessageFwdHeader new_messageFwdHeader(const MTPflags &_flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) { + return MTPmessageFwdHeader(new MTPDmessageFwdHeader(_flags, _from_id, _date, _channel_id, _channel_post)); + } + inline static MTPchannels_messageEditData new_channels_messageEditData(const MTPflags &_flags) { + return MTPchannels_messageEditData(new MTPDchannels_messageEditData(_flags)); + } + inline static MTPauth_codeType new_auth_codeTypeSms() { + return MTPauth_codeType(mtpc_auth_codeTypeSms); + } + inline static MTPauth_codeType new_auth_codeTypeCall() { + return MTPauth_codeType(mtpc_auth_codeTypeCall); + } + inline static MTPauth_codeType new_auth_codeTypeFlashCall() { + return MTPauth_codeType(mtpc_auth_codeTypeFlashCall); + } + inline static MTPauth_sentCodeType new_auth_sentCodeTypeApp(MTPint _length) { + return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeApp(_length)); + } + inline static MTPauth_sentCodeType new_auth_sentCodeTypeSms(MTPint _length) { + return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeSms(_length)); + } + inline static MTPauth_sentCodeType new_auth_sentCodeTypeCall(MTPint _length) { + return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeCall(_length)); + } + inline static MTPauth_sentCodeType new_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) { + return MTPauth_sentCodeType(new MTPDauth_sentCodeTypeFlashCall(_pattern)); + } + }; + +} // namespace internal +} // namespace MTP + // Inline methods definition inline MTPresPQ::MTPresPQ() : mtpDataOwner(new MTPDresPQ()) { @@ -20835,7 +22177,7 @@ inline void MTPresPQ::write(mtpBuffer &to) const { inline MTPresPQ::MTPresPQ(MTPDresPQ *_data) : mtpDataOwner(_data) { } inline MTPresPQ MTP_resPQ(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_pq, const MTPVector &_server_public_key_fingerprints) { - return MTPresPQ(new MTPDresPQ(_nonce, _server_nonce, _pq, _server_public_key_fingerprints)); + return MTP::internal::TypeCreator::new_resPQ(_nonce, _server_nonce, _pq, _server_public_key_fingerprints); } inline MTPp_Q_inner_data::MTPp_Q_inner_data() : mtpDataOwner(new MTPDp_q_inner_data()) { @@ -20872,7 +22214,7 @@ inline void MTPp_Q_inner_data::write(mtpBuffer &to) const { inline MTPp_Q_inner_data::MTPp_Q_inner_data(MTPDp_q_inner_data *_data) : mtpDataOwner(_data) { } inline MTPp_Q_inner_data MTP_p_q_inner_data(const MTPstring &_pq, const MTPstring &_p, const MTPstring &_q, const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint256 &_new_nonce) { - return MTPp_Q_inner_data(new MTPDp_q_inner_data(_pq, _p, _q, _nonce, _server_nonce, _new_nonce)); + return MTP::internal::TypeCreator::new_p_q_inner_data(_pq, _p, _q, _nonce, _server_nonce, _new_nonce); } inline uint32 MTPserver_DH_Params::innerLength() const { @@ -20940,10 +22282,10 @@ inline MTPserver_DH_Params::MTPserver_DH_Params(MTPDserver_DH_params_fail *_data inline MTPserver_DH_Params::MTPserver_DH_Params(MTPDserver_DH_params_ok *_data) : mtpDataOwner(_data), _type(mtpc_server_DH_params_ok) { } inline MTPserver_DH_Params MTP_server_DH_params_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash) { - return MTPserver_DH_Params(new MTPDserver_DH_params_fail(_nonce, _server_nonce, _new_nonce_hash)); + return MTP::internal::TypeCreator::new_server_DH_params_fail(_nonce, _server_nonce, _new_nonce_hash); } inline MTPserver_DH_Params MTP_server_DH_params_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPstring &_encrypted_answer) { - return MTPserver_DH_Params(new MTPDserver_DH_params_ok(_nonce, _server_nonce, _encrypted_answer)); + return MTP::internal::TypeCreator::new_server_DH_params_ok(_nonce, _server_nonce, _encrypted_answer); } inline MTPserver_DH_inner_data::MTPserver_DH_inner_data() : mtpDataOwner(new MTPDserver_DH_inner_data()) { @@ -20980,7 +22322,7 @@ inline void MTPserver_DH_inner_data::write(mtpBuffer &to) const { inline MTPserver_DH_inner_data::MTPserver_DH_inner_data(MTPDserver_DH_inner_data *_data) : mtpDataOwner(_data) { } inline MTPserver_DH_inner_data MTP_server_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, MTPint _g, const MTPstring &_dh_prime, const MTPstring &_g_a, MTPint _server_time) { - return MTPserver_DH_inner_data(new MTPDserver_DH_inner_data(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time)); + return MTP::internal::TypeCreator::new_server_DH_inner_data(_nonce, _server_nonce, _g, _dh_prime, _g_a, _server_time); } inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data() : mtpDataOwner(new MTPDclient_DH_inner_data()) { @@ -21013,7 +22355,7 @@ inline void MTPclient_DH_Inner_Data::write(mtpBuffer &to) const { inline MTPclient_DH_Inner_Data::MTPclient_DH_Inner_Data(MTPDclient_DH_inner_data *_data) : mtpDataOwner(_data) { } inline MTPclient_DH_Inner_Data MTP_client_DH_inner_data(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPlong &_retry_id, const MTPstring &_g_b) { - return MTPclient_DH_Inner_Data(new MTPDclient_DH_inner_data(_nonce, _server_nonce, _retry_id, _g_b)); + return MTP::internal::TypeCreator::new_client_DH_inner_data(_nonce, _server_nonce, _retry_id, _g_b); } inline uint32 MTPset_client_DH_params_answer::innerLength() const { @@ -21101,13 +22443,13 @@ inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(MTPDdh_gen inline MTPset_client_DH_params_answer::MTPset_client_DH_params_answer(MTPDdh_gen_fail *_data) : mtpDataOwner(_data), _type(mtpc_dh_gen_fail) { } inline MTPset_client_DH_params_answer MTP_dh_gen_ok(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash1) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_ok(_nonce, _server_nonce, _new_nonce_hash1)); + return MTP::internal::TypeCreator::new_dh_gen_ok(_nonce, _server_nonce, _new_nonce_hash1); } inline MTPset_client_DH_params_answer MTP_dh_gen_retry(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash2) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_retry(_nonce, _server_nonce, _new_nonce_hash2)); + return MTP::internal::TypeCreator::new_dh_gen_retry(_nonce, _server_nonce, _new_nonce_hash2); } inline MTPset_client_DH_params_answer MTP_dh_gen_fail(const MTPint128 &_nonce, const MTPint128 &_server_nonce, const MTPint128 &_new_nonce_hash3) { - return MTPset_client_DH_params_answer(new MTPDdh_gen_fail(_nonce, _server_nonce, _new_nonce_hash3)); + return MTP::internal::TypeCreator::new_dh_gen_fail(_nonce, _server_nonce, _new_nonce_hash3); } inline MTPmsgsAck::MTPmsgsAck() : mtpDataOwner(new MTPDmsgs_ack()) { @@ -21134,7 +22476,7 @@ inline void MTPmsgsAck::write(mtpBuffer &to) const { inline MTPmsgsAck::MTPmsgsAck(MTPDmsgs_ack *_data) : mtpDataOwner(_data) { } inline MTPmsgsAck MTP_msgs_ack(const MTPVector &_msg_ids) { - return MTPmsgsAck(new MTPDmsgs_ack(_msg_ids)); + return MTP::internal::TypeCreator::new_msgs_ack(_msg_ids); } inline uint32 MTPbadMsgNotification::innerLength() const { @@ -21204,10 +22546,10 @@ inline MTPbadMsgNotification::MTPbadMsgNotification(MTPDbad_msg_notification *_d inline MTPbadMsgNotification::MTPbadMsgNotification(MTPDbad_server_salt *_data) : mtpDataOwner(_data), _type(mtpc_bad_server_salt) { } inline MTPbadMsgNotification MTP_bad_msg_notification(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code) { - return MTPbadMsgNotification(new MTPDbad_msg_notification(_bad_msg_id, _bad_msg_seqno, _error_code)); + return MTP::internal::TypeCreator::new_bad_msg_notification(_bad_msg_id, _bad_msg_seqno, _error_code); } inline MTPbadMsgNotification MTP_bad_server_salt(const MTPlong &_bad_msg_id, MTPint _bad_msg_seqno, MTPint _error_code, const MTPlong &_new_server_salt) { - return MTPbadMsgNotification(new MTPDbad_server_salt(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt)); + return MTP::internal::TypeCreator::new_bad_server_salt(_bad_msg_id, _bad_msg_seqno, _error_code, _new_server_salt); } inline MTPmsgsStateReq::MTPmsgsStateReq() : mtpDataOwner(new MTPDmsgs_state_req()) { @@ -21234,7 +22576,7 @@ inline void MTPmsgsStateReq::write(mtpBuffer &to) const { inline MTPmsgsStateReq::MTPmsgsStateReq(MTPDmsgs_state_req *_data) : mtpDataOwner(_data) { } inline MTPmsgsStateReq MTP_msgs_state_req(const MTPVector &_msg_ids) { - return MTPmsgsStateReq(new MTPDmsgs_state_req(_msg_ids)); + return MTP::internal::TypeCreator::new_msgs_state_req(_msg_ids); } inline MTPmsgsStateInfo::MTPmsgsStateInfo() : mtpDataOwner(new MTPDmsgs_state_info()) { @@ -21263,7 +22605,7 @@ inline void MTPmsgsStateInfo::write(mtpBuffer &to) const { inline MTPmsgsStateInfo::MTPmsgsStateInfo(MTPDmsgs_state_info *_data) : mtpDataOwner(_data) { } inline MTPmsgsStateInfo MTP_msgs_state_info(const MTPlong &_req_msg_id, const MTPstring &_info) { - return MTPmsgsStateInfo(new MTPDmsgs_state_info(_req_msg_id, _info)); + return MTP::internal::TypeCreator::new_msgs_state_info(_req_msg_id, _info); } inline MTPmsgsAllInfo::MTPmsgsAllInfo() : mtpDataOwner(new MTPDmsgs_all_info()) { @@ -21292,7 +22634,7 @@ inline void MTPmsgsAllInfo::write(mtpBuffer &to) const { inline MTPmsgsAllInfo::MTPmsgsAllInfo(MTPDmsgs_all_info *_data) : mtpDataOwner(_data) { } inline MTPmsgsAllInfo MTP_msgs_all_info(const MTPVector &_msg_ids, const MTPstring &_info) { - return MTPmsgsAllInfo(new MTPDmsgs_all_info(_msg_ids, _info)); + return MTP::internal::TypeCreator::new_msgs_all_info(_msg_ids, _info); } inline uint32 MTPmsgDetailedInfo::innerLength() const { @@ -21362,10 +22704,10 @@ inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(MTPDmsg_detailed_info *_data) : mt inline MTPmsgDetailedInfo::MTPmsgDetailedInfo(MTPDmsg_new_detailed_info *_data) : mtpDataOwner(_data), _type(mtpc_msg_new_detailed_info) { } inline MTPmsgDetailedInfo MTP_msg_detailed_info(const MTPlong &_msg_id, const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { - return MTPmsgDetailedInfo(new MTPDmsg_detailed_info(_msg_id, _answer_msg_id, _bytes, _status)); + return MTP::internal::TypeCreator::new_msg_detailed_info(_msg_id, _answer_msg_id, _bytes, _status); } inline MTPmsgDetailedInfo MTP_msg_new_detailed_info(const MTPlong &_answer_msg_id, MTPint _bytes, MTPint _status) { - return MTPmsgDetailedInfo(new MTPDmsg_new_detailed_info(_answer_msg_id, _bytes, _status)); + return MTP::internal::TypeCreator::new_msg_new_detailed_info(_answer_msg_id, _bytes, _status); } inline MTPmsgResendReq::MTPmsgResendReq() : mtpDataOwner(new MTPDmsg_resend_req()) { @@ -21392,7 +22734,7 @@ inline void MTPmsgResendReq::write(mtpBuffer &to) const { inline MTPmsgResendReq::MTPmsgResendReq(MTPDmsg_resend_req *_data) : mtpDataOwner(_data) { } inline MTPmsgResendReq MTP_msg_resend_req(const MTPVector &_msg_ids) { - return MTPmsgResendReq(new MTPDmsg_resend_req(_msg_ids)); + return MTP::internal::TypeCreator::new_msg_resend_req(_msg_ids); } inline MTPrpcError::MTPrpcError() : mtpDataOwner(new MTPDrpc_error()) { @@ -21421,7 +22763,7 @@ inline void MTPrpcError::write(mtpBuffer &to) const { inline MTPrpcError::MTPrpcError(MTPDrpc_error *_data) : mtpDataOwner(_data) { } inline MTPrpcError MTP_rpc_error(MTPint _error_code, const MTPstring &_error_message) { - return MTPrpcError(new MTPDrpc_error(_error_code, _error_message)); + return MTP::internal::TypeCreator::new_rpc_error(_error_code, _error_message); } inline uint32 MTPrpcDropAnswer::innerLength() const { @@ -21473,13 +22815,13 @@ inline MTPrpcDropAnswer::MTPrpcDropAnswer(mtpTypeId type) : mtpDataOwner(0), _ty inline MTPrpcDropAnswer::MTPrpcDropAnswer(MTPDrpc_answer_dropped *_data) : mtpDataOwner(_data), _type(mtpc_rpc_answer_dropped) { } inline MTPrpcDropAnswer MTP_rpc_answer_unknown() { - return MTPrpcDropAnswer(mtpc_rpc_answer_unknown); + return MTP::internal::TypeCreator::new_rpc_answer_unknown(); } inline MTPrpcDropAnswer MTP_rpc_answer_dropped_running() { - return MTPrpcDropAnswer(mtpc_rpc_answer_dropped_running); + return MTP::internal::TypeCreator::new_rpc_answer_dropped_running(); } inline MTPrpcDropAnswer MTP_rpc_answer_dropped(const MTPlong &_msg_id, MTPint _seq_no, MTPint _bytes) { - return MTPrpcDropAnswer(new MTPDrpc_answer_dropped(_msg_id, _seq_no, _bytes)); + return MTP::internal::TypeCreator::new_rpc_answer_dropped(_msg_id, _seq_no, _bytes); } inline MTPfutureSalt::MTPfutureSalt() : mtpDataOwner(new MTPDfuture_salt()) { @@ -21510,7 +22852,7 @@ inline void MTPfutureSalt::write(mtpBuffer &to) const { inline MTPfutureSalt::MTPfutureSalt(MTPDfuture_salt *_data) : mtpDataOwner(_data) { } inline MTPfutureSalt MTP_future_salt(MTPint _valid_since, MTPint _valid_until, const MTPlong &_salt) { - return MTPfutureSalt(new MTPDfuture_salt(_valid_since, _valid_until, _salt)); + return MTP::internal::TypeCreator::new_future_salt(_valid_since, _valid_until, _salt); } inline MTPfutureSalts::MTPfutureSalts() : mtpDataOwner(new MTPDfuture_salts()) { @@ -21541,7 +22883,7 @@ inline void MTPfutureSalts::write(mtpBuffer &to) const { inline MTPfutureSalts::MTPfutureSalts(MTPDfuture_salts *_data) : mtpDataOwner(_data) { } inline MTPfutureSalts MTP_future_salts(const MTPlong &_req_msg_id, MTPint _now, const MTPvector &_salts) { - return MTPfutureSalts(new MTPDfuture_salts(_req_msg_id, _now, _salts)); + return MTP::internal::TypeCreator::new_future_salts(_req_msg_id, _now, _salts); } inline MTPpong::MTPpong() : mtpDataOwner(new MTPDpong()) { @@ -21570,7 +22912,7 @@ inline void MTPpong::write(mtpBuffer &to) const { inline MTPpong::MTPpong(MTPDpong *_data) : mtpDataOwner(_data) { } inline MTPpong MTP_pong(const MTPlong &_msg_id, const MTPlong &_ping_id) { - return MTPpong(new MTPDpong(_msg_id, _ping_id)); + return MTP::internal::TypeCreator::new_pong(_msg_id, _ping_id); } inline uint32 MTPdestroySessionRes::innerLength() const { @@ -21630,10 +22972,10 @@ inline MTPdestroySessionRes::MTPdestroySessionRes(MTPDdestroy_session_ok *_data) inline MTPdestroySessionRes::MTPdestroySessionRes(MTPDdestroy_session_none *_data) : mtpDataOwner(_data), _type(mtpc_destroy_session_none) { } inline MTPdestroySessionRes MTP_destroy_session_ok(const MTPlong &_session_id) { - return MTPdestroySessionRes(new MTPDdestroy_session_ok(_session_id)); + return MTP::internal::TypeCreator::new_destroy_session_ok(_session_id); } inline MTPdestroySessionRes MTP_destroy_session_none(const MTPlong &_session_id) { - return MTPdestroySessionRes(new MTPDdestroy_session_none(_session_id)); + return MTP::internal::TypeCreator::new_destroy_session_none(_session_id); } inline MTPnewSession::MTPnewSession() : mtpDataOwner(new MTPDnew_session_created()) { @@ -21664,7 +23006,7 @@ inline void MTPnewSession::write(mtpBuffer &to) const { inline MTPnewSession::MTPnewSession(MTPDnew_session_created *_data) : mtpDataOwner(_data) { } inline MTPnewSession MTP_new_session_created(const MTPlong &_first_msg_id, const MTPlong &_unique_id, const MTPlong &_server_salt) { - return MTPnewSession(new MTPDnew_session_created(_first_msg_id, _unique_id, _server_salt)); + return MTP::internal::TypeCreator::new_new_session_created(_first_msg_id, _unique_id, _server_salt); } inline MTPhttpWait::MTPhttpWait() : mtpDataOwner(new MTPDhttp_wait()) { @@ -21695,7 +23037,7 @@ inline void MTPhttpWait::write(mtpBuffer &to) const { inline MTPhttpWait::MTPhttpWait(MTPDhttp_wait *_data) : mtpDataOwner(_data) { } inline MTPhttpWait MTP_http_wait(MTPint _max_delay, MTPint _wait_after, MTPint _max_wait) { - return MTPhttpWait(new MTPDhttp_wait(_max_delay, _wait_after, _max_wait)); + return MTP::internal::TypeCreator::new_http_wait(_max_delay, _wait_after, _max_wait); } inline uint32 MTPbool::innerLength() const { @@ -21713,8 +23055,6 @@ inline void MTPbool::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId } } inline void MTPbool::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPbool::MTPbool(mtpTypeId type) : _type(type) { switch (type) { @@ -21724,10 +23064,10 @@ inline MTPbool::MTPbool(mtpTypeId type) : _type(type) { } } inline MTPbool MTP_boolFalse() { - return MTPbool(mtpc_boolFalse); + return MTP::internal::TypeCreator::new_boolFalse(); } inline MTPbool MTP_boolTrue() { - return MTPbool(mtpc_boolTrue); + return MTP::internal::TypeCreator::new_boolTrue(); } inline uint32 MTPtrue::innerLength() const { @@ -21741,7 +23081,7 @@ inline void MTPtrue::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPtrue::write(mtpBuffer &to) const { } inline MTPtrue MTP_true() { - return MTPtrue(); + return MTP::internal::TypeCreator::new_true(); } inline MTPerror::MTPerror() : mtpDataOwner(new MTPDerror()) { @@ -21770,7 +23110,7 @@ inline void MTPerror::write(mtpBuffer &to) const { inline MTPerror::MTPerror(MTPDerror *_data) : mtpDataOwner(_data) { } inline MTPerror MTP_error(MTPint _code, const MTPstring &_text) { - return MTPerror(new MTPDerror(_code, _text)); + return MTP::internal::TypeCreator::new_error(_code, _text); } inline uint32 MTPnull::innerLength() const { @@ -21784,7 +23124,7 @@ inline void MTPnull::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId inline void MTPnull::write(mtpBuffer &to) const { } inline MTPnull MTP_null() { - return MTPnull(); + return MTP::internal::TypeCreator::new_null(); } inline uint32 MTPinputPeer::innerLength() const { @@ -21868,19 +23208,19 @@ inline MTPinputPeer::MTPinputPeer(MTPDinputPeerUser *_data) : mtpDataOwner(_data inline MTPinputPeer::MTPinputPeer(MTPDinputPeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputPeerChannel) { } inline MTPinputPeer MTP_inputPeerEmpty() { - return MTPinputPeer(mtpc_inputPeerEmpty); + return MTP::internal::TypeCreator::new_inputPeerEmpty(); } inline MTPinputPeer MTP_inputPeerSelf() { - return MTPinputPeer(mtpc_inputPeerSelf); + return MTP::internal::TypeCreator::new_inputPeerSelf(); } inline MTPinputPeer MTP_inputPeerChat(MTPint _chat_id) { - return MTPinputPeer(new MTPDinputPeerChat(_chat_id)); + return MTP::internal::TypeCreator::new_inputPeerChat(_chat_id); } inline MTPinputPeer MTP_inputPeerUser(MTPint _user_id, const MTPlong &_access_hash) { - return MTPinputPeer(new MTPDinputPeerUser(_user_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputPeerUser(_user_id, _access_hash); } inline MTPinputPeer MTP_inputPeerChannel(MTPint _channel_id, const MTPlong &_access_hash) { - return MTPinputPeer(new MTPDinputPeerChannel(_channel_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputPeerChannel(_channel_id, _access_hash); } inline uint32 MTPinputUser::innerLength() const { @@ -21930,13 +23270,13 @@ inline MTPinputUser::MTPinputUser(mtpTypeId type) : mtpDataOwner(0), _type(type) inline MTPinputUser::MTPinputUser(MTPDinputUser *_data) : mtpDataOwner(_data), _type(mtpc_inputUser) { } inline MTPinputUser MTP_inputUserEmpty() { - return MTPinputUser(mtpc_inputUserEmpty); + return MTP::internal::TypeCreator::new_inputUserEmpty(); } inline MTPinputUser MTP_inputUserSelf() { - return MTPinputUser(mtpc_inputUserSelf); + return MTP::internal::TypeCreator::new_inputUserSelf(); } inline MTPinputUser MTP_inputUser(MTPint _user_id, const MTPlong &_access_hash) { - return MTPinputUser(new MTPDinputUser(_user_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputUser(_user_id, _access_hash); } inline MTPinputContact::MTPinputContact() : mtpDataOwner(new MTPDinputPhoneContact()) { @@ -21969,7 +23309,7 @@ inline void MTPinputContact::write(mtpBuffer &to) const { inline MTPinputContact::MTPinputContact(MTPDinputPhoneContact *_data) : mtpDataOwner(_data) { } inline MTPinputContact MTP_inputPhoneContact(const MTPlong &_client_id, const MTPstring &_phone, const MTPstring &_first_name, const MTPstring &_last_name) { - return MTPinputContact(new MTPDinputPhoneContact(_client_id, _phone, _first_name, _last_name)); + return MTP::internal::TypeCreator::new_inputPhoneContact(_client_id, _phone, _first_name, _last_name); } inline uint32 MTPinputFile::innerLength() const { @@ -22039,10 +23379,10 @@ inline MTPinputFile::MTPinputFile(MTPDinputFile *_data) : mtpDataOwner(_data), _ inline MTPinputFile::MTPinputFile(MTPDinputFileBig *_data) : mtpDataOwner(_data), _type(mtpc_inputFileBig) { } inline MTPinputFile MTP_inputFile(const MTPlong &_id, MTPint _parts, const MTPstring &_name, const MTPstring &_md5_checksum) { - return MTPinputFile(new MTPDinputFile(_id, _parts, _name, _md5_checksum)); + return MTP::internal::TypeCreator::new_inputFile(_id, _parts, _name, _md5_checksum); } inline MTPinputFile MTP_inputFileBig(const MTPlong &_id, MTPint _parts, const MTPstring &_name) { - return MTPinputFile(new MTPDinputFileBig(_id, _parts, _name)); + return MTP::internal::TypeCreator::new_inputFileBig(_id, _parts, _name); } inline uint32 MTPinputMedia::innerLength() const { @@ -22250,34 +23590,34 @@ inline MTPinputMedia::MTPinputMedia(MTPDinputMediaVenue *_data) : mtpDataOwner(_ inline MTPinputMedia::MTPinputMedia(MTPDinputMediaGifExternal *_data) : mtpDataOwner(_data), _type(mtpc_inputMediaGifExternal) { } inline MTPinputMedia MTP_inputMediaEmpty() { - return MTPinputMedia(mtpc_inputMediaEmpty); + return MTP::internal::TypeCreator::new_inputMediaEmpty(); } inline MTPinputMedia MTP_inputMediaUploadedPhoto(const MTPInputFile &_file, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaUploadedPhoto(_file, _caption)); + return MTP::internal::TypeCreator::new_inputMediaUploadedPhoto(_file, _caption); } inline MTPinputMedia MTP_inputMediaPhoto(const MTPInputPhoto &_id, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaPhoto(_id, _caption)); + return MTP::internal::TypeCreator::new_inputMediaPhoto(_id, _caption); } inline MTPinputMedia MTP_inputMediaGeoPoint(const MTPInputGeoPoint &_geo_point) { - return MTPinputMedia(new MTPDinputMediaGeoPoint(_geo_point)); + return MTP::internal::TypeCreator::new_inputMediaGeoPoint(_geo_point); } inline MTPinputMedia MTP_inputMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name) { - return MTPinputMedia(new MTPDinputMediaContact(_phone_number, _first_name, _last_name)); + return MTP::internal::TypeCreator::new_inputMediaContact(_phone_number, _first_name, _last_name); } inline MTPinputMedia MTP_inputMediaUploadedDocument(const MTPInputFile &_file, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaUploadedDocument(_file, _mime_type, _attributes, _caption)); + return MTP::internal::TypeCreator::new_inputMediaUploadedDocument(_file, _mime_type, _attributes, _caption); } inline MTPinputMedia MTP_inputMediaUploadedThumbDocument(const MTPInputFile &_file, const MTPInputFile &_thumb, const MTPstring &_mime_type, const MTPVector &_attributes, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaUploadedThumbDocument(_file, _thumb, _mime_type, _attributes, _caption)); + return MTP::internal::TypeCreator::new_inputMediaUploadedThumbDocument(_file, _thumb, _mime_type, _attributes, _caption); } inline MTPinputMedia MTP_inputMediaDocument(const MTPInputDocument &_id, const MTPstring &_caption) { - return MTPinputMedia(new MTPDinputMediaDocument(_id, _caption)); + return MTP::internal::TypeCreator::new_inputMediaDocument(_id, _caption); } inline MTPinputMedia MTP_inputMediaVenue(const MTPInputGeoPoint &_geo_point, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { - return MTPinputMedia(new MTPDinputMediaVenue(_geo_point, _title, _address, _provider, _venue_id)); + return MTP::internal::TypeCreator::new_inputMediaVenue(_geo_point, _title, _address, _provider, _venue_id); } inline MTPinputMedia MTP_inputMediaGifExternal(const MTPstring &_url, const MTPstring &_q) { - return MTPinputMedia(new MTPDinputMediaGifExternal(_url, _q)); + return MTP::internal::TypeCreator::new_inputMediaGifExternal(_url, _q); } inline uint32 MTPinputChatPhoto::innerLength() const { @@ -22343,13 +23683,13 @@ inline MTPinputChatPhoto::MTPinputChatPhoto(MTPDinputChatUploadedPhoto *_data) : inline MTPinputChatPhoto::MTPinputChatPhoto(MTPDinputChatPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputChatPhoto) { } inline MTPinputChatPhoto MTP_inputChatPhotoEmpty() { - return MTPinputChatPhoto(mtpc_inputChatPhotoEmpty); + return MTP::internal::TypeCreator::new_inputChatPhotoEmpty(); } inline MTPinputChatPhoto MTP_inputChatUploadedPhoto(const MTPInputFile &_file, const MTPInputPhotoCrop &_crop) { - return MTPinputChatPhoto(new MTPDinputChatUploadedPhoto(_file, _crop)); + return MTP::internal::TypeCreator::new_inputChatUploadedPhoto(_file, _crop); } inline MTPinputChatPhoto MTP_inputChatPhoto(const MTPInputPhoto &_id, const MTPInputPhotoCrop &_crop) { - return MTPinputChatPhoto(new MTPDinputChatPhoto(_id, _crop)); + return MTP::internal::TypeCreator::new_inputChatPhoto(_id, _crop); } inline uint32 MTPinputGeoPoint::innerLength() const { @@ -22397,10 +23737,10 @@ inline MTPinputGeoPoint::MTPinputGeoPoint(mtpTypeId type) : mtpDataOwner(0), _ty inline MTPinputGeoPoint::MTPinputGeoPoint(MTPDinputGeoPoint *_data) : mtpDataOwner(_data), _type(mtpc_inputGeoPoint) { } inline MTPinputGeoPoint MTP_inputGeoPointEmpty() { - return MTPinputGeoPoint(mtpc_inputGeoPointEmpty); + return MTP::internal::TypeCreator::new_inputGeoPointEmpty(); } inline MTPinputGeoPoint MTP_inputGeoPoint(const MTPdouble &_lat, const MTPdouble &_long) { - return MTPinputGeoPoint(new MTPDinputGeoPoint(_lat, _long)); + return MTP::internal::TypeCreator::new_inputGeoPoint(_lat, _long); } inline uint32 MTPinputPhoto::innerLength() const { @@ -22448,10 +23788,10 @@ inline MTPinputPhoto::MTPinputPhoto(mtpTypeId type) : mtpDataOwner(0), _type(typ inline MTPinputPhoto::MTPinputPhoto(MTPDinputPhoto *_data) : mtpDataOwner(_data), _type(mtpc_inputPhoto) { } inline MTPinputPhoto MTP_inputPhotoEmpty() { - return MTPinputPhoto(mtpc_inputPhotoEmpty); + return MTP::internal::TypeCreator::new_inputPhotoEmpty(); } inline MTPinputPhoto MTP_inputPhoto(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputPhoto(new MTPDinputPhoto(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputPhoto(_id, _access_hash); } inline uint32 MTPinputFileLocation::innerLength() const { @@ -22535,13 +23875,13 @@ inline MTPinputFileLocation::MTPinputFileLocation(MTPDinputEncryptedFileLocation inline MTPinputFileLocation::MTPinputFileLocation(MTPDinputDocumentFileLocation *_data) : mtpDataOwner(_data), _type(mtpc_inputDocumentFileLocation) { } inline MTPinputFileLocation MTP_inputFileLocation(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPinputFileLocation(new MTPDinputFileLocation(_volume_id, _local_id, _secret)); + return MTP::internal::TypeCreator::new_inputFileLocation(_volume_id, _local_id, _secret); } inline MTPinputFileLocation MTP_inputEncryptedFileLocation(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputFileLocation(new MTPDinputEncryptedFileLocation(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputEncryptedFileLocation(_id, _access_hash); } inline MTPinputFileLocation MTP_inputDocumentFileLocation(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputFileLocation(new MTPDinputDocumentFileLocation(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputDocumentFileLocation(_id, _access_hash); } inline uint32 MTPinputPhotoCrop::innerLength() const { @@ -22591,10 +23931,10 @@ inline MTPinputPhotoCrop::MTPinputPhotoCrop(mtpTypeId type) : mtpDataOwner(0), _ inline MTPinputPhotoCrop::MTPinputPhotoCrop(MTPDinputPhotoCrop *_data) : mtpDataOwner(_data), _type(mtpc_inputPhotoCrop) { } inline MTPinputPhotoCrop MTP_inputPhotoCropAuto() { - return MTPinputPhotoCrop(mtpc_inputPhotoCropAuto); + return MTP::internal::TypeCreator::new_inputPhotoCropAuto(); } inline MTPinputPhotoCrop MTP_inputPhotoCrop(const MTPdouble &_crop_left, const MTPdouble &_crop_top, const MTPdouble &_crop_width) { - return MTPinputPhotoCrop(new MTPDinputPhotoCrop(_crop_left, _crop_top, _crop_width)); + return MTP::internal::TypeCreator::new_inputPhotoCrop(_crop_left, _crop_top, _crop_width); } inline MTPinputAppEvent::MTPinputAppEvent() : mtpDataOwner(new MTPDinputAppEvent()) { @@ -22627,7 +23967,7 @@ inline void MTPinputAppEvent::write(mtpBuffer &to) const { inline MTPinputAppEvent::MTPinputAppEvent(MTPDinputAppEvent *_data) : mtpDataOwner(_data) { } inline MTPinputAppEvent MTP_inputAppEvent(const MTPdouble &_time, const MTPstring &_type, const MTPlong &_peer, const MTPstring &_data) { - return MTPinputAppEvent(new MTPDinputAppEvent(_time, _type, _peer, _data)); + return MTP::internal::TypeCreator::new_inputAppEvent(_time, _type, _peer, _data); } inline uint32 MTPpeer::innerLength() const { @@ -22703,13 +24043,13 @@ inline MTPpeer::MTPpeer(MTPDpeerChat *_data) : mtpDataOwner(_data), _type(mtpc_p inline MTPpeer::MTPpeer(MTPDpeerChannel *_data) : mtpDataOwner(_data), _type(mtpc_peerChannel) { } inline MTPpeer MTP_peerUser(MTPint _user_id) { - return MTPpeer(new MTPDpeerUser(_user_id)); + return MTP::internal::TypeCreator::new_peerUser(_user_id); } inline MTPpeer MTP_peerChat(MTPint _chat_id) { - return MTPpeer(new MTPDpeerChat(_chat_id)); + return MTP::internal::TypeCreator::new_peerChat(_chat_id); } inline MTPpeer MTP_peerChannel(MTPint _channel_id) { - return MTPpeer(new MTPDpeerChannel(_channel_id)); + return MTP::internal::TypeCreator::new_peerChannel(_channel_id); } inline uint32 MTPstorage_fileType::innerLength() const { @@ -22735,8 +24075,6 @@ inline void MTPstorage_fileType::read(const mtpPrime *&from, const mtpPrime *end } } inline void MTPstorage_fileType::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPstorage_fileType::MTPstorage_fileType(mtpTypeId type) : _type(type) { switch (type) { @@ -22754,34 +24092,34 @@ inline MTPstorage_fileType::MTPstorage_fileType(mtpTypeId type) : _type(type) { } } inline MTPstorage_fileType MTP_storage_fileUnknown() { - return MTPstorage_fileType(mtpc_storage_fileUnknown); + return MTP::internal::TypeCreator::new_storage_fileUnknown(); } inline MTPstorage_fileType MTP_storage_fileJpeg() { - return MTPstorage_fileType(mtpc_storage_fileJpeg); + return MTP::internal::TypeCreator::new_storage_fileJpeg(); } inline MTPstorage_fileType MTP_storage_fileGif() { - return MTPstorage_fileType(mtpc_storage_fileGif); + return MTP::internal::TypeCreator::new_storage_fileGif(); } inline MTPstorage_fileType MTP_storage_filePng() { - return MTPstorage_fileType(mtpc_storage_filePng); + return MTP::internal::TypeCreator::new_storage_filePng(); } inline MTPstorage_fileType MTP_storage_filePdf() { - return MTPstorage_fileType(mtpc_storage_filePdf); + return MTP::internal::TypeCreator::new_storage_filePdf(); } inline MTPstorage_fileType MTP_storage_fileMp3() { - return MTPstorage_fileType(mtpc_storage_fileMp3); + return MTP::internal::TypeCreator::new_storage_fileMp3(); } inline MTPstorage_fileType MTP_storage_fileMov() { - return MTPstorage_fileType(mtpc_storage_fileMov); + return MTP::internal::TypeCreator::new_storage_fileMov(); } inline MTPstorage_fileType MTP_storage_filePartial() { - return MTPstorage_fileType(mtpc_storage_filePartial); + return MTP::internal::TypeCreator::new_storage_filePartial(); } inline MTPstorage_fileType MTP_storage_fileMp4() { - return MTPstorage_fileType(mtpc_storage_fileMp4); + return MTP::internal::TypeCreator::new_storage_fileMp4(); } inline MTPstorage_fileType MTP_storage_fileWebp() { - return MTPstorage_fileType(mtpc_storage_fileWebp); + return MTP::internal::TypeCreator::new_storage_fileWebp(); } inline uint32 MTPfileLocation::innerLength() const { @@ -22851,10 +24189,10 @@ inline MTPfileLocation::MTPfileLocation(MTPDfileLocationUnavailable *_data) : mt inline MTPfileLocation::MTPfileLocation(MTPDfileLocation *_data) : mtpDataOwner(_data), _type(mtpc_fileLocation) { } inline MTPfileLocation MTP_fileLocationUnavailable(const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPfileLocation(new MTPDfileLocationUnavailable(_volume_id, _local_id, _secret)); + return MTP::internal::TypeCreator::new_fileLocationUnavailable(_volume_id, _local_id, _secret); } inline MTPfileLocation MTP_fileLocation(MTPint _dc_id, const MTPlong &_volume_id, MTPint _local_id, const MTPlong &_secret) { - return MTPfileLocation(new MTPDfileLocation(_dc_id, _volume_id, _local_id, _secret)); + return MTP::internal::TypeCreator::new_fileLocation(_dc_id, _volume_id, _local_id, _secret); } inline uint32 MTPuser::innerLength() const { @@ -22936,10 +24274,11 @@ inline MTPuser::MTPuser(MTPDuserEmpty *_data) : mtpDataOwner(_data), _type(mtpc_ inline MTPuser::MTPuser(MTPDuser *_data) : mtpDataOwner(_data), _type(mtpc_user) { } inline MTPuser MTP_userEmpty(MTPint _id) { - return MTPuser(new MTPDuserEmpty(_id)); + return MTP::internal::TypeCreator::new_userEmpty(_id); } -inline MTPuser MTP_user(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) { - return MTPuser(new MTPDuser(_flags, _id, _access_hash, _first_name, _last_name, _username, _phone, _photo, _status, _bot_info_version, _restriction_reason, _bot_inline_placeholder)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDuser::Flags) +inline MTPuser MTP_user(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username, const MTPstring &_phone, const MTPUserProfilePhoto &_photo, const MTPUserStatus &_status, MTPint _bot_info_version, const MTPstring &_restriction_reason, const MTPstring &_bot_inline_placeholder) { + return MTP::internal::TypeCreator::new_user(_flags, _id, _access_hash, _first_name, _last_name, _username, _phone, _photo, _status, _bot_info_version, _restriction_reason, _bot_inline_placeholder); } inline uint32 MTPuserProfilePhoto::innerLength() const { @@ -22989,10 +24328,10 @@ inline MTPuserProfilePhoto::MTPuserProfilePhoto(mtpTypeId type) : mtpDataOwner(0 inline MTPuserProfilePhoto::MTPuserProfilePhoto(MTPDuserProfilePhoto *_data) : mtpDataOwner(_data), _type(mtpc_userProfilePhoto) { } inline MTPuserProfilePhoto MTP_userProfilePhotoEmpty() { - return MTPuserProfilePhoto(mtpc_userProfilePhotoEmpty); + return MTP::internal::TypeCreator::new_userProfilePhotoEmpty(); } inline MTPuserProfilePhoto MTP_userProfilePhoto(const MTPlong &_photo_id, const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { - return MTPuserProfilePhoto(new MTPDuserProfilePhoto(_photo_id, _photo_small, _photo_big)); + return MTP::internal::TypeCreator::new_userProfilePhoto(_photo_id, _photo_small, _photo_big); } inline uint32 MTPuserStatus::innerLength() const { @@ -23060,22 +24399,22 @@ inline MTPuserStatus::MTPuserStatus(MTPDuserStatusOnline *_data) : mtpDataOwner( inline MTPuserStatus::MTPuserStatus(MTPDuserStatusOffline *_data) : mtpDataOwner(_data), _type(mtpc_userStatusOffline) { } inline MTPuserStatus MTP_userStatusEmpty() { - return MTPuserStatus(mtpc_userStatusEmpty); + return MTP::internal::TypeCreator::new_userStatusEmpty(); } inline MTPuserStatus MTP_userStatusOnline(MTPint _expires) { - return MTPuserStatus(new MTPDuserStatusOnline(_expires)); + return MTP::internal::TypeCreator::new_userStatusOnline(_expires); } inline MTPuserStatus MTP_userStatusOffline(MTPint _was_online) { - return MTPuserStatus(new MTPDuserStatusOffline(_was_online)); + return MTP::internal::TypeCreator::new_userStatusOffline(_was_online); } inline MTPuserStatus MTP_userStatusRecently() { - return MTPuserStatus(mtpc_userStatusRecently); + return MTP::internal::TypeCreator::new_userStatusRecently(); } inline MTPuserStatus MTP_userStatusLastWeek() { - return MTPuserStatus(mtpc_userStatusLastWeek); + return MTP::internal::TypeCreator::new_userStatusLastWeek(); } inline MTPuserStatus MTP_userStatusLastMonth() { - return MTPuserStatus(mtpc_userStatusLastMonth); + return MTP::internal::TypeCreator::new_userStatusLastMonth(); } inline uint32 MTPchat::innerLength() const { @@ -23219,19 +24558,21 @@ inline MTPchat::MTPchat(MTPDchannel *_data) : mtpDataOwner(_data), _type(mtpc_ch inline MTPchat::MTPchat(MTPDchannelForbidden *_data) : mtpDataOwner(_data), _type(mtpc_channelForbidden) { } inline MTPchat MTP_chatEmpty(MTPint _id) { - return MTPchat(new MTPDchatEmpty(_id)); + return MTP::internal::TypeCreator::new_chatEmpty(_id); } -inline MTPchat MTP_chat(MTPint _flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) { - return MTPchat(new MTPDchat(_flags, _id, _title, _photo, _participants_count, _date, _version, _migrated_to)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchat::Flags) +inline MTPchat MTP_chat(const MTPflags &_flags, MTPint _id, const MTPstring &_title, const MTPChatPhoto &_photo, MTPint _participants_count, MTPint _date, MTPint _version, const MTPInputChannel &_migrated_to) { + return MTP::internal::TypeCreator::new_chat(_flags, _id, _title, _photo, _participants_count, _date, _version, _migrated_to); } inline MTPchat MTP_chatForbidden(MTPint _id, const MTPstring &_title) { - return MTPchat(new MTPDchatForbidden(_id, _title)); + return MTP::internal::TypeCreator::new_chatForbidden(_id, _title); } -inline MTPchat MTP_channel(MTPint _flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) { - return MTPchat(new MTPDchannel(_flags, _id, _access_hash, _title, _username, _photo, _date, _version, _restriction_reason)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchannel::Flags) +inline MTPchat MTP_channel(const MTPflags &_flags, MTPint _id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_username, const MTPChatPhoto &_photo, MTPint _date, MTPint _version, const MTPstring &_restriction_reason) { + return MTP::internal::TypeCreator::new_channel(_flags, _id, _access_hash, _title, _username, _photo, _date, _version, _restriction_reason); } inline MTPchat MTP_channelForbidden(MTPint _id, const MTPlong &_access_hash, const MTPstring &_title) { - return MTPchat(new MTPDchannelForbidden(_id, _access_hash, _title)); + return MTP::internal::TypeCreator::new_channelForbidden(_id, _access_hash, _title); } inline uint32 MTPchatFull::innerLength() const { @@ -23331,10 +24672,11 @@ inline MTPchatFull::MTPchatFull(MTPDchatFull *_data) : mtpDataOwner(_data), _typ inline MTPchatFull::MTPchatFull(MTPDchannelFull *_data) : mtpDataOwner(_data), _type(mtpc_channelFull) { } inline MTPchatFull MTP_chatFull(MTPint _id, const MTPChatParticipants &_participants, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info) { - return MTPchatFull(new MTPDchatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info)); + return MTP::internal::TypeCreator::new_chatFull(_id, _participants, _chat_photo, _notify_settings, _exported_invite, _bot_info); } -inline MTPchatFull MTP_channelFull(MTPint _flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) { - return MTPchatFull(new MTPDchannelFull(_flags, _id, _about, _participants_count, _admins_count, _kicked_count, _read_inbox_max_id, _unread_count, _unread_important_count, _chat_photo, _notify_settings, _exported_invite, _bot_info, _migrated_from_chat_id, _migrated_from_max_id, _pinned_msg_id)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchannelFull::Flags) +inline MTPchatFull MTP_channelFull(const MTPflags &_flags, MTPint _id, const MTPstring &_about, MTPint _participants_count, MTPint _admins_count, MTPint _kicked_count, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPhoto &_chat_photo, const MTPPeerNotifySettings &_notify_settings, const MTPExportedChatInvite &_exported_invite, const MTPVector &_bot_info, MTPint _migrated_from_chat_id, MTPint _migrated_from_max_id, MTPint _pinned_msg_id) { + return MTP::internal::TypeCreator::new_channelFull(_flags, _id, _about, _participants_count, _admins_count, _kicked_count, _read_inbox_max_id, _unread_count, _unread_important_count, _chat_photo, _notify_settings, _exported_invite, _bot_info, _migrated_from_chat_id, _migrated_from_max_id, _pinned_msg_id); } inline uint32 MTPchatParticipant::innerLength() const { @@ -23418,13 +24760,13 @@ inline MTPchatParticipant::MTPchatParticipant(MTPDchatParticipantCreator *_data) inline MTPchatParticipant::MTPchatParticipant(MTPDchatParticipantAdmin *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipantAdmin) { } inline MTPchatParticipant MTP_chatParticipant(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchatParticipant(new MTPDchatParticipant(_user_id, _inviter_id, _date)); + return MTP::internal::TypeCreator::new_chatParticipant(_user_id, _inviter_id, _date); } inline MTPchatParticipant MTP_chatParticipantCreator(MTPint _user_id) { - return MTPchatParticipant(new MTPDchatParticipantCreator(_user_id)); + return MTP::internal::TypeCreator::new_chatParticipantCreator(_user_id); } inline MTPchatParticipant MTP_chatParticipantAdmin(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchatParticipant(new MTPDchatParticipantAdmin(_user_id, _inviter_id, _date)); + return MTP::internal::TypeCreator::new_chatParticipantAdmin(_user_id, _inviter_id, _date); } inline uint32 MTPchatParticipants::innerLength() const { @@ -23491,11 +24833,12 @@ inline MTPchatParticipants::MTPchatParticipants(MTPDchatParticipantsForbidden *_ } inline MTPchatParticipants::MTPchatParticipants(MTPDchatParticipants *_data) : mtpDataOwner(_data), _type(mtpc_chatParticipants) { } -inline MTPchatParticipants MTP_chatParticipantsForbidden(MTPint _flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) { - return MTPchatParticipants(new MTPDchatParticipantsForbidden(_flags, _chat_id, _self_participant)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchatParticipantsForbidden::Flags) +inline MTPchatParticipants MTP_chatParticipantsForbidden(const MTPflags &_flags, MTPint _chat_id, const MTPChatParticipant &_self_participant) { + return MTP::internal::TypeCreator::new_chatParticipantsForbidden(_flags, _chat_id, _self_participant); } inline MTPchatParticipants MTP_chatParticipants(MTPint _chat_id, const MTPVector &_participants, MTPint _version) { - return MTPchatParticipants(new MTPDchatParticipants(_chat_id, _participants, _version)); + return MTP::internal::TypeCreator::new_chatParticipants(_chat_id, _participants, _version); } inline uint32 MTPchatPhoto::innerLength() const { @@ -23543,10 +24886,10 @@ inline MTPchatPhoto::MTPchatPhoto(mtpTypeId type) : mtpDataOwner(0), _type(type) inline MTPchatPhoto::MTPchatPhoto(MTPDchatPhoto *_data) : mtpDataOwner(_data), _type(mtpc_chatPhoto) { } inline MTPchatPhoto MTP_chatPhotoEmpty() { - return MTPchatPhoto(mtpc_chatPhotoEmpty); + return MTP::internal::TypeCreator::new_chatPhotoEmpty(); } inline MTPchatPhoto MTP_chatPhoto(const MTPFileLocation &_photo_small, const MTPFileLocation &_photo_big) { - return MTPchatPhoto(new MTPDchatPhoto(_photo_small, _photo_big)); + return MTP::internal::TypeCreator::new_chatPhoto(_photo_small, _photo_big); } inline uint32 MTPmessage::innerLength() const { @@ -23660,13 +25003,15 @@ inline MTPmessage::MTPmessage(MTPDmessage *_data) : mtpDataOwner(_data), _type(m inline MTPmessage::MTPmessage(MTPDmessageService *_data) : mtpDataOwner(_data), _type(mtpc_messageService) { } inline MTPmessage MTP_messageEmpty(MTPint _id) { - return MTPmessage(new MTPDmessageEmpty(_id)); + return MTP::internal::TypeCreator::new_messageEmpty(_id); } -inline MTPmessage MTP_message(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) { - return MTPmessage(new MTPDmessage(_flags, _id, _from_id, _to_id, _fwd_from, _via_bot_id, _reply_to_msg_id, _date, _message, _media, _reply_markup, _entities, _views, _edit_date)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessage::Flags) +inline MTPmessage MTP_message(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, MTPint _date, const MTPstring &_message, const MTPMessageMedia &_media, const MTPReplyMarkup &_reply_markup, const MTPVector &_entities, MTPint _views, MTPint _edit_date) { + return MTP::internal::TypeCreator::new_message(_flags, _id, _from_id, _to_id, _fwd_from, _via_bot_id, _reply_to_msg_id, _date, _message, _media, _reply_markup, _entities, _views, _edit_date); } -inline MTPmessage MTP_messageService(MTPint _flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) { - return MTPmessage(new MTPDmessageService(_flags, _id, _from_id, _to_id, _reply_to_msg_id, _date, _action)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessageService::Flags) +inline MTPmessage MTP_messageService(const MTPflags &_flags, MTPint _id, MTPint _from_id, const MTPPeer &_to_id, MTPint _reply_to_msg_id, MTPint _date, const MTPMessageAction &_action) { + return MTP::internal::TypeCreator::new_messageService(_flags, _id, _from_id, _to_id, _reply_to_msg_id, _date, _action); } inline uint32 MTPmessageMedia::innerLength() const { @@ -23812,28 +25157,28 @@ inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaWebPage *_data) : mtpDat inline MTPmessageMedia::MTPmessageMedia(MTPDmessageMediaVenue *_data) : mtpDataOwner(_data), _type(mtpc_messageMediaVenue) { } inline MTPmessageMedia MTP_messageMediaEmpty() { - return MTPmessageMedia(mtpc_messageMediaEmpty); + return MTP::internal::TypeCreator::new_messageMediaEmpty(); } inline MTPmessageMedia MTP_messageMediaPhoto(const MTPPhoto &_photo, const MTPstring &_caption) { - return MTPmessageMedia(new MTPDmessageMediaPhoto(_photo, _caption)); + return MTP::internal::TypeCreator::new_messageMediaPhoto(_photo, _caption); } inline MTPmessageMedia MTP_messageMediaGeo(const MTPGeoPoint &_geo) { - return MTPmessageMedia(new MTPDmessageMediaGeo(_geo)); + return MTP::internal::TypeCreator::new_messageMediaGeo(_geo); } inline MTPmessageMedia MTP_messageMediaContact(const MTPstring &_phone_number, const MTPstring &_first_name, const MTPstring &_last_name, MTPint _user_id) { - return MTPmessageMedia(new MTPDmessageMediaContact(_phone_number, _first_name, _last_name, _user_id)); + return MTP::internal::TypeCreator::new_messageMediaContact(_phone_number, _first_name, _last_name, _user_id); } inline MTPmessageMedia MTP_messageMediaUnsupported() { - return MTPmessageMedia(mtpc_messageMediaUnsupported); + return MTP::internal::TypeCreator::new_messageMediaUnsupported(); } inline MTPmessageMedia MTP_messageMediaDocument(const MTPDocument &_document, const MTPstring &_caption) { - return MTPmessageMedia(new MTPDmessageMediaDocument(_document, _caption)); + return MTP::internal::TypeCreator::new_messageMediaDocument(_document, _caption); } inline MTPmessageMedia MTP_messageMediaWebPage(const MTPWebPage &_webpage) { - return MTPmessageMedia(new MTPDmessageMediaWebPage(_webpage)); + return MTP::internal::TypeCreator::new_messageMediaWebPage(_webpage); } inline MTPmessageMedia MTP_messageMediaVenue(const MTPGeoPoint &_geo, const MTPstring &_title, const MTPstring &_address, const MTPstring &_provider, const MTPstring &_venue_id) { - return MTPmessageMedia(new MTPDmessageMediaVenue(_geo, _title, _address, _provider, _venue_id)); + return MTP::internal::TypeCreator::new_messageMediaVenue(_geo, _title, _address, _provider, _venue_id); } inline uint32 MTPmessageAction::innerLength() const { @@ -24015,40 +25360,40 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChatMigrateTo *_data) inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data) : mtpDataOwner(_data), _type(mtpc_messageActionChannelMigrateFrom) { } inline MTPmessageAction MTP_messageActionEmpty() { - return MTPmessageAction(mtpc_messageActionEmpty); + return MTP::internal::TypeCreator::new_messageActionEmpty(); } inline MTPmessageAction MTP_messageActionChatCreate(const MTPstring &_title, const MTPVector &_users) { - return MTPmessageAction(new MTPDmessageActionChatCreate(_title, _users)); + return MTP::internal::TypeCreator::new_messageActionChatCreate(_title, _users); } inline MTPmessageAction MTP_messageActionChatEditTitle(const MTPstring &_title) { - return MTPmessageAction(new MTPDmessageActionChatEditTitle(_title)); + return MTP::internal::TypeCreator::new_messageActionChatEditTitle(_title); } inline MTPmessageAction MTP_messageActionChatEditPhoto(const MTPPhoto &_photo) { - return MTPmessageAction(new MTPDmessageActionChatEditPhoto(_photo)); + return MTP::internal::TypeCreator::new_messageActionChatEditPhoto(_photo); } inline MTPmessageAction MTP_messageActionChatDeletePhoto() { - return MTPmessageAction(mtpc_messageActionChatDeletePhoto); + return MTP::internal::TypeCreator::new_messageActionChatDeletePhoto(); } inline MTPmessageAction MTP_messageActionChatAddUser(const MTPVector &_users) { - return MTPmessageAction(new MTPDmessageActionChatAddUser(_users)); + return MTP::internal::TypeCreator::new_messageActionChatAddUser(_users); } inline MTPmessageAction MTP_messageActionChatDeleteUser(MTPint _user_id) { - return MTPmessageAction(new MTPDmessageActionChatDeleteUser(_user_id)); + return MTP::internal::TypeCreator::new_messageActionChatDeleteUser(_user_id); } inline MTPmessageAction MTP_messageActionChatJoinedByLink(MTPint _inviter_id) { - return MTPmessageAction(new MTPDmessageActionChatJoinedByLink(_inviter_id)); + return MTP::internal::TypeCreator::new_messageActionChatJoinedByLink(_inviter_id); } inline MTPmessageAction MTP_messageActionChannelCreate(const MTPstring &_title) { - return MTPmessageAction(new MTPDmessageActionChannelCreate(_title)); + return MTP::internal::TypeCreator::new_messageActionChannelCreate(_title); } inline MTPmessageAction MTP_messageActionChatMigrateTo(MTPint _channel_id) { - return MTPmessageAction(new MTPDmessageActionChatMigrateTo(_channel_id)); + return MTP::internal::TypeCreator::new_messageActionChatMigrateTo(_channel_id); } inline MTPmessageAction MTP_messageActionChannelMigrateFrom(const MTPstring &_title, MTPint _chat_id) { - return MTPmessageAction(new MTPDmessageActionChannelMigrateFrom(_title, _chat_id)); + return MTP::internal::TypeCreator::new_messageActionChannelMigrateFrom(_title, _chat_id); } inline MTPmessageAction MTP_messageActionPinMessage() { - return MTPmessageAction(mtpc_messageActionPinMessage); + return MTP::internal::TypeCreator::new_messageActionPinMessage(); } inline uint32 MTPdialog::innerLength() const { @@ -24130,10 +25475,10 @@ inline MTPdialog::MTPdialog(MTPDdialog *_data) : mtpDataOwner(_data), _type(mtpc inline MTPdialog::MTPdialog(MTPDdialogChannel *_data) : mtpDataOwner(_data), _type(mtpc_dialogChannel) { } inline MTPdialog MTP_dialog(const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings) { - return MTPdialog(new MTPDdialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings)); + return MTP::internal::TypeCreator::new_dialog(_peer, _top_message, _read_inbox_max_id, _unread_count, _notify_settings); } inline MTPdialog MTP_dialogChannel(const MTPPeer &_peer, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts) { - return MTPdialog(new MTPDdialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts)); + return MTP::internal::TypeCreator::new_dialogChannel(_peer, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _notify_settings, _pts); } inline uint32 MTPphoto::innerLength() const { @@ -24199,10 +25544,10 @@ inline MTPphoto::MTPphoto(MTPDphotoEmpty *_data) : mtpDataOwner(_data), _type(mt inline MTPphoto::MTPphoto(MTPDphoto *_data) : mtpDataOwner(_data), _type(mtpc_photo) { } inline MTPphoto MTP_photoEmpty(const MTPlong &_id) { - return MTPphoto(new MTPDphotoEmpty(_id)); + return MTP::internal::TypeCreator::new_photoEmpty(_id); } inline MTPphoto MTP_photo(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPVector &_sizes) { - return MTPphoto(new MTPDphoto(_id, _access_hash, _date, _sizes)); + return MTP::internal::TypeCreator::new_photo(_id, _access_hash, _date, _sizes); } inline uint32 MTPphotoSize::innerLength() const { @@ -24294,13 +25639,13 @@ inline MTPphotoSize::MTPphotoSize(MTPDphotoSize *_data) : mtpDataOwner(_data), _ inline MTPphotoSize::MTPphotoSize(MTPDphotoCachedSize *_data) : mtpDataOwner(_data), _type(mtpc_photoCachedSize) { } inline MTPphotoSize MTP_photoSizeEmpty(const MTPstring &_type) { - return MTPphotoSize(new MTPDphotoSizeEmpty(_type)); + return MTP::internal::TypeCreator::new_photoSizeEmpty(_type); } inline MTPphotoSize MTP_photoSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, MTPint _size) { - return MTPphotoSize(new MTPDphotoSize(_type, _location, _w, _h, _size)); + return MTP::internal::TypeCreator::new_photoSize(_type, _location, _w, _h, _size); } inline MTPphotoSize MTP_photoCachedSize(const MTPstring &_type, const MTPFileLocation &_location, MTPint _w, MTPint _h, const MTPbytes &_bytes) { - return MTPphotoSize(new MTPDphotoCachedSize(_type, _location, _w, _h, _bytes)); + return MTP::internal::TypeCreator::new_photoCachedSize(_type, _location, _w, _h, _bytes); } inline uint32 MTPgeoPoint::innerLength() const { @@ -24348,10 +25693,10 @@ inline MTPgeoPoint::MTPgeoPoint(mtpTypeId type) : mtpDataOwner(0), _type(type) { inline MTPgeoPoint::MTPgeoPoint(MTPDgeoPoint *_data) : mtpDataOwner(_data), _type(mtpc_geoPoint) { } inline MTPgeoPoint MTP_geoPointEmpty() { - return MTPgeoPoint(mtpc_geoPointEmpty); + return MTP::internal::TypeCreator::new_geoPointEmpty(); } inline MTPgeoPoint MTP_geoPoint(const MTPdouble &_long, const MTPdouble &_lat) { - return MTPgeoPoint(new MTPDgeoPoint(_long, _lat)); + return MTP::internal::TypeCreator::new_geoPoint(_long, _lat); } inline MTPauth_checkedPhone::MTPauth_checkedPhone() : mtpDataOwner(new MTPDauth_checkedPhone()) { @@ -24378,82 +25723,43 @@ inline void MTPauth_checkedPhone::write(mtpBuffer &to) const { inline MTPauth_checkedPhone::MTPauth_checkedPhone(MTPDauth_checkedPhone *_data) : mtpDataOwner(_data) { } inline MTPauth_checkedPhone MTP_auth_checkedPhone(MTPBool _phone_registered) { - return MTPauth_checkedPhone(new MTPDauth_checkedPhone(_phone_registered)); + return MTP::internal::TypeCreator::new_auth_checkedPhone(_phone_registered); +} + +inline MTPauth_sentCode::MTPauth_sentCode() : mtpDataOwner(new MTPDauth_sentCode()) { } inline uint32 MTPauth_sentCode::innerLength() const { - switch (_type) { - case mtpc_auth_sentCode: { - const MTPDauth_sentCode &v(c_auth_sentCode()); - return v.vphone_registered.innerLength() + v.vphone_code_hash.innerLength() + v.vsend_call_timeout.innerLength() + v.vis_password.innerLength(); - } - case mtpc_auth_sentAppCode: { - const MTPDauth_sentAppCode &v(c_auth_sentAppCode()); - return v.vphone_registered.innerLength() + v.vphone_code_hash.innerLength() + v.vsend_call_timeout.innerLength() + v.vis_password.innerLength(); - } - } - return 0; + const MTPDauth_sentCode &v(c_auth_sentCode()); + return v.vflags.innerLength() + v.vtype.innerLength() + v.vphone_code_hash.innerLength() + (v.has_next_type() ? v.vnext_type.innerLength() : 0) + (v.has_timeout() ? v.vtimeout.innerLength() : 0); } inline mtpTypeId MTPauth_sentCode::type() const { - if (!_type) throw mtpErrorUninitialized(); - return _type; + return mtpc_auth_sentCode; } inline void MTPauth_sentCode::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != _type) setData(0); - switch (cons) { - case mtpc_auth_sentCode: _type = cons; { - if (!data) setData(new MTPDauth_sentCode()); - MTPDauth_sentCode &v(_auth_sentCode()); - v.vphone_registered.read(from, end); - v.vphone_code_hash.read(from, end); - v.vsend_call_timeout.read(from, end); - v.vis_password.read(from, end); - } break; - case mtpc_auth_sentAppCode: _type = cons; { - if (!data) setData(new MTPDauth_sentAppCode()); - MTPDauth_sentAppCode &v(_auth_sentAppCode()); - v.vphone_registered.read(from, end); - v.vphone_code_hash.read(from, end); - v.vsend_call_timeout.read(from, end); - v.vis_password.read(from, end); - } break; - default: throw mtpErrorUnexpected(cons, "MTPauth_sentCode"); - } + if (cons != mtpc_auth_sentCode) throw mtpErrorUnexpected(cons, "MTPauth_sentCode"); + + if (!data) setData(new MTPDauth_sentCode()); + MTPDauth_sentCode &v(_auth_sentCode()); + v.vflags.read(from, end); + v.vtype.read(from, end); + v.vphone_code_hash.read(from, end); + if (v.has_next_type()) { v.vnext_type.read(from, end); } else { v.vnext_type = MTPauth_CodeType(); } + if (v.has_timeout()) { v.vtimeout.read(from, end); } else { v.vtimeout = MTPint(); } } inline void MTPauth_sentCode::write(mtpBuffer &to) const { - switch (_type) { - case mtpc_auth_sentCode: { - const MTPDauth_sentCode &v(c_auth_sentCode()); - v.vphone_registered.write(to); - v.vphone_code_hash.write(to); - v.vsend_call_timeout.write(to); - v.vis_password.write(to); - } break; - case mtpc_auth_sentAppCode: { - const MTPDauth_sentAppCode &v(c_auth_sentAppCode()); - v.vphone_registered.write(to); - v.vphone_code_hash.write(to); - v.vsend_call_timeout.write(to); - v.vis_password.write(to); - } break; - } + const MTPDauth_sentCode &v(c_auth_sentCode()); + v.vflags.write(to); + v.vtype.write(to); + v.vphone_code_hash.write(to); + if (v.has_next_type()) v.vnext_type.write(to); + if (v.has_timeout()) v.vtimeout.write(to); } -inline MTPauth_sentCode::MTPauth_sentCode(mtpTypeId type) : mtpDataOwner(0), _type(type) { - switch (type) { - case mtpc_auth_sentCode: setData(new MTPDauth_sentCode()); break; - case mtpc_auth_sentAppCode: setData(new MTPDauth_sentAppCode()); break; - default: throw mtpErrorBadTypeId(type, "MTPauth_sentCode"); - } +inline MTPauth_sentCode::MTPauth_sentCode(MTPDauth_sentCode *_data) : mtpDataOwner(_data) { } -inline MTPauth_sentCode::MTPauth_sentCode(MTPDauth_sentCode *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCode) { -} -inline MTPauth_sentCode::MTPauth_sentCode(MTPDauth_sentAppCode *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentAppCode) { -} -inline MTPauth_sentCode MTP_auth_sentCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password) { - return MTPauth_sentCode(new MTPDauth_sentCode(_phone_registered, _phone_code_hash, _send_call_timeout, _is_password)); -} -inline MTPauth_sentCode MTP_auth_sentAppCode(MTPBool _phone_registered, const MTPstring &_phone_code_hash, MTPint _send_call_timeout, MTPBool _is_password) { - return MTPauth_sentCode(new MTPDauth_sentAppCode(_phone_registered, _phone_code_hash, _send_call_timeout, _is_password)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDauth_sentCode::Flags) +inline MTPauth_sentCode MTP_auth_sentCode(const MTPflags &_flags, const MTPauth_SentCodeType &_type, const MTPstring &_phone_code_hash, const MTPauth_CodeType &_next_type, MTPint _timeout) { + return MTP::internal::TypeCreator::new_auth_sentCode(_flags, _type, _phone_code_hash, _next_type, _timeout); } inline MTPauth_authorization::MTPauth_authorization() : mtpDataOwner(new MTPDauth_authorization()) { @@ -24480,7 +25786,7 @@ inline void MTPauth_authorization::write(mtpBuffer &to) const { inline MTPauth_authorization::MTPauth_authorization(MTPDauth_authorization *_data) : mtpDataOwner(_data) { } inline MTPauth_authorization MTP_auth_authorization(const MTPUser &_user) { - return MTPauth_authorization(new MTPDauth_authorization(_user)); + return MTP::internal::TypeCreator::new_auth_authorization(_user); } inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization() : mtpDataOwner(new MTPDauth_exportedAuthorization()) { @@ -24509,7 +25815,7 @@ inline void MTPauth_exportedAuthorization::write(mtpBuffer &to) const { inline MTPauth_exportedAuthorization::MTPauth_exportedAuthorization(MTPDauth_exportedAuthorization *_data) : mtpDataOwner(_data) { } inline MTPauth_exportedAuthorization MTP_auth_exportedAuthorization(MTPint _id, const MTPbytes &_bytes) { - return MTPauth_exportedAuthorization(new MTPDauth_exportedAuthorization(_id, _bytes)); + return MTP::internal::TypeCreator::new_auth_exportedAuthorization(_id, _bytes); } inline uint32 MTPinputNotifyPeer::innerLength() const { @@ -24559,16 +25865,16 @@ inline MTPinputNotifyPeer::MTPinputNotifyPeer(mtpTypeId type) : mtpDataOwner(0), inline MTPinputNotifyPeer::MTPinputNotifyPeer(MTPDinputNotifyPeer *_data) : mtpDataOwner(_data), _type(mtpc_inputNotifyPeer) { } inline MTPinputNotifyPeer MTP_inputNotifyPeer(const MTPInputPeer &_peer) { - return MTPinputNotifyPeer(new MTPDinputNotifyPeer(_peer)); + return MTP::internal::TypeCreator::new_inputNotifyPeer(_peer); } inline MTPinputNotifyPeer MTP_inputNotifyUsers() { - return MTPinputNotifyPeer(mtpc_inputNotifyUsers); + return MTP::internal::TypeCreator::new_inputNotifyUsers(); } inline MTPinputNotifyPeer MTP_inputNotifyChats() { - return MTPinputNotifyPeer(mtpc_inputNotifyChats); + return MTP::internal::TypeCreator::new_inputNotifyChats(); } inline MTPinputNotifyPeer MTP_inputNotifyAll() { - return MTPinputNotifyPeer(mtpc_inputNotifyAll); + return MTP::internal::TypeCreator::new_inputNotifyAll(); } inline uint32 MTPinputPeerNotifyEvents::innerLength() const { @@ -24586,8 +25892,6 @@ inline void MTPinputPeerNotifyEvents::read(const mtpPrime *&from, const mtpPrime } } inline void MTPinputPeerNotifyEvents::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPinputPeerNotifyEvents::MTPinputPeerNotifyEvents(mtpTypeId type) : _type(type) { switch (type) { @@ -24597,10 +25901,10 @@ inline MTPinputPeerNotifyEvents::MTPinputPeerNotifyEvents(mtpTypeId type) : _typ } } inline MTPinputPeerNotifyEvents MTP_inputPeerNotifyEventsEmpty() { - return MTPinputPeerNotifyEvents(mtpc_inputPeerNotifyEventsEmpty); + return MTP::internal::TypeCreator::new_inputPeerNotifyEventsEmpty(); } inline MTPinputPeerNotifyEvents MTP_inputPeerNotifyEventsAll() { - return MTPinputPeerNotifyEvents(mtpc_inputPeerNotifyEventsAll); + return MTP::internal::TypeCreator::new_inputPeerNotifyEventsAll(); } inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings() : mtpDataOwner(new MTPDinputPeerNotifySettings()) { @@ -24630,8 +25934,9 @@ inline void MTPinputPeerNotifySettings::write(mtpBuffer &to) const { } inline MTPinputPeerNotifySettings::MTPinputPeerNotifySettings(MTPDinputPeerNotifySettings *_data) : mtpDataOwner(_data) { } -inline MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) { - return MTPinputPeerNotifySettings(new MTPDinputPeerNotifySettings(_flags, _mute_until, _sound)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputPeerNotifySettings::Flags) +inline MTPinputPeerNotifySettings MTP_inputPeerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { + return MTP::internal::TypeCreator::new_inputPeerNotifySettings(_flags, _mute_until, _sound); } inline uint32 MTPpeerNotifyEvents::innerLength() const { @@ -24649,8 +25954,6 @@ inline void MTPpeerNotifyEvents::read(const mtpPrime *&from, const mtpPrime *end } } inline void MTPpeerNotifyEvents::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPpeerNotifyEvents::MTPpeerNotifyEvents(mtpTypeId type) : _type(type) { switch (type) { @@ -24660,10 +25963,10 @@ inline MTPpeerNotifyEvents::MTPpeerNotifyEvents(mtpTypeId type) : _type(type) { } } inline MTPpeerNotifyEvents MTP_peerNotifyEventsEmpty() { - return MTPpeerNotifyEvents(mtpc_peerNotifyEventsEmpty); + return MTP::internal::TypeCreator::new_peerNotifyEventsEmpty(); } inline MTPpeerNotifyEvents MTP_peerNotifyEventsAll() { - return MTPpeerNotifyEvents(mtpc_peerNotifyEventsAll); + return MTP::internal::TypeCreator::new_peerNotifyEventsAll(); } inline uint32 MTPpeerNotifySettings::innerLength() const { @@ -24713,10 +26016,11 @@ inline MTPpeerNotifySettings::MTPpeerNotifySettings(mtpTypeId type) : mtpDataOwn inline MTPpeerNotifySettings::MTPpeerNotifySettings(MTPDpeerNotifySettings *_data) : mtpDataOwner(_data), _type(mtpc_peerNotifySettings) { } inline MTPpeerNotifySettings MTP_peerNotifySettingsEmpty() { - return MTPpeerNotifySettings(mtpc_peerNotifySettingsEmpty); + return MTP::internal::TypeCreator::new_peerNotifySettingsEmpty(); } -inline MTPpeerNotifySettings MTP_peerNotifySettings(MTPint _flags, MTPint _mute_until, const MTPstring &_sound) { - return MTPpeerNotifySettings(new MTPDpeerNotifySettings(_flags, _mute_until, _sound)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDpeerNotifySettings::Flags) +inline MTPpeerNotifySettings MTP_peerNotifySettings(const MTPflags &_flags, MTPint _mute_until, const MTPstring &_sound) { + return MTP::internal::TypeCreator::new_peerNotifySettings(_flags, _mute_until, _sound); } inline MTPpeerSettings::MTPpeerSettings() : mtpDataOwner(new MTPDpeerSettings()) { @@ -24742,8 +26046,9 @@ inline void MTPpeerSettings::write(mtpBuffer &to) const { } inline MTPpeerSettings::MTPpeerSettings(MTPDpeerSettings *_data) : mtpDataOwner(_data) { } -inline MTPpeerSettings MTP_peerSettings(MTPint _flags) { - return MTPpeerSettings(new MTPDpeerSettings(_flags)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDpeerSettings::Flags) +inline MTPpeerSettings MTP_peerSettings(const MTPflags &_flags) { + return MTP::internal::TypeCreator::new_peerSettings(_flags); } inline uint32 MTPwallPaper::innerLength() const { @@ -24815,10 +26120,10 @@ inline MTPwallPaper::MTPwallPaper(MTPDwallPaper *_data) : mtpDataOwner(_data), _ inline MTPwallPaper::MTPwallPaper(MTPDwallPaperSolid *_data) : mtpDataOwner(_data), _type(mtpc_wallPaperSolid) { } inline MTPwallPaper MTP_wallPaper(MTPint _id, const MTPstring &_title, const MTPVector &_sizes, MTPint _color) { - return MTPwallPaper(new MTPDwallPaper(_id, _title, _sizes, _color)); + return MTP::internal::TypeCreator::new_wallPaper(_id, _title, _sizes, _color); } inline MTPwallPaper MTP_wallPaperSolid(MTPint _id, const MTPstring &_title, MTPint _bg_color, MTPint _color) { - return MTPwallPaper(new MTPDwallPaperSolid(_id, _title, _bg_color, _color)); + return MTP::internal::TypeCreator::new_wallPaperSolid(_id, _title, _bg_color, _color); } inline uint32 MTPreportReason::innerLength() const { @@ -24868,16 +26173,16 @@ inline MTPreportReason::MTPreportReason(mtpTypeId type) : mtpDataOwner(0), _type inline MTPreportReason::MTPreportReason(MTPDinputReportReasonOther *_data) : mtpDataOwner(_data), _type(mtpc_inputReportReasonOther) { } inline MTPreportReason MTP_inputReportReasonSpam() { - return MTPreportReason(mtpc_inputReportReasonSpam); + return MTP::internal::TypeCreator::new_inputReportReasonSpam(); } inline MTPreportReason MTP_inputReportReasonViolence() { - return MTPreportReason(mtpc_inputReportReasonViolence); + return MTP::internal::TypeCreator::new_inputReportReasonViolence(); } inline MTPreportReason MTP_inputReportReasonPornography() { - return MTPreportReason(mtpc_inputReportReasonPornography); + return MTP::internal::TypeCreator::new_inputReportReasonPornography(); } inline MTPreportReason MTP_inputReportReasonOther(const MTPstring &_text) { - return MTPreportReason(new MTPDinputReportReasonOther(_text)); + return MTP::internal::TypeCreator::new_inputReportReasonOther(_text); } inline MTPuserFull::MTPuserFull() : mtpDataOwner(new MTPDuserFull()) { @@ -24915,8 +26220,9 @@ inline void MTPuserFull::write(mtpBuffer &to) const { } inline MTPuserFull::MTPuserFull(MTPDuserFull *_data) : mtpDataOwner(_data) { } -inline MTPuserFull MTP_userFull(MTPint _flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) { - return MTPuserFull(new MTPDuserFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDuserFull::Flags) +inline MTPuserFull MTP_userFull(const MTPflags &_flags, const MTPUser &_user, const MTPstring &_about, const MTPcontacts_Link &_link, const MTPPhoto &_profile_photo, const MTPPeerNotifySettings &_notify_settings, const MTPBotInfo &_bot_info) { + return MTP::internal::TypeCreator::new_userFull(_flags, _user, _about, _link, _profile_photo, _notify_settings, _bot_info); } inline MTPcontact::MTPcontact() : mtpDataOwner(new MTPDcontact()) { @@ -24945,7 +26251,7 @@ inline void MTPcontact::write(mtpBuffer &to) const { inline MTPcontact::MTPcontact(MTPDcontact *_data) : mtpDataOwner(_data) { } inline MTPcontact MTP_contact(MTPint _user_id, MTPBool _mutual) { - return MTPcontact(new MTPDcontact(_user_id, _mutual)); + return MTP::internal::TypeCreator::new_contact(_user_id, _mutual); } inline MTPimportedContact::MTPimportedContact() : mtpDataOwner(new MTPDimportedContact()) { @@ -24974,7 +26280,7 @@ inline void MTPimportedContact::write(mtpBuffer &to) const { inline MTPimportedContact::MTPimportedContact(MTPDimportedContact *_data) : mtpDataOwner(_data) { } inline MTPimportedContact MTP_importedContact(MTPint _user_id, const MTPlong &_client_id) { - return MTPimportedContact(new MTPDimportedContact(_user_id, _client_id)); + return MTP::internal::TypeCreator::new_importedContact(_user_id, _client_id); } inline MTPcontactBlocked::MTPcontactBlocked() : mtpDataOwner(new MTPDcontactBlocked()) { @@ -25003,7 +26309,7 @@ inline void MTPcontactBlocked::write(mtpBuffer &to) const { inline MTPcontactBlocked::MTPcontactBlocked(MTPDcontactBlocked *_data) : mtpDataOwner(_data) { } inline MTPcontactBlocked MTP_contactBlocked(MTPint _user_id, MTPint _date) { - return MTPcontactBlocked(new MTPDcontactBlocked(_user_id, _date)); + return MTP::internal::TypeCreator::new_contactBlocked(_user_id, _date); } inline MTPcontactStatus::MTPcontactStatus() : mtpDataOwner(new MTPDcontactStatus()) { @@ -25032,7 +26338,7 @@ inline void MTPcontactStatus::write(mtpBuffer &to) const { inline MTPcontactStatus::MTPcontactStatus(MTPDcontactStatus *_data) : mtpDataOwner(_data) { } inline MTPcontactStatus MTP_contactStatus(MTPint _user_id, const MTPUserStatus &_status) { - return MTPcontactStatus(new MTPDcontactStatus(_user_id, _status)); + return MTP::internal::TypeCreator::new_contactStatus(_user_id, _status); } inline MTPcontacts_link::MTPcontacts_link() : mtpDataOwner(new MTPDcontacts_link()) { @@ -25063,7 +26369,7 @@ inline void MTPcontacts_link::write(mtpBuffer &to) const { inline MTPcontacts_link::MTPcontacts_link(MTPDcontacts_link *_data) : mtpDataOwner(_data) { } inline MTPcontacts_link MTP_contacts_link(const MTPContactLink &_my_link, const MTPContactLink &_foreign_link, const MTPUser &_user) { - return MTPcontacts_link(new MTPDcontacts_link(_my_link, _foreign_link, _user)); + return MTP::internal::TypeCreator::new_contacts_link(_my_link, _foreign_link, _user); } inline uint32 MTPcontacts_contacts::innerLength() const { @@ -25111,10 +26417,10 @@ inline MTPcontacts_contacts::MTPcontacts_contacts(mtpTypeId type) : mtpDataOwner inline MTPcontacts_contacts::MTPcontacts_contacts(MTPDcontacts_contacts *_data) : mtpDataOwner(_data), _type(mtpc_contacts_contacts) { } inline MTPcontacts_contacts MTP_contacts_contactsNotModified() { - return MTPcontacts_contacts(mtpc_contacts_contactsNotModified); + return MTP::internal::TypeCreator::new_contacts_contactsNotModified(); } inline MTPcontacts_contacts MTP_contacts_contacts(const MTPVector &_contacts, const MTPVector &_users) { - return MTPcontacts_contacts(new MTPDcontacts_contacts(_contacts, _users)); + return MTP::internal::TypeCreator::new_contacts_contacts(_contacts, _users); } inline MTPcontacts_importedContacts::MTPcontacts_importedContacts() : mtpDataOwner(new MTPDcontacts_importedContacts()) { @@ -25145,7 +26451,7 @@ inline void MTPcontacts_importedContacts::write(mtpBuffer &to) const { inline MTPcontacts_importedContacts::MTPcontacts_importedContacts(MTPDcontacts_importedContacts *_data) : mtpDataOwner(_data) { } inline MTPcontacts_importedContacts MTP_contacts_importedContacts(const MTPVector &_imported, const MTPVector &_retry_contacts, const MTPVector &_users) { - return MTPcontacts_importedContacts(new MTPDcontacts_importedContacts(_imported, _retry_contacts, _users)); + return MTP::internal::TypeCreator::new_contacts_importedContacts(_imported, _retry_contacts, _users); } inline uint32 MTPcontacts_blocked::innerLength() const { @@ -25211,10 +26517,10 @@ inline MTPcontacts_blocked::MTPcontacts_blocked(MTPDcontacts_blocked *_data) : m inline MTPcontacts_blocked::MTPcontacts_blocked(MTPDcontacts_blockedSlice *_data) : mtpDataOwner(_data), _type(mtpc_contacts_blockedSlice) { } inline MTPcontacts_blocked MTP_contacts_blocked(const MTPVector &_blocked, const MTPVector &_users) { - return MTPcontacts_blocked(new MTPDcontacts_blocked(_blocked, _users)); + return MTP::internal::TypeCreator::new_contacts_blocked(_blocked, _users); } inline MTPcontacts_blocked MTP_contacts_blockedSlice(MTPint _count, const MTPVector &_blocked, const MTPVector &_users) { - return MTPcontacts_blocked(new MTPDcontacts_blockedSlice(_count, _blocked, _users)); + return MTP::internal::TypeCreator::new_contacts_blockedSlice(_count, _blocked, _users); } inline uint32 MTPmessages_dialogs::innerLength() const { @@ -25288,10 +26594,10 @@ inline MTPmessages_dialogs::MTPmessages_dialogs(MTPDmessages_dialogs *_data) : m inline MTPmessages_dialogs::MTPmessages_dialogs(MTPDmessages_dialogsSlice *_data) : mtpDataOwner(_data), _type(mtpc_messages_dialogsSlice) { } inline MTPmessages_dialogs MTP_messages_dialogs(const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_dialogs(new MTPDmessages_dialogs(_dialogs, _messages, _chats, _users)); + return MTP::internal::TypeCreator::new_messages_dialogs(_dialogs, _messages, _chats, _users); } inline MTPmessages_dialogs MTP_messages_dialogsSlice(MTPint _count, const MTPVector &_dialogs, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_dialogs(new MTPDmessages_dialogsSlice(_count, _dialogs, _messages, _chats, _users)); + return MTP::internal::TypeCreator::new_messages_dialogsSlice(_count, _dialogs, _messages, _chats, _users); } inline uint32 MTPmessages_messages::innerLength() const { @@ -25389,13 +26695,14 @@ inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_messagesSlice *_d inline MTPmessages_messages::MTPmessages_messages(MTPDmessages_channelMessages *_data) : mtpDataOwner(_data), _type(mtpc_messages_channelMessages) { } inline MTPmessages_messages MTP_messages_messages(const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_messages(_messages, _chats, _users)); + return MTP::internal::TypeCreator::new_messages_messages(_messages, _chats, _users); } inline MTPmessages_messages MTP_messages_messagesSlice(MTPint _count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_messagesSlice(_count, _messages, _chats, _users)); + return MTP::internal::TypeCreator::new_messages_messagesSlice(_count, _messages, _chats, _users); } -inline MTPmessages_messages MTP_messages_channelMessages(MTPint _flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_messages(new MTPDmessages_channelMessages(_flags, _pts, _count, _messages, _collapsed, _chats, _users)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_channelMessages::Flags) +inline MTPmessages_messages MTP_messages_channelMessages(const MTPflags &_flags, MTPint _pts, MTPint _count, const MTPVector &_messages, const MTPVector &_collapsed, const MTPVector &_chats, const MTPVector &_users) { + return MTP::internal::TypeCreator::new_messages_channelMessages(_flags, _pts, _count, _messages, _collapsed, _chats, _users); } inline MTPmessages_chats::MTPmessages_chats() : mtpDataOwner(new MTPDmessages_chats()) { @@ -25422,7 +26729,7 @@ inline void MTPmessages_chats::write(mtpBuffer &to) const { inline MTPmessages_chats::MTPmessages_chats(MTPDmessages_chats *_data) : mtpDataOwner(_data) { } inline MTPmessages_chats MTP_messages_chats(const MTPVector &_chats) { - return MTPmessages_chats(new MTPDmessages_chats(_chats)); + return MTP::internal::TypeCreator::new_messages_chats(_chats); } inline MTPmessages_chatFull::MTPmessages_chatFull() : mtpDataOwner(new MTPDmessages_chatFull()) { @@ -25453,7 +26760,7 @@ inline void MTPmessages_chatFull::write(mtpBuffer &to) const { inline MTPmessages_chatFull::MTPmessages_chatFull(MTPDmessages_chatFull *_data) : mtpDataOwner(_data) { } inline MTPmessages_chatFull MTP_messages_chatFull(const MTPChatFull &_full_chat, const MTPVector &_chats, const MTPVector &_users) { - return MTPmessages_chatFull(new MTPDmessages_chatFull(_full_chat, _chats, _users)); + return MTP::internal::TypeCreator::new_messages_chatFull(_full_chat, _chats, _users); } inline MTPmessages_affectedHistory::MTPmessages_affectedHistory() : mtpDataOwner(new MTPDmessages_affectedHistory()) { @@ -25484,7 +26791,7 @@ inline void MTPmessages_affectedHistory::write(mtpBuffer &to) const { inline MTPmessages_affectedHistory::MTPmessages_affectedHistory(MTPDmessages_affectedHistory *_data) : mtpDataOwner(_data) { } inline MTPmessages_affectedHistory MTP_messages_affectedHistory(MTPint _pts, MTPint _pts_count, MTPint _offset) { - return MTPmessages_affectedHistory(new MTPDmessages_affectedHistory(_pts, _pts_count, _offset)); + return MTP::internal::TypeCreator::new_messages_affectedHistory(_pts, _pts_count, _offset); } inline uint32 MTPmessagesFilter::innerLength() const { @@ -25510,8 +26817,6 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, } } inline void MTPmessagesFilter::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) { switch (type) { @@ -25529,34 +26834,34 @@ inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) { } } inline MTPmessagesFilter MTP_inputMessagesFilterEmpty() { - return MTPmessagesFilter(mtpc_inputMessagesFilterEmpty); + return MTP::internal::TypeCreator::new_inputMessagesFilterEmpty(); } inline MTPmessagesFilter MTP_inputMessagesFilterPhotos() { - return MTPmessagesFilter(mtpc_inputMessagesFilterPhotos); + return MTP::internal::TypeCreator::new_inputMessagesFilterPhotos(); } inline MTPmessagesFilter MTP_inputMessagesFilterVideo() { - return MTPmessagesFilter(mtpc_inputMessagesFilterVideo); + return MTP::internal::TypeCreator::new_inputMessagesFilterVideo(); } inline MTPmessagesFilter MTP_inputMessagesFilterPhotoVideo() { - return MTPmessagesFilter(mtpc_inputMessagesFilterPhotoVideo); + return MTP::internal::TypeCreator::new_inputMessagesFilterPhotoVideo(); } inline MTPmessagesFilter MTP_inputMessagesFilterPhotoVideoDocuments() { - return MTPmessagesFilter(mtpc_inputMessagesFilterPhotoVideoDocuments); + return MTP::internal::TypeCreator::new_inputMessagesFilterPhotoVideoDocuments(); } inline MTPmessagesFilter MTP_inputMessagesFilterDocument() { - return MTPmessagesFilter(mtpc_inputMessagesFilterDocument); + return MTP::internal::TypeCreator::new_inputMessagesFilterDocument(); } inline MTPmessagesFilter MTP_inputMessagesFilterUrl() { - return MTPmessagesFilter(mtpc_inputMessagesFilterUrl); + return MTP::internal::TypeCreator::new_inputMessagesFilterUrl(); } inline MTPmessagesFilter MTP_inputMessagesFilterGif() { - return MTPmessagesFilter(mtpc_inputMessagesFilterGif); + return MTP::internal::TypeCreator::new_inputMessagesFilterGif(); } inline MTPmessagesFilter MTP_inputMessagesFilterVoice() { - return MTPmessagesFilter(mtpc_inputMessagesFilterVoice); + return MTP::internal::TypeCreator::new_inputMessagesFilterVoice(); } inline MTPmessagesFilter MTP_inputMessagesFilterMusic() { - return MTPmessagesFilter(mtpc_inputMessagesFilterMusic); + return MTP::internal::TypeCreator::new_inputMessagesFilterMusic(); } inline uint32 MTPupdate::innerLength() const { @@ -26420,139 +27725,140 @@ inline MTPupdate::MTPupdate(MTPDupdateEditChannelMessage *_data) : mtpDataOwner( inline MTPupdate::MTPupdate(MTPDupdateChannelPinnedMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateChannelPinnedMessage) { } inline MTPupdate MTP_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateNewMessage(_message, _pts, _pts_count); } inline MTPupdate MTP_updateMessageID(MTPint _id, const MTPlong &_random_id) { - return MTPupdate(new MTPDupdateMessageID(_id, _random_id)); + return MTP::internal::TypeCreator::new_updateMessageID(_id, _random_id); } inline MTPupdate MTP_updateDeleteMessages(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateDeleteMessages(_messages, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateDeleteMessages(_messages, _pts, _pts_count); } inline MTPupdate MTP_updateUserTyping(MTPint _user_id, const MTPSendMessageAction &_action) { - return MTPupdate(new MTPDupdateUserTyping(_user_id, _action)); + return MTP::internal::TypeCreator::new_updateUserTyping(_user_id, _action); } inline MTPupdate MTP_updateChatUserTyping(MTPint _chat_id, MTPint _user_id, const MTPSendMessageAction &_action) { - return MTPupdate(new MTPDupdateChatUserTyping(_chat_id, _user_id, _action)); + return MTP::internal::TypeCreator::new_updateChatUserTyping(_chat_id, _user_id, _action); } inline MTPupdate MTP_updateChatParticipants(const MTPChatParticipants &_participants) { - return MTPupdate(new MTPDupdateChatParticipants(_participants)); + return MTP::internal::TypeCreator::new_updateChatParticipants(_participants); } inline MTPupdate MTP_updateUserStatus(MTPint _user_id, const MTPUserStatus &_status) { - return MTPupdate(new MTPDupdateUserStatus(_user_id, _status)); + return MTP::internal::TypeCreator::new_updateUserStatus(_user_id, _status); } inline MTPupdate MTP_updateUserName(MTPint _user_id, const MTPstring &_first_name, const MTPstring &_last_name, const MTPstring &_username) { - return MTPupdate(new MTPDupdateUserName(_user_id, _first_name, _last_name, _username)); + return MTP::internal::TypeCreator::new_updateUserName(_user_id, _first_name, _last_name, _username); } inline MTPupdate MTP_updateUserPhoto(MTPint _user_id, MTPint _date, const MTPUserProfilePhoto &_photo, MTPBool _previous) { - return MTPupdate(new MTPDupdateUserPhoto(_user_id, _date, _photo, _previous)); + return MTP::internal::TypeCreator::new_updateUserPhoto(_user_id, _date, _photo, _previous); } inline MTPupdate MTP_updateContactRegistered(MTPint _user_id, MTPint _date) { - return MTPupdate(new MTPDupdateContactRegistered(_user_id, _date)); + return MTP::internal::TypeCreator::new_updateContactRegistered(_user_id, _date); } inline MTPupdate MTP_updateContactLink(MTPint _user_id, const MTPContactLink &_my_link, const MTPContactLink &_foreign_link) { - return MTPupdate(new MTPDupdateContactLink(_user_id, _my_link, _foreign_link)); + return MTP::internal::TypeCreator::new_updateContactLink(_user_id, _my_link, _foreign_link); } inline MTPupdate MTP_updateNewAuthorization(const MTPlong &_auth_key_id, MTPint _date, const MTPstring &_device, const MTPstring &_location) { - return MTPupdate(new MTPDupdateNewAuthorization(_auth_key_id, _date, _device, _location)); + return MTP::internal::TypeCreator::new_updateNewAuthorization(_auth_key_id, _date, _device, _location); } inline MTPupdate MTP_updateNewEncryptedMessage(const MTPEncryptedMessage &_message, MTPint _qts) { - return MTPupdate(new MTPDupdateNewEncryptedMessage(_message, _qts)); + return MTP::internal::TypeCreator::new_updateNewEncryptedMessage(_message, _qts); } inline MTPupdate MTP_updateEncryptedChatTyping(MTPint _chat_id) { - return MTPupdate(new MTPDupdateEncryptedChatTyping(_chat_id)); + return MTP::internal::TypeCreator::new_updateEncryptedChatTyping(_chat_id); } inline MTPupdate MTP_updateEncryption(const MTPEncryptedChat &_chat, MTPint _date) { - return MTPupdate(new MTPDupdateEncryption(_chat, _date)); + return MTP::internal::TypeCreator::new_updateEncryption(_chat, _date); } inline MTPupdate MTP_updateEncryptedMessagesRead(MTPint _chat_id, MTPint _max_date, MTPint _date) { - return MTPupdate(new MTPDupdateEncryptedMessagesRead(_chat_id, _max_date, _date)); + return MTP::internal::TypeCreator::new_updateEncryptedMessagesRead(_chat_id, _max_date, _date); } inline MTPupdate MTP_updateChatParticipantAdd(MTPint _chat_id, MTPint _user_id, MTPint _inviter_id, MTPint _date, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantAdd(_chat_id, _user_id, _inviter_id, _date, _version)); + return MTP::internal::TypeCreator::new_updateChatParticipantAdd(_chat_id, _user_id, _inviter_id, _date, _version); } inline MTPupdate MTP_updateChatParticipantDelete(MTPint _chat_id, MTPint _user_id, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantDelete(_chat_id, _user_id, _version)); + return MTP::internal::TypeCreator::new_updateChatParticipantDelete(_chat_id, _user_id, _version); } inline MTPupdate MTP_updateDcOptions(const MTPVector &_dc_options) { - return MTPupdate(new MTPDupdateDcOptions(_dc_options)); + return MTP::internal::TypeCreator::new_updateDcOptions(_dc_options); } inline MTPupdate MTP_updateUserBlocked(MTPint _user_id, MTPBool _blocked) { - return MTPupdate(new MTPDupdateUserBlocked(_user_id, _blocked)); + return MTP::internal::TypeCreator::new_updateUserBlocked(_user_id, _blocked); } inline MTPupdate MTP_updateNotifySettings(const MTPNotifyPeer &_peer, const MTPPeerNotifySettings &_notify_settings) { - return MTPupdate(new MTPDupdateNotifySettings(_peer, _notify_settings)); + return MTP::internal::TypeCreator::new_updateNotifySettings(_peer, _notify_settings); } inline MTPupdate MTP_updateServiceNotification(const MTPstring &_type, const MTPstring &_message, const MTPMessageMedia &_media, MTPBool _popup) { - return MTPupdate(new MTPDupdateServiceNotification(_type, _message, _media, _popup)); + return MTP::internal::TypeCreator::new_updateServiceNotification(_type, _message, _media, _popup); } inline MTPupdate MTP_updatePrivacy(const MTPPrivacyKey &_key, const MTPVector &_rules) { - return MTPupdate(new MTPDupdatePrivacy(_key, _rules)); + return MTP::internal::TypeCreator::new_updatePrivacy(_key, _rules); } inline MTPupdate MTP_updateUserPhone(MTPint _user_id, const MTPstring &_phone) { - return MTPupdate(new MTPDupdateUserPhone(_user_id, _phone)); + return MTP::internal::TypeCreator::new_updateUserPhone(_user_id, _phone); } inline MTPupdate MTP_updateReadHistoryInbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadHistoryInbox(_peer, _max_id, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateReadHistoryInbox(_peer, _max_id, _pts, _pts_count); } inline MTPupdate MTP_updateReadHistoryOutbox(const MTPPeer &_peer, MTPint _max_id, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadHistoryOutbox(_peer, _max_id, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateReadHistoryOutbox(_peer, _max_id, _pts, _pts_count); } inline MTPupdate MTP_updateWebPage(const MTPWebPage &_webpage, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateWebPage(_webpage, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateWebPage(_webpage, _pts, _pts_count); } inline MTPupdate MTP_updateReadMessagesContents(const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateReadMessagesContents(_messages, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateReadMessagesContents(_messages, _pts, _pts_count); } -inline MTPupdate MTP_updateChannelTooLong(MTPint _flags, MTPint _channel_id, MTPint _pts) { - return MTPupdate(new MTPDupdateChannelTooLong(_flags, _channel_id, _pts)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateChannelTooLong::Flags) +inline MTPupdate MTP_updateChannelTooLong(const MTPflags &_flags, MTPint _channel_id, MTPint _pts) { + return MTP::internal::TypeCreator::new_updateChannelTooLong(_flags, _channel_id, _pts); } inline MTPupdate MTP_updateChannel(MTPint _channel_id) { - return MTPupdate(new MTPDupdateChannel(_channel_id)); + return MTP::internal::TypeCreator::new_updateChannel(_channel_id); } inline MTPupdate MTP_updateChannelGroup(MTPint _channel_id, const MTPMessageGroup &_group) { - return MTPupdate(new MTPDupdateChannelGroup(_channel_id, _group)); + return MTP::internal::TypeCreator::new_updateChannelGroup(_channel_id, _group); } inline MTPupdate MTP_updateNewChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateNewChannelMessage(_message, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateNewChannelMessage(_message, _pts, _pts_count); } inline MTPupdate MTP_updateReadChannelInbox(MTPint _channel_id, MTPint _max_id) { - return MTPupdate(new MTPDupdateReadChannelInbox(_channel_id, _max_id)); + return MTP::internal::TypeCreator::new_updateReadChannelInbox(_channel_id, _max_id); } inline MTPupdate MTP_updateDeleteChannelMessages(MTPint _channel_id, const MTPVector &_messages, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateDeleteChannelMessages(_channel_id, _messages, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateDeleteChannelMessages(_channel_id, _messages, _pts, _pts_count); } inline MTPupdate MTP_updateChannelMessageViews(MTPint _channel_id, MTPint _id, MTPint _views) { - return MTPupdate(new MTPDupdateChannelMessageViews(_channel_id, _id, _views)); + return MTP::internal::TypeCreator::new_updateChannelMessageViews(_channel_id, _id, _views); } inline MTPupdate MTP_updateChatAdmins(MTPint _chat_id, MTPBool _enabled, MTPint _version) { - return MTPupdate(new MTPDupdateChatAdmins(_chat_id, _enabled, _version)); + return MTP::internal::TypeCreator::new_updateChatAdmins(_chat_id, _enabled, _version); } inline MTPupdate MTP_updateChatParticipantAdmin(MTPint _chat_id, MTPint _user_id, MTPBool _is_admin, MTPint _version) { - return MTPupdate(new MTPDupdateChatParticipantAdmin(_chat_id, _user_id, _is_admin, _version)); + return MTP::internal::TypeCreator::new_updateChatParticipantAdmin(_chat_id, _user_id, _is_admin, _version); } inline MTPupdate MTP_updateNewStickerSet(const MTPmessages_StickerSet &_stickerset) { - return MTPupdate(new MTPDupdateNewStickerSet(_stickerset)); + return MTP::internal::TypeCreator::new_updateNewStickerSet(_stickerset); } inline MTPupdate MTP_updateStickerSetsOrder(const MTPVector &_order) { - return MTPupdate(new MTPDupdateStickerSetsOrder(_order)); + return MTP::internal::TypeCreator::new_updateStickerSetsOrder(_order); } inline MTPupdate MTP_updateStickerSets() { - return MTPupdate(mtpc_updateStickerSets); + return MTP::internal::TypeCreator::new_updateStickerSets(); } inline MTPupdate MTP_updateSavedGifs() { - return MTPupdate(mtpc_updateSavedGifs); + return MTP::internal::TypeCreator::new_updateSavedGifs(); } inline MTPupdate MTP_updateBotInlineQuery(const MTPlong &_query_id, MTPint _user_id, const MTPstring &_query, const MTPstring &_offset) { - return MTPupdate(new MTPDupdateBotInlineQuery(_query_id, _user_id, _query, _offset)); + return MTP::internal::TypeCreator::new_updateBotInlineQuery(_query_id, _user_id, _query, _offset); } inline MTPupdate MTP_updateBotInlineSend(MTPint _user_id, const MTPstring &_query, const MTPstring &_id) { - return MTPupdate(new MTPDupdateBotInlineSend(_user_id, _query, _id)); + return MTP::internal::TypeCreator::new_updateBotInlineSend(_user_id, _query, _id); } inline MTPupdate MTP_updateEditChannelMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) { - return MTPupdate(new MTPDupdateEditChannelMessage(_message, _pts, _pts_count)); + return MTP::internal::TypeCreator::new_updateEditChannelMessage(_message, _pts, _pts_count); } inline MTPupdate MTP_updateChannelPinnedMessage(MTPint _channel_id, MTPint _id) { - return MTPupdate(new MTPDupdateChannelPinnedMessage(_channel_id, _id)); + return MTP::internal::TypeCreator::new_updateChannelPinnedMessage(_channel_id, _id); } inline MTPupdates_state::MTPupdates_state() : mtpDataOwner(new MTPDupdates_state()) { @@ -26587,7 +27893,7 @@ inline void MTPupdates_state::write(mtpBuffer &to) const { inline MTPupdates_state::MTPupdates_state(MTPDupdates_state *_data) : mtpDataOwner(_data) { } inline MTPupdates_state MTP_updates_state(MTPint _pts, MTPint _qts, MTPint _date, MTPint _seq, MTPint _unread_count) { - return MTPupdates_state(new MTPDupdates_state(_pts, _qts, _date, _seq, _unread_count)); + return MTP::internal::TypeCreator::new_updates_state(_pts, _qts, _date, _seq, _unread_count); } inline uint32 MTPupdates_difference::innerLength() const { @@ -26685,13 +27991,13 @@ inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_difference *_dat inline MTPupdates_difference::MTPupdates_difference(MTPDupdates_differenceSlice *_data) : mtpDataOwner(_data), _type(mtpc_updates_differenceSlice) { } inline MTPupdates_difference MTP_updates_differenceEmpty(MTPint _date, MTPint _seq) { - return MTPupdates_difference(new MTPDupdates_differenceEmpty(_date, _seq)); + return MTP::internal::TypeCreator::new_updates_differenceEmpty(_date, _seq); } inline MTPupdates_difference MTP_updates_difference(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_state) { - return MTPupdates_difference(new MTPDupdates_difference(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _state)); + return MTP::internal::TypeCreator::new_updates_difference(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _state); } inline MTPupdates_difference MTP_updates_differenceSlice(const MTPVector &_new_messages, const MTPVector &_new_encrypted_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users, const MTPupdates_State &_intermediate_state) { - return MTPupdates_difference(new MTPDupdates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state)); + return MTP::internal::TypeCreator::new_updates_differenceSlice(_new_messages, _new_encrypted_messages, _other_updates, _chats, _users, _intermediate_state); } inline uint32 MTPupdates::innerLength() const { @@ -26891,25 +28197,28 @@ inline MTPupdates::MTPupdates(MTPDupdates *_data) : mtpDataOwner(_data), _type(m inline MTPupdates::MTPupdates(MTPDupdateShortSentMessage *_data) : mtpDataOwner(_data), _type(mtpc_updateShortSentMessage) { } inline MTPupdates MTP_updatesTooLong() { - return MTPupdates(mtpc_updatesTooLong); + return MTP::internal::TypeCreator::new_updatesTooLong(); } -inline MTPupdates MTP_updateShortMessage(MTPint _flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortMessage(_flags, _id, _user_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateShortMessage::Flags) +inline MTPupdates MTP_updateShortMessage(const MTPflags &_flags, MTPint _id, MTPint _user_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { + return MTP::internal::TypeCreator::new_updateShortMessage(_flags, _id, _user_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities); } -inline MTPupdates MTP_updateShortChatMessage(MTPint _flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortChatMessage(_flags, _id, _from_id, _chat_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateShortChatMessage::Flags) +inline MTPupdates MTP_updateShortChatMessage(const MTPflags &_flags, MTPint _id, MTPint _from_id, MTPint _chat_id, const MTPstring &_message, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageFwdHeader &_fwd_from, MTPint _via_bot_id, MTPint _reply_to_msg_id, const MTPVector &_entities) { + return MTP::internal::TypeCreator::new_updateShortChatMessage(_flags, _id, _from_id, _chat_id, _message, _pts, _pts_count, _date, _fwd_from, _via_bot_id, _reply_to_msg_id, _entities); } inline MTPupdates MTP_updateShort(const MTPUpdate &_update, MTPint _date) { - return MTPupdates(new MTPDupdateShort(_update, _date)); + return MTP::internal::TypeCreator::new_updateShort(_update, _date); } inline MTPupdates MTP_updatesCombined(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq_start, MTPint _seq) { - return MTPupdates(new MTPDupdatesCombined(_updates, _users, _chats, _date, _seq_start, _seq)); + return MTP::internal::TypeCreator::new_updatesCombined(_updates, _users, _chats, _date, _seq_start, _seq); } inline MTPupdates MTP_updates(const MTPVector &_updates, const MTPVector &_users, const MTPVector &_chats, MTPint _date, MTPint _seq) { - return MTPupdates(new MTPDupdates(_updates, _users, _chats, _date, _seq)); + return MTP::internal::TypeCreator::new_updates(_updates, _users, _chats, _date, _seq); } -inline MTPupdates MTP_updateShortSentMessage(MTPint _flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) { - return MTPupdates(new MTPDupdateShortSentMessage(_flags, _id, _pts, _pts_count, _date, _media, _entities)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdateShortSentMessage::Flags) +inline MTPupdates MTP_updateShortSentMessage(const MTPflags &_flags, MTPint _id, MTPint _pts, MTPint _pts_count, MTPint _date, const MTPMessageMedia &_media, const MTPVector &_entities) { + return MTP::internal::TypeCreator::new_updateShortSentMessage(_flags, _id, _pts, _pts_count, _date, _media, _entities); } inline uint32 MTPphotos_photos::innerLength() const { @@ -26975,10 +28284,10 @@ inline MTPphotos_photos::MTPphotos_photos(MTPDphotos_photos *_data) : mtpDataOwn inline MTPphotos_photos::MTPphotos_photos(MTPDphotos_photosSlice *_data) : mtpDataOwner(_data), _type(mtpc_photos_photosSlice) { } inline MTPphotos_photos MTP_photos_photos(const MTPVector &_photos, const MTPVector &_users) { - return MTPphotos_photos(new MTPDphotos_photos(_photos, _users)); + return MTP::internal::TypeCreator::new_photos_photos(_photos, _users); } inline MTPphotos_photos MTP_photos_photosSlice(MTPint _count, const MTPVector &_photos, const MTPVector &_users) { - return MTPphotos_photos(new MTPDphotos_photosSlice(_count, _photos, _users)); + return MTP::internal::TypeCreator::new_photos_photosSlice(_count, _photos, _users); } inline MTPphotos_photo::MTPphotos_photo() : mtpDataOwner(new MTPDphotos_photo()) { @@ -27007,7 +28316,7 @@ inline void MTPphotos_photo::write(mtpBuffer &to) const { inline MTPphotos_photo::MTPphotos_photo(MTPDphotos_photo *_data) : mtpDataOwner(_data) { } inline MTPphotos_photo MTP_photos_photo(const MTPPhoto &_photo, const MTPVector &_users) { - return MTPphotos_photo(new MTPDphotos_photo(_photo, _users)); + return MTP::internal::TypeCreator::new_photos_photo(_photo, _users); } inline MTPupload_file::MTPupload_file() : mtpDataOwner(new MTPDupload_file()) { @@ -27038,7 +28347,7 @@ inline void MTPupload_file::write(mtpBuffer &to) const { inline MTPupload_file::MTPupload_file(MTPDupload_file *_data) : mtpDataOwner(_data) { } inline MTPupload_file MTP_upload_file(const MTPstorage_FileType &_type, MTPint _mtime, const MTPbytes &_bytes) { - return MTPupload_file(new MTPDupload_file(_type, _mtime, _bytes)); + return MTP::internal::TypeCreator::new_upload_file(_type, _mtime, _bytes); } inline MTPdcOption::MTPdcOption() : mtpDataOwner(new MTPDdcOption()) { @@ -27070,8 +28379,9 @@ inline void MTPdcOption::write(mtpBuffer &to) const { } inline MTPdcOption::MTPdcOption(MTPDdcOption *_data) : mtpDataOwner(_data) { } -inline MTPdcOption MTP_dcOption(MTPint _flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { - return MTPdcOption(new MTPDdcOption(_flags, _id, _ip_address, _port)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDdcOption::Flags) +inline MTPdcOption MTP_dcOption(const MTPflags &_flags, MTPint _id, const MTPstring &_ip_address, MTPint _port) { + return MTP::internal::TypeCreator::new_dcOption(_flags, _id, _ip_address, _port); } inline MTPconfig::MTPconfig() : mtpDataOwner(new MTPDconfig()) { @@ -27136,7 +28446,7 @@ inline void MTPconfig::write(mtpBuffer &to) const { inline MTPconfig::MTPconfig(MTPDconfig *_data) : mtpDataOwner(_data) { } inline MTPconfig MTP_config(MTPint _date, MTPint _expires, MTPBool _test_mode, MTPint _this_dc, const MTPVector &_dc_options, MTPint _chat_size_max, MTPint _megagroup_size_max, MTPint _forwarded_count_max, MTPint _online_update_period_ms, MTPint _offline_blur_timeout_ms, MTPint _offline_idle_timeout_ms, MTPint _online_cloud_timeout_ms, MTPint _notify_cloud_delay_ms, MTPint _notify_default_delay_ms, MTPint _chat_big_size, MTPint _push_chat_period_ms, MTPint _push_chat_limit, MTPint _saved_gifs_limit, MTPint _edit_time_limit, const MTPVector &_disabled_features) { - return MTPconfig(new MTPDconfig(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _disabled_features)); + return MTP::internal::TypeCreator::new_config(_date, _expires, _test_mode, _this_dc, _dc_options, _chat_size_max, _megagroup_size_max, _forwarded_count_max, _online_update_period_ms, _offline_blur_timeout_ms, _offline_idle_timeout_ms, _online_cloud_timeout_ms, _notify_cloud_delay_ms, _notify_default_delay_ms, _chat_big_size, _push_chat_period_ms, _push_chat_limit, _saved_gifs_limit, _edit_time_limit, _disabled_features); } inline MTPnearestDc::MTPnearestDc() : mtpDataOwner(new MTPDnearestDc()) { @@ -27167,7 +28477,7 @@ inline void MTPnearestDc::write(mtpBuffer &to) const { inline MTPnearestDc::MTPnearestDc(MTPDnearestDc *_data) : mtpDataOwner(_data) { } inline MTPnearestDc MTP_nearestDc(const MTPstring &_country, MTPint _this_dc, MTPint _nearest_dc) { - return MTPnearestDc(new MTPDnearestDc(_country, _this_dc, _nearest_dc)); + return MTP::internal::TypeCreator::new_nearestDc(_country, _this_dc, _nearest_dc); } inline uint32 MTPhelp_appUpdate::innerLength() const { @@ -27219,10 +28529,10 @@ inline MTPhelp_appUpdate::MTPhelp_appUpdate(mtpTypeId type) : mtpDataOwner(0), _ inline MTPhelp_appUpdate::MTPhelp_appUpdate(MTPDhelp_appUpdate *_data) : mtpDataOwner(_data), _type(mtpc_help_appUpdate) { } inline MTPhelp_appUpdate MTP_help_appUpdate(MTPint _id, MTPBool _critical, const MTPstring &_url, const MTPstring &_text) { - return MTPhelp_appUpdate(new MTPDhelp_appUpdate(_id, _critical, _url, _text)); + return MTP::internal::TypeCreator::new_help_appUpdate(_id, _critical, _url, _text); } inline MTPhelp_appUpdate MTP_help_noAppUpdate() { - return MTPhelp_appUpdate(mtpc_help_noAppUpdate); + return MTP::internal::TypeCreator::new_help_noAppUpdate(); } inline MTPhelp_inviteText::MTPhelp_inviteText() : mtpDataOwner(new MTPDhelp_inviteText()) { @@ -27249,7 +28559,7 @@ inline void MTPhelp_inviteText::write(mtpBuffer &to) const { inline MTPhelp_inviteText::MTPhelp_inviteText(MTPDhelp_inviteText *_data) : mtpDataOwner(_data) { } inline MTPhelp_inviteText MTP_help_inviteText(const MTPstring &_message) { - return MTPhelp_inviteText(new MTPDhelp_inviteText(_message)); + return MTP::internal::TypeCreator::new_help_inviteText(_message); } inline uint32 MTPencryptedChat::innerLength() const { @@ -27387,19 +28697,19 @@ inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChat *_data) : mtpDataOwn inline MTPencryptedChat::MTPencryptedChat(MTPDencryptedChatDiscarded *_data) : mtpDataOwner(_data), _type(mtpc_encryptedChatDiscarded) { } inline MTPencryptedChat MTP_encryptedChatEmpty(MTPint _id) { - return MTPencryptedChat(new MTPDencryptedChatEmpty(_id)); + return MTP::internal::TypeCreator::new_encryptedChatEmpty(_id); } inline MTPencryptedChat MTP_encryptedChatWaiting(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id) { - return MTPencryptedChat(new MTPDencryptedChatWaiting(_id, _access_hash, _date, _admin_id, _participant_id)); + return MTP::internal::TypeCreator::new_encryptedChatWaiting(_id, _access_hash, _date, _admin_id, _participant_id); } inline MTPencryptedChat MTP_encryptedChatRequested(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a) { - return MTPencryptedChat(new MTPDencryptedChatRequested(_id, _access_hash, _date, _admin_id, _participant_id, _g_a)); + return MTP::internal::TypeCreator::new_encryptedChatRequested(_id, _access_hash, _date, _admin_id, _participant_id, _g_a); } inline MTPencryptedChat MTP_encryptedChat(MTPint _id, const MTPlong &_access_hash, MTPint _date, MTPint _admin_id, MTPint _participant_id, const MTPbytes &_g_a_or_b, const MTPlong &_key_fingerprint) { - return MTPencryptedChat(new MTPDencryptedChat(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint)); + return MTP::internal::TypeCreator::new_encryptedChat(_id, _access_hash, _date, _admin_id, _participant_id, _g_a_or_b, _key_fingerprint); } inline MTPencryptedChat MTP_encryptedChatDiscarded(MTPint _id) { - return MTPencryptedChat(new MTPDencryptedChatDiscarded(_id)); + return MTP::internal::TypeCreator::new_encryptedChatDiscarded(_id); } inline MTPinputEncryptedChat::MTPinputEncryptedChat() : mtpDataOwner(new MTPDinputEncryptedChat()) { @@ -27428,7 +28738,7 @@ inline void MTPinputEncryptedChat::write(mtpBuffer &to) const { inline MTPinputEncryptedChat::MTPinputEncryptedChat(MTPDinputEncryptedChat *_data) : mtpDataOwner(_data) { } inline MTPinputEncryptedChat MTP_inputEncryptedChat(MTPint _chat_id, const MTPlong &_access_hash) { - return MTPinputEncryptedChat(new MTPDinputEncryptedChat(_chat_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputEncryptedChat(_chat_id, _access_hash); } inline uint32 MTPencryptedFile::innerLength() const { @@ -27482,10 +28792,10 @@ inline MTPencryptedFile::MTPencryptedFile(mtpTypeId type) : mtpDataOwner(0), _ty inline MTPencryptedFile::MTPencryptedFile(MTPDencryptedFile *_data) : mtpDataOwner(_data), _type(mtpc_encryptedFile) { } inline MTPencryptedFile MTP_encryptedFileEmpty() { - return MTPencryptedFile(mtpc_encryptedFileEmpty); + return MTP::internal::TypeCreator::new_encryptedFileEmpty(); } inline MTPencryptedFile MTP_encryptedFile(const MTPlong &_id, const MTPlong &_access_hash, MTPint _size, MTPint _dc_id, MTPint _key_fingerprint) { - return MTPencryptedFile(new MTPDencryptedFile(_id, _access_hash, _size, _dc_id, _key_fingerprint)); + return MTP::internal::TypeCreator::new_encryptedFile(_id, _access_hash, _size, _dc_id, _key_fingerprint); } inline uint32 MTPinputEncryptedFile::innerLength() const { @@ -27575,16 +28885,16 @@ inline MTPinputEncryptedFile::MTPinputEncryptedFile(MTPDinputEncryptedFile *_dat inline MTPinputEncryptedFile::MTPinputEncryptedFile(MTPDinputEncryptedFileBigUploaded *_data) : mtpDataOwner(_data), _type(mtpc_inputEncryptedFileBigUploaded) { } inline MTPinputEncryptedFile MTP_inputEncryptedFileEmpty() { - return MTPinputEncryptedFile(mtpc_inputEncryptedFileEmpty); + return MTP::internal::TypeCreator::new_inputEncryptedFileEmpty(); } inline MTPinputEncryptedFile MTP_inputEncryptedFileUploaded(const MTPlong &_id, MTPint _parts, const MTPstring &_md5_checksum, MTPint _key_fingerprint) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFileUploaded(_id, _parts, _md5_checksum, _key_fingerprint)); + return MTP::internal::TypeCreator::new_inputEncryptedFileUploaded(_id, _parts, _md5_checksum, _key_fingerprint); } inline MTPinputEncryptedFile MTP_inputEncryptedFile(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFile(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputEncryptedFile(_id, _access_hash); } inline MTPinputEncryptedFile MTP_inputEncryptedFileBigUploaded(const MTPlong &_id, MTPint _parts, MTPint _key_fingerprint) { - return MTPinputEncryptedFile(new MTPDinputEncryptedFileBigUploaded(_id, _parts, _key_fingerprint)); + return MTP::internal::TypeCreator::new_inputEncryptedFileBigUploaded(_id, _parts, _key_fingerprint); } inline uint32 MTPencryptedMessage::innerLength() const { @@ -27658,10 +28968,10 @@ inline MTPencryptedMessage::MTPencryptedMessage(MTPDencryptedMessage *_data) : m inline MTPencryptedMessage::MTPencryptedMessage(MTPDencryptedMessageService *_data) : mtpDataOwner(_data), _type(mtpc_encryptedMessageService) { } inline MTPencryptedMessage MTP_encryptedMessage(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes, const MTPEncryptedFile &_file) { - return MTPencryptedMessage(new MTPDencryptedMessage(_random_id, _chat_id, _date, _bytes, _file)); + return MTP::internal::TypeCreator::new_encryptedMessage(_random_id, _chat_id, _date, _bytes, _file); } inline MTPencryptedMessage MTP_encryptedMessageService(const MTPlong &_random_id, MTPint _chat_id, MTPint _date, const MTPbytes &_bytes) { - return MTPencryptedMessage(new MTPDencryptedMessageService(_random_id, _chat_id, _date, _bytes)); + return MTP::internal::TypeCreator::new_encryptedMessageService(_random_id, _chat_id, _date, _bytes); } inline uint32 MTPmessages_dhConfig::innerLength() const { @@ -27727,10 +29037,10 @@ inline MTPmessages_dhConfig::MTPmessages_dhConfig(MTPDmessages_dhConfigNotModifi inline MTPmessages_dhConfig::MTPmessages_dhConfig(MTPDmessages_dhConfig *_data) : mtpDataOwner(_data), _type(mtpc_messages_dhConfig) { } inline MTPmessages_dhConfig MTP_messages_dhConfigNotModified(const MTPbytes &_random) { - return MTPmessages_dhConfig(new MTPDmessages_dhConfigNotModified(_random)); + return MTP::internal::TypeCreator::new_messages_dhConfigNotModified(_random); } inline MTPmessages_dhConfig MTP_messages_dhConfig(MTPint _g, const MTPbytes &_p, MTPint _version, const MTPbytes &_random) { - return MTPmessages_dhConfig(new MTPDmessages_dhConfig(_g, _p, _version, _random)); + return MTP::internal::TypeCreator::new_messages_dhConfig(_g, _p, _version, _random); } inline uint32 MTPmessages_sentEncryptedMessage::innerLength() const { @@ -27792,10 +29102,10 @@ inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(MTPDme inline MTPmessages_sentEncryptedMessage::MTPmessages_sentEncryptedMessage(MTPDmessages_sentEncryptedFile *_data) : mtpDataOwner(_data), _type(mtpc_messages_sentEncryptedFile) { } inline MTPmessages_sentEncryptedMessage MTP_messages_sentEncryptedMessage(MTPint _date) { - return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedMessage(_date)); + return MTP::internal::TypeCreator::new_messages_sentEncryptedMessage(_date); } inline MTPmessages_sentEncryptedMessage MTP_messages_sentEncryptedFile(MTPint _date, const MTPEncryptedFile &_file) { - return MTPmessages_sentEncryptedMessage(new MTPDmessages_sentEncryptedFile(_date, _file)); + return MTP::internal::TypeCreator::new_messages_sentEncryptedFile(_date, _file); } inline uint32 MTPinputDocument::innerLength() const { @@ -27843,10 +29153,10 @@ inline MTPinputDocument::MTPinputDocument(mtpTypeId type) : mtpDataOwner(0), _ty inline MTPinputDocument::MTPinputDocument(MTPDinputDocument *_data) : mtpDataOwner(_data), _type(mtpc_inputDocument) { } inline MTPinputDocument MTP_inputDocumentEmpty() { - return MTPinputDocument(mtpc_inputDocumentEmpty); + return MTP::internal::TypeCreator::new_inputDocumentEmpty(); } inline MTPinputDocument MTP_inputDocument(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputDocument(new MTPDinputDocument(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputDocument(_id, _access_hash); } inline uint32 MTPdocument::innerLength() const { @@ -27920,10 +29230,10 @@ inline MTPdocument::MTPdocument(MTPDdocumentEmpty *_data) : mtpDataOwner(_data), inline MTPdocument::MTPdocument(MTPDdocument *_data) : mtpDataOwner(_data), _type(mtpc_document) { } inline MTPdocument MTP_documentEmpty(const MTPlong &_id) { - return MTPdocument(new MTPDdocumentEmpty(_id)); + return MTP::internal::TypeCreator::new_documentEmpty(_id); } inline MTPdocument MTP_document(const MTPlong &_id, const MTPlong &_access_hash, MTPint _date, const MTPstring &_mime_type, MTPint _size, const MTPPhotoSize &_thumb, MTPint _dc_id, const MTPVector &_attributes) { - return MTPdocument(new MTPDdocument(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _attributes)); + return MTP::internal::TypeCreator::new_document(_id, _access_hash, _date, _mime_type, _size, _thumb, _dc_id, _attributes); } inline MTPhelp_support::MTPhelp_support() : mtpDataOwner(new MTPDhelp_support()) { @@ -27952,7 +29262,7 @@ inline void MTPhelp_support::write(mtpBuffer &to) const { inline MTPhelp_support::MTPhelp_support(MTPDhelp_support *_data) : mtpDataOwner(_data) { } inline MTPhelp_support MTP_help_support(const MTPstring &_phone_number, const MTPUser &_user) { - return MTPhelp_support(new MTPDhelp_support(_phone_number, _user)); + return MTP::internal::TypeCreator::new_help_support(_phone_number, _user); } inline uint32 MTPnotifyPeer::innerLength() const { @@ -28002,16 +29312,16 @@ inline MTPnotifyPeer::MTPnotifyPeer(mtpTypeId type) : mtpDataOwner(0), _type(typ inline MTPnotifyPeer::MTPnotifyPeer(MTPDnotifyPeer *_data) : mtpDataOwner(_data), _type(mtpc_notifyPeer) { } inline MTPnotifyPeer MTP_notifyPeer(const MTPPeer &_peer) { - return MTPnotifyPeer(new MTPDnotifyPeer(_peer)); + return MTP::internal::TypeCreator::new_notifyPeer(_peer); } inline MTPnotifyPeer MTP_notifyUsers() { - return MTPnotifyPeer(mtpc_notifyUsers); + return MTP::internal::TypeCreator::new_notifyUsers(); } inline MTPnotifyPeer MTP_notifyChats() { - return MTPnotifyPeer(mtpc_notifyChats); + return MTP::internal::TypeCreator::new_notifyChats(); } inline MTPnotifyPeer MTP_notifyAll() { - return MTPnotifyPeer(mtpc_notifyAll); + return MTP::internal::TypeCreator::new_notifyAll(); } inline uint32 MTPsendMessageAction::innerLength() const { @@ -28115,34 +29425,34 @@ inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadPhotoActi inline MTPsendMessageAction::MTPsendMessageAction(MTPDsendMessageUploadDocumentAction *_data) : mtpDataOwner(_data), _type(mtpc_sendMessageUploadDocumentAction) { } inline MTPsendMessageAction MTP_sendMessageTypingAction() { - return MTPsendMessageAction(mtpc_sendMessageTypingAction); + return MTP::internal::TypeCreator::new_sendMessageTypingAction(); } inline MTPsendMessageAction MTP_sendMessageCancelAction() { - return MTPsendMessageAction(mtpc_sendMessageCancelAction); + return MTP::internal::TypeCreator::new_sendMessageCancelAction(); } inline MTPsendMessageAction MTP_sendMessageRecordVideoAction() { - return MTPsendMessageAction(mtpc_sendMessageRecordVideoAction); + return MTP::internal::TypeCreator::new_sendMessageRecordVideoAction(); } inline MTPsendMessageAction MTP_sendMessageUploadVideoAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadVideoAction(_progress)); + return MTP::internal::TypeCreator::new_sendMessageUploadVideoAction(_progress); } inline MTPsendMessageAction MTP_sendMessageRecordAudioAction() { - return MTPsendMessageAction(mtpc_sendMessageRecordAudioAction); + return MTP::internal::TypeCreator::new_sendMessageRecordAudioAction(); } inline MTPsendMessageAction MTP_sendMessageUploadAudioAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadAudioAction(_progress)); + return MTP::internal::TypeCreator::new_sendMessageUploadAudioAction(_progress); } inline MTPsendMessageAction MTP_sendMessageUploadPhotoAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadPhotoAction(_progress)); + return MTP::internal::TypeCreator::new_sendMessageUploadPhotoAction(_progress); } inline MTPsendMessageAction MTP_sendMessageUploadDocumentAction(MTPint _progress) { - return MTPsendMessageAction(new MTPDsendMessageUploadDocumentAction(_progress)); + return MTP::internal::TypeCreator::new_sendMessageUploadDocumentAction(_progress); } inline MTPsendMessageAction MTP_sendMessageGeoLocationAction() { - return MTPsendMessageAction(mtpc_sendMessageGeoLocationAction); + return MTP::internal::TypeCreator::new_sendMessageGeoLocationAction(); } inline MTPsendMessageAction MTP_sendMessageChooseContactAction() { - return MTPsendMessageAction(mtpc_sendMessageChooseContactAction); + return MTP::internal::TypeCreator::new_sendMessageChooseContactAction(); } inline MTPcontacts_found::MTPcontacts_found() : mtpDataOwner(new MTPDcontacts_found()) { @@ -28173,7 +29483,7 @@ inline void MTPcontacts_found::write(mtpBuffer &to) const { inline MTPcontacts_found::MTPcontacts_found(MTPDcontacts_found *_data) : mtpDataOwner(_data) { } inline MTPcontacts_found MTP_contacts_found(const MTPVector &_results, const MTPVector &_chats, const MTPVector &_users) { - return MTPcontacts_found(new MTPDcontacts_found(_results, _chats, _users)); + return MTP::internal::TypeCreator::new_contacts_found(_results, _chats, _users); } inline uint32 MTPinputPrivacyKey::innerLength() const { @@ -28191,8 +29501,6 @@ inline void MTPinputPrivacyKey::read(const mtpPrime *&from, const mtpPrime *end, } } inline void MTPinputPrivacyKey::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPinputPrivacyKey::MTPinputPrivacyKey(mtpTypeId type) : _type(type) { switch (type) { @@ -28202,10 +29510,10 @@ inline MTPinputPrivacyKey::MTPinputPrivacyKey(mtpTypeId type) : _type(type) { } } inline MTPinputPrivacyKey MTP_inputPrivacyKeyStatusTimestamp() { - return MTPinputPrivacyKey(mtpc_inputPrivacyKeyStatusTimestamp); + return MTP::internal::TypeCreator::new_inputPrivacyKeyStatusTimestamp(); } inline MTPinputPrivacyKey MTP_inputPrivacyKeyChatInvite() { - return MTPinputPrivacyKey(mtpc_inputPrivacyKeyChatInvite); + return MTP::internal::TypeCreator::new_inputPrivacyKeyChatInvite(); } inline uint32 MTPprivacyKey::innerLength() const { @@ -28223,8 +29531,6 @@ inline void MTPprivacyKey::read(const mtpPrime *&from, const mtpPrime *end, mtpT } } inline void MTPprivacyKey::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPprivacyKey::MTPprivacyKey(mtpTypeId type) : _type(type) { switch (type) { @@ -28234,10 +29540,10 @@ inline MTPprivacyKey::MTPprivacyKey(mtpTypeId type) : _type(type) { } } inline MTPprivacyKey MTP_privacyKeyStatusTimestamp() { - return MTPprivacyKey(mtpc_privacyKeyStatusTimestamp); + return MTP::internal::TypeCreator::new_privacyKeyStatusTimestamp(); } inline MTPprivacyKey MTP_privacyKeyChatInvite() { - return MTPprivacyKey(mtpc_privacyKeyChatInvite); + return MTP::internal::TypeCreator::new_privacyKeyChatInvite(); } inline uint32 MTPinputPrivacyRule::innerLength() const { @@ -28305,22 +29611,22 @@ inline MTPinputPrivacyRule::MTPinputPrivacyRule(MTPDinputPrivacyValueAllowUsers inline MTPinputPrivacyRule::MTPinputPrivacyRule(MTPDinputPrivacyValueDisallowUsers *_data) : mtpDataOwner(_data), _type(mtpc_inputPrivacyValueDisallowUsers) { } inline MTPinputPrivacyRule MTP_inputPrivacyValueAllowContacts() { - return MTPinputPrivacyRule(mtpc_inputPrivacyValueAllowContacts); + return MTP::internal::TypeCreator::new_inputPrivacyValueAllowContacts(); } inline MTPinputPrivacyRule MTP_inputPrivacyValueAllowAll() { - return MTPinputPrivacyRule(mtpc_inputPrivacyValueAllowAll); + return MTP::internal::TypeCreator::new_inputPrivacyValueAllowAll(); } inline MTPinputPrivacyRule MTP_inputPrivacyValueAllowUsers(const MTPVector &_users) { - return MTPinputPrivacyRule(new MTPDinputPrivacyValueAllowUsers(_users)); + return MTP::internal::TypeCreator::new_inputPrivacyValueAllowUsers(_users); } inline MTPinputPrivacyRule MTP_inputPrivacyValueDisallowContacts() { - return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowContacts); + return MTP::internal::TypeCreator::new_inputPrivacyValueDisallowContacts(); } inline MTPinputPrivacyRule MTP_inputPrivacyValueDisallowAll() { - return MTPinputPrivacyRule(mtpc_inputPrivacyValueDisallowAll); + return MTP::internal::TypeCreator::new_inputPrivacyValueDisallowAll(); } inline MTPinputPrivacyRule MTP_inputPrivacyValueDisallowUsers(const MTPVector &_users) { - return MTPinputPrivacyRule(new MTPDinputPrivacyValueDisallowUsers(_users)); + return MTP::internal::TypeCreator::new_inputPrivacyValueDisallowUsers(_users); } inline uint32 MTPprivacyRule::innerLength() const { @@ -28388,22 +29694,22 @@ inline MTPprivacyRule::MTPprivacyRule(MTPDprivacyValueAllowUsers *_data) : mtpDa inline MTPprivacyRule::MTPprivacyRule(MTPDprivacyValueDisallowUsers *_data) : mtpDataOwner(_data), _type(mtpc_privacyValueDisallowUsers) { } inline MTPprivacyRule MTP_privacyValueAllowContacts() { - return MTPprivacyRule(mtpc_privacyValueAllowContacts); + return MTP::internal::TypeCreator::new_privacyValueAllowContacts(); } inline MTPprivacyRule MTP_privacyValueAllowAll() { - return MTPprivacyRule(mtpc_privacyValueAllowAll); + return MTP::internal::TypeCreator::new_privacyValueAllowAll(); } inline MTPprivacyRule MTP_privacyValueAllowUsers(const MTPVector &_users) { - return MTPprivacyRule(new MTPDprivacyValueAllowUsers(_users)); + return MTP::internal::TypeCreator::new_privacyValueAllowUsers(_users); } inline MTPprivacyRule MTP_privacyValueDisallowContacts() { - return MTPprivacyRule(mtpc_privacyValueDisallowContacts); + return MTP::internal::TypeCreator::new_privacyValueDisallowContacts(); } inline MTPprivacyRule MTP_privacyValueDisallowAll() { - return MTPprivacyRule(mtpc_privacyValueDisallowAll); + return MTP::internal::TypeCreator::new_privacyValueDisallowAll(); } inline MTPprivacyRule MTP_privacyValueDisallowUsers(const MTPVector &_users) { - return MTPprivacyRule(new MTPDprivacyValueDisallowUsers(_users)); + return MTP::internal::TypeCreator::new_privacyValueDisallowUsers(_users); } inline MTPaccount_privacyRules::MTPaccount_privacyRules() : mtpDataOwner(new MTPDaccount_privacyRules()) { @@ -28432,7 +29738,7 @@ inline void MTPaccount_privacyRules::write(mtpBuffer &to) const { inline MTPaccount_privacyRules::MTPaccount_privacyRules(MTPDaccount_privacyRules *_data) : mtpDataOwner(_data) { } inline MTPaccount_privacyRules MTP_account_privacyRules(const MTPVector &_rules, const MTPVector &_users) { - return MTPaccount_privacyRules(new MTPDaccount_privacyRules(_rules, _users)); + return MTP::internal::TypeCreator::new_account_privacyRules(_rules, _users); } inline MTPaccountDaysTTL::MTPaccountDaysTTL() : mtpDataOwner(new MTPDaccountDaysTTL()) { @@ -28459,36 +29765,7 @@ inline void MTPaccountDaysTTL::write(mtpBuffer &to) const { inline MTPaccountDaysTTL::MTPaccountDaysTTL(MTPDaccountDaysTTL *_data) : mtpDataOwner(_data) { } inline MTPaccountDaysTTL MTP_accountDaysTTL(MTPint _days) { - return MTPaccountDaysTTL(new MTPDaccountDaysTTL(_days)); -} - -inline MTPaccount_sentChangePhoneCode::MTPaccount_sentChangePhoneCode() : mtpDataOwner(new MTPDaccount_sentChangePhoneCode()) { -} - -inline uint32 MTPaccount_sentChangePhoneCode::innerLength() const { - const MTPDaccount_sentChangePhoneCode &v(c_account_sentChangePhoneCode()); - return v.vphone_code_hash.innerLength() + v.vsend_call_timeout.innerLength(); -} -inline mtpTypeId MTPaccount_sentChangePhoneCode::type() const { - return mtpc_account_sentChangePhoneCode; -} -inline void MTPaccount_sentChangePhoneCode::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { - if (cons != mtpc_account_sentChangePhoneCode) throw mtpErrorUnexpected(cons, "MTPaccount_sentChangePhoneCode"); - - if (!data) setData(new MTPDaccount_sentChangePhoneCode()); - MTPDaccount_sentChangePhoneCode &v(_account_sentChangePhoneCode()); - v.vphone_code_hash.read(from, end); - v.vsend_call_timeout.read(from, end); -} -inline void MTPaccount_sentChangePhoneCode::write(mtpBuffer &to) const { - const MTPDaccount_sentChangePhoneCode &v(c_account_sentChangePhoneCode()); - v.vphone_code_hash.write(to); - v.vsend_call_timeout.write(to); -} -inline MTPaccount_sentChangePhoneCode::MTPaccount_sentChangePhoneCode(MTPDaccount_sentChangePhoneCode *_data) : mtpDataOwner(_data) { -} -inline MTPaccount_sentChangePhoneCode MTP_account_sentChangePhoneCode(const MTPstring &_phone_code_hash, MTPint _send_call_timeout) { - return MTPaccount_sentChangePhoneCode(new MTPDaccount_sentChangePhoneCode(_phone_code_hash, _send_call_timeout)); + return MTP::internal::TypeCreator::new_accountDaysTTL(_days); } inline uint32 MTPdocumentAttribute::innerLength() const { @@ -28614,22 +29891,23 @@ inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeAudio *_d inline MTPdocumentAttribute::MTPdocumentAttribute(MTPDdocumentAttributeFilename *_data) : mtpDataOwner(_data), _type(mtpc_documentAttributeFilename) { } inline MTPdocumentAttribute MTP_documentAttributeImageSize(MTPint _w, MTPint _h) { - return MTPdocumentAttribute(new MTPDdocumentAttributeImageSize(_w, _h)); + return MTP::internal::TypeCreator::new_documentAttributeImageSize(_w, _h); } inline MTPdocumentAttribute MTP_documentAttributeAnimated() { - return MTPdocumentAttribute(mtpc_documentAttributeAnimated); + return MTP::internal::TypeCreator::new_documentAttributeAnimated(); } inline MTPdocumentAttribute MTP_documentAttributeSticker(const MTPstring &_alt, const MTPInputStickerSet &_stickerset) { - return MTPdocumentAttribute(new MTPDdocumentAttributeSticker(_alt, _stickerset)); + return MTP::internal::TypeCreator::new_documentAttributeSticker(_alt, _stickerset); } inline MTPdocumentAttribute MTP_documentAttributeVideo(MTPint _duration, MTPint _w, MTPint _h) { - return MTPdocumentAttribute(new MTPDdocumentAttributeVideo(_duration, _w, _h)); + return MTP::internal::TypeCreator::new_documentAttributeVideo(_duration, _w, _h); } -inline MTPdocumentAttribute MTP_documentAttributeAudio(MTPint _flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) { - return MTPdocumentAttribute(new MTPDdocumentAttributeAudio(_flags, _duration, _title, _performer, _waveform)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDdocumentAttributeAudio::Flags) +inline MTPdocumentAttribute MTP_documentAttributeAudio(const MTPflags &_flags, MTPint _duration, const MTPstring &_title, const MTPstring &_performer, const MTPbytes &_waveform) { + return MTP::internal::TypeCreator::new_documentAttributeAudio(_flags, _duration, _title, _performer, _waveform); } inline MTPdocumentAttribute MTP_documentAttributeFilename(const MTPstring &_file_name) { - return MTPdocumentAttribute(new MTPDdocumentAttributeFilename(_file_name)); + return MTP::internal::TypeCreator::new_documentAttributeFilename(_file_name); } inline uint32 MTPmessages_stickers::innerLength() const { @@ -28677,10 +29955,10 @@ inline MTPmessages_stickers::MTPmessages_stickers(mtpTypeId type) : mtpDataOwner inline MTPmessages_stickers::MTPmessages_stickers(MTPDmessages_stickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_stickers) { } inline MTPmessages_stickers MTP_messages_stickersNotModified() { - return MTPmessages_stickers(mtpc_messages_stickersNotModified); + return MTP::internal::TypeCreator::new_messages_stickersNotModified(); } inline MTPmessages_stickers MTP_messages_stickers(const MTPstring &_hash, const MTPVector &_stickers) { - return MTPmessages_stickers(new MTPDmessages_stickers(_hash, _stickers)); + return MTP::internal::TypeCreator::new_messages_stickers(_hash, _stickers); } inline MTPstickerPack::MTPstickerPack() : mtpDataOwner(new MTPDstickerPack()) { @@ -28709,7 +29987,7 @@ inline void MTPstickerPack::write(mtpBuffer &to) const { inline MTPstickerPack::MTPstickerPack(MTPDstickerPack *_data) : mtpDataOwner(_data) { } inline MTPstickerPack MTP_stickerPack(const MTPstring &_emoticon, const MTPVector &_documents) { - return MTPstickerPack(new MTPDstickerPack(_emoticon, _documents)); + return MTP::internal::TypeCreator::new_stickerPack(_emoticon, _documents); } inline uint32 MTPmessages_allStickers::innerLength() const { @@ -28757,10 +30035,10 @@ inline MTPmessages_allStickers::MTPmessages_allStickers(mtpTypeId type) : mtpDat inline MTPmessages_allStickers::MTPmessages_allStickers(MTPDmessages_allStickers *_data) : mtpDataOwner(_data), _type(mtpc_messages_allStickers) { } inline MTPmessages_allStickers MTP_messages_allStickersNotModified() { - return MTPmessages_allStickers(mtpc_messages_allStickersNotModified); + return MTP::internal::TypeCreator::new_messages_allStickersNotModified(); } inline MTPmessages_allStickers MTP_messages_allStickers(MTPint _hash, const MTPVector &_sets) { - return MTPmessages_allStickers(new MTPDmessages_allStickers(_hash, _sets)); + return MTP::internal::TypeCreator::new_messages_allStickers(_hash, _sets); } inline MTPdisabledFeature::MTPdisabledFeature() : mtpDataOwner(new MTPDdisabledFeature()) { @@ -28789,7 +30067,7 @@ inline void MTPdisabledFeature::write(mtpBuffer &to) const { inline MTPdisabledFeature::MTPdisabledFeature(MTPDdisabledFeature *_data) : mtpDataOwner(_data) { } inline MTPdisabledFeature MTP_disabledFeature(const MTPstring &_feature, const MTPstring &_description) { - return MTPdisabledFeature(new MTPDdisabledFeature(_feature, _description)); + return MTP::internal::TypeCreator::new_disabledFeature(_feature, _description); } inline MTPmessages_affectedMessages::MTPmessages_affectedMessages() : mtpDataOwner(new MTPDmessages_affectedMessages()) { @@ -28818,7 +30096,7 @@ inline void MTPmessages_affectedMessages::write(mtpBuffer &to) const { inline MTPmessages_affectedMessages::MTPmessages_affectedMessages(MTPDmessages_affectedMessages *_data) : mtpDataOwner(_data) { } inline MTPmessages_affectedMessages MTP_messages_affectedMessages(MTPint _pts, MTPint _pts_count) { - return MTPmessages_affectedMessages(new MTPDmessages_affectedMessages(_pts, _pts_count)); + return MTP::internal::TypeCreator::new_messages_affectedMessages(_pts, _pts_count); } inline uint32 MTPcontactLink::innerLength() const { @@ -28838,8 +30116,6 @@ inline void MTPcontactLink::read(const mtpPrime *&from, const mtpPrime *end, mtp } } inline void MTPcontactLink::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPcontactLink::MTPcontactLink(mtpTypeId type) : _type(type) { switch (type) { @@ -28851,16 +30127,16 @@ inline MTPcontactLink::MTPcontactLink(mtpTypeId type) : _type(type) { } } inline MTPcontactLink MTP_contactLinkUnknown() { - return MTPcontactLink(mtpc_contactLinkUnknown); + return MTP::internal::TypeCreator::new_contactLinkUnknown(); } inline MTPcontactLink MTP_contactLinkNone() { - return MTPcontactLink(mtpc_contactLinkNone); + return MTP::internal::TypeCreator::new_contactLinkNone(); } inline MTPcontactLink MTP_contactLinkHasPhone() { - return MTPcontactLink(mtpc_contactLinkHasPhone); + return MTP::internal::TypeCreator::new_contactLinkHasPhone(); } inline MTPcontactLink MTP_contactLinkContact() { - return MTPcontactLink(mtpc_contactLinkContact); + return MTP::internal::TypeCreator::new_contactLinkContact(); } inline uint32 MTPwebPage::innerLength() const { @@ -28968,13 +30244,14 @@ inline MTPwebPage::MTPwebPage(MTPDwebPagePending *_data) : mtpDataOwner(_data), inline MTPwebPage::MTPwebPage(MTPDwebPage *_data) : mtpDataOwner(_data), _type(mtpc_webPage) { } inline MTPwebPage MTP_webPageEmpty(const MTPlong &_id) { - return MTPwebPage(new MTPDwebPageEmpty(_id)); + return MTP::internal::TypeCreator::new_webPageEmpty(_id); } inline MTPwebPage MTP_webPagePending(const MTPlong &_id, MTPint _date) { - return MTPwebPage(new MTPDwebPagePending(_id, _date)); + return MTP::internal::TypeCreator::new_webPagePending(_id, _date); } -inline MTPwebPage MTP_webPage(MTPint _flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) { - return MTPwebPage(new MTPDwebPage(_flags, _id, _url, _display_url, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDwebPage::Flags) +inline MTPwebPage MTP_webPage(const MTPflags &_flags, const MTPlong &_id, const MTPstring &_url, const MTPstring &_display_url, const MTPstring &_type, const MTPstring &_site_name, const MTPstring &_title, const MTPstring &_description, const MTPPhoto &_photo, const MTPstring &_embed_url, const MTPstring &_embed_type, MTPint _embed_width, MTPint _embed_height, MTPint _duration, const MTPstring &_author, const MTPDocument &_document) { + return MTP::internal::TypeCreator::new_webPage(_flags, _id, _url, _display_url, _type, _site_name, _title, _description, _photo, _embed_url, _embed_type, _embed_width, _embed_height, _duration, _author, _document); } inline MTPauthorization::MTPauthorization() : mtpDataOwner(new MTPDauthorization()) { @@ -29025,7 +30302,7 @@ inline void MTPauthorization::write(mtpBuffer &to) const { inline MTPauthorization::MTPauthorization(MTPDauthorization *_data) : mtpDataOwner(_data) { } inline MTPauthorization MTP_authorization(const MTPlong &_hash, MTPint _flags, const MTPstring &_device_model, const MTPstring &_platform, const MTPstring &_system_version, MTPint _api_id, const MTPstring &_app_name, const MTPstring &_app_version, MTPint _date_created, MTPint _date_active, const MTPstring &_ip, const MTPstring &_country, const MTPstring &_region) { - return MTPauthorization(new MTPDauthorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region)); + return MTP::internal::TypeCreator::new_authorization(_hash, _flags, _device_model, _platform, _system_version, _api_id, _app_name, _app_version, _date_created, _date_active, _ip, _country, _region); } inline MTPaccount_authorizations::MTPaccount_authorizations() : mtpDataOwner(new MTPDaccount_authorizations()) { @@ -29052,7 +30329,7 @@ inline void MTPaccount_authorizations::write(mtpBuffer &to) const { inline MTPaccount_authorizations::MTPaccount_authorizations(MTPDaccount_authorizations *_data) : mtpDataOwner(_data) { } inline MTPaccount_authorizations MTP_account_authorizations(const MTPVector &_authorizations) { - return MTPaccount_authorizations(new MTPDaccount_authorizations(_authorizations)); + return MTP::internal::TypeCreator::new_account_authorizations(_authorizations); } inline uint32 MTPaccount_password::innerLength() const { @@ -29122,10 +30399,10 @@ inline MTPaccount_password::MTPaccount_password(MTPDaccount_noPassword *_data) : inline MTPaccount_password::MTPaccount_password(MTPDaccount_password *_data) : mtpDataOwner(_data), _type(mtpc_account_password) { } inline MTPaccount_password MTP_account_noPassword(const MTPbytes &_new_salt, const MTPstring &_email_unconfirmed_pattern) { - return MTPaccount_password(new MTPDaccount_noPassword(_new_salt, _email_unconfirmed_pattern)); + return MTP::internal::TypeCreator::new_account_noPassword(_new_salt, _email_unconfirmed_pattern); } inline MTPaccount_password MTP_account_password(const MTPbytes &_current_salt, const MTPbytes &_new_salt, const MTPstring &_hint, MTPBool _has_recovery, const MTPstring &_email_unconfirmed_pattern) { - return MTPaccount_password(new MTPDaccount_password(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern)); + return MTP::internal::TypeCreator::new_account_password(_current_salt, _new_salt, _hint, _has_recovery, _email_unconfirmed_pattern); } inline MTPaccount_passwordSettings::MTPaccount_passwordSettings() : mtpDataOwner(new MTPDaccount_passwordSettings()) { @@ -29152,7 +30429,7 @@ inline void MTPaccount_passwordSettings::write(mtpBuffer &to) const { inline MTPaccount_passwordSettings::MTPaccount_passwordSettings(MTPDaccount_passwordSettings *_data) : mtpDataOwner(_data) { } inline MTPaccount_passwordSettings MTP_account_passwordSettings(const MTPstring &_email) { - return MTPaccount_passwordSettings(new MTPDaccount_passwordSettings(_email)); + return MTP::internal::TypeCreator::new_account_passwordSettings(_email); } inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings() : mtpDataOwner(new MTPDaccount_passwordInputSettings()) { @@ -29186,8 +30463,9 @@ inline void MTPaccount_passwordInputSettings::write(mtpBuffer &to) const { } inline MTPaccount_passwordInputSettings::MTPaccount_passwordInputSettings(MTPDaccount_passwordInputSettings *_data) : mtpDataOwner(_data) { } -inline MTPaccount_passwordInputSettings MTP_account_passwordInputSettings(MTPint _flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) { - return MTPaccount_passwordInputSettings(new MTPDaccount_passwordInputSettings(_flags, _new_salt, _new_password_hash, _hint, _email)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDaccount_passwordInputSettings::Flags) +inline MTPaccount_passwordInputSettings MTP_account_passwordInputSettings(const MTPflags &_flags, const MTPbytes &_new_salt, const MTPbytes &_new_password_hash, const MTPstring &_hint, const MTPstring &_email) { + return MTP::internal::TypeCreator::new_account_passwordInputSettings(_flags, _new_salt, _new_password_hash, _hint, _email); } inline MTPauth_passwordRecovery::MTPauth_passwordRecovery() : mtpDataOwner(new MTPDauth_passwordRecovery()) { @@ -29214,7 +30492,7 @@ inline void MTPauth_passwordRecovery::write(mtpBuffer &to) const { inline MTPauth_passwordRecovery::MTPauth_passwordRecovery(MTPDauth_passwordRecovery *_data) : mtpDataOwner(_data) { } inline MTPauth_passwordRecovery MTP_auth_passwordRecovery(const MTPstring &_email_pattern) { - return MTPauth_passwordRecovery(new MTPDauth_passwordRecovery(_email_pattern)); + return MTP::internal::TypeCreator::new_auth_passwordRecovery(_email_pattern); } inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage() : mtpDataOwner(new MTPDreceivedNotifyMessage()) { @@ -29243,7 +30521,7 @@ inline void MTPreceivedNotifyMessage::write(mtpBuffer &to) const { inline MTPreceivedNotifyMessage::MTPreceivedNotifyMessage(MTPDreceivedNotifyMessage *_data) : mtpDataOwner(_data) { } inline MTPreceivedNotifyMessage MTP_receivedNotifyMessage(MTPint _id, MTPint _flags) { - return MTPreceivedNotifyMessage(new MTPDreceivedNotifyMessage(_id, _flags)); + return MTP::internal::TypeCreator::new_receivedNotifyMessage(_id, _flags); } inline uint32 MTPexportedChatInvite::innerLength() const { @@ -29289,10 +30567,10 @@ inline MTPexportedChatInvite::MTPexportedChatInvite(mtpTypeId type) : mtpDataOwn inline MTPexportedChatInvite::MTPexportedChatInvite(MTPDchatInviteExported *_data) : mtpDataOwner(_data), _type(mtpc_chatInviteExported) { } inline MTPexportedChatInvite MTP_chatInviteEmpty() { - return MTPexportedChatInvite(mtpc_chatInviteEmpty); + return MTP::internal::TypeCreator::new_chatInviteEmpty(); } inline MTPexportedChatInvite MTP_chatInviteExported(const MTPstring &_link) { - return MTPexportedChatInvite(new MTPDchatInviteExported(_link)); + return MTP::internal::TypeCreator::new_chatInviteExported(_link); } inline uint32 MTPchatInvite::innerLength() const { @@ -29354,10 +30632,11 @@ inline MTPchatInvite::MTPchatInvite(MTPDchatInviteAlready *_data) : mtpDataOwner inline MTPchatInvite::MTPchatInvite(MTPDchatInvite *_data) : mtpDataOwner(_data), _type(mtpc_chatInvite) { } inline MTPchatInvite MTP_chatInviteAlready(const MTPChat &_chat) { - return MTPchatInvite(new MTPDchatInviteAlready(_chat)); + return MTP::internal::TypeCreator::new_chatInviteAlready(_chat); } -inline MTPchatInvite MTP_chatInvite(MTPint _flags, const MTPstring &_title) { - return MTPchatInvite(new MTPDchatInvite(_flags, _title)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchatInvite::Flags) +inline MTPchatInvite MTP_chatInvite(const MTPflags &_flags, const MTPstring &_title) { + return MTP::internal::TypeCreator::new_chatInvite(_flags, _title); } inline uint32 MTPinputStickerSet::innerLength() const { @@ -29421,13 +30700,13 @@ inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetID *_data) : mt inline MTPinputStickerSet::MTPinputStickerSet(MTPDinputStickerSetShortName *_data) : mtpDataOwner(_data), _type(mtpc_inputStickerSetShortName) { } inline MTPinputStickerSet MTP_inputStickerSetEmpty() { - return MTPinputStickerSet(mtpc_inputStickerSetEmpty); + return MTP::internal::TypeCreator::new_inputStickerSetEmpty(); } inline MTPinputStickerSet MTP_inputStickerSetID(const MTPlong &_id, const MTPlong &_access_hash) { - return MTPinputStickerSet(new MTPDinputStickerSetID(_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputStickerSetID(_id, _access_hash); } inline MTPinputStickerSet MTP_inputStickerSetShortName(const MTPstring &_short_name) { - return MTPinputStickerSet(new MTPDinputStickerSetShortName(_short_name)); + return MTP::internal::TypeCreator::new_inputStickerSetShortName(_short_name); } inline MTPstickerSet::MTPstickerSet() : mtpDataOwner(new MTPDstickerSet()) { @@ -29465,8 +30744,9 @@ inline void MTPstickerSet::write(mtpBuffer &to) const { } inline MTPstickerSet::MTPstickerSet(MTPDstickerSet *_data) : mtpDataOwner(_data) { } -inline MTPstickerSet MTP_stickerSet(MTPint _flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) { - return MTPstickerSet(new MTPDstickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDstickerSet::Flags) +inline MTPstickerSet MTP_stickerSet(const MTPflags &_flags, const MTPlong &_id, const MTPlong &_access_hash, const MTPstring &_title, const MTPstring &_short_name, MTPint _count, MTPint _hash) { + return MTP::internal::TypeCreator::new_stickerSet(_flags, _id, _access_hash, _title, _short_name, _count, _hash); } inline MTPmessages_stickerSet::MTPmessages_stickerSet() : mtpDataOwner(new MTPDmessages_stickerSet()) { @@ -29497,7 +30777,7 @@ inline void MTPmessages_stickerSet::write(mtpBuffer &to) const { inline MTPmessages_stickerSet::MTPmessages_stickerSet(MTPDmessages_stickerSet *_data) : mtpDataOwner(_data) { } inline MTPmessages_stickerSet MTP_messages_stickerSet(const MTPStickerSet &_set, const MTPVector &_packs, const MTPVector &_documents) { - return MTPmessages_stickerSet(new MTPDmessages_stickerSet(_set, _packs, _documents)); + return MTP::internal::TypeCreator::new_messages_stickerSet(_set, _packs, _documents); } inline MTPbotCommand::MTPbotCommand() : mtpDataOwner(new MTPDbotCommand()) { @@ -29526,7 +30806,7 @@ inline void MTPbotCommand::write(mtpBuffer &to) const { inline MTPbotCommand::MTPbotCommand(MTPDbotCommand *_data) : mtpDataOwner(_data) { } inline MTPbotCommand MTP_botCommand(const MTPstring &_command, const MTPstring &_description) { - return MTPbotCommand(new MTPDbotCommand(_command, _description)); + return MTP::internal::TypeCreator::new_botCommand(_command, _description); } inline MTPbotInfo::MTPbotInfo() : mtpDataOwner(new MTPDbotInfo()) { @@ -29557,7 +30837,7 @@ inline void MTPbotInfo::write(mtpBuffer &to) const { inline MTPbotInfo::MTPbotInfo(MTPDbotInfo *_data) : mtpDataOwner(_data) { } inline MTPbotInfo MTP_botInfo(MTPint _user_id, const MTPstring &_description, const MTPVector &_commands) { - return MTPbotInfo(new MTPDbotInfo(_user_id, _description, _commands)); + return MTP::internal::TypeCreator::new_botInfo(_user_id, _description, _commands); } inline MTPkeyboardButton::MTPkeyboardButton() : mtpDataOwner(new MTPDkeyboardButton()) { @@ -29584,7 +30864,7 @@ inline void MTPkeyboardButton::write(mtpBuffer &to) const { inline MTPkeyboardButton::MTPkeyboardButton(MTPDkeyboardButton *_data) : mtpDataOwner(_data) { } inline MTPkeyboardButton MTP_keyboardButton(const MTPstring &_text) { - return MTPkeyboardButton(new MTPDkeyboardButton(_text)); + return MTP::internal::TypeCreator::new_keyboardButton(_text); } inline MTPkeyboardButtonRow::MTPkeyboardButtonRow() : mtpDataOwner(new MTPDkeyboardButtonRow()) { @@ -29611,7 +30891,7 @@ inline void MTPkeyboardButtonRow::write(mtpBuffer &to) const { inline MTPkeyboardButtonRow::MTPkeyboardButtonRow(MTPDkeyboardButtonRow *_data) : mtpDataOwner(_data) { } inline MTPkeyboardButtonRow MTP_keyboardButtonRow(const MTPVector &_buttons) { - return MTPkeyboardButtonRow(new MTPDkeyboardButtonRow(_buttons)); + return MTP::internal::TypeCreator::new_keyboardButtonRow(_buttons); } inline uint32 MTPreplyMarkup::innerLength() const { @@ -29688,14 +30968,17 @@ inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyKeyboardForceReply *_data) : mtpD } inline MTPreplyMarkup::MTPreplyMarkup(MTPDreplyKeyboardMarkup *_data) : mtpDataOwner(_data), _type(mtpc_replyKeyboardMarkup) { } -inline MTPreplyMarkup MTP_replyKeyboardHide(MTPint _flags) { - return MTPreplyMarkup(new MTPDreplyKeyboardHide(_flags)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDreplyKeyboardHide::Flags) +inline MTPreplyMarkup MTP_replyKeyboardHide(const MTPflags &_flags) { + return MTP::internal::TypeCreator::new_replyKeyboardHide(_flags); } -inline MTPreplyMarkup MTP_replyKeyboardForceReply(MTPint _flags) { - return MTPreplyMarkup(new MTPDreplyKeyboardForceReply(_flags)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDreplyKeyboardForceReply::Flags) +inline MTPreplyMarkup MTP_replyKeyboardForceReply(const MTPflags &_flags) { + return MTP::internal::TypeCreator::new_replyKeyboardForceReply(_flags); } -inline MTPreplyMarkup MTP_replyKeyboardMarkup(MTPint _flags, const MTPVector &_rows) { - return MTPreplyMarkup(new MTPDreplyKeyboardMarkup(_flags, _rows)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDreplyKeyboardMarkup::Flags) +inline MTPreplyMarkup MTP_replyKeyboardMarkup(const MTPflags &_flags, const MTPVector &_rows) { + return MTP::internal::TypeCreator::new_replyKeyboardMarkup(_flags, _rows); } inline uint32 MTPhelp_appChangelog::innerLength() const { @@ -29741,10 +31024,10 @@ inline MTPhelp_appChangelog::MTPhelp_appChangelog(mtpTypeId type) : mtpDataOwner inline MTPhelp_appChangelog::MTPhelp_appChangelog(MTPDhelp_appChangelog *_data) : mtpDataOwner(_data), _type(mtpc_help_appChangelog) { } inline MTPhelp_appChangelog MTP_help_appChangelogEmpty() { - return MTPhelp_appChangelog(mtpc_help_appChangelogEmpty); + return MTP::internal::TypeCreator::new_help_appChangelogEmpty(); } inline MTPhelp_appChangelog MTP_help_appChangelog(const MTPstring &_text) { - return MTPhelp_appChangelog(new MTPDhelp_appChangelog(_text)); + return MTP::internal::TypeCreator::new_help_appChangelog(_text); } inline uint32 MTPmessageEntity::innerLength() const { @@ -29974,37 +31257,37 @@ inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityPre *_data) : mtpData inline MTPmessageEntity::MTPmessageEntity(MTPDmessageEntityTextUrl *_data) : mtpDataOwner(_data), _type(mtpc_messageEntityTextUrl) { } inline MTPmessageEntity MTP_messageEntityUnknown(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityUnknown(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityUnknown(_offset, _length); } inline MTPmessageEntity MTP_messageEntityMention(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityMention(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityMention(_offset, _length); } inline MTPmessageEntity MTP_messageEntityHashtag(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityHashtag(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityHashtag(_offset, _length); } inline MTPmessageEntity MTP_messageEntityBotCommand(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityBotCommand(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityBotCommand(_offset, _length); } inline MTPmessageEntity MTP_messageEntityUrl(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityUrl(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityUrl(_offset, _length); } inline MTPmessageEntity MTP_messageEntityEmail(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityEmail(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityEmail(_offset, _length); } inline MTPmessageEntity MTP_messageEntityBold(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityBold(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityBold(_offset, _length); } inline MTPmessageEntity MTP_messageEntityItalic(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityItalic(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityItalic(_offset, _length); } inline MTPmessageEntity MTP_messageEntityCode(MTPint _offset, MTPint _length) { - return MTPmessageEntity(new MTPDmessageEntityCode(_offset, _length)); + return MTP::internal::TypeCreator::new_messageEntityCode(_offset, _length); } inline MTPmessageEntity MTP_messageEntityPre(MTPint _offset, MTPint _length, const MTPstring &_language) { - return MTPmessageEntity(new MTPDmessageEntityPre(_offset, _length, _language)); + return MTP::internal::TypeCreator::new_messageEntityPre(_offset, _length, _language); } inline MTPmessageEntity MTP_messageEntityTextUrl(MTPint _offset, MTPint _length, const MTPstring &_url) { - return MTPmessageEntity(new MTPDmessageEntityTextUrl(_offset, _length, _url)); + return MTP::internal::TypeCreator::new_messageEntityTextUrl(_offset, _length, _url); } inline uint32 MTPinputChannel::innerLength() const { @@ -30052,10 +31335,10 @@ inline MTPinputChannel::MTPinputChannel(mtpTypeId type) : mtpDataOwner(0), _type inline MTPinputChannel::MTPinputChannel(MTPDinputChannel *_data) : mtpDataOwner(_data), _type(mtpc_inputChannel) { } inline MTPinputChannel MTP_inputChannelEmpty() { - return MTPinputChannel(mtpc_inputChannelEmpty); + return MTP::internal::TypeCreator::new_inputChannelEmpty(); } inline MTPinputChannel MTP_inputChannel(MTPint _channel_id, const MTPlong &_access_hash) { - return MTPinputChannel(new MTPDinputChannel(_channel_id, _access_hash)); + return MTP::internal::TypeCreator::new_inputChannel(_channel_id, _access_hash); } inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer() : mtpDataOwner(new MTPDcontacts_resolvedPeer()) { @@ -30086,7 +31369,7 @@ inline void MTPcontacts_resolvedPeer::write(mtpBuffer &to) const { inline MTPcontacts_resolvedPeer::MTPcontacts_resolvedPeer(MTPDcontacts_resolvedPeer *_data) : mtpDataOwner(_data) { } inline MTPcontacts_resolvedPeer MTP_contacts_resolvedPeer(const MTPPeer &_peer, const MTPVector &_chats, const MTPVector &_users) { - return MTPcontacts_resolvedPeer(new MTPDcontacts_resolvedPeer(_peer, _chats, _users)); + return MTP::internal::TypeCreator::new_contacts_resolvedPeer(_peer, _chats, _users); } inline MTPmessageRange::MTPmessageRange() : mtpDataOwner(new MTPDmessageRange()) { @@ -30115,7 +31398,7 @@ inline void MTPmessageRange::write(mtpBuffer &to) const { inline MTPmessageRange::MTPmessageRange(MTPDmessageRange *_data) : mtpDataOwner(_data) { } inline MTPmessageRange MTP_messageRange(MTPint _min_id, MTPint _max_id) { - return MTPmessageRange(new MTPDmessageRange(_min_id, _max_id)); + return MTP::internal::TypeCreator::new_messageRange(_min_id, _max_id); } inline MTPmessageGroup::MTPmessageGroup() : mtpDataOwner(new MTPDmessageGroup()) { @@ -30148,7 +31431,7 @@ inline void MTPmessageGroup::write(mtpBuffer &to) const { inline MTPmessageGroup::MTPmessageGroup(MTPDmessageGroup *_data) : mtpDataOwner(_data) { } inline MTPmessageGroup MTP_messageGroup(MTPint _min_id, MTPint _max_id, MTPint _count, MTPint _date) { - return MTPmessageGroup(new MTPDmessageGroup(_min_id, _max_id, _count, _date)); + return MTP::internal::TypeCreator::new_messageGroup(_min_id, _max_id, _count, _date); } inline uint32 MTPupdates_channelDifference::innerLength() const { @@ -30259,14 +31542,17 @@ inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_ch } inline MTPupdates_channelDifference::MTPupdates_channelDifference(MTPDupdates_channelDifference *_data) : mtpDataOwner(_data), _type(mtpc_updates_channelDifference) { } -inline MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(MTPint _flags, MTPint _pts, MTPint _timeout) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceEmpty(_flags, _pts, _timeout)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdates_channelDifferenceEmpty::Flags) +inline MTPupdates_channelDifference MTP_updates_channelDifferenceEmpty(const MTPflags &_flags, MTPint _pts, MTPint _timeout) { + return MTP::internal::TypeCreator::new_updates_channelDifferenceEmpty(_flags, _pts, _timeout); } -inline MTPupdates_channelDifference MTP_updates_channelDifferenceTooLong(MTPint _flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifferenceTooLong(_flags, _pts, _timeout, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _messages, _chats, _users)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdates_channelDifferenceTooLong::Flags) +inline MTPupdates_channelDifference MTP_updates_channelDifferenceTooLong(const MTPflags &_flags, MTPint _pts, MTPint _timeout, MTPint _top_message, MTPint _top_important_message, MTPint _read_inbox_max_id, MTPint _unread_count, MTPint _unread_important_count, const MTPVector &_messages, const MTPVector &_chats, const MTPVector &_users) { + return MTP::internal::TypeCreator::new_updates_channelDifferenceTooLong(_flags, _pts, _timeout, _top_message, _top_important_message, _read_inbox_max_id, _unread_count, _unread_important_count, _messages, _chats, _users); } -inline MTPupdates_channelDifference MTP_updates_channelDifference(MTPint _flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) { - return MTPupdates_channelDifference(new MTPDupdates_channelDifference(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDupdates_channelDifference::Flags) +inline MTPupdates_channelDifference MTP_updates_channelDifference(const MTPflags &_flags, MTPint _pts, MTPint _timeout, const MTPVector &_new_messages, const MTPVector &_other_updates, const MTPVector &_chats, const MTPVector &_users) { + return MTP::internal::TypeCreator::new_updates_channelDifference(_flags, _pts, _timeout, _new_messages, _other_updates, _chats, _users); } inline uint32 MTPchannelMessagesFilter::innerLength() const { @@ -30316,13 +31602,14 @@ inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(mtpTypeId type) : mtpD inline MTPchannelMessagesFilter::MTPchannelMessagesFilter(MTPDchannelMessagesFilter *_data) : mtpDataOwner(_data), _type(mtpc_channelMessagesFilter) { } inline MTPchannelMessagesFilter MTP_channelMessagesFilterEmpty() { - return MTPchannelMessagesFilter(mtpc_channelMessagesFilterEmpty); + return MTP::internal::TypeCreator::new_channelMessagesFilterEmpty(); } -inline MTPchannelMessagesFilter MTP_channelMessagesFilter(MTPint _flags, const MTPVector &_ranges) { - return MTPchannelMessagesFilter(new MTPDchannelMessagesFilter(_flags, _ranges)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchannelMessagesFilter::Flags) +inline MTPchannelMessagesFilter MTP_channelMessagesFilter(const MTPflags &_flags, const MTPVector &_ranges) { + return MTP::internal::TypeCreator::new_channelMessagesFilter(_flags, _ranges); } inline MTPchannelMessagesFilter MTP_channelMessagesFilterCollapsed() { - return MTPchannelMessagesFilter(mtpc_channelMessagesFilterCollapsed); + return MTP::internal::TypeCreator::new_channelMessagesFilterCollapsed(); } inline uint32 MTPchannelParticipant::innerLength() const { @@ -30464,22 +31751,22 @@ inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantKicked inline MTPchannelParticipant::MTPchannelParticipant(MTPDchannelParticipantCreator *_data) : mtpDataOwner(_data), _type(mtpc_channelParticipantCreator) { } inline MTPchannelParticipant MTP_channelParticipant(MTPint _user_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipant(_user_id, _date)); + return MTP::internal::TypeCreator::new_channelParticipant(_user_id, _date); } inline MTPchannelParticipant MTP_channelParticipantSelf(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantSelf(_user_id, _inviter_id, _date)); + return MTP::internal::TypeCreator::new_channelParticipantSelf(_user_id, _inviter_id, _date); } inline MTPchannelParticipant MTP_channelParticipantModerator(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantModerator(_user_id, _inviter_id, _date)); + return MTP::internal::TypeCreator::new_channelParticipantModerator(_user_id, _inviter_id, _date); } inline MTPchannelParticipant MTP_channelParticipantEditor(MTPint _user_id, MTPint _inviter_id, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantEditor(_user_id, _inviter_id, _date)); + return MTP::internal::TypeCreator::new_channelParticipantEditor(_user_id, _inviter_id, _date); } inline MTPchannelParticipant MTP_channelParticipantKicked(MTPint _user_id, MTPint _kicked_by, MTPint _date) { - return MTPchannelParticipant(new MTPDchannelParticipantKicked(_user_id, _kicked_by, _date)); + return MTP::internal::TypeCreator::new_channelParticipantKicked(_user_id, _kicked_by, _date); } inline MTPchannelParticipant MTP_channelParticipantCreator(MTPint _user_id) { - return MTPchannelParticipant(new MTPDchannelParticipantCreator(_user_id)); + return MTP::internal::TypeCreator::new_channelParticipantCreator(_user_id); } inline uint32 MTPchannelParticipantsFilter::innerLength() const { @@ -30499,8 +31786,6 @@ inline void MTPchannelParticipantsFilter::read(const mtpPrime *&from, const mtpP } } inline void MTPchannelParticipantsFilter::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPchannelParticipantsFilter::MTPchannelParticipantsFilter(mtpTypeId type) : _type(type) { switch (type) { @@ -30512,16 +31797,16 @@ inline MTPchannelParticipantsFilter::MTPchannelParticipantsFilter(mtpTypeId type } } inline MTPchannelParticipantsFilter MTP_channelParticipantsRecent() { - return MTPchannelParticipantsFilter(mtpc_channelParticipantsRecent); + return MTP::internal::TypeCreator::new_channelParticipantsRecent(); } inline MTPchannelParticipantsFilter MTP_channelParticipantsAdmins() { - return MTPchannelParticipantsFilter(mtpc_channelParticipantsAdmins); + return MTP::internal::TypeCreator::new_channelParticipantsAdmins(); } inline MTPchannelParticipantsFilter MTP_channelParticipantsKicked() { - return MTPchannelParticipantsFilter(mtpc_channelParticipantsKicked); + return MTP::internal::TypeCreator::new_channelParticipantsKicked(); } inline MTPchannelParticipantsFilter MTP_channelParticipantsBots() { - return MTPchannelParticipantsFilter(mtpc_channelParticipantsBots); + return MTP::internal::TypeCreator::new_channelParticipantsBots(); } inline uint32 MTPchannelParticipantRole::innerLength() const { @@ -30540,8 +31825,6 @@ inline void MTPchannelParticipantRole::read(const mtpPrime *&from, const mtpPrim } } inline void MTPchannelParticipantRole::write(mtpBuffer &to) const { - switch (_type) { - } } inline MTPchannelParticipantRole::MTPchannelParticipantRole(mtpTypeId type) : _type(type) { switch (type) { @@ -30552,13 +31835,13 @@ inline MTPchannelParticipantRole::MTPchannelParticipantRole(mtpTypeId type) : _t } } inline MTPchannelParticipantRole MTP_channelRoleEmpty() { - return MTPchannelParticipantRole(mtpc_channelRoleEmpty); + return MTP::internal::TypeCreator::new_channelRoleEmpty(); } inline MTPchannelParticipantRole MTP_channelRoleModerator() { - return MTPchannelParticipantRole(mtpc_channelRoleModerator); + return MTP::internal::TypeCreator::new_channelRoleModerator(); } inline MTPchannelParticipantRole MTP_channelRoleEditor() { - return MTPchannelParticipantRole(mtpc_channelRoleEditor); + return MTP::internal::TypeCreator::new_channelRoleEditor(); } inline MTPchannels_channelParticipants::MTPchannels_channelParticipants() : mtpDataOwner(new MTPDchannels_channelParticipants()) { @@ -30589,7 +31872,7 @@ inline void MTPchannels_channelParticipants::write(mtpBuffer &to) const { inline MTPchannels_channelParticipants::MTPchannels_channelParticipants(MTPDchannels_channelParticipants *_data) : mtpDataOwner(_data) { } inline MTPchannels_channelParticipants MTP_channels_channelParticipants(MTPint _count, const MTPVector &_participants, const MTPVector &_users) { - return MTPchannels_channelParticipants(new MTPDchannels_channelParticipants(_count, _participants, _users)); + return MTP::internal::TypeCreator::new_channels_channelParticipants(_count, _participants, _users); } inline MTPchannels_channelParticipant::MTPchannels_channelParticipant() : mtpDataOwner(new MTPDchannels_channelParticipant()) { @@ -30618,7 +31901,7 @@ inline void MTPchannels_channelParticipant::write(mtpBuffer &to) const { inline MTPchannels_channelParticipant::MTPchannels_channelParticipant(MTPDchannels_channelParticipant *_data) : mtpDataOwner(_data) { } inline MTPchannels_channelParticipant MTP_channels_channelParticipant(const MTPChannelParticipant &_participant, const MTPVector &_users) { - return MTPchannels_channelParticipant(new MTPDchannels_channelParticipant(_participant, _users)); + return MTP::internal::TypeCreator::new_channels_channelParticipant(_participant, _users); } inline MTPhelp_termsOfService::MTPhelp_termsOfService() : mtpDataOwner(new MTPDhelp_termsOfService()) { @@ -30645,7 +31928,7 @@ inline void MTPhelp_termsOfService::write(mtpBuffer &to) const { inline MTPhelp_termsOfService::MTPhelp_termsOfService(MTPDhelp_termsOfService *_data) : mtpDataOwner(_data) { } inline MTPhelp_termsOfService MTP_help_termsOfService(const MTPstring &_text) { - return MTPhelp_termsOfService(new MTPDhelp_termsOfService(_text)); + return MTP::internal::TypeCreator::new_help_termsOfService(_text); } inline uint32 MTPfoundGif::innerLength() const { @@ -30719,10 +32002,10 @@ inline MTPfoundGif::MTPfoundGif(MTPDfoundGif *_data) : mtpDataOwner(_data), _typ inline MTPfoundGif::MTPfoundGif(MTPDfoundGifCached *_data) : mtpDataOwner(_data), _type(mtpc_foundGifCached) { } inline MTPfoundGif MTP_foundGif(const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h) { - return MTPfoundGif(new MTPDfoundGif(_url, _thumb_url, _content_url, _content_type, _w, _h)); + return MTP::internal::TypeCreator::new_foundGif(_url, _thumb_url, _content_url, _content_type, _w, _h); } inline MTPfoundGif MTP_foundGifCached(const MTPstring &_url, const MTPPhoto &_photo, const MTPDocument &_document) { - return MTPfoundGif(new MTPDfoundGifCached(_url, _photo, _document)); + return MTP::internal::TypeCreator::new_foundGifCached(_url, _photo, _document); } inline MTPmessages_foundGifs::MTPmessages_foundGifs() : mtpDataOwner(new MTPDmessages_foundGifs()) { @@ -30751,7 +32034,7 @@ inline void MTPmessages_foundGifs::write(mtpBuffer &to) const { inline MTPmessages_foundGifs::MTPmessages_foundGifs(MTPDmessages_foundGifs *_data) : mtpDataOwner(_data) { } inline MTPmessages_foundGifs MTP_messages_foundGifs(MTPint _next_offset, const MTPVector &_results) { - return MTPmessages_foundGifs(new MTPDmessages_foundGifs(_next_offset, _results)); + return MTP::internal::TypeCreator::new_messages_foundGifs(_next_offset, _results); } inline uint32 MTPmessages_savedGifs::innerLength() const { @@ -30799,10 +32082,10 @@ inline MTPmessages_savedGifs::MTPmessages_savedGifs(mtpTypeId type) : mtpDataOwn inline MTPmessages_savedGifs::MTPmessages_savedGifs(MTPDmessages_savedGifs *_data) : mtpDataOwner(_data), _type(mtpc_messages_savedGifs) { } inline MTPmessages_savedGifs MTP_messages_savedGifsNotModified() { - return MTPmessages_savedGifs(mtpc_messages_savedGifsNotModified); + return MTP::internal::TypeCreator::new_messages_savedGifsNotModified(); } inline MTPmessages_savedGifs MTP_messages_savedGifs(MTPint _hash, const MTPVector &_gifs) { - return MTPmessages_savedGifs(new MTPDmessages_savedGifs(_hash, _gifs)); + return MTP::internal::TypeCreator::new_messages_savedGifs(_hash, _gifs); } inline uint32 MTPinputBotInlineMessage::innerLength() const { @@ -30866,10 +32149,11 @@ inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMess inline MTPinputBotInlineMessage::MTPinputBotInlineMessage(MTPDinputBotInlineMessageText *_data) : mtpDataOwner(_data), _type(mtpc_inputBotInlineMessageText) { } inline MTPinputBotInlineMessage MTP_inputBotInlineMessageMediaAuto(const MTPstring &_caption) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageMediaAuto(_caption)); + return MTP::internal::TypeCreator::new_inputBotInlineMessageMediaAuto(_caption); } -inline MTPinputBotInlineMessage MTP_inputBotInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities) { - return MTPinputBotInlineMessage(new MTPDinputBotInlineMessageText(_flags, _message, _entities)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineMessageText::Flags) +inline MTPinputBotInlineMessage MTP_inputBotInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) { + return MTP::internal::TypeCreator::new_inputBotInlineMessageText(_flags, _message, _entities); } inline MTPinputBotInlineResult::MTPinputBotInlineResult() : mtpDataOwner(new MTPDinputBotInlineResult()) { @@ -30919,8 +32203,9 @@ inline void MTPinputBotInlineResult::write(mtpBuffer &to) const { } inline MTPinputBotInlineResult::MTPinputBotInlineResult(MTPDinputBotInlineResult *_data) : mtpDataOwner(_data) { } -inline MTPinputBotInlineResult MTP_inputBotInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { - return MTPinputBotInlineResult(new MTPDinputBotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputBotInlineResult::Flags) +inline MTPinputBotInlineResult MTP_inputBotInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPInputBotInlineMessage &_send_message) { + return MTP::internal::TypeCreator::new_inputBotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message); } inline uint32 MTPbotInlineMessage::innerLength() const { @@ -30984,10 +32269,11 @@ inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageMediaAuto *_ inline MTPbotInlineMessage::MTPbotInlineMessage(MTPDbotInlineMessageText *_data) : mtpDataOwner(_data), _type(mtpc_botInlineMessageText) { } inline MTPbotInlineMessage MTP_botInlineMessageMediaAuto(const MTPstring &_caption) { - return MTPbotInlineMessage(new MTPDbotInlineMessageMediaAuto(_caption)); + return MTP::internal::TypeCreator::new_botInlineMessageMediaAuto(_caption); } -inline MTPbotInlineMessage MTP_botInlineMessageText(MTPint _flags, const MTPstring &_message, const MTPVector &_entities) { - return MTPbotInlineMessage(new MTPDbotInlineMessageText(_flags, _message, _entities)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDbotInlineMessageText::Flags) +inline MTPbotInlineMessage MTP_botInlineMessageText(const MTPflags &_flags, const MTPstring &_message, const MTPVector &_entities) { + return MTP::internal::TypeCreator::new_botInlineMessageText(_flags, _message, _entities); } inline uint32 MTPbotInlineResult::innerLength() const { @@ -31099,13 +32385,14 @@ inline MTPbotInlineResult::MTPbotInlineResult(MTPDbotInlineMediaResultPhoto *_da inline MTPbotInlineResult::MTPbotInlineResult(MTPDbotInlineResult *_data) : mtpDataOwner(_data), _type(mtpc_botInlineResult) { } inline MTPbotInlineResult MTP_botInlineMediaResultDocument(const MTPstring &_id, const MTPstring &_type, const MTPDocument &_document, const MTPBotInlineMessage &_send_message) { - return MTPbotInlineResult(new MTPDbotInlineMediaResultDocument(_id, _type, _document, _send_message)); + return MTP::internal::TypeCreator::new_botInlineMediaResultDocument(_id, _type, _document, _send_message); } inline MTPbotInlineResult MTP_botInlineMediaResultPhoto(const MTPstring &_id, const MTPstring &_type, const MTPPhoto &_photo, const MTPBotInlineMessage &_send_message) { - return MTPbotInlineResult(new MTPDbotInlineMediaResultPhoto(_id, _type, _photo, _send_message)); + return MTP::internal::TypeCreator::new_botInlineMediaResultPhoto(_id, _type, _photo, _send_message); } -inline MTPbotInlineResult MTP_botInlineResult(MTPint _flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) { - return MTPbotInlineResult(new MTPDbotInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDbotInlineResult::Flags) +inline MTPbotInlineResult MTP_botInlineResult(const MTPflags &_flags, const MTPstring &_id, const MTPstring &_type, const MTPstring &_title, const MTPstring &_description, const MTPstring &_url, const MTPstring &_thumb_url, const MTPstring &_content_url, const MTPstring &_content_type, MTPint _w, MTPint _h, MTPint _duration, const MTPBotInlineMessage &_send_message) { + return MTP::internal::TypeCreator::new_botInlineResult(_flags, _id, _type, _title, _description, _url, _thumb_url, _content_url, _content_type, _w, _h, _duration, _send_message); } inline MTPmessages_botResults::MTPmessages_botResults() : mtpDataOwner(new MTPDmessages_botResults()) { @@ -31137,8 +32424,9 @@ inline void MTPmessages_botResults::write(mtpBuffer &to) const { } inline MTPmessages_botResults::MTPmessages_botResults(MTPDmessages_botResults *_data) : mtpDataOwner(_data) { } -inline MTPmessages_botResults MTP_messages_botResults(MTPint _flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) { - return MTPmessages_botResults(new MTPDmessages_botResults(_flags, _query_id, _next_offset, _results)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessages_botResults::Flags) +inline MTPmessages_botResults MTP_messages_botResults(const MTPflags &_flags, const MTPlong &_query_id, const MTPstring &_next_offset, const MTPVector &_results) { + return MTP::internal::TypeCreator::new_messages_botResults(_flags, _query_id, _next_offset, _results); } inline MTPexportedMessageLink::MTPexportedMessageLink() : mtpDataOwner(new MTPDexportedMessageLink()) { @@ -31165,7 +32453,7 @@ inline void MTPexportedMessageLink::write(mtpBuffer &to) const { inline MTPexportedMessageLink::MTPexportedMessageLink(MTPDexportedMessageLink *_data) : mtpDataOwner(_data) { } inline MTPexportedMessageLink MTP_exportedMessageLink(const MTPstring &_link) { - return MTPexportedMessageLink(new MTPDexportedMessageLink(_link)); + return MTP::internal::TypeCreator::new_exportedMessageLink(_link); } inline MTPmessageFwdHeader::MTPmessageFwdHeader() : mtpDataOwner(new MTPDmessageFwdHeader()) { @@ -31199,8 +32487,9 @@ inline void MTPmessageFwdHeader::write(mtpBuffer &to) const { } inline MTPmessageFwdHeader::MTPmessageFwdHeader(MTPDmessageFwdHeader *_data) : mtpDataOwner(_data) { } -inline MTPmessageFwdHeader MTP_messageFwdHeader(MTPint _flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) { - return MTPmessageFwdHeader(new MTPDmessageFwdHeader(_flags, _from_id, _date, _channel_id, _channel_post)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessageFwdHeader::Flags) +inline MTPmessageFwdHeader MTP_messageFwdHeader(const MTPflags &_flags, MTPint _from_id, MTPint _date, MTPint _channel_id, MTPint _channel_post) { + return MTP::internal::TypeCreator::new_messageFwdHeader(_flags, _from_id, _date, _channel_id, _channel_post); } inline MTPchannels_messageEditData::MTPchannels_messageEditData() : mtpDataOwner(new MTPDchannels_messageEditData()) { @@ -31226,9 +32515,154 @@ inline void MTPchannels_messageEditData::write(mtpBuffer &to) const { } inline MTPchannels_messageEditData::MTPchannels_messageEditData(MTPDchannels_messageEditData *_data) : mtpDataOwner(_data) { } -inline MTPchannels_messageEditData MTP_channels_messageEditData(MTPint _flags) { - return MTPchannels_messageEditData(new MTPDchannels_messageEditData(_flags)); +Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDchannels_messageEditData::Flags) +inline MTPchannels_messageEditData MTP_channels_messageEditData(const MTPflags &_flags) { + return MTP::internal::TypeCreator::new_channels_messageEditData(_flags); } +inline uint32 MTPauth_codeType::innerLength() const { + return 0; +} +inline mtpTypeId MTPauth_codeType::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPauth_codeType::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + switch (cons) { + case mtpc_auth_codeTypeSms: _type = cons; break; + case mtpc_auth_codeTypeCall: _type = cons; break; + case mtpc_auth_codeTypeFlashCall: _type = cons; break; + default: throw mtpErrorUnexpected(cons, "MTPauth_codeType"); + } +} +inline void MTPauth_codeType::write(mtpBuffer &to) const { +} +inline MTPauth_codeType::MTPauth_codeType(mtpTypeId type) : _type(type) { + switch (type) { + case mtpc_auth_codeTypeSms: break; + case mtpc_auth_codeTypeCall: break; + case mtpc_auth_codeTypeFlashCall: break; + default: throw mtpErrorBadTypeId(type, "MTPauth_codeType"); + } +} +inline MTPauth_codeType MTP_auth_codeTypeSms() { + return MTP::internal::TypeCreator::new_auth_codeTypeSms(); +} +inline MTPauth_codeType MTP_auth_codeTypeCall() { + return MTP::internal::TypeCreator::new_auth_codeTypeCall(); +} +inline MTPauth_codeType MTP_auth_codeTypeFlashCall() { + return MTP::internal::TypeCreator::new_auth_codeTypeFlashCall(); +} + +inline uint32 MTPauth_sentCodeType::innerLength() const { + switch (_type) { + case mtpc_auth_sentCodeTypeApp: { + const MTPDauth_sentCodeTypeApp &v(c_auth_sentCodeTypeApp()); + return v.vlength.innerLength(); + } + case mtpc_auth_sentCodeTypeSms: { + const MTPDauth_sentCodeTypeSms &v(c_auth_sentCodeTypeSms()); + return v.vlength.innerLength(); + } + case mtpc_auth_sentCodeTypeCall: { + const MTPDauth_sentCodeTypeCall &v(c_auth_sentCodeTypeCall()); + return v.vlength.innerLength(); + } + case mtpc_auth_sentCodeTypeFlashCall: { + const MTPDauth_sentCodeTypeFlashCall &v(c_auth_sentCodeTypeFlashCall()); + return v.vpattern.innerLength(); + } + } + return 0; +} +inline mtpTypeId MTPauth_sentCodeType::type() const { + if (!_type) throw mtpErrorUninitialized(); + return _type; +} +inline void MTPauth_sentCodeType::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) { + if (cons != _type) setData(0); + switch (cons) { + case mtpc_auth_sentCodeTypeApp: _type = cons; { + if (!data) setData(new MTPDauth_sentCodeTypeApp()); + MTPDauth_sentCodeTypeApp &v(_auth_sentCodeTypeApp()); + v.vlength.read(from, end); + } break; + case mtpc_auth_sentCodeTypeSms: _type = cons; { + if (!data) setData(new MTPDauth_sentCodeTypeSms()); + MTPDauth_sentCodeTypeSms &v(_auth_sentCodeTypeSms()); + v.vlength.read(from, end); + } break; + case mtpc_auth_sentCodeTypeCall: _type = cons; { + if (!data) setData(new MTPDauth_sentCodeTypeCall()); + MTPDauth_sentCodeTypeCall &v(_auth_sentCodeTypeCall()); + v.vlength.read(from, end); + } break; + case mtpc_auth_sentCodeTypeFlashCall: _type = cons; { + if (!data) setData(new MTPDauth_sentCodeTypeFlashCall()); + MTPDauth_sentCodeTypeFlashCall &v(_auth_sentCodeTypeFlashCall()); + v.vpattern.read(from, end); + } break; + default: throw mtpErrorUnexpected(cons, "MTPauth_sentCodeType"); + } +} +inline void MTPauth_sentCodeType::write(mtpBuffer &to) const { + switch (_type) { + case mtpc_auth_sentCodeTypeApp: { + const MTPDauth_sentCodeTypeApp &v(c_auth_sentCodeTypeApp()); + v.vlength.write(to); + } break; + case mtpc_auth_sentCodeTypeSms: { + const MTPDauth_sentCodeTypeSms &v(c_auth_sentCodeTypeSms()); + v.vlength.write(to); + } break; + case mtpc_auth_sentCodeTypeCall: { + const MTPDauth_sentCodeTypeCall &v(c_auth_sentCodeTypeCall()); + v.vlength.write(to); + } break; + case mtpc_auth_sentCodeTypeFlashCall: { + const MTPDauth_sentCodeTypeFlashCall &v(c_auth_sentCodeTypeFlashCall()); + v.vpattern.write(to); + } break; + } +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(mtpTypeId type) : mtpDataOwner(0), _type(type) { + switch (type) { + case mtpc_auth_sentCodeTypeApp: setData(new MTPDauth_sentCodeTypeApp()); break; + case mtpc_auth_sentCodeTypeSms: setData(new MTPDauth_sentCodeTypeSms()); break; + case mtpc_auth_sentCodeTypeCall: setData(new MTPDauth_sentCodeTypeCall()); break; + case mtpc_auth_sentCodeTypeFlashCall: setData(new MTPDauth_sentCodeTypeFlashCall()); break; + default: throw mtpErrorBadTypeId(type, "MTPauth_sentCodeType"); + } +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeApp *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeApp) { +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeSms *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeSms) { +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeCall *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeCall) { +} +inline MTPauth_sentCodeType::MTPauth_sentCodeType(MTPDauth_sentCodeTypeFlashCall *_data) : mtpDataOwner(_data), _type(mtpc_auth_sentCodeTypeFlashCall) { +} +inline MTPauth_sentCodeType MTP_auth_sentCodeTypeApp(MTPint _length) { + return MTP::internal::TypeCreator::new_auth_sentCodeTypeApp(_length); +} +inline MTPauth_sentCodeType MTP_auth_sentCodeTypeSms(MTPint _length) { + return MTP::internal::TypeCreator::new_auth_sentCodeTypeSms(_length); +} +inline MTPauth_sentCodeType MTP_auth_sentCodeTypeCall(MTPint _length) { + return MTP::internal::TypeCreator::new_auth_sentCodeTypeCall(_length); +} +inline MTPauth_sentCodeType MTP_auth_sentCodeTypeFlashCall(const MTPstring &_pattern) { + return MTP::internal::TypeCreator::new_auth_sentCodeTypeFlashCall(_pattern); +} +inline MTPDmessage::Flags mtpCastFlags(MTPDmessageService::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } +inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } +inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortChatMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } +inline MTPDmessage::Flags mtpCastFlags(MTPDupdateShortSentMessage::Flags flags) { return MTPDmessage::Flags(QFlag(flags)); } +inline MTPDreplyKeyboardMarkup::Flags mtpCastFlags(MTPDreplyKeyboardHide::Flags flags) { return MTPDreplyKeyboardMarkup::Flags(QFlag(flags)); } +inline MTPDreplyKeyboardMarkup::Flags mtpCastFlags(MTPDreplyKeyboardForceReply::Flags flags) { return MTPDreplyKeyboardMarkup::Flags(QFlag(flags)); } +inline MTPDpeerNotifySettings::Flags mtpCastFlags(MTPDinputPeerNotifySettings::Flags flags) { return MTPDpeerNotifySettings::Flags(QFlag(flags)); } +inline MTPDinputPeerNotifySettings::Flags mtpCastFlags(MTPDpeerNotifySettings::Flags flags) { return MTPDinputPeerNotifySettings::Flags(QFlag(flags)); } + // Human-readable text serialization void mtpTextSerializeType(MTPStringLogger &to, const mtpPrime *&from, const mtpPrime *end, mtpPrime cons, uint32 level, mtpPrime vcons); diff --git a/Telegram/SourceFiles/mtproto/mtpSession.cpp b/Telegram/SourceFiles/mtproto/session.cpp similarity index 77% rename from Telegram/SourceFiles/mtproto/mtpSession.cpp rename to Telegram/SourceFiles/mtproto/session.cpp index a6d6d918c..70f5561a5 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.cpp +++ b/Telegram/SourceFiles/mtproto/session.cpp @@ -19,9 +19,13 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include -void MTPSessionData::clear() { +#include "mtproto/session.h" + +namespace MTP { +namespace internal { + +void SessionData::clear() { RPCCallbackClears clearCallbacks; { QReadLocker locker1(haveSentMutex()), locker2(toResendMutex()), locker3(haveReceivedMutex()), locker4(wereAckedMutex()); @@ -62,11 +66,11 @@ void MTPSessionData::clear() { QWriteLocker locker(receivedIdsMutex()); receivedIds.clear(); } - _mtp_internal::clearCallbacksDelayed(clearCallbacks); + clearCallbacksDelayed(clearCallbacks); } -MTProtoSession::MTProtoSession(int32 dcenter) : QObject() +Session::Session(int32 dcenter) : QObject() , _connection(0) , _killed(false) , _needToReceive(false) @@ -81,7 +85,7 @@ MTProtoSession::MTProtoSession(int32 dcenter) : QObject() return; } if (dcWithShift) { - DEBUG_LOG(("Session Info: MTProtoSession::start called on already started session")); + DEBUG_LOG(("Session Info: Session::start called on already started session")); return; } @@ -92,9 +96,9 @@ MTProtoSession::MTProtoSession(int32 dcenter) : QObject() connect(&sender, SIGNAL(timeout()), this, SLOT(needToResumeAndSend())); - MTProtoDCMap &dcs(mtpDCMap()); + DcenterMap &dcs(DCMap()); - _connection = new MTProtoConnection(); + _connection = new Connection(); dcWithShift = _connection->start(&data, dcenter); if (!dcWithShift) { delete _connection; @@ -104,17 +108,17 @@ MTProtoSession::MTProtoSession(int32 dcenter) : QObject() } if (!dc) { dcenter = dcWithShift; - int32 dcId = dcWithShift % _mtp_internal::dcShift; - MTProtoDCMap::const_iterator dcIndex = dcs.constFind(dcId); + int32 dcId = bareDcId(dcWithShift); + auto dcIndex = dcs.constFind(dcId); if (dcIndex == dcs.cend()) { - dc = MTProtoDCPtr(new MTProtoDC(dcId, mtpAuthKeyPtr())); - dcs.insert(dcWithShift % _mtp_internal::dcShift, dc); + dc = DcenterPtr(new Dcenter(dcId, AuthKeyPtr())); + dcs.insert(dcId, dc); } else { dc = dcIndex.value(); } ReadLockerAttempt lock(keyMutex()); - data.setKey(lock ? dc->getKey() : mtpAuthKeyPtr(0)); + data.setKey(lock ? dc->getKey() : AuthKeyPtr()); if (lock && dc->connectionInited()) { data.setLayerWasInited(true); } @@ -123,7 +127,7 @@ MTProtoSession::MTProtoSession(int32 dcenter) : QObject() } } -void MTProtoSession::restart() { +void Session::restart() { if (_killed) { DEBUG_LOG(("Session Error: can't restart a killed session")); return; @@ -131,7 +135,7 @@ void MTProtoSession::restart() { emit needToRestart(); } -void MTProtoSession::stop() { +void Session::stop() { if (_killed) { DEBUG_LOG(("Session Error: can't kill a killed session")); return; @@ -143,20 +147,20 @@ void MTProtoSession::stop() { } } -void MTProtoSession::kill() { +void Session::kill() { stop(); _killed = true; DEBUG_LOG(("Session Info: marked session dcWithShift %1 as killed").arg(dcWithShift)); } -void MTProtoSession::unpaused() { +void Session::unpaused() { if (_needToReceive) { _needToReceive = false; QTimer::singleShot(0, this, SLOT(tryToReceive())); } } -void MTProtoSession::sendAnything(quint64 msCanWait) { +void Session::sendAnything(quint64 msCanWait) { if (_killed) { DEBUG_LOG(("Session Error: can't send anything in a killed session")); return; @@ -186,16 +190,16 @@ void MTProtoSession::sendAnything(quint64 msCanWait) { } } -void MTProtoSession::needToResumeAndSend() { +void Session::needToResumeAndSend() { if (_killed) { DEBUG_LOG(("Session Info: can't resume a killed session")); return; } if (!_connection) { DEBUG_LOG(("Session Info: resuming session dcWithShift %1").arg(dcWithShift)); - MTProtoDCMap &dcs(mtpDCMap()); + DcenterMap &dcs(DCMap()); - _connection = new MTProtoConnection(); + _connection = new Connection(); if (!_connection->start(&data, dcWithShift)) { delete _connection; _connection = 0; @@ -212,11 +216,11 @@ void MTProtoSession::needToResumeAndSend() { } } -void MTProtoSession::sendPong(quint64 msgId, quint64 pingId) { +void Session::sendPong(quint64 msgId, quint64 pingId) { send(MTP_pong(MTP_long(msgId), MTP_long(pingId))); } -void MTProtoSession::sendMsgsStateInfo(quint64 msgId, QByteArray data) { +void Session::sendMsgsStateInfo(quint64 msgId, QByteArray data) { MTPMsgsStateInfo req(MTP_msgs_state_info(MTP_long(msgId), MTPstring())); string &info(req._msgs_state_info().vinfo._string().v); info.resize(data.size()); @@ -226,7 +230,7 @@ void MTProtoSession::sendMsgsStateInfo(quint64 msgId, QByteArray data) { send(req); } -void MTProtoSession::checkRequestsByTimer() { +void Session::checkRequestsByTimer() { QVector resendingIds; QVector removingIds; // remove very old (10 minutes) containers and resend requests QVector stateRequestIds; @@ -287,19 +291,19 @@ void MTProtoSession::checkRequestsByTimer() { } } } - _mtp_internal::clearCallbacksDelayed(clearCallbacks); + clearCallbacksDelayed(clearCallbacks); } } -void MTProtoSession::onConnectionStateChange(qint32 newState) { - _mtp_internal::onStateChange(dcWithShift, newState); +void Session::onConnectionStateChange(qint32 newState) { + onStateChange(dcWithShift, newState); } -void MTProtoSession::onResetDone() { - _mtp_internal::onSessionReset(dcWithShift); +void Session::onResetDone() { + onSessionReset(dcWithShift); } -void MTProtoSession::cancel(mtpRequestId requestId, mtpMsgId msgId) { +void Session::cancel(mtpRequestId requestId, mtpMsgId msgId) { if (requestId) { QWriteLocker locker(data.toSendMutex()); data.toSendMap().remove(requestId); @@ -310,20 +314,20 @@ void MTProtoSession::cancel(mtpRequestId requestId, mtpMsgId msgId) { } } -void MTProtoSession::ping() { +void Session::ping() { _ping = true; sendAnything(0); } -int32 MTProtoSession::requestState(mtpRequestId requestId) const { +int32 Session::requestState(mtpRequestId requestId) const { int32 result = MTP::RequestSent; bool connected = false; if (_connection) { int32 s = _connection->state(); - if (s == MTProtoConnection::Connected) { + if (s == ConnectedState) { connected = true; - } else if (s == MTProtoConnection::Connecting || s == MTProtoConnection::Disconnected) { + } else if (s == ConnectingState || s == DisconnectedState) { if (result < 0 || result == MTP::RequestSent) { result = MTP::RequestConnecting; } @@ -348,14 +352,14 @@ int32 MTProtoSession::requestState(mtpRequestId requestId) const { } } -int32 MTProtoSession::getState() const { +int32 Session::getState() const { int32 result = -86400000; if (_connection) { int32 s = _connection->state(); - if (s == MTProtoConnection::Connected) { + if (s == ConnectedState) { return s; - } else if (s == MTProtoConnection::Connecting || s == MTProtoConnection::Disconnected) { + } else if (s == ConnectingState || s == DisconnectedState) { if (result < 0) { return s; } @@ -366,16 +370,16 @@ int32 MTProtoSession::getState() const { } } if (result == -86400000) { - result = MTProtoConnection::Disconnected; + result = DisconnectedState; } return result; } -QString MTProtoSession::transport() const { +QString Session::transport() const { return _connection ? _connection->transport() : QString(); } -mtpRequestId MTProtoSession::resend(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { +mtpRequestId Session::resend(quint64 msgId, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { mtpRequest request; { QWriteLocker locker(data.haveSentMutex()); @@ -415,13 +419,13 @@ mtpRequestId MTProtoSession::resend(quint64 msgId, quint64 msCanWait, bool force } } -void MTProtoSession::resendMany(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { +void Session::resendMany(QVector msgIds, quint64 msCanWait, bool forceContainer, bool sendMsgStateInfo) { for (int32 i = 0, l = msgIds.size(); i < l; ++i) { resend(msgIds.at(i), msCanWait, forceContainer, sendMsgStateInfo); } } -void MTProtoSession::resendAll() { +void Session::resendAll() { QVector toResend; { QReadLocker locker(data.haveSentMutex()); @@ -436,7 +440,7 @@ void MTProtoSession::resendAll() { } } -void MTProtoSession::sendPrepared(const mtpRequest &request, uint64 msCanWait, bool newRequest) { // returns true, if emit of needToSend() is needed +void Session::sendPrepared(const mtpRequest &request, uint64 msCanWait, bool newRequest) { // returns true, if emit of needToSend() is needed { QWriteLocker locker(data.toSendMutex()); data.toSendMap().insert(request->requestId, request); @@ -452,33 +456,33 @@ void MTProtoSession::sendPrepared(const mtpRequest &request, uint64 msCanWait, b sendAnything(msCanWait); } -QReadWriteLock *MTProtoSession::keyMutex() const { +QReadWriteLock *Session::keyMutex() const { return dc->keyMutex(); } -void MTProtoSession::authKeyCreatedForDC() { - DEBUG_LOG(("AuthKey Info: MTProtoSession::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift)); +void Session::authKeyCreatedForDC() { + DEBUG_LOG(("AuthKey Info: Session::authKeyCreatedForDC slot, emitting authKeyCreated(), dcWithShift %1").arg(dcWithShift)); data.setKey(dc->getKey()); emit authKeyCreated(); } -void MTProtoSession::notifyKeyCreated(const mtpAuthKeyPtr &key) { - DEBUG_LOG(("AuthKey Info: MTProtoSession::keyCreated(), setting, dcWithShift %1").arg(dcWithShift)); +void Session::notifyKeyCreated(const AuthKeyPtr &key) { + DEBUG_LOG(("AuthKey Info: Session::keyCreated(), setting, dcWithShift %1").arg(dcWithShift)); dc->setKey(key); } -void MTProtoSession::layerWasInitedForDC(bool wasInited) { - DEBUG_LOG(("MTP Info: MTProtoSession::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift)); +void Session::layerWasInitedForDC(bool wasInited) { + DEBUG_LOG(("MTP Info: Session::layerWasInitedForDC slot, dcWithShift %1").arg(dcWithShift)); data.setLayerWasInited(wasInited); } -void MTProtoSession::notifyLayerInited(bool wasInited) { +void Session::notifyLayerInited(bool wasInited) { DEBUG_LOG(("MTP Info: emitting MTProtoDC::layerWasInited(%1), dcWithShift %2").arg(Logs::b(wasInited)).arg(dcWithShift)); dc->setConnectionInited(wasInited); emit dc->layerWasInited(wasInited); } -void MTProtoSession::destroyKey() { +void Session::destroyKey() { if (!dc) return; if (data.getKey()) { @@ -486,20 +490,20 @@ void MTProtoSession::destroyKey() { if (data.getKey() == dc->getKey()) { dc->destroyKey(); } - data.setKey(mtpAuthKeyPtr(0)); + data.setKey(AuthKeyPtr()); } } -int32 MTProtoSession::getDcWithShift() const { +int32 Session::getDcWithShift() const { return dcWithShift; } -void MTProtoSession::tryToReceive() { +void Session::tryToReceive() { if (_killed) { DEBUG_LOG(("Session Error: can't receive in a killed session")); return; } - if (_mtp_internal::paused()) { + if (paused()) { _needToReceive = true; return; } @@ -518,20 +522,23 @@ void MTProtoSession::tryToReceive() { responses.erase(i); } if (requestId <= 0) { - if (dcWithShift < int(_mtp_internal::dcShift)) { // call globalCallback only in main session - _mtp_internal::globalCallback(response.constData(), response.constData() + response.size()); + if (dcWithShift == bareDcId(dcWithShift)) { // call globalCallback only in main session + globalCallback(response.constData(), response.constData() + response.size()); } } else { - _mtp_internal::execCallback(requestId, response.constData(), response.constData() + response.size()); + execCallback(requestId, response.constData(), response.constData() + response.size()); } ++cnt; } } -MTProtoSession::~MTProtoSession() { +Session::~Session() { t_assert(_connection == 0); } MTPrpcError rpcClientError(const QString &type, const QString &description) { return MTP_rpc_error(MTP_int(0), MTP_string(("CLIENT_" + type + (description.length() ? (": " + description) : "")).toUtf8().constData())); } + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/mtproto/mtpSession.h b/Telegram/SourceFiles/mtproto/session.h similarity index 89% rename from Telegram/SourceFiles/mtproto/mtpSession.h rename to Telegram/SourceFiles/mtproto/session.h index a635372f1..f46694e3a 100644 --- a/Telegram/SourceFiles/mtproto/mtpSession.h +++ b/Telegram/SourceFiles/mtproto/session.h @@ -20,19 +20,26 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once -#include "mtpConnection.h" -#include "mtpDC.h" -#include "mtpRPC.h" +#include "mtproto/connection.h" +#include "mtproto/dcenter.h" +#include "mtproto/rpc_sender.h" -class MTProtoSession; +namespace MTP { +namespace internal { -class MTPSessionData { +class Session; + +class SessionData { public: - MTPSessionData(MTProtoSession *creator) - : _session(0), _salt(0) - , _messagesSent(0), _fakeRequestId(-2000000000) - , _owner(creator), _keyChecked(false), _layerInited(false) { + SessionData(Session *creator) + : _session(0) + , _salt(0) + , _messagesSent(0) + , _fakeRequestId(-2000000000) + , _owner(creator) + , _keyChecked(false) + , _layerInited(false) { } void setSession(uint64 session) { @@ -66,13 +73,12 @@ public: return _salt; } - const mtpAuthKeyPtr &getKey() const { + const AuthKeyPtr &getKey() const { return _authKey; } - void setKey(const mtpAuthKeyPtr &key) { + void setKey(const AuthKeyPtr &key) { if (_authKey != key) { - uint64 session; - memsetrnd(session); + uint64 session = rand_value(); _authKey = key; DEBUG_LOG(("MTP Info: new auth key set in SessionData, id %1, setting random server_session %2").arg(key ? key->keyId() : 0).arg(session)); @@ -170,10 +176,10 @@ public: return _fakeRequestId; } - MTProtoSession *owner() { + Session *owner() { return _owner; } - const MTProtoSession *owner() const { + const Session *owner() const { return _owner; } @@ -192,9 +198,9 @@ private: uint32 _messagesSent; mtpRequestId _fakeRequestId; - MTProtoSession *_owner; + Session *_owner; - mtpAuthKeyPtr _authKey; + AuthKeyPtr _authKey; bool _keyChecked, _layerInited; mtpPreRequestMap toSend; // map of request_id -> request, that is waiting to be sent @@ -217,12 +223,12 @@ private: }; -class MTProtoSession : public QObject { +class Session : public QObject { Q_OBJECT public: - MTProtoSession(int32 dcenter); + Session(int32 dcenter); void restart(); void stop(); @@ -231,10 +237,10 @@ public: void unpaused(); int32 getDcWithShift() const; - ~MTProtoSession(); + ~Session(); QReadWriteLock *keyMutex() const; - void notifyKeyCreated(const mtpAuthKeyPtr &key); + void notifyKeyCreated(const AuthKeyPtr &key); void destroyKey(); void notifyLayerInited(bool wasInited); @@ -278,15 +284,15 @@ public slots: private: - MTProtoConnection *_connection; + Connection *_connection; bool _killed; bool _needToReceive; - MTPSessionData data; + SessionData data; int32 dcWithShift; - MTProtoDCPtr dc; + DcenterPtr dc; uint64 msSendCall, msWait; @@ -297,8 +303,11 @@ private: }; -inline QReadWriteLock *MTPSessionData::keyMutex() const { +inline QReadWriteLock *SessionData::keyMutex() const { return _owner->keyMutex(); } MTPrpcError rpcClientError(const QString &type, const QString &description = QString()); + +} // namespace internal +} // namespace MTP diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index 2430d02d5..f0c06c53d 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -613,8 +613,6 @@ void OverviewInner::onDragExec() { bool uponSelected = false; if (_dragItem) { - bool afterDragSymbol; - uint16 symbol; if (!_selected.isEmpty() && _selected.cbegin().value() == FullSelection) { uponSelected = _selected.contains(_dragItem); } else { @@ -661,10 +659,10 @@ void OverviewInner::onDragExec() { mimeData->setData(qsl("application/x-td-forward-pressed-link"), "1"); if (lnkDocument) { - QString already = static_cast(textlnkDown().data())->document()->already(true); - if (!already.isEmpty()) { + QString filepath = static_cast(textlnkDown().data())->document()->filepath(DocumentData::FilePathResolveChecked); + if (!filepath.isEmpty()) { QList urls; - urls.push_back(QUrl::fromLocalFile(already)); + urls.push_back(QUrl::fromLocalFile(filepath)); mimeData->setUrls(urls); } } @@ -778,14 +776,20 @@ void OverviewInner::preloadMore() { if (!_searchRequest) { MTPmessagesFilter filter = (_type == OverviewLinks) ? MTP_inputMessagesFilterUrl() : MTP_inputMessagesFilterDocument(); if (!_searchFull) { - int32 flags = (_history->peer->isChannel() && !_history->peer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchId ? SearchFromOffset : SearchFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchId ? SearchFromOffset : SearchFromStart)); + MTPmessages_Search::Flags flags = 0; + if (_history->peer->isChannel() && !_history->peer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchId ? SearchFromOffset : SearchFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchId ? SearchFromOffset : SearchFromStart)); if (!_lastSearchId) { _searchQueries.insert(_searchRequest, _searchQuery); } } else if (_migrated && !_searchFullMigrated) { - int32 flags = (_migrated->peer->isChannel() && !_migrated->peer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _migrated->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchMigratedId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart)); + MTPmessages_Search::Flags flags = 0; + if (_migrated->peer->isChannel() && !_migrated->peer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _migrated->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(_lastSearchMigratedId), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart), rpcFail(&OverviewInner::searchFailed, _lastSearchMigratedId ? SearchMigratedFromOffset : SearchMigratedFromStart)); } } } else if (App::main()) { @@ -1263,8 +1267,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { _contextMenuLnk = textlnkOver(); PhotoLink *lnkPhoto = dynamic_cast(_contextMenuLnk.data()); DocumentLink *lnkDocument = dynamic_cast(_contextMenuLnk.data()); - bool lnkIsAudio = lnkDocument ? (lnkDocument->document()->voice() != 0) : false; bool lnkIsVideo = lnkDocument ? lnkDocument->document()->isVideo() : false; + bool lnkIsAudio = lnkDocument ? (lnkDocument->document()->voice() != nullptr) : false; + bool lnkIsSong = lnkDocument ? (lnkDocument->document()->song() != nullptr) : false; if (lnkPhoto || lnkDocument) { _menu = new PopupMenu(); if (App::hoveredLinkItem()) { @@ -1275,10 +1280,10 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (lnkDocument && lnkDocument->document()->loading()) { _menu->addAction(lang(lng_context_cancel_download), this, SLOT(cancelContextDownload()))->setEnabled(true); } else { - if (lnkDocument && !lnkDocument->document()->already(true).isEmpty()) { + if (lnkDocument && !lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked).isEmpty()) { _menu->addAction(lang((cPlatform() == dbipMac || cPlatform() == dbipMacOld) ? lng_context_show_in_finder : lng_context_show_in_folder), this, SLOT(showContextInFolder()))->setEnabled(true); } - _menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : lng_context_save_file)), this, SLOT(saveContextFile()))->setEnabled(true); + _menu->addAction(lang(lnkIsVideo ? lng_context_save_video : (lnkIsAudio ? lng_context_save_audio : (lnkIsSong ? lng_context_save_audio_file : lng_context_save_file))), this, SLOT(saveContextFile()))->setEnabled(true); } } if (isUponSelected > 1) { @@ -1496,9 +1501,12 @@ void OverviewInner::cancelContextDownload() { } void OverviewInner::showContextInFolder() { - DocumentLink *lnkDocument = dynamic_cast(_contextMenuLnk.data()); - QString already = lnkDocument ? lnkDocument->document()->already(true) : QString(); - if (!already.isEmpty()) psShowInFolder(already); + if (DocumentLink *lnkDocument = dynamic_cast(_contextMenuLnk.data())) { + QString filepath = lnkDocument->document()->filepath(DocumentData::FilePathResolveChecked); + if (!filepath.isEmpty()) { + psShowInFolder(filepath); + } + } } void OverviewInner::saveContextFile() { @@ -1527,9 +1535,12 @@ bool OverviewInner::onSearchMessages(bool searchCache) { } else if (_searchQuery != q) { _searchQuery = q; _searchFull = _searchFullMigrated = false; - int32 flags = (_history->peer->isChannel() && !_history->peer->isMegagroup()) ? MTPmessages_Search::flag_important_only : 0; + MTPmessages_Search::Flags flags = 0; + if (_history->peer->isChannel() && !_history->peer->isMegagroup()) { + flags |= MTPmessages_Search::Flag::f_important_only; + } MTPmessagesFilter filter = (_type == OverviewLinks) ? MTP_inputMessagesFilterUrl() : MTP_inputMessagesFilterDocument(); - _searchRequest = MTP::send(MTPmessages_Search(MTP_int(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, SearchFromStart), rpcFail(&OverviewInner::searchFailed, SearchFromStart)); + _searchRequest = MTP::send(MTPmessages_Search(MTP_flags(flags), _history->peer->input, MTP_string(_searchQuery), filter, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(SearchPerPage)), rpcDone(&OverviewInner::searchReceived, SearchFromStart), rpcFail(&OverviewInner::searchFailed, SearchFromStart)); _searchQueries.insert(_searchRequest, _searchQuery); } return false; @@ -2383,7 +2394,6 @@ void OverviewWidget::onDeleteSelectedSure() { for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) { i.value()->destroy(); } - Notify::historyItemsResized(); Ui::hideLayer(); for (QMap >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) { @@ -2405,7 +2415,6 @@ void OverviewWidget::onDeleteContextSure() { App::main()->checkPeerHistory(h->peer); } - Notify::historyItemsResized(); Ui::hideLayer(); if (wasOnServer) { diff --git a/Telegram/SourceFiles/playerwidget.cpp b/Telegram/SourceFiles/playerwidget.cpp index 1ab72f6c5..eefeb4da0 100644 --- a/Telegram/SourceFiles/playerwidget.cpp +++ b/Telegram/SourceFiles/playerwidget.cpp @@ -324,7 +324,7 @@ void PlayerWidget::preloadNext() { if (next) { if (HistoryDocument *document = static_cast(next->getMedia())) { DocumentData *d = document->getDocument(); - if (!d->loaded(true)) { + if (!d->loaded(DocumentData::FilePathResolveSaveFromDataSilent)) { DocumentOpenLink::doOpen(d, ActionOnLoadNone); } } diff --git a/Telegram/SourceFiles/profilewidget.cpp b/Telegram/SourceFiles/profilewidget.cpp index c28c5fba1..a3036db88 100644 --- a/Telegram/SourceFiles/profilewidget.cpp +++ b/Telegram/SourceFiles/profilewidget.cpp @@ -282,7 +282,7 @@ void ProfileInner::loadProfilePhotos(int32 yFrom) { if (yFrom >= _participants.size()) return; if (yTo > _participants.size()) yTo = _participants.size(); for (int32 i = yFrom; i < yTo; ++i) { - _participants[i]->photo->load(); + _participants[i]->loadUserpic(); } } @@ -364,7 +364,7 @@ void ProfileInner::onDeleteChannelSure() { if (_peerChannel->migrateFrom()) { App::main()->deleteConversation(_peerChannel->migrateFrom()); } - MTP::send(MTPchannels_DeleteChannel(_peerChannel->inputChannel), App::main()->rpcDone(&MainWidget::sentUpdatesReceived)); + MTP::send(MTPchannels_DeleteChannel(_peerChannel->inputChannel), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::deleteChannelFailed)); } } void ProfileInner::onBlockUser() { @@ -832,7 +832,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { // profile top += st::profilePadding.top(); if (_photoLink || _peerUser || (_peerChat && !_peerChat->canEdit()) || (_peerChannel && !_amCreator)) { - p.drawPixmap(_left, top, _peer->photo->pix(st::profilePhotoSize)); + _peer->paintUserpic(p, st::profilePhotoSize, _left, top); } else { if (a_photoOver.current() < 1) { p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg); @@ -978,7 +978,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { } if (_peerUser && peerToUser(_peerUser->id) != MTP::authedId()) { top += st::setSectionSkip + _blockUser.height(); - } else if (_peerChannel && _amCreator) { + } else if (canDeleteChannel()) { top += (_peerChannel->isMegagroup() ? 0 : (st::setSectionSkip - st::setLittleSkip)) + _deleteChannel.height(); } @@ -1019,7 +1019,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { } UserData *user = *i; - p.drawPixmap(_left, top + st::profileListPadding.height(), user->photo->pix(st::profileListPhotoSize)); + user->paintUserpic(p, st::profileListPhotoSize, _left, top + st::profileListPadding.height()); ParticipantData *data = _participantsData[cnt]; if (!data) { data = _participantsData[cnt] = new ParticipantData(); @@ -1034,7 +1034,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) { data->online = App::onlineText(user, l_time); } if (_peerChat) { - data->admin = (peerFromUser(_peerChat->creator) == user->id) || (_peerChat->admins.constFind(user) != _peerChat->admins.cend()); + data->admin = (peerFromUser(_peerChat->creator) == user->id) || (_peerChat->adminsEnabled() && (_peerChat->admins.constFind(user) != _peerChat->admins.cend())); } else if (_peerChannel) { data->admin = (_peerChannel->mgInfo->lastAdmins.constFind(user) != _peerChannel->mgInfo->lastAdmins.cend()); } else { @@ -1115,8 +1115,10 @@ void ProfileInner::updateSelected() { } int32 participantsTop = 0; - if (_peerChannel && _amCreator) { + if (canDeleteChannel()) { participantsTop = _deleteChannel.y() + _deleteChannel.height(); + } else if (_peerChannel && _amCreator) { + participantsTop = _searchInPeer.y() + _searchInPeer.height(); } else { participantsTop = _deleteConversation.y() + _deleteConversation.height(); } @@ -1365,6 +1367,10 @@ bool ProfileInner::migrateFail(const RPCError &error) { return true; } +bool ProfileInner::canDeleteChannel() const { + return _peerChannel && _amCreator && (_peerChannel->count <= 1000); +} + void ProfileInner::resizeEvent(QResizeEvent *e) { _width = qMin(width() - st::profilePadding.left() - st::profilePadding.right(), int(st::profileMaxWidth)); _left = (width() - _width) / 2; @@ -1482,7 +1488,7 @@ void ProfileInner::resizeEvent(QResizeEvent *e) { if (_peerUser && peerToUser(_peerUser->id) != MTP::authedId()) { top += st::setSectionSkip; _blockUser.move(_left, top); top += _blockUser.height(); - } else if (_peerChannel && _amCreator) { + } else if (canDeleteChannel()) { top += (_peerChannel->isMegagroup() ? 0 : (st::setSectionSkip - st::setLittleSkip)); _deleteChannel.move(_left, top); top += _deleteChannel.height(); } @@ -1503,10 +1509,13 @@ void ProfileInner::contextMenuEvent(QContextMenuEvent *e) { _menu->deleteLater(); _menu = 0; } - if (!_phoneText.isEmpty() || (_peerUser && !_peerUser->username.isEmpty())) { + if (!_phoneText.isEmpty() || _peerUser) { QRect info(_left + st::profilePhotoSize + st::profilePhoneLeft, st::profilePadding.top(), _width - st::profilePhotoSize - st::profilePhoneLeft, st::profilePhotoSize); if (info.contains(mapFromGlobal(e->globalPos()))) { _menu = new PopupMenu(); + if (_peerUser) { + _menu->addAction(lang(lng_profile_copy_fullname), this, SLOT(onCopyFullName()))->setEnabled(true); + } if (!_phoneText.isEmpty()) { _menu->addAction(lang(lng_profile_copy_phone), this, SLOT(onCopyPhone()))->setEnabled(true); } @@ -1526,6 +1535,11 @@ void ProfileInner::onMenuDestroy(QObject *obj) { } } +void ProfileInner::onCopyFullName() { + if (!_peerUser) return; + QApplication::clipboard()->setText(lng_full_name(lt_first_name, _peerUser->firstName, lt_last_name, _peerUser->lastName).trimmed()); +} + void ProfileInner::onCopyPhone() { QApplication::clipboard()->setText(_phoneText); } @@ -1602,9 +1616,9 @@ int32 ProfileInner::countMinHeight() { h += st::profileHeaderSkip; } } else if (_peerChannel) { - if (_amCreator) { + if (canDeleteChannel()) { h = _deleteChannel.y() + _deleteChannel.height() + st::profileHeaderSkip; - } else if (_peerChannel->amIn()) { + } else if (_peerChannel->amIn() && !_amCreator) { h = _deleteConversation.y() + _deleteConversation.height() + st::profileHeaderSkip; } else { h = _searchInPeer.y() + _searchInPeer.height() + st::profileHeaderSkip; @@ -1755,7 +1769,7 @@ void ProfileInner::showAll() { _addParticipant.hide(); } _blockUser.hide(); - if (_amCreator) { + if (canDeleteChannel()) { _deleteChannel.show(); } else { _deleteChannel.hide(); diff --git a/Telegram/SourceFiles/profilewidget.h b/Telegram/SourceFiles/profilewidget.h index 23b6fcd02..fe27c90e5 100644 --- a/Telegram/SourceFiles/profilewidget.h +++ b/Telegram/SourceFiles/profilewidget.h @@ -109,6 +109,7 @@ public slots: void onMediaLinks(); void onMenuDestroy(QObject *obj); + void onCopyFullName(); void onCopyPhone(); void onCopyUsername(); @@ -191,6 +192,7 @@ private: UserBlockedStatus _wasBlocked; mtpRequestId _blockRequest; LinkButton _blockUser, _deleteChannel; + bool canDeleteChannel() const; // participants int32 _pHeight; diff --git a/Telegram/SourceFiles/pspecific.h b/Telegram/SourceFiles/pspecific.h index 7003daa42..f0128a173 100644 --- a/Telegram/SourceFiles/pspecific.h +++ b/Telegram/SourceFiles/pspecific.h @@ -26,15 +26,17 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #ifdef Q_OS_MAC #include "pspecific_mac.h" -#endif +#endif // Q_OS_MAC #ifdef Q_OS_LINUX #include "pspecific_linux.h" -#endif +#endif // Q_OS_LINUX -#ifdef Q_OS_WIN -#include "pspecific_wnd.h" -#endif +#ifdef Q_OS_WINRT +#include "pspecific_winrt.h" +#elif defined Q_OS_WIN // Q_OS_WINRT +#include "pspecific_win.h" +#endif // Q_OS_WIN* namespace PlatformSpecific { diff --git a/Telegram/SourceFiles/pspecific_linux.cpp b/Telegram/SourceFiles/pspecific_linux.cpp index 2134e97dd..e3af2b9de 100644 --- a/Telegram/SourceFiles/pspecific_linux.cpp +++ b/Telegram/SourceFiles/pspecific_linux.cpp @@ -33,12 +33,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include -#undef signals extern "C" { - #include - #include -} +#undef signals +#include +#include #define signals public +} // extern "C" #include @@ -347,7 +347,7 @@ namespace { } bool loadLibrary(QLibrary &lib, const char *name, int version) { - DEBUG_LOG(("Loading '%1' with version %2..").arg(QLatin1String(name)).arg(version)); + DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version)); lib.setFileNameAndVersion(QLatin1String(name), version); if (lib.load()) { DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version)); @@ -443,7 +443,7 @@ namespace { } if (!useGtkBase && lib_gtk.isLoaded()) { - LOG(("Could not load appindicator, trying to load gtk..")); + LOG(("Could not load appindicator, trying to load gtk...")); setupGtkBase(lib_gtk); } if (!useGtkBase) { diff --git a/Telegram/SourceFiles/pspecific_mac.cpp b/Telegram/SourceFiles/pspecific_mac.cpp index f674e84e6..531c59561 100644 --- a/Telegram/SourceFiles/pspecific_mac.cpp +++ b/Telegram/SourceFiles/pspecific_mac.cpp @@ -502,7 +502,7 @@ void PsMainWindow::psNotifyShown(NotifyWindow *w) { void PsMainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) { QString title = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->history()->peer->name : qsl("Telegram Desktop"); QString subtitle = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->notificationHeader() : QString(); - QPixmap pix = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->history()->peer->photo->pix(st::notifyMacPhotoSize) : QPixmap(); + QPixmap pix = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->history()->peer->genUserpic(st::notifyMacPhotoSize) : QPixmap(); QString msg = (!App::passcoded() && cNotifyView() <= dbinvShowPreview) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview); _private.showNotify(item->history()->peer->id, item->id, pix, title, subtitle, msg, !App::passcoded() && (cNotifyView() <= dbinvShowPreview)); diff --git a/Telegram/SourceFiles/pspecific_wnd.cpp b/Telegram/SourceFiles/pspecific_win.cpp similarity index 98% rename from Telegram/SourceFiles/pspecific_wnd.cpp rename to Telegram/SourceFiles/pspecific_win.cpp index 898ac1cee..26665b0d5 100644 --- a/Telegram/SourceFiles/pspecific_wnd.cpp +++ b/Telegram/SourceFiles/pspecific_win.cpp @@ -2185,7 +2185,6 @@ namespace PlatformSpecific { namespace { void _psLogError(const char *str, LSTATUS code) { - WCHAR errMsg[2048]; LPTSTR errorText = NULL, errorTextDefault = L"(Unknown error)"; FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errorText, 0, 0); if (!errorText) { @@ -2198,7 +2197,7 @@ namespace { } bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) { - DEBUG_LOG(("App Info: opening reg key %1..").arg(QString::fromStdWString(key))); + DEBUG_LOG(("App Info: opening reg key %1...").arg(QString::fromStdWString(key))); LSTATUS status = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE | KEY_WRITE, rkey); if (status != ERROR_SUCCESS) { if (status == ERROR_FILE_NOT_FOUND) { @@ -2237,7 +2236,7 @@ namespace { void RegisterCustomScheme() { #ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME - DEBUG_LOG(("App Info: Checking custom scheme 'tg'..")); + DEBUG_LOG(("App Info: Checking custom scheme 'tg'...")); HKEY rkey; QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()); @@ -2523,11 +2522,11 @@ bool LoadDbgHelp(bool extended = false) { WCHAR szTemp[4096]; if (GetModuleFileName(NULL, szTemp, 4096) > 0) { - wcscat(szTemp, L".local"); + wcscat_s(szTemp, L".local"); if (GetFileAttributes(szTemp) == INVALID_FILE_ATTRIBUTES) { // ".local" file does not exist, so we can try to load the dbghelp.dll from the "Debugging Tools for Windows" if (GetEnvironmentVariable(L"ProgramFiles", szTemp, 4096) > 0) { - wcscat(szTemp, L"\\Debugging Tools for Windows\\dbghelp.dll"); + wcscat_s(szTemp, L"\\Debugging Tools for Windows\\dbghelp.dll"); // now check if the file exists: if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) { hDll = LoadLibrary(szTemp); @@ -2535,7 +2534,7 @@ bool LoadDbgHelp(bool extended = false) { } // Still not found? Then try to load the 64-Bit version: if (!hDll && (GetEnvironmentVariable(L"ProgramFiles", szTemp, 4096) > 0)) { - wcscat(szTemp, L"\\Debugging Tools for Windows 64-Bit\\dbghelp.dll"); + wcscat_s(szTemp, L"\\Debugging Tools for Windows 64-Bit\\dbghelp.dll"); if (GetFileAttributes(szTemp) != INVALID_FILE_ATTRIBUTES) { hDll = LoadLibrary(szTemp); } @@ -2729,12 +2728,6 @@ BOOL _getModuleInfo(HANDLE hProcess, DWORD64 baseAddr, IMAGEHLP_MODULEW64 *pModu } void psWriteDump() { - OSVERSIONINFOEXA version; - ZeroMemory(&version, sizeof(OSVERSIONINFOEXA)); - version.dwOSVersionInfoSize = sizeof(version); - if (GetVersionExA((OSVERSIONINFOA*)&version) != FALSE) { - SignalHandlers::dump() << "OS-Version: " << version.dwMajorVersion << "." << version.dwMinorVersion << "." << version.dwBuildNumber << "\n"; - } } char ImageHlpSymbol64[sizeof(IMAGEHLP_SYMBOL64) + StackEntryMaxNameLength]; @@ -2902,6 +2895,7 @@ QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile) { } void psWriteStackTrace() { +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS if (!LoadDbgHelp()) { SignalHandlers::dump() << "ERROR: Could not load dbghelp.dll!\n"; return; @@ -2977,6 +2971,7 @@ void psWriteStackTrace() { break; } } +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS } class StringReferenceWrapper { @@ -3246,11 +3241,9 @@ QString toastImage(const StorageKey &key, PeerData *peer) { } else { v.until = 0; } - v.path = cWorkingDir() + qsl("tdata/temp/") + QString::number(MTP::nonce(), 16) + qsl(".png"); - if (peer->photo->loaded() && (key.first || key.second)) { - peer->photo->pix().save(v.path, "PNG"); - } else if (!key.first && key.second) { - (peer->isUser() ? userDefPhoto : chatDefPhoto)(peer->colorIndex)->pix().save(v.path, "PNG"); + v.path = cWorkingDir() + qsl("tdata/temp/") + QString::number(rand_value(), 16) + qsl(".png"); + if (key.first || key.second) { + peer->saveUserpic(v.path); } else { App::wnd()->iconLarge().save(v.path, "PNG"); } @@ -3275,11 +3268,7 @@ bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title StorageKey key; QString imagePath; if (showpix) { - if (peer->photoLoc.isNull() || !peer->photo->loaded()) { - key = StorageKey(0, (peer->isUser() ? 0x1000 : 0x2000) | peer->colorIndex); - } else { - key = storageKey(peer->photoLoc); - } + key = peer->userpicUniqueKey(); } else { key = StorageKey(0, 0); } @@ -3297,7 +3286,7 @@ bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title hr = nodeList->get_Length(&nodeListLength); if (!SUCCEEDED(hr)) return false; - if (nodeListLength < (withSubtitle ? 3 : 2)) return false; + if (nodeListLength < (withSubtitle ? 3U : 2U)) return false; { ComPtr textNode; @@ -3396,7 +3385,7 @@ void CheckPinnedAppUserModelId() { BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo); CloseHandle(srcfile); if (!srcres) return; - LOG(("Checking..")); + LOG(("Checking...")); WIN32_FIND_DATA findData; HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0); if (findHandle == INVALID_HANDLE_VALUE) { @@ -3442,7 +3431,7 @@ void CheckPinnedAppUserModelId() { PROPVARIANT appIdPropVar; hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar); if (!SUCCEEDED(hr)) return; - LOG(("Reading..")); + LOG(("Reading...")); WCHAR already[MAX_PATH]; hr = propVariantToString(appIdPropVar, already, MAX_PATH); if (SUCCEEDED(hr)) { diff --git a/Telegram/SourceFiles/pspecific_wnd.h b/Telegram/SourceFiles/pspecific_win.h similarity index 99% rename from Telegram/SourceFiles/pspecific_wnd.h rename to Telegram/SourceFiles/pspecific_win.h index 0f149ad29..e6303f27f 100644 --- a/Telegram/SourceFiles/pspecific_wnd.h +++ b/Telegram/SourceFiles/pspecific_win.h @@ -21,6 +21,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once +#include + inline QString psServerPrefix() { return qsl("Global\\"); } diff --git a/Telegram/SourceFiles/pspecific_winrt.cpp b/Telegram/SourceFiles/pspecific_winrt.cpp new file mode 100644 index 000000000..ee96c9ae5 --- /dev/null +++ b/Telegram/SourceFiles/pspecific_winrt.cpp @@ -0,0 +1,3074 @@ +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#include "stdafx.h" +#include "pspecific.h" + +#include "lang.h" +#include "application.h" +#include "mainwidget.h" + +#include "localstorage.h" + +#include "passcodewidget.h" + +//#include +#include + +//#include +//#include +//#include +//#include + +//#pragma warning(push) +//#pragma warning(disable:4091) +//#include +//#include +//#pragma warning(pop) + +//#include +//#include +//#include +//#include + +//#include + +//#include +//#include +//#include +//#include +//#include +//#include +//#include +//#include + +#include + +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) < (b) ? (b) : (a)) + +#include + +#ifndef DCX_USESTYLE +#define DCX_USESTYLE 0x00010000 +#endif + +#ifndef WM_NCPOINTERUPDATE +#define WM_NCPOINTERUPDATE 0x0241 +#define WM_NCPOINTERDOWN 0x0242 +#define WM_NCPOINTERUP 0x0243 +#endif + +const WCHAR AppUserModelIdRelease[] = L"Telegram.TelegramDesktop"; +const WCHAR AppUserModelIdBeta[] = L"Telegram.TelegramDesktop.Beta"; + +const WCHAR *AppUserModelId() { + return cBetaVersion() ? AppUserModelIdBeta : AppUserModelIdRelease; +} + +static const PROPERTYKEY pkey_AppUserModel_ID = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 5 }; +static const PROPERTYKEY pkey_AppUserModel_StartPinOption = { { 0x9F4C2855, 0x9F79, 0x4B39, { 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3 } }, 12 }; + +//using namespace Microsoft::WRL; +//using namespace ABI::Windows::UI::Notifications; +//using namespace ABI::Windows::Data::Xml::Dom; +//using namespace Windows::Foundation; + +namespace { + QStringList _initLogs; + + bool frameless = true; + bool useTheme = false; + bool useOpenWith = false; + bool useOpenAs = false; + bool useWtsapi = false; + bool useShellapi = false; + bool useToast = false; + bool themeInited = false; + bool finished = true; + int menuShown = 0, menuHidden = 0; + int dleft = 0, dtop = 0; + QMargins simpleMargins, margins; + HICON bigIcon = 0, smallIcon = 0, overlayIcon = 0; + bool sessionLoggedOff = false; + + UINT tbCreatedMsgId = 0; + + //ComPtr taskbarList; + + //ComPtr toastNotificationManager; + //ComPtr toastNotifier; + //ComPtr toastNotificationFactory; + //struct ToastNotificationPtr { + // ToastNotificationPtr() { + // } + // ToastNotificationPtr(const ComPtr &ptr) : p(ptr) { + // } + // ComPtr p; + //}; + //typedef QMap > ToastNotifications; + //ToastNotifications toastNotifications; + //struct ToastImage { + // uint64 until; + // QString path; + //}; + //typedef QMap ToastImages; + //ToastImages toastImages; + //bool ToastImageSavedFlag = false; + + //HWND createTaskbarHider() { + // HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0); + // HWND hWnd = 0; + + // QString cn = QString("TelegramTaskbarHider"); + // LPCWSTR _cn = (LPCWSTR)cn.utf16(); + // WNDCLASSEX wc; + + // wc.cbSize = sizeof(wc); + // wc.style = 0; + // wc.lpfnWndProc = DefWindowProc; + // wc.cbClsExtra = 0; + // wc.cbWndExtra = 0; + // wc.hInstance = appinst; + // wc.hIcon = 0; + // wc.hCursor = 0; + // wc.hbrBackground = 0; + // wc.lpszMenuName = NULL; + // wc.lpszClassName = _cn; + // wc.hIconSm = 0; + // if (!RegisterClassEx(&wc)) { + // DEBUG_LOG(("Application Error: could not register taskbar hider window class, error: %1").arg(GetLastError())); + // return hWnd; + // } + + // hWnd = CreateWindowEx(WS_EX_TOOLWINDOW, _cn, 0, WS_POPUP, 0, 0, 0, 0, 0, 0, appinst, 0); + // if (!hWnd) { + // DEBUG_LOG(("Application Error: could not create taskbar hider window class, error: %1").arg(GetLastError())); + // return hWnd; + // } + // return hWnd; + //} + + //enum { + // _PsShadowMoved = 0x01, + // _PsShadowResized = 0x02, + // _PsShadowShown = 0x04, + // _PsShadowHidden = 0x08, + // _PsShadowActivate = 0x10, + //}; + + //enum { + // _PsInitHor = 0x01, + // _PsInitVer = 0x02, + //}; + + //int32 _psSize = 0; + //class _PsShadowWindows { + //public: + + // _PsShadowWindows() : screenDC(0), max_w(0), max_h(0), _x(0), _y(0), _w(0), _h(0), hidden(true), r(0), g(0), b(0), noKeyColor(RGB(255, 255, 255)) { + // for (int i = 0; i < 4; ++i) { + // dcs[i] = 0; + // bitmaps[i] = 0; + // hwnds[i] = 0; + // } + // } + + // void setColor(QColor c) { + // r = c.red(); + // g = c.green(); + // b = c.blue(); + + // if (!hwnds[0]) return; + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // for (int i = 0; i < 4; ++i) { + // Gdiplus::Graphics graphics(dcs[i]); + // graphics.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // if ((i % 2) && _h || !(i % 2) && _w) { + // graphics.FillRectangle(&brush, 0, 0, (i % 2) ? _size : _w, (i % 2) ? _h : _size); + // } + // } + // initCorners(); + + // _x = _y = _w = _h = 0; + // update(_PsShadowMoved | _PsShadowResized); + // } + + // bool init(QColor c) { + // style::rect topLeft = st::wndShadow; + // _fullsize = topLeft.width(); + // _shift = st::wndShadowShift; + // QImage cornersImage(_fullsize, _fullsize, QImage::Format_ARGB32_Premultiplied); + // { + // QPainter p(&cornersImage); + // p.drawPixmap(QPoint(0, 0), App::sprite(), topLeft); + // } + // if (rtl()) cornersImage = cornersImage.mirrored(true, false); + // uchar *bits = cornersImage.bits(); + // if (bits) { + // for ( + // quint32 *p = (quint32*)bits, *end = (quint32*)(bits + cornersImage.byteCount()); + // p < end; + // ++p + // ) { + // *p = (*p ^ 0x00ffffff) << 24; + // } + // } + + // _metaSize = _fullsize + 2 * _shift; + // _alphas.reserve(_metaSize); + // _colors.reserve(_metaSize * _metaSize); + // for (int32 j = 0; j < _metaSize; ++j) { + // for (int32 i = 0; i < _metaSize; ++i) { + // _colors.push_back((i < 2 * _shift || j < 2 * _shift) ? 1 : qMax(BYTE(1), BYTE(cornersImage.pixel(QPoint(i - 2 * _shift, j - 2 * _shift)) >> 24))); + // } + // } + // uchar prev = 0; + // for (int32 i = 0; i < _metaSize; ++i) { + // uchar a = _colors[(_metaSize - 1) * _metaSize + i]; + // if (a < prev) break; + + // _alphas.push_back(a); + // prev = a; + // } + // _psSize = _size = _alphas.size() - 2 * _shift; + + // setColor(c); + + // Gdiplus::GdiplusStartupInput gdiplusStartupInput; + // ULONG_PTR gdiplusToken; + // Gdiplus::Status gdiRes = Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + // if (gdiRes != Gdiplus::Ok) { + // LOG(("Application Error: could not init GDI+, error: %1").arg((int)gdiRes)); + // return false; + // } + // blend.AlphaFormat = AC_SRC_ALPHA; + // blend.SourceConstantAlpha = 255; + // blend.BlendFlags = 0; + // blend.BlendOp = AC_SRC_OVER; + + // screenDC = GetDC(0); + // if (!screenDC) { + // LOG(("Application Error: could not GetDC(0), error: %2").arg(GetLastError())); + // return false; + // } + + // QRect avail(Sandbox::availableGeometry()); + // max_w = avail.width(); + // if (max_w < st::wndMinWidth) max_w = st::wndMinWidth; + // max_h = avail.height(); + // if (max_h < st::wndMinHeight) max_h = st::wndMinHeight; + + // HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0); + // HWND hwnd = App::wnd() ? App::wnd()->psHwnd() : 0; + + // for (int i = 0; i < 4; ++i) { + // QString cn = QString("TelegramShadow%1").arg(i); + // LPCWSTR _cn = (LPCWSTR)cn.utf16(); + // WNDCLASSEX wc; + + // wc.cbSize = sizeof(wc); + // wc.style = 0; + // wc.lpfnWndProc = wndProc; + // wc.cbClsExtra = 0; + // wc.cbWndExtra = 0; + // wc.hInstance = appinst; + // wc.hIcon = 0; + // wc.hCursor = 0; + // wc.hbrBackground = 0; + // wc.lpszMenuName = NULL; + // wc.lpszClassName = _cn; + // wc.hIconSm = 0; + // if (!RegisterClassEx(&wc)) { + // LOG(("Application Error: could not register shadow window class %1, error: %2").arg(i).arg(GetLastError())); + // destroy(); + // return false; + // } + + // hwnds[i] = CreateWindowEx(WS_EX_LAYERED | WS_EX_TOOLWINDOW, _cn, 0, WS_POPUP, 0, 0, 0, 0, 0, 0, appinst, 0); + // if (!hwnds[i]) { + // LOG(("Application Error: could not create shadow window class %1, error: %2").arg(i).arg(GetLastError())); + // destroy(); + // return false; + // } + // SetWindowLong(hwnds[i], GWL_HWNDPARENT, (LONG)hwnd); + + // dcs[i] = CreateCompatibleDC(screenDC); + // if (!dcs[i]) { + // LOG(("Application Error: could not create dc for shadow window class %1, error: %2").arg(i).arg(GetLastError())); + // destroy(); + // return false; + // } + + // bitmaps[i] = CreateCompatibleBitmap(screenDC, (i % 2) ? _size : max_w, (i % 2) ? max_h : _size); + // if (!bitmaps[i]) { + // LOG(("Application Error: could not create bitmap for shadow window class %1, error: %2").arg(i).arg(GetLastError())); + // destroy(); + // return false; + // } + + // SelectObject(dcs[i], bitmaps[i]); + // } + + // initCorners(); + // return true; + // } + + // void initCorners(int directions = (_PsInitHor | _PsInitVer)) { + // bool hor = (directions & _PsInitHor), ver = (directions & _PsInitVer); + // Gdiplus::Graphics graphics0(dcs[0]), graphics1(dcs[1]), graphics2(dcs[2]), graphics3(dcs[3]); + // graphics0.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // graphics1.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // graphics2.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // graphics3.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // if (hor) graphics0.FillRectangle(&brush, 0, 0, _fullsize - (_size - _shift), 2 * _shift); + + // if (ver) { + // graphics1.FillRectangle(&brush, 0, 0, _size, 2 * _shift); + // graphics3.FillRectangle(&brush, 0, 0, _size, 2 * _shift); + // graphics1.FillRectangle(&brush, _size - _shift, 2 * _shift, _shift, _fullsize); + // graphics3.FillRectangle(&brush, 0, 2 * _shift, _shift, _fullsize); + // } + + // if (hor) { + // for (int j = 2 * _shift; j < _size; ++j) { + // for (int k = 0; k < _fullsize - (_size - _shift); ++k) { + // brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b)); + // graphics0.FillRectangle(&brush, k, j, 1, 1); + // graphics2.FillRectangle(&brush, k, _size - (j - 2 * _shift) - 1, 1, 1); + // } + // } + // for (int j = _size; j < _size + 2 * _shift; ++j) { + // for (int k = 0; k < _fullsize - (_size - _shift); ++k) { + // brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b)); + // graphics2.FillRectangle(&brush, k, _size - (j - 2 * _shift) - 1, 1, 1); + // } + // } + // } + // if (ver) { + // for (int j = 2 * _shift; j < _fullsize + 2 * _shift; ++j) { + // for (int k = _shift; k < _size; ++k) { + // brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + (k + _shift)], r, g, b)); + // graphics1.FillRectangle(&brush, _size - k - 1, j, 1, 1); + // graphics3.FillRectangle(&brush, k, j, 1, 1); + // } + // } + // } + // } + // void verCorners(int h, Gdiplus::Graphics *pgraphics1, Gdiplus::Graphics *pgraphics3) { + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // pgraphics1->FillRectangle(&brush, _size - _shift, h - _fullsize, _shift, _fullsize); + // pgraphics3->FillRectangle(&brush, 0, h - _fullsize, _shift, _fullsize); + // for (int j = 0; j < _fullsize; ++j) { + // for (int k = _shift; k < _size; ++k) { + // brush.SetColor(Gdiplus::Color(_colors[(j + 2 * _shift) * _metaSize + k + _shift], r, g, b)); + // pgraphics1->FillRectangle(&brush, _size - k - 1, h - j - 1, 1, 1); + // pgraphics3->FillRectangle(&brush, k, h - j - 1, 1, 1); + // } + // } + // } + // void horCorners(int w, Gdiplus::Graphics *pgraphics0, Gdiplus::Graphics *pgraphics2) { + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // pgraphics0->FillRectangle(&brush, w - 2 * _size - (_fullsize - (_size - _shift)), 0, _fullsize - (_size - _shift), 2 * _shift); + // for (int j = 2 * _shift; j < _size; ++j) { + // for (int k = 0; k < _fullsize - (_size - _shift); ++k) { + // brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b)); + // pgraphics0->FillRectangle(&brush, w - 2 * _size - k - 1, j, 1, 1); + // pgraphics2->FillRectangle(&brush, w - 2 * _size - k - 1, _size - (j - 2 * _shift) - 1, 1, 1); + // } + // } + // for (int j = _size; j < _size + 2 * _shift; ++j) { + // for (int k = 0; k < _fullsize - (_size - _shift); ++k) { + // brush.SetColor(Gdiplus::Color(_colors[j * _metaSize + k + (_size + _shift)], r, g, b)); + // pgraphics2->FillRectangle(&brush, w - 2 * _size - k - 1, _size - (j - 2 * _shift) - 1, 1, 1); + // } + // } + // } + + // void update(int changes, WINDOWPOS *pos = 0) { + // HWND hwnd = App::wnd() ? App::wnd()->psHwnd() : 0; + // if (!hwnd || !hwnds[0]) return; + + // if (changes == _PsShadowActivate) { + // for (int i = 0; i < 4; ++i) { + // SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + // } + // return; + // } + + // if (changes & _PsShadowHidden) { + // if (!hidden) { + // for (int i = 0; i < 4; ++i) { + // hidden = true; + // ShowWindow(hwnds[i], SW_HIDE); + // } + // } + // return; + // } + // if (!App::wnd()->psPosInited()) return; + + // int x = _x, y = _y, w = _w, h = _h; + // if (pos && (!(pos->flags & SWP_NOMOVE) || !(pos->flags & SWP_NOSIZE) || !(pos->flags & SWP_NOREPOSITION))) { + // if (!(pos->flags & SWP_NOMOVE)) { + // x = pos->x - _size; + // y = pos->y - _size; + // } else if (pos->flags & SWP_NOSIZE) { + // for (int i = 0; i < 4; ++i) { + // SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); + // } + // return; + // } + // if (!(pos->flags & SWP_NOSIZE)) { + // w = pos->cx + 2 * _size; + // h = pos->cy + 2 * _size; + // } + // } else { + // RECT r; + // GetWindowRect(hwnd, &r); + // x = r.left - _size; + // y = r.top - _size; + // w = r.right + _size - x; + // h = r.bottom + _size - y; + // } + // if (h < 2 * _fullsize + 2 * _shift) { + // h = 2 * _fullsize + 2 * _shift; + // } + // if (w < 2 * (_fullsize + _shift)) { + // w = 2 * (_fullsize + _shift); + // } + + // if (w != _w) { + // int from = (_w > 2 * (_fullsize + _shift)) ? (_w - _size - _fullsize - _shift) : (_fullsize - (_size - _shift)); + // int to = w - _size - _fullsize - _shift; + // if (w > max_w) { + // from = _fullsize - (_size - _shift); + // max_w *= 2; + // for (int i = 0; i < 4; i += 2) { + // DeleteObject(bitmaps[i]); + // bitmaps[i] = CreateCompatibleBitmap(screenDC, max_w, _size); + // SelectObject(dcs[i], bitmaps[i]); + // } + // initCorners(_PsInitHor); + // } + // Gdiplus::Graphics graphics0(dcs[0]), graphics2(dcs[2]); + // graphics0.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // graphics2.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // if (to > from) { + // graphics0.FillRectangle(&brush, from, 0, to - from, 2 * _shift); + // for (int i = 2 * _shift; i < _size; ++i) { + // Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b)); + // graphics0.DrawLine(&pen, from, i, to, i); + // graphics2.DrawLine(&pen, from, _size - (i - 2 * _shift) - 1, to, _size - (i - 2 * _shift) - 1); + // } + // for (int i = _size; i < _size + 2 * _shift; ++i) { + // Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b)); + // graphics2.DrawLine(&pen, from, _size - (i - 2 * _shift) - 1, to, _size - (i - 2 * _shift) - 1); + // } + // } + // if (_w > w) { + // graphics0.FillRectangle(&brush, w - _size - _fullsize - _shift, 0, _fullsize - (_size - _shift), _size); + // graphics2.FillRectangle(&brush, w - _size - _fullsize - _shift, 0, _fullsize - (_size - _shift), _size); + // } + // horCorners(w, &graphics0, &graphics2); + // POINT p0 = { x + _size, y }, p2 = { x + _size, y + h - _size }, f = { 0, 0 }; + // SIZE s = { w - 2 * _size, _size }; + // updateWindow(0, &p0, &s); + // updateWindow(2, &p2, &s); + // } else if (x != _x || y != _y) { + // POINT p0 = { x + _size, y }, p2 = { x + _size, y + h - _size }; + // updateWindow(0, &p0); + // updateWindow(2, &p2); + // } else if (h != _h) { + // POINT p2 = { x + _size, y + h - _size }; + // updateWindow(2, &p2); + // } + + // if (h != _h) { + // int from = (_h > 2 * _fullsize + 2 * _shift) ? (_h - _fullsize) : (_fullsize + 2 * _shift); + // int to = h - _fullsize; + // if (h > max_h) { + // from = (_fullsize + 2 * _shift); + // max_h *= 2; + // for (int i = 1; i < 4; i += 2) { + // DeleteObject(bitmaps[i]); + // bitmaps[i] = CreateCompatibleBitmap(dcs[i], _size, max_h); + // SelectObject(dcs[i], bitmaps[i]); + // } + // initCorners(_PsInitVer); + // } + // Gdiplus::Graphics graphics1(dcs[1]), graphics3(dcs[3]); + // graphics1.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + // graphics3.SetCompositingMode(Gdiplus::CompositingModeSourceCopy); + + // Gdiplus::SolidBrush brush(Gdiplus::Color(_alphas[0], r, g, b)); + // if (to > from) { + // graphics1.FillRectangle(&brush, _size - _shift, from, _shift, to - from); + // graphics3.FillRectangle(&brush, 0, from, _shift, to - from); + // for (int i = 2 * _shift; i < _size + _shift; ++i) { + // Gdiplus::Pen pen(Gdiplus::Color(_alphas[i], r, g, b)); + // graphics1.DrawLine(&pen, _size + _shift - i - 1, from, _size + _shift - i - 1, to); + // graphics3.DrawLine(&pen, i - _shift, from, i - _shift, to); + // } + // } + // if (_h > h) { + // graphics1.FillRectangle(&brush, 0, h - _fullsize, _size, _fullsize); + // graphics3.FillRectangle(&brush, 0, h - _fullsize, _size, _fullsize); + // } + // verCorners(h, &graphics1, &graphics3); + + // POINT p1 = {x + w - _size, y}, p3 = {x, y}, f = {0, 0}; + // SIZE s = { _size, h }; + // updateWindow(1, &p1, &s); + // updateWindow(3, &p3, &s); + // } else if (x != _x || y != _y) { + // POINT p1 = { x + w - _size, y }, p3 = { x, y }; + // updateWindow(1, &p1); + // updateWindow(3, &p3); + // } else if (w != _w) { + // POINT p1 = { x + w - _size, y }; + // updateWindow(1, &p1); + // } + // _x = x; + // _y = y; + // _w = w; + // _h = h; + + // if (hidden && (changes & _PsShadowShown)) { + // for (int i = 0; i < 4; ++i) { + // SetWindowPos(hwnds[i], hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW | SWP_NOACTIVATE); + // } + // hidden = false; + // } + // } + + // void updateWindow(int i, POINT *p, SIZE *s = 0) { + // static POINT f = {0, 0}; + // if (s) { + // UpdateLayeredWindow(hwnds[i], (s ? screenDC : 0), p, s, (s ? dcs[i] : 0), (s ? (&f) : 0), noKeyColor, &blend, ULW_ALPHA); + // } else { + // SetWindowPos(hwnds[i], 0, p->x, p->y, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER); + // } + // } + + // void destroy() { + // for (int i = 0; i < 4; ++i) { + // if (dcs[i]) DeleteDC(dcs[i]); + // if (bitmaps[i]) DeleteObject(bitmaps[i]); + // if (hwnds[i]) DestroyWindow(hwnds[i]); + // dcs[i] = 0; + // bitmaps[i] = 0; + // hwnds[i] = 0; + // } + // if (screenDC) ReleaseDC(0, screenDC); + // } + + //private: + + // int _x, _y, _w, _h; + // int _metaSize, _fullsize, _size, _shift; + // QVector _alphas, _colors; + + // bool hidden; + + // HWND hwnds[4]; + // HDC dcs[4], screenDC; + // HBITMAP bitmaps[4]; + // int max_w, max_h; + // BLENDFUNCTION blend; + + // BYTE r, g, b; + // COLORREF noKeyColor; + + // static LRESULT CALLBACK _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + + //}; + //_PsShadowWindows _psShadowWindows; + + //LRESULT CALLBACK _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + // if (finished) return DefWindowProc(hwnd, msg, wParam, lParam); + + // int i; + // for (i = 0; i < 4; ++i) { + // if (_psShadowWindows.hwnds[i] && hwnd == _psShadowWindows.hwnds[i]) { + // break; + // } + // } + // if (i == 4) return DefWindowProc(hwnd, msg, wParam, lParam); + + // switch (msg) { + // case WM_CLOSE: + // App::wnd()->close(); + // break; + + // case WM_NCHITTEST: { + // int32 xPos = GET_X_LPARAM(lParam), yPos = GET_Y_LPARAM(lParam); + // switch (i) { + // case 0: return HTTOP; + // case 1: return (yPos < _psShadowWindows._y + _psSize) ? HTTOPRIGHT : ((yPos >= _psShadowWindows._y + _psShadowWindows._h - _psSize) ? HTBOTTOMRIGHT : HTRIGHT); + // case 2: return HTBOTTOM; + // case 3: return (yPos < _psShadowWindows._y + _psSize) ? HTTOPLEFT : ((yPos >= _psShadowWindows._y + _psShadowWindows._h - _psSize) ? HTBOTTOMLEFT : HTLEFT); + // } + // return HTTRANSPARENT; + // } break; + + // case WM_NCACTIVATE: return DefWindowProc(hwnd, msg, wParam, lParam); + // case WM_NCLBUTTONDOWN: + // case WM_NCLBUTTONUP: + // case WM_NCLBUTTONDBLCLK: + // case WM_NCMBUTTONDOWN: + // case WM_NCMBUTTONUP: + // case WM_NCMBUTTONDBLCLK: + // case WM_NCRBUTTONDOWN: + // case WM_NCRBUTTONUP: + // case WM_NCRBUTTONDBLCLK: + // case WM_NCXBUTTONDOWN: + // case WM_NCXBUTTONUP: + // case WM_NCXBUTTONDBLCLK: + // case WM_NCMOUSEHOVER: + // case WM_NCMOUSELEAVE: + // case WM_NCMOUSEMOVE: + // case WM_NCPOINTERUPDATE: + // case WM_NCPOINTERDOWN: + // case WM_NCPOINTERUP: + // if (App::wnd() && App::wnd()->psHwnd()) { + // if (msg == WM_NCLBUTTONDOWN) { + // ::SetForegroundWindow(App::wnd()->psHwnd()); + // } + // LRESULT res = SendMessage(App::wnd()->psHwnd(), msg, wParam, lParam); + // return res; + // } + // return 0; + // break; + // case WM_ACTIVATE: + // if (App::wnd() && App::wnd()->psHwnd() && wParam == WA_ACTIVE) { + // if ((HWND)lParam != App::wnd()->psHwnd()) { + // ::SetForegroundWindow(hwnd); + // ::SetWindowPos(App::wnd()->psHwnd(), hwnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); + // } + // } + // return DefWindowProc(hwnd, msg, wParam, lParam); + // break; + // default: + // return DefWindowProc(hwnd, msg, wParam, lParam); + // } + // return 0; + //} + + //QColor _shActive(0, 0, 0), _shInactive(0, 0, 0); + + //typedef HRESULT (FAR STDAPICALLTYPE *f_setWindowTheme)(HWND hWnd, LPCWSTR pszSubAppName, LPCWSTR pszSubIdList); + //f_setWindowTheme setWindowTheme = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_openAs_RunDLL)(HWND hWnd, HINSTANCE hInstance, LPCWSTR lpszCmdLine, int nCmdShow); + //f_openAs_RunDLL openAs_RunDLL = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_shOpenWithDialog)(HWND hwndParent, const OPENASINFO *poainfo); + //f_shOpenWithDialog shOpenWithDialog = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_shAssocEnumHandlers)(PCWSTR pszExtra, ASSOC_FILTER afFilter, IEnumAssocHandlers **ppEnumHandler); + //f_shAssocEnumHandlers shAssocEnumHandlers = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_shCreateItemFromParsingName)(PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv); + //f_shCreateItemFromParsingName shCreateItemFromParsingName = 0; + + //typedef BOOL (FAR STDAPICALLTYPE *f_wtsRegisterSessionNotification)(HWND hWnd, DWORD dwFlags); + //f_wtsRegisterSessionNotification wtsRegisterSessionNotification = 0; + + //typedef BOOL (FAR STDAPICALLTYPE *f_wtsUnRegisterSessionNotification)(HWND hWnd); + //f_wtsUnRegisterSessionNotification wtsUnRegisterSessionNotification = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_shQueryUserNotificationState)(QUERY_USER_NOTIFICATION_STATE *pquns); + //f_shQueryUserNotificationState shQueryUserNotificationState = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_setCurrentProcessExplicitAppUserModelID)(__in PCWSTR AppID); + //f_setCurrentProcessExplicitAppUserModelID setCurrentProcessExplicitAppUserModelID = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_roGetActivationFactory)(_In_ HSTRING activatableClassId, _In_ REFIID iid, _COM_Outptr_ void ** factory); + //f_roGetActivationFactory roGetActivationFactory = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_windowsCreateStringReference)(_In_reads_opt_(length + 1) PCWSTR sourceString, UINT32 length, _Out_ HSTRING_HEADER * hstringHeader, _Outptr_result_maybenull_ _Result_nullonfailure_ HSTRING * string); + //f_windowsCreateStringReference windowsCreateStringReference = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_windowsDeleteString)(_In_opt_ HSTRING string); + //f_windowsDeleteString windowsDeleteString = 0; + + //typedef HRESULT (FAR STDAPICALLTYPE *f_propVariantToString)(_In_ REFPROPVARIANT propvar, _Out_writes_(cch) PWSTR psz, _In_ UINT cch); + //f_propVariantToString propVariantToString = 0; + + template + bool loadFunction(HINSTANCE dll, LPCSTR name, TFunction &func) { + if (!dll) return false; + + func = (TFunction)GetProcAddress(dll, name); + return !!func; + } + + class _PsInitializer { + public: + _PsInitializer() { + frameless = false; + + setupUx(); + setupShell(); + setupWtsapi(); + setupPropSys(); + setupCombase(); + + //useTheme = !!setWindowTheme; + } + void setupUx() { + //HINSTANCE procId = LoadLibrary(L"UXTHEME.DLL"); + + //loadFunction(procId, "SetWindowTheme", setWindowTheme); + } + void setupShell() { + //HINSTANCE procId = LoadLibrary(L"SHELL32.DLL"); + //setupOpenWith(procId); + //setupOpenAs(procId); + //setupShellapi(procId); + //setupAppUserModel(procId); + } + void setupOpenWith(HINSTANCE procId) { + //if (!loadFunction(procId, "SHAssocEnumHandlers", shAssocEnumHandlers)) return; + //if (!loadFunction(procId, "SHCreateItemFromParsingName", shCreateItemFromParsingName)) return; + //useOpenWith = true; + } + void setupOpenAs(HINSTANCE procId) { + //if (!loadFunction(procId, "SHOpenWithDialog", shOpenWithDialog) && !loadFunction(procId, "OpenAs_RunDLLW", openAs_RunDLL)) return; + //useOpenAs = true; + } + void setupShellapi(HINSTANCE procId) { + //if (!loadFunction(procId, "SHQueryUserNotificationState", shQueryUserNotificationState)) return; + //useShellapi = true; + } + void setupAppUserModel(HINSTANCE procId) { + //if (!loadFunction(procId, "SetCurrentProcessExplicitAppUserModelID", setCurrentProcessExplicitAppUserModelID)) return; + } + void setupWtsapi() { + //HINSTANCE procId = LoadLibrary(L"WTSAPI32.DLL"); + + //if (!loadFunction(procId, "WTSRegisterSessionNotification", wtsRegisterSessionNotification)) return; + //if (!loadFunction(procId, "WTSUnRegisterSessionNotification", wtsUnRegisterSessionNotification)) return; + //useWtsapi = true; + } + void setupCombase() { + //if (!setCurrentProcessExplicitAppUserModelID) return; + + //HINSTANCE procId = LoadLibrary(L"COMBASE.DLL"); + //setupToast(procId); + } + void setupPropSys() { + //HINSTANCE procId = LoadLibrary(L"PROPSYS.DLL"); + //if (!loadFunction(procId, "PropVariantToString", propVariantToString)) return; + } + void setupToast(HINSTANCE procId) { + //if (!propVariantToString) return; + //if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS8) return; + //if (!loadFunction(procId, "RoGetActivationFactory", roGetActivationFactory)) return; + + //HINSTANCE otherProcId = LoadLibrary(L"api-ms-win-core-winrt-string-l1-1-0.dll"); + //if (!loadFunction(otherProcId, "WindowsCreateStringReference", windowsCreateStringReference)) return; + //if (!loadFunction(otherProcId, "WindowsDeleteString", windowsDeleteString)) return; + + //useToast = true; + } + }; + _PsInitializer _psInitializer; + + class _PsEventFilter : public QAbstractNativeEventFilter { + public: + _PsEventFilter() { + } + + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) { + Window *wnd = App::wnd(); + if (!wnd) return false; + + MSG *msg = (MSG*)message; + if (msg->message == WM_ENDSESSION) { + App::quit(); + return false; + } + if (msg->hwnd == wnd->psHwnd() || msg->hwnd && !wnd->psHwnd()) { + return mainWindowEvent(msg->hwnd, msg->message, msg->wParam, msg->lParam, (LRESULT*)result); + } + return false; + } + + bool mainWindowEvent(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result) { + //if (tbCreatedMsgId && msg == tbCreatedMsgId) { + // HRESULT hr = CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_PPV_ARGS(&taskbarList)); + // if (!SUCCEEDED(hr)) { + // taskbarList.Reset(); + // } + //} + switch (msg) { + + case WM_TIMECHANGE: { + App::wnd()->checkAutoLockIn(100); + } return false; + + case WM_WTSSESSION_CHANGE: { + if (wParam == WTS_SESSION_LOGOFF || wParam == WTS_SESSION_LOCK) { + sessionLoggedOff = true; + } else if (wParam == WTS_SESSION_LOGON || wParam == WTS_SESSION_UNLOCK) { + sessionLoggedOff = false; + } + } return false; + + case WM_DESTROY: { + App::quit(); + } return false; + + case WM_ACTIVATE: { + if (LOWORD(wParam) == WA_CLICKACTIVE) { + App::wnd()->inactivePress(true); + } + //if (LOWORD(wParam) != WA_INACTIVE) { + // _psShadowWindows.setColor(_shActive); + // _psShadowWindows.update(_PsShadowActivate); + //} else { + // _psShadowWindows.setColor(_shInactive); + //} + if (Global::started()) { + QMetaObject::invokeMethod(App::wnd(), "updateCounter", Qt::QueuedConnection); + App::wnd()->update(); + } + } return false; + + case WM_NCPAINT: if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) return false; *result = 0; return true; + + //case WM_NCCALCSIZE: { + // WINDOWPLACEMENT wp; + // wp.length = sizeof(WINDOWPLACEMENT); + // if (GetWindowPlacement(hWnd, &wp) && wp.showCmd == SW_SHOWMAXIMIZED) { + // LPNCCALCSIZE_PARAMS params = (LPNCCALCSIZE_PARAMS)lParam; + // LPRECT r = (wParam == TRUE) ? ¶ms->rgrc[0] : (LPRECT)lParam; + // HMONITOR hMonitor = MonitorFromPoint({ (r->left + r->right) / 2, (r->top + r->bottom) / 2 }, MONITOR_DEFAULTTONEAREST); + // if (hMonitor) { + // MONITORINFO mi; + // mi.cbSize = sizeof(mi); + // if (GetMonitorInfo(hMonitor, &mi)) { + // *r = mi.rcWork; + // } + // } + // } + // *result = 0; + // return true; + //} + + //case WM_NCACTIVATE: { + // *result = DefWindowProc(hWnd, msg, wParam, -1); + //} return true; + + //case WM_WINDOWPOSCHANGING: + //case WM_WINDOWPOSCHANGED: { + // WINDOWPLACEMENT wp; + // wp.length = sizeof(WINDOWPLACEMENT); + // if (GetWindowPlacement(hWnd, &wp) && (wp.showCmd == SW_SHOWMAXIMIZED || wp.showCmd == SW_SHOWMINIMIZED)) { + // _psShadowWindows.update(_PsShadowHidden); + // } else { + // _psShadowWindows.update(_PsShadowMoved | _PsShadowResized, (WINDOWPOS*)lParam); + // } + //} return false; + + case WM_SIZE: { + if (App::wnd()) { + if (wParam == SIZE_MAXIMIZED || wParam == SIZE_RESTORED || wParam == SIZE_MINIMIZED) { + if (wParam != SIZE_RESTORED || App::wnd()->windowState() != Qt::WindowNoState) { + Qt::WindowState state = Qt::WindowNoState; + if (wParam == SIZE_MAXIMIZED) { + state = Qt::WindowMaximized; + } else if (wParam == SIZE_MINIMIZED) { + state = Qt::WindowMinimized; + } + emit App::wnd()->windowHandle()->windowStateChanged(state); + } else { + App::wnd()->psUpdatedPosition(); + } + App::wnd()->psUpdateMargins(); + //int changes = (wParam == SIZE_MINIMIZED || wParam == SIZE_MAXIMIZED) ? _PsShadowHidden : (_PsShadowResized | _PsShadowShown); + //_psShadowWindows.update(changes); + } + } + } return false; + + //case WM_SHOWWINDOW: { + // LONG style = GetWindowLong(hWnd, GWL_STYLE); + // int changes = _PsShadowResized | ((wParam && !(style & (WS_MAXIMIZE | WS_MINIMIZE))) ? _PsShadowShown : _PsShadowHidden); + // _psShadowWindows.update(changes); + //} return false; + + case WM_MOVE: { + //_psShadowWindows.update(_PsShadowMoved); + App::wnd()->psUpdatedPosition(); + } return false; + + //case WM_NCHITTEST: { + // POINTS p = MAKEPOINTS(lParam); + // RECT r; + // GetWindowRect(hWnd, &r); + // HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + dleft, p.y - r.top + dtop)); + // switch (res) { + // case HitTestClient: + // case HitTestSysButton: *result = HTCLIENT; break; + // case HitTestIcon: *result = HTCAPTION; break; + // case HitTestCaption: *result = HTCAPTION; break; + // case HitTestTop: *result = HTTOP; break; + // case HitTestTopRight: *result = HTTOPRIGHT; break; + // case HitTestRight: *result = HTRIGHT; break; + // case HitTestBottomRight: *result = HTBOTTOMRIGHT; break; + // case HitTestBottom: *result = HTBOTTOM; break; + // case HitTestBottomLeft: *result = HTBOTTOMLEFT; break; + // case HitTestLeft: *result = HTLEFT; break; + // case HitTestTopLeft: *result = HTTOPLEFT; break; + // case HitTestNone: + // default: *result = HTTRANSPARENT; break; + // }; + //} return true; + + //case WM_NCRBUTTONUP: { + // SendMessage(hWnd, WM_SYSCOMMAND, SC_MOUSEMENU, lParam); + //} return true; + + //case WM_NCLBUTTONDOWN: { + // POINTS p = MAKEPOINTS(lParam); + // RECT r; + // GetWindowRect(hWnd, &r); + // HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + dleft, p.y - r.top + dtop)); + // switch (res) { + // case HitTestIcon: + // if (menuHidden && getms() < menuHidden + 10) { + // menuHidden = 0; + // if (getms() < menuShown + GetDoubleClickTime()) { + // App::wnd()->close(); + // } + // } else { + // QRect icon = App::wnd()->iconRect(); + // p.x = r.left - dleft + icon.left(); + // p.y = r.top - dtop + icon.top() + icon.height(); + // App::wnd()->psUpdateSysMenu(App::wnd()->windowHandle()->windowState()); + // menuShown = getms(); + // menuHidden = 0; + // TrackPopupMenu(App::wnd()->psMenu(), TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, p.x, p.y, 0, hWnd, 0); + // menuHidden = getms(); + // } + // return true; + // }; + //} return false; + + //case WM_NCLBUTTONDBLCLK: { + // POINTS p = MAKEPOINTS(lParam); + // RECT r; + // GetWindowRect(hWnd, &r); + // HitTestType res = App::wnd()->hitTest(QPoint(p.x - r.left + dleft, p.y - r.top + dtop)); + // switch (res) { + // case HitTestIcon: App::wnd()->close(); return true; + // }; + //} return false; + + //case WM_SYSCOMMAND: { + // if (wParam == SC_MOUSEMENU) { + // POINTS p = MAKEPOINTS(lParam); + // App::wnd()->psUpdateSysMenu(App::wnd()->windowHandle()->windowState()); + // TrackPopupMenu(App::wnd()->psMenu(), TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON, p.x, p.y, 0, hWnd, 0); + // } + //} return false; + + case WM_COMMAND: { + if (HIWORD(wParam)) return false; + int cmd = LOWORD(wParam); + switch (cmd) { + case SC_CLOSE: App::wnd()->close(); return true; + case SC_MINIMIZE: App::wnd()->setWindowState(Qt::WindowMinimized); return true; + case SC_MAXIMIZE: App::wnd()->setWindowState(Qt::WindowMaximized); return true; + case SC_RESTORE: App::wnd()->setWindowState(Qt::WindowNoState); return true; + } + } return true; + + } + return false; + } + }; + _PsEventFilter *_psEventFilter = 0; + +}; + +PsMainWindow::PsMainWindow(QWidget *parent) : QMainWindow(parent) +, ps_hWnd(0) +, ps_menu(0) +, icon256(qsl(":/gui/art/icon256.png")) +, iconbig256(qsl(":/gui/art/iconbig256.png")) +, wndIcon(QPixmap::fromImage(icon256, Qt::ColorOnly)) +, ps_iconBig(0) +, ps_iconSmall(0) +, ps_iconOverlay(0) +, trayIcon(0) +, trayIconMenu(0) +, posInited(false) +//, ps_tbHider_hWnd(createTaskbarHider()) +{ + //tbCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated"); + connect(&ps_cleanNotifyPhotosTimer, SIGNAL(timeout()), this, SLOT(psCleanNotifyPhotos())); +} + +void PsMainWindow::psShowTrayMenu() { + trayIconMenu->popup(QCursor::pos()); +} + +void PsMainWindow::psCleanNotifyPhotosIn(int32 dt) { + if (dt < 0) { + if (ps_cleanNotifyPhotosTimer.isActive() && ps_cleanNotifyPhotosTimer.remainingTime() <= -dt) return; + dt = -dt; + } + ps_cleanNotifyPhotosTimer.start(dt); +} + +void PsMainWindow::psCleanNotifyPhotos() { + //uint64 ms = getms(true), minuntil = 0; + //for (ToastImages::iterator i = toastImages.begin(); i != toastImages.end();) { + // if (!i->until) { + // ++i; + // continue; + // } + // if (i->until <= ms) { + // QFile(i->path).remove(); + // i = toastImages.erase(i); + // } else { + // if (!minuntil || minuntil > i->until) { + // minuntil = i->until; + // } + // ++i; + // } + //} + //if (minuntil) psCleanNotifyPhotosIn(int32(minuntil - ms)); +} + +void PsMainWindow::psRefreshTaskbarIcon() { + QWidget *w = new QWidget(this); + w->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint); + w->setGeometry(x() + 1, y() + 1, 1, 1); + QPalette p(w->palette()); + p.setColor(QPalette::Background, st::titleBG->c); + QWindow *wnd = w->windowHandle(); + w->setPalette(p); + w->show(); + w->activateWindow(); + delete w; +} + +void PsMainWindow::psTrayMenuUpdated() { +} + +void PsMainWindow::psSetupTrayIcon() { + if (!trayIcon) { + trayIcon = new QSystemTrayIcon(this); + + QIcon icon(QPixmap::fromImage(App::wnd()->iconLarge(), Qt::ColorOnly)); + + trayIcon->setIcon(icon); + trayIcon->setToolTip(QString::fromStdWString(AppName)); + connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleTray(QSystemTrayIcon::ActivationReason)), Qt::UniqueConnection); + connect(trayIcon, SIGNAL(messageClicked()), this, SLOT(showFromTray())); + App::wnd()->updateTrayMenu(); + } + psUpdateCounter(); + + trayIcon->show(); + psUpdateDelegate(); +} + +void PsMainWindow::psUpdateWorkmode() { + switch (cWorkMode()) { + case dbiwmWindowAndTray: { + psSetupTrayIcon(); + //HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + //if (psOwner) { + // SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0); + // psRefreshTaskbarIcon(); + //} + } break; + + case dbiwmTrayOnly: { + psSetupTrayIcon(); + //HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + //if (!psOwner) { + // SetWindowLong(ps_hWnd, GWL_HWNDPARENT, (LONG)ps_tbHider_hWnd); + //} + } break; + + case dbiwmWindowOnly: { + if (trayIcon) { + trayIcon->setContextMenu(0); + trayIcon->deleteLater(); + } + trayIcon = 0; + + //HWND psOwner = (HWND)GetWindowLong(ps_hWnd, GWL_HWNDPARENT); + //if (psOwner) { + // SetWindowLong(ps_hWnd, GWL_HWNDPARENT, 0); + // psRefreshTaskbarIcon(); + //} + } break; + } +} + +HICON qt_pixmapToWinHICON(const QPixmap &); +HBITMAP qt_pixmapToWinHBITMAP(const QPixmap &, int hbitmapFormat); + +static HICON _qt_createHIcon(const QIcon &icon, int xSize, int ySize) { + if (!icon.isNull()) { + const QPixmap pm = icon.pixmap(icon.actualSize(QSize(xSize, ySize))); + if (!pm.isNull()) + return qt_pixmapToWinHICON(pm); + } + return 0; +} + +void PsMainWindow::psUpdateCounter() { + int32 counter = App::histories().unreadBadge(); + bool muted = App::histories().unreadOnlyMuted(); + + style::color bg = muted ? st::counterMuteBG : st::counterBG; + QIcon iconSmall, iconBig; + iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(16, counter, bg, true), Qt::ColorOnly)); + iconSmall.addPixmap(QPixmap::fromImage(iconWithCounter(32, counter, bg, true), Qt::ColorOnly)); + //iconBig.addPixmap(QPixmap::fromImage(iconWithCounter(32, taskbarList.Get() ? 0 : counter, bg, false), Qt::ColorOnly)); + //iconBig.addPixmap(QPixmap::fromImage(iconWithCounter(64, taskbarList.Get() ? 0 : counter, bg, false), Qt::ColorOnly)); + if (trayIcon) { + trayIcon->setIcon(iconSmall); + } + + setWindowTitle((counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram")); + //psDestroyIcons(); + //ps_iconSmall = _qt_createHIcon(iconSmall, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); + //ps_iconBig = _qt_createHIcon(iconBig, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON)); + //SendMessage(ps_hWnd, WM_SETICON, 0, (LPARAM)ps_iconSmall); + //SendMessage(ps_hWnd, WM_SETICON, 1, (LPARAM)(ps_iconBig ? ps_iconBig : ps_iconSmall)); + //if (taskbarList.Get()) { + // if (counter > 0) { + // QIcon iconOverlay; + // iconOverlay.addPixmap(QPixmap::fromImage(iconWithCounter(-16, counter, bg, false), Qt::ColorOnly)); + // iconOverlay.addPixmap(QPixmap::fromImage(iconWithCounter(-32, counter, bg, false), Qt::ColorOnly)); + // ps_iconOverlay = _qt_createHIcon(iconOverlay, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); + // } + // QString description = counter > 0 ? QString("%1 unread messages").arg(counter) : qsl("No unread messages"); + // taskbarList->SetOverlayIcon(ps_hWnd, ps_iconOverlay, description.toStdWString().c_str()); + //} + //SetWindowPos(ps_hWnd, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); +} + +void PsMainWindow::psUpdateDelegate() { +} + +namespace { + HMONITOR enumMonitor = 0; + RECT enumMonitorWork; + + BOOL CALLBACK _monitorEnumProc( + _In_ HMONITOR hMonitor, + _In_ HDC hdcMonitor, + _In_ LPRECT lprcMonitor, + _In_ LPARAM dwData + ) { + //MONITORINFOEX info; + //info.cbSize = sizeof(info); + //GetMonitorInfo(hMonitor, &info); + //if (dwData == hashCrc32(info.szDevice, sizeof(info.szDevice))) { + // enumMonitor = hMonitor; + // enumMonitorWork = info.rcWork; + // return FALSE; + //} + return TRUE; + } +} + +void PsMainWindow::psInitSize() { + setMinimumWidth(st::wndMinWidth); + setMinimumHeight(st::wndMinHeight); + + TWindowPos pos(cWindowPos()); + QRect avail(Sandbox::availableGeometry()); + bool maximized = false; + QRect geom(avail.x() + (avail.width() - st::wndDefWidth) / 2, avail.y() + (avail.height() - st::wndDefHeight) / 2, st::wndDefWidth, st::wndDefHeight); + if (pos.w && pos.h) { + if (pos.y < 0) pos.y = 0; + enumMonitor = 0; + //EnumDisplayMonitors(0, 0, &_monitorEnumProc, pos.moncrc); + if (enumMonitor) { + int32 w = enumMonitorWork.right - enumMonitorWork.left, h = enumMonitorWork.bottom - enumMonitorWork.top; + if (w >= st::wndMinWidth && h >= st::wndMinHeight) { + if (pos.w > w) pos.w = w; + if (pos.h > h) pos.h = h; + pos.x += enumMonitorWork.left; + pos.y += enumMonitorWork.top; + if (pos.x < enumMonitorWork.right - 10 && pos.y < enumMonitorWork.bottom - 10) { + geom = QRect(pos.x, pos.y, pos.w, pos.h); + } + } + } + maximized = pos.maximized; + } + setGeometry(geom); +} + +bool InitToastManager(); +//bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title, const QString &subtitle, const QString &msg); +void CheckPinnedAppUserModelId(); +void CleanupAppUserModelIdShortcut(); + +void PsMainWindow::psInitFrameless() { + psUpdatedPositionTimer.setSingleShot(true); + connect(&psUpdatedPositionTimer, SIGNAL(timeout()), this, SLOT(psSavePosition())); + + QPlatformNativeInterface *i = QGuiApplication::platformNativeInterface(); + ps_hWnd = static_cast(i->nativeResourceForWindow(QByteArrayLiteral("handle"), windowHandle())); + + if (!ps_hWnd) return; + + //if (useWtsapi) wtsRegisterSessionNotification(ps_hWnd, NOTIFY_FOR_THIS_SESSION); + + if (frameless) { + setWindowFlags(Qt::FramelessWindowHint); + } + + if (!InitToastManager()) { + useToast = false; + } + + psInitSysMenu(); +} + +void PsMainWindow::psSavePosition(Qt::WindowState state) { + if (state == Qt::WindowActive) state = windowHandle()->windowState(); + if (state == Qt::WindowMinimized || !posInited) return; + + TWindowPos pos(cWindowPos()), curPos = pos; + + if (state == Qt::WindowMaximized) { + curPos.maximized = 1; + } else { + //RECT w; + //GetWindowRect(ps_hWnd, &w); + //curPos.x = w.left; + //curPos.y = w.top; + //curPos.w = w.right - w.left; + //curPos.h = w.bottom - w.top; + curPos.maximized = 0; + } + + //HMONITOR hMonitor = MonitorFromWindow(ps_hWnd, MONITOR_DEFAULTTONEAREST); + //if (hMonitor) { + // MONITORINFOEX info; + // info.cbSize = sizeof(info); + // GetMonitorInfo(hMonitor, &info); + // if (!curPos.maximized) { + // curPos.x -= info.rcWork.left; + // curPos.y -= info.rcWork.top; + // } + // curPos.moncrc = hashCrc32(info.szDevice, sizeof(info.szDevice)); + //} + + if (curPos.w >= st::wndMinWidth && curPos.h >= st::wndMinHeight) { + if (curPos.x != pos.x || curPos.y != pos.y || curPos.w != pos.w || curPos.h != pos.h || curPos.moncrc != pos.moncrc || curPos.maximized != pos.maximized) { + cSetWindowPos(curPos); + Local::writeSettings(); + } + } +} + +void PsMainWindow::psUpdatedPosition() { + psUpdatedPositionTimer.start(SaveWindowPositionTimeout); +} + +bool PsMainWindow::psHasNativeNotifications() { + return useToast; +} + +Q_DECLARE_METATYPE(QMargins); +void PsMainWindow::psFirstShow() { + if (useToast) { + cSetCustomNotifies(!cWindowsNotifications()); + } else { + cSetCustomNotifies(true); + } + + //_psShadowWindows.init(_shActive); + finished = false; + + psUpdateMargins(); + + //_psShadowWindows.update(_PsShadowHidden); + bool showShadows = true; + + show(); + if (cWindowPos().maximized) { + setWindowState(Qt::WindowMaximized); + } + + if ((cLaunchMode() == LaunchModeAutoStart && cStartMinimized()) || cStartInTray()) { + setWindowState(Qt::WindowMinimized); + if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) { + hide(); + } else { + show(); + } + showShadows = false; + } else { + show(); + } + + posInited = true; + if (showShadows) { + //_psShadowWindows.update(_PsShadowMoved | _PsShadowResized | _PsShadowShown); + } +} + +bool PsMainWindow::psHandleTitle() { + return true; +} + +void PsMainWindow::psInitSysMenu() { + Qt::WindowStates states = windowState(); + //ps_menu = GetSystemMenu(ps_hWnd, FALSE); + psUpdateSysMenu(windowHandle()->windowState()); +} + +void PsMainWindow::psUpdateSysMenu(Qt::WindowState state) { + if (!ps_menu) return; + + int menuToDisable = SC_RESTORE; + if (state == Qt::WindowMaximized) { + menuToDisable = SC_MAXIMIZE; + } else if (state == Qt::WindowMinimized) { + menuToDisable = SC_MINIMIZE; + } + //int itemCount = GetMenuItemCount(ps_menu); + //for (int i = 0; i < itemCount; ++i) { + // MENUITEMINFO itemInfo = {0}; + // itemInfo.cbSize = sizeof(itemInfo); + // itemInfo.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID; + // if (GetMenuItemInfo(ps_menu, i, TRUE, &itemInfo)) { + // if (itemInfo.fType & MFT_SEPARATOR) { + // continue; + // } + // if (itemInfo.wID && !(itemInfo.fState & MFS_DEFAULT)) { + // UINT fOldState = itemInfo.fState, fState = itemInfo.fState & ~MFS_DISABLED; + // if (itemInfo.wID == SC_CLOSE) { + // fState |= MFS_DEFAULT; + // } else if (itemInfo.wID == menuToDisable || (itemInfo.wID != SC_MINIMIZE && itemInfo.wID != SC_MAXIMIZE && itemInfo.wID != SC_RESTORE)) { + // fState |= MFS_DISABLED; + // } + // itemInfo.fMask = MIIM_STATE; + // itemInfo.fState = fState; + // if (!SetMenuItemInfo(ps_menu, i, TRUE, &itemInfo)) { + // DEBUG_LOG(("PS Error: could not set state %1 to menu item %2, old state %3, error %4").arg(fState).arg(itemInfo.wID).arg(fOldState).arg(GetLastError())); + // DestroyMenu(ps_menu); + // ps_menu = 0; + // break; + // } + // } + // } else { + // DEBUG_LOG(("PS Error: could not get state, menu item %1 of %2, error %3").arg(i).arg(itemCount).arg(GetLastError())); + // DestroyMenu(ps_menu); + // ps_menu = 0; + // break; + // } + //} +} + +void PsMainWindow::psUpdateMargins() { + if (!ps_hWnd) return; + + //RECT r, a; + + //GetClientRect(ps_hWnd, &r); + //a = r; + + //LONG style = GetWindowLong(ps_hWnd, GWL_STYLE), styleEx = GetWindowLong(ps_hWnd, GWL_EXSTYLE); + //AdjustWindowRectEx(&a, style, false, styleEx); + //QMargins margins = QMargins(a.left - r.left, a.top - r.top, r.right - a.right, r.bottom - a.bottom); + //if (style & WS_MAXIMIZE) { + // RECT w, m; + // GetWindowRect(ps_hWnd, &w); + // m = w; + + // HMONITOR hMonitor = MonitorFromRect(&w, MONITOR_DEFAULTTONEAREST); + // if (hMonitor) { + // MONITORINFO mi; + // mi.cbSize = sizeof(mi); + // GetMonitorInfo(hMonitor, &mi); + // m = mi.rcWork; + // } + + // dleft = w.left - m.left; + // dtop = w.top - m.top; + + // margins.setLeft(margins.left() - w.left + m.left); + // margins.setRight(margins.right() - m.right + w.right); + // margins.setBottom(margins.bottom() - m.bottom + w.bottom); + // margins.setTop(margins.top() - w.top + m.top); + //} else { + // dleft = dtop = 0; + //} + + //QPlatformNativeInterface *i = QGuiApplication::platformNativeInterface(); + //i->setWindowProperty(windowHandle()->handle(), qsl("WindowsCustomMargins"), QVariant::fromValue(margins)); + //if (!themeInited) { + // themeInited = true; + // if (useTheme) { + // if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8) { + // setWindowTheme(ps_hWnd, L" ", L" "); + // QApplication::setStyle(QStyleFactory::create(qsl("Windows"))); + // } + // } + //} +} + +void PsMainWindow::psFlash() { + //if (GetForegroundWindow() == ps_hWnd) return; + + //FLASHWINFO info; + //info.cbSize = sizeof(info); + //info.hwnd = ps_hWnd; + //info.dwFlags = FLASHW_ALL; + //info.dwTimeout = 0; + //info.uCount = 1; + //FlashWindowEx(&info); +} + +HWND PsMainWindow::psHwnd() const { + return ps_hWnd; +} + +HMENU PsMainWindow::psMenu() const { + return ps_menu; +} + +void PsMainWindow::psDestroyIcons() { + //if (ps_iconBig) { + // DestroyIcon(ps_iconBig); + // ps_iconBig = 0; + // } + // if (ps_iconSmall) { + // DestroyIcon(ps_iconSmall); + // ps_iconSmall = 0; + // } + //if (ps_iconOverlay) { + // DestroyIcon(ps_iconOverlay); + // ps_iconOverlay = 0; + //} +} + +PsMainWindow::~PsMainWindow() { + //if (useWtsapi) { + // QPlatformNativeInterface *i = QGuiApplication::platformNativeInterface(); + // if (HWND hWnd = static_cast(i->nativeResourceForWindow(QByteArrayLiteral("handle"), windowHandle()))) { + // wtsUnRegisterSessionNotification(hWnd); + // } + //} + + //if (taskbarList) taskbarList.Reset(); + + //toastNotifications.clear(); + //if (toastNotificationManager) toastNotificationManager.Reset(); + //if (toastNotifier) toastNotifier.Reset(); + //if (toastNotificationFactory) toastNotificationFactory.Reset(); + + finished = true; + //if (ps_menu) DestroyMenu(ps_menu); + psDestroyIcons(); + //_psShadowWindows.destroy(); + //if (ps_tbHider_hWnd) DestroyWindow(ps_tbHider_hWnd); +} + +namespace { + QRect _monitorRect; + uint64 _monitorLastGot = 0; +} + +QRect psDesktopRect() { + uint64 tnow = getms(); + if (tnow > _monitorLastGot + 1000 || tnow < _monitorLastGot) { + _monitorLastGot = tnow; + //HMONITOR hMonitor = MonitorFromWindow(App::wnd()->psHwnd(), MONITOR_DEFAULTTONEAREST); + //if (hMonitor) { + // MONITORINFOEX info; + // info.cbSize = sizeof(info); + // GetMonitorInfo(hMonitor, &info); + // _monitorRect = QRect(info.rcWork.left, info.rcWork.top, info.rcWork.right - info.rcWork.left, info.rcWork.bottom - info.rcWork.top); + //} else { + _monitorRect = QApplication::desktop()->availableGeometry(App::wnd()); + //} + } + return _monitorRect; +} + +void psShowOverAll(QWidget *w, bool canFocus) { +} + +void psBringToBack(QWidget *w) { +} + +void PsMainWindow::psActivateNotify(NotifyWindow *w) { +} + +void PsMainWindow::psClearNotifies(PeerId peerId) { + //if (!toastNotifier) return; + + //if (peerId) { + // ToastNotifications::iterator i = toastNotifications.find(peerId); + // if (i != toastNotifications.cend()) { + // QMap temp = i.value(); + // toastNotifications.erase(i); + + // for (QMap::const_iterator j = temp.cbegin(), e = temp.cend(); j != e; ++j) { + // toastNotifier->Hide(j->p.Get()); + // } + // } + //} else { + // ToastNotifications temp = toastNotifications; + // toastNotifications.clear(); + + // for (ToastNotifications::const_iterator i = temp.cbegin(), end = temp.cend(); i != end; ++i) { + // for (QMap::const_iterator j = i->cbegin(), e = i->cend(); j != e; ++j) { + // toastNotifier->Hide(j->p.Get()); + // } + // } + //} +} + +void PsMainWindow::psNotifyShown(NotifyWindow *w) { +} + +void PsMainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) { + QString title = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->history()->peer->name : qsl("Telegram Desktop"); + QString subtitle = (!App::passcoded() && cNotifyView() <= dbinvShowName) ? item->notificationHeader() : QString(); + bool showpix = (!App::passcoded() && cNotifyView() <= dbinvShowName); + QString msg = (!App::passcoded() && cNotifyView() <= dbinvShowPreview) ? (fwdCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, fwdCount)) : lang(lng_notification_preview); + +// CreateToast(item->history()->peer, item->id, showpix, title, subtitle, msg); +} + +QAbstractNativeEventFilter *psNativeEventFilter() { + delete _psEventFilter; + _psEventFilter = new _PsEventFilter(); + return _psEventFilter; +} + +void psDeleteDir(const QString &dir) { + std::wstring wDir = QDir::toNativeSeparators(dir).toStdWString(); + WCHAR path[4096]; + memcpy(path, wDir.c_str(), (wDir.size() + 1) * sizeof(WCHAR)); + path[wDir.size() + 1] = 0; + //SHFILEOPSTRUCT file_op = { + // NULL, + // FO_DELETE, + // path, + // L"", + // FOF_NOCONFIRMATION | + // FOF_NOERRORUI | + // FOF_SILENT, + // false, + // 0, + // L"" + //}; + //int res = SHFileOperation(&file_op); +} + +namespace { + BOOL CALLBACK _ActivateProcess(HWND hWnd, LPARAM lParam) { + //uint64 &processId(*(uint64*)lParam); + + //DWORD dwProcessId; + //::GetWindowThreadProcessId(hWnd, &dwProcessId); + + //if ((uint64)dwProcessId == processId) { // found top-level window + // static const int32 nameBufSize = 1024; + // WCHAR nameBuf[nameBufSize]; + // int32 len = GetWindowText(hWnd, nameBuf, nameBufSize); + // if (len && len < nameBufSize) { + // if (QRegularExpression(qsl("^Telegram(\\s*\\(\\d+\\))?$")).match(QString::fromStdWString(nameBuf)).hasMatch()) { + // BOOL res = ::SetForegroundWindow(hWnd); + // ::SetFocus(hWnd); + // return FALSE; + // } + // } + //} + return TRUE; + } +} + +namespace { + uint64 _lastUserAction = 0; +} + +void psUserActionDone() { + _lastUserAction = getms(true); + if (sessionLoggedOff) sessionLoggedOff = false; +} + +bool psIdleSupported() { + //LASTINPUTINFO lii; + //lii.cbSize = sizeof(LASTINPUTINFO); + //return GetLastInputInfo(&lii); + return false; +} + +uint64 psIdleTime() { + //LASTINPUTINFO lii; + //lii.cbSize = sizeof(LASTINPUTINFO); + //return GetLastInputInfo(&lii) ? (GetTickCount() - lii.dwTime) : (getms(true) - _lastUserAction); + return (getms(true) - _lastUserAction); +} + +bool psSkipAudioNotify() { + //QUERY_USER_NOTIFICATION_STATE state; + //if (useShellapi && SUCCEEDED(shQueryUserNotificationState(&state))) { + // if (state == QUNS_NOT_PRESENT || state == QUNS_PRESENTATION_MODE) return true; + //} + return sessionLoggedOff; +} + +bool psSkipDesktopNotify() { + //QUERY_USER_NOTIFICATION_STATE state; + //if (useShellapi && SUCCEEDED(shQueryUserNotificationState(&state))) { + // if (state == QUNS_PRESENTATION_MODE || state == QUNS_RUNNING_D3D_FULL_SCREEN/* || state == QUNS_BUSY*/) return true; + //} + return false; +} + +QStringList psInitLogs() { + return _initLogs; +} + +void psClearInitLogs() { + _initLogs = QStringList(); +} + +void psActivateProcess(uint64 pid) { + if (pid) { + //::EnumWindows((WNDENUMPROC)_ActivateProcess, (LPARAM)&pid); + } +} + +QString psCurrentCountry() { + //int chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, 0, 0); + //if (chCount && chCount < 128) { + // WCHAR wstrCountry[128]; + // int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, wstrCountry, chCount); + // return len ? QString::fromStdWString(std::wstring(wstrCountry)) : QString::fromLatin1(DefaultCountry); + //} + return QString::fromLatin1(DefaultCountry); +} + +namespace { + QString langById(int lngId) { + int primary = lngId & 0xFF; + switch (primary) { + case 0x36: return qsl("af"); + case 0x1C: return qsl("sq"); + case 0x5E: return qsl("am"); + case 0x01: return qsl("ar"); + case 0x2B: return qsl("hy"); + case 0x4D: return qsl("as"); + case 0x2C: return qsl("az"); + case 0x45: return qsl("bn"); + case 0x6D: return qsl("ba"); + case 0x2D: return qsl("eu"); + case 0x23: return qsl("be"); + case 0x1A: + if (lngId == LANG_CROATIAN) { + return qsl("hr"); + } else if (lngId == LANG_BOSNIAN_NEUTRAL || lngId == LANG_BOSNIAN) { + return qsl("bs"); + } + return qsl("sr"); + break; + case 0x7E: return qsl("br"); + case 0x02: return qsl("bg"); + case 0x92: return qsl("ku"); + case 0x03: return qsl("ca"); + case 0x04: return qsl("zh"); + case 0x83: return qsl("co"); + case 0x05: return qsl("cs"); + case 0x06: return qsl("da"); + case 0x65: return qsl("dv"); + case 0x13: return qsl("nl"); + case 0x09: return qsl("en"); + case 0x25: return qsl("et"); + case 0x38: return qsl("fo"); + case 0x0B: return qsl("fi"); + case 0x0c: return qsl("fr"); + case 0x62: return qsl("fy"); + case 0x56: return qsl("gl"); + case 0x37: return qsl("ka"); + case 0x07: return qsl("de"); + case 0x08: return qsl("el"); + case 0x6F: return qsl("kl"); + case 0x47: return qsl("gu"); + case 0x68: return qsl("ha"); + case 0x0D: return qsl("he"); + case 0x39: return qsl("hi"); + case 0x0E: return qsl("hu"); + case 0x0F: return qsl("is"); + case 0x70: return qsl("ig"); + case 0x21: return qsl("id"); + case 0x5D: return qsl("iu"); + case 0x3C: return qsl("ga"); + case 0x34: return qsl("xh"); + case 0x35: return qsl("zu"); + case 0x10: return qsl("it"); + case 0x11: return qsl("ja"); + case 0x4B: return qsl("kn"); + case 0x3F: return qsl("kk"); + case 0x53: return qsl("kh"); + case 0x87: return qsl("rw"); + case 0x12: return qsl("ko"); + case 0x40: return qsl("ky"); + case 0x54: return qsl("lo"); + case 0x26: return qsl("lv"); + case 0x27: return qsl("lt"); + case 0x6E: return qsl("lb"); + case 0x2F: return qsl("mk"); + case 0x3E: return qsl("ms"); + case 0x4C: return qsl("ml"); + case 0x3A: return qsl("mt"); + case 0x81: return qsl("mi"); + case 0x4E: return qsl("mr"); + case 0x50: return qsl("mn"); + case 0x61: return qsl("ne"); + case 0x14: return qsl("no"); + case 0x82: return qsl("oc"); + case 0x48: return qsl("or"); + case 0x63: return qsl("ps"); + case 0x29: return qsl("fa"); + case 0x15: return qsl("pl"); + case 0x16: return qsl("pt"); + case 0x67: return qsl("ff"); + case 0x46: return qsl("pa"); + case 0x18: return qsl("ro"); + case 0x17: return qsl("rm"); + case 0x19: return qsl("ru"); + case 0x3B: return qsl("se"); + case 0x4F: return qsl("sa"); + case 0x32: return qsl("tn"); + case 0x59: return qsl("sd"); + case 0x5B: return qsl("si"); + case 0x1B: return qsl("sk"); + case 0x24: return qsl("sl"); + case 0x0A: return qsl("es"); + case 0x41: return qsl("sw"); + case 0x1D: return qsl("sv"); + case 0x28: return qsl("tg"); + case 0x49: return qsl("ta"); + case 0x44: return qsl("tt"); + case 0x4A: return qsl("te"); + case 0x1E: return qsl("th"); + case 0x51: return qsl("bo"); + case 0x73: return qsl("ti"); + case 0x1F: return qsl("tr"); + case 0x42: return qsl("tk"); + case 0x22: return qsl("uk"); + case 0x20: return qsl("ur"); + case 0x80: return qsl("ug"); + case 0x43: return qsl("uz"); + case 0x2A: return qsl("vi"); + case 0x52: return qsl("cy"); + case 0x88: return qsl("wo"); + case 0x78: return qsl("ii"); + case 0x6A: return qsl("yo"); + } + return QString::fromLatin1(DefaultLanguage); + } +} + +QString psCurrentLanguage() { + //int chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNAME, 0, 0); + //if (chCount && chCount < 128) { + // WCHAR wstrLocale[128]; + // int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SNAME, wstrLocale, chCount); + // if (!len) return QString::fromLatin1(DefaultLanguage); + // QString locale = QString::fromStdWString(std::wstring(wstrLocale)); + // QRegularExpressionMatch m = QRegularExpression("(^|[^a-z])([a-z]{2})-").match(locale); + // if (m.hasMatch()) { + // return m.captured(2); + // } + //} + //chCount = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, 0, 0); + //if (chCount && chCount < 128) { + // WCHAR wstrLocale[128]; + // int len = GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_ILANGUAGE, wstrLocale, chCount), lngId = 0; + // if (len < 5) return QString::fromLatin1(DefaultLanguage); + + // for (int i = 0; i < 4; ++i) { + // WCHAR ch = wstrLocale[i]; + // lngId *= 16; + // if (ch >= WCHAR('0') && ch <= WCHAR('9')) { + // lngId += (ch - WCHAR('0')); + // } else if (ch >= WCHAR('A') && ch <= WCHAR('F')) { + // lngId += (10 + ch - WCHAR('A')); + // } else { + // return QString::fromLatin1(DefaultLanguage); + // } + // } + // return langById(lngId); + //} + return QString::fromLatin1(DefaultLanguage); +} + +QString psAppDataPath() { + static const int maxFileLen = MAX_PATH * 10; + //WCHAR wstrPath[maxFileLen]; + //if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { + // QDir appData(QString::fromStdWString(std::wstring(wstrPath))); + // return appData.absolutePath() + '/' + QString::fromWCharArray(AppName) + '/'; + //} + return QString(); +} + +QString psAppDataPathOld() { + static const int maxFileLen = MAX_PATH * 10; + //WCHAR wstrPath[maxFileLen]; + //if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { + // QDir appData(QString::fromStdWString(std::wstring(wstrPath))); + // return appData.absolutePath() + '/' + QString::fromWCharArray(AppNameOld) + '/'; + //} + return QString(); +} + +QString psDownloadPath() { + return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + QString::fromWCharArray(AppName) + '/'; +} + +QString psCurrentExeDirectory(int argc, char *argv[]) { + //LPWSTR *args; + //int argsCount; + //args = CommandLineToArgvW(GetCommandLine(), &argsCount); + //if (args) { + // QFileInfo info(QDir::fromNativeSeparators(QString::fromWCharArray(args[0]))); + // if (info.isFile()) { + // return info.absoluteDir().absolutePath() + '/'; + // } + // LocalFree(args); + //} + return QString(); +} + +QString psCurrentExeName(int argc, char *argv[]) { + //LPWSTR *args; + //int argsCount; + //args = CommandLineToArgvW(GetCommandLine(), &argsCount); + //if (args) { + // QFileInfo info(QDir::fromNativeSeparators(QString::fromWCharArray(args[0]))); + // if (info.isFile()) { + // return info.fileName(); + // } + // LocalFree(args); + //} + return QString(); +} + +void psDoCleanup() { + try { + psAutoStart(false, true); + psSendToMenu(false, true); + CleanupAppUserModelIdShortcut(); + } catch (...) { + } +} + +int psCleanup() { + __try + { + psDoCleanup(); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + return 0; + } + return 0; +} + +void psDoFixPrevious() { + try { + //static const int bufSize = 4096; + //DWORD checkType, checkSize = bufSize * 2; + //WCHAR checkStr[bufSize]; + + //QString appId = QString::fromStdWString(AppId); + //QString newKeyStr1 = QString("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId); + //QString newKeyStr2 = QString("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId); + //QString oldKeyStr1 = QString("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId); + //QString oldKeyStr2 = QString("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%1_is1").arg(appId); + //HKEY newKey1, newKey2, oldKey1, oldKey2; + //LSTATUS newKeyRes1 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr1.toStdWString().c_str(), 0, KEY_READ, &newKey1); + //LSTATUS newKeyRes2 = RegOpenKeyEx(HKEY_CURRENT_USER, newKeyStr2.toStdWString().c_str(), 0, KEY_READ, &newKey2); + //LSTATUS oldKeyRes1 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str(), 0, KEY_READ, &oldKey1); + //LSTATUS oldKeyRes2 = RegOpenKeyEx(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str(), 0, KEY_READ, &oldKey2); + + //bool existNew1 = (newKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(newKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2; + //bool existNew2 = (newKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(newKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2; + //bool existOld1 = (oldKeyRes1 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey1, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2; + //bool existOld2 = (oldKeyRes2 == ERROR_SUCCESS) && (RegQueryValueEx(oldKey2, L"InstallDate", 0, &checkType, (BYTE*)checkStr, &checkSize) == ERROR_SUCCESS); checkSize = bufSize * 2; + + //if (newKeyRes1 == ERROR_SUCCESS) RegCloseKey(newKey1); + //if (newKeyRes2 == ERROR_SUCCESS) RegCloseKey(newKey2); + //if (oldKeyRes1 == ERROR_SUCCESS) RegCloseKey(oldKey1); + //if (oldKeyRes2 == ERROR_SUCCESS) RegCloseKey(oldKey2); + + //if (existNew1 || existNew2) { + // oldKeyRes1 = existOld1 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr1.toStdWString().c_str()) : ERROR_SUCCESS; + // oldKeyRes2 = existOld2 ? RegDeleteKey(HKEY_LOCAL_MACHINE, oldKeyStr2.toStdWString().c_str()) : ERROR_SUCCESS; + //} + + //QString userDesktopLnk, commonDesktopLnk; + //WCHAR userDesktopFolder[MAX_PATH], commonDesktopFolder[MAX_PATH]; + //HRESULT userDesktopRes = SHGetFolderPath(0, CSIDL_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, userDesktopFolder); + //HRESULT commonDesktopRes = SHGetFolderPath(0, CSIDL_COMMON_DESKTOPDIRECTORY, 0, SHGFP_TYPE_CURRENT, commonDesktopFolder); + //if (SUCCEEDED(userDesktopRes)) { + // userDesktopLnk = QString::fromWCharArray(userDesktopFolder) + "\\Telegram.lnk"; + //} + //if (SUCCEEDED(commonDesktopRes)) { + // commonDesktopLnk = QString::fromWCharArray(commonDesktopFolder) + "\\Telegram.lnk"; + //} + //QFile userDesktopFile(userDesktopLnk), commonDesktopFile(commonDesktopLnk); + //if (QFile::exists(userDesktopLnk) && QFile::exists(commonDesktopLnk) && userDesktopLnk != commonDesktopLnk) { + // bool removed = QFile::remove(commonDesktopLnk); + //} + } catch (...) { + } +} + +int psFixPrevious() { + __try + { + psDoFixPrevious(); + } + __except(EXCEPTION_EXECUTE_HANDLER) + { + return 0; + } + return 0; +} + +void psPostprocessFile(const QString &name) { + //std::wstring zoneFile = QDir::toNativeSeparators(name).toStdWString() + L":Zone.Identifier"; + //HANDLE f = CreateFile(zoneFile.c_str(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + //if (f == INVALID_HANDLE_VALUE) { // :( + // return; + //} + + //const char data[] = "[ZoneTransfer]\r\nZoneId=3\r\n"; + + //DWORD written = 0; + //BOOL result = WriteFile(f, data, sizeof(data), &written, NULL); + //CloseHandle(f); + + //if (!result || written != sizeof(data)) { // :( + // return; + //} +} + +namespace { + //struct OpenWithApp { + // OpenWithApp(const QString &name, HBITMAP icon, IAssocHandler *handler) : name(name), icon(icon), handler(handler) { + // } + // OpenWithApp(const QString &name, IAssocHandler *handler) : name(name), icon(0), handler(handler) { + // } + // void destroy() { + // if (icon) DeleteBitmap(icon); + // if (handler) handler->Release(); + // } + // QString name; + // HBITMAP icon; + // IAssocHandler *handler; + //}; + + //bool OpenWithAppLess(const OpenWithApp &a, const OpenWithApp &b) { + // return a.name < b.name; + //} + + //HBITMAP _iconToBitmap(LPWSTR icon, int iconindex) { + // if (!icon) return 0; + // WCHAR tmpIcon[4096]; + // if (icon[0] == L'@' && SUCCEEDED(SHLoadIndirectString(icon, tmpIcon, 4096, 0))) { + // icon = tmpIcon; + // } + // int32 w = GetSystemMetrics(SM_CXSMICON), h = GetSystemMetrics(SM_CYSMICON); + + // HICON ico = ExtractIcon(0, icon, iconindex); + // if (!ico) { + // if (!iconindex) { // try to read image + // QImage img(QString::fromWCharArray(icon)); + // if (!img.isNull()) { + // return qt_pixmapToWinHBITMAP(QPixmap::fromImage(img.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)), /* HBitmapAlpha */ 2); + // } + // } + // return 0; + // } + + // HDC screenDC = GetDC(0), hdc = CreateCompatibleDC(screenDC); + // HBITMAP result = CreateCompatibleBitmap(screenDC, w, h); + // HGDIOBJ was = SelectObject(hdc, result); + // DrawIconEx(hdc, 0, 0, ico, w, h, 0, NULL, DI_NORMAL); + // SelectObject(hdc, was); + // DeleteDC(hdc); + // ReleaseDC(0, screenDC); + + // DestroyIcon(ico); + + // return (HBITMAP)CopyImage(result, IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE | LR_CREATEDIBSECTION); + //} +} + +bool psShowOpenWithMenu(int x, int y, const QString &file) { + if (!useOpenWith || !App::wnd()) return false; + + //bool result = false; + //QList handlers; + //IShellItem* pItem = nullptr; + //if (SUCCEEDED(shCreateItemFromParsingName(QDir::toNativeSeparators(file).toStdWString().c_str(), nullptr, IID_PPV_ARGS(&pItem)))) { + // IEnumAssocHandlers *assocHandlers = 0; + // if (SUCCEEDED(pItem->BindToHandler(nullptr, BHID_EnumAssocHandlers, IID_PPV_ARGS(&assocHandlers)))) { + // HRESULT hr = S_FALSE; + // do + // { + // IAssocHandler *handler = 0; + // ULONG ulFetched = 0; + // hr = assocHandlers->Next(1, &handler, &ulFetched); + // if (FAILED(hr) || hr == S_FALSE || !ulFetched) break; + + // LPWSTR name = 0; + // if (SUCCEEDED(handler->GetUIName(&name))) { + // LPWSTR icon = 0; + // int iconindex = 0; + // if (SUCCEEDED(handler->GetIconLocation(&icon, &iconindex)) && icon) { + // handlers.push_back(OpenWithApp(QString::fromWCharArray(name), _iconToBitmap(icon, iconindex), handler)); + // CoTaskMemFree(icon); + // } else { + // handlers.push_back(OpenWithApp(QString::fromWCharArray(name), handler)); + // } + // CoTaskMemFree(name); + // } else { + // handler->Release(); + // } + // } while (hr != S_FALSE); + // assocHandlers->Release(); + // } + + // if (!handlers.isEmpty()) { + // HMENU menu = CreatePopupMenu(); + // std::sort(handlers.begin(), handlers.end(), OpenWithAppLess); + // for (int32 i = 0, l = handlers.size(); i < l; ++i) { + // MENUITEMINFO menuInfo = { 0 }; + // menuInfo.cbSize = sizeof(menuInfo); + // menuInfo.fMask = MIIM_STRING | MIIM_DATA | MIIM_ID; + // menuInfo.fType = MFT_STRING; + // menuInfo.wID = i + 1; + // if (handlers.at(i).icon) { + // menuInfo.fMask |= MIIM_BITMAP; + // menuInfo.hbmpItem = handlers.at(i).icon; + // } + + // QString name = handlers.at(i).name; + // if (name.size() > 512) name = name.mid(0, 512); + // WCHAR nameArr[1024]; + // name.toWCharArray(nameArr); + // nameArr[name.size()] = 0; + // menuInfo.dwTypeData = nameArr; + // InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &menuInfo); + // } + // MENUITEMINFO sepInfo = { 0 }; + // sepInfo.cbSize = sizeof(sepInfo); + // sepInfo.fMask = MIIM_STRING | MIIM_DATA; + // sepInfo.fType = MFT_SEPARATOR; + // InsertMenuItem(menu, GetMenuItemCount(menu), true, &sepInfo); + + // MENUITEMINFO menuInfo = { 0 }; + // menuInfo.cbSize = sizeof(menuInfo); + // menuInfo.fMask = MIIM_STRING | MIIM_DATA | MIIM_ID; + // menuInfo.fType = MFT_STRING; + // menuInfo.wID = handlers.size() + 1; + + // QString name = lang(lng_wnd_choose_program_menu); + // if (name.size() > 512) name = name.mid(0, 512); + // WCHAR nameArr[1024]; + // name.toWCharArray(nameArr); + // nameArr[name.size()] = 0; + // menuInfo.dwTypeData = nameArr; + // InsertMenuItem(menu, GetMenuItemCount(menu), TRUE, &menuInfo); + + // int sel = TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD, x, y, 0, App::wnd()->psHwnd(), 0); + // DestroyMenu(menu); + + // if (sel > 0) { + // if (sel <= handlers.size()) { + // IDataObject *dataObj = 0; + // if (SUCCEEDED(pItem->BindToHandler(nullptr, BHID_DataObject, IID_PPV_ARGS(&dataObj))) && dataObj) { + // handlers.at(sel - 1).handler->Invoke(dataObj); + // dataObj->Release(); + // result = true; + // } + // } + // } else { + // result = true; + // } + // for (int i = 0, l = handlers.size(); i < l; ++i) { + // handlers[i].destroy(); + // } + // } + + // pItem->Release(); + //} + //return result; + return false; +} + +void psOpenFile(const QString &name, bool openWith) { + bool mailtoScheme = name.startsWith(qstr("mailto:")); + std::wstring wname = mailtoScheme ? name.toStdWString() : QDir::toNativeSeparators(name).toStdWString(); + + if (openWith && useOpenAs) { + //if (shOpenWithDialog) { + // OPENASINFO info; + // info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_REGISTER_EXT | OAIF_EXEC; + // if (mailtoScheme) info.oaifInFlags |= OAIF_FILE_IS_URI | OAIF_URL_PROTOCOL; + // info.pcszClass = NULL; + // info.pcszFile = wname.c_str(); + // shOpenWithDialog(0, &info); + //} else { + // openAs_RunDLL(0, 0, wname.c_str(), SW_SHOWNORMAL); + //} + } else { + //ShellExecute(0, L"open", wname.c_str(), 0, 0, SW_SHOWNORMAL); + } + QDesktopServices::openUrl(QUrl::fromLocalFile(name)); +} + +void psShowInFolder(const QString &name) { + //QString nameEscaped = QDir::toNativeSeparators(name).replace('"', qsl("\"\"")); + //ShellExecute(0, 0, qsl("explorer").toStdWString().c_str(), (qsl("/select,") + nameEscaped).toStdWString().c_str(), 0, SW_SHOWNORMAL); +} + +namespace PlatformSpecific { + + void start() { + } + + void finish() { + delete _psEventFilter; + _psEventFilter = 0; + + //if (ToastImageSavedFlag) { + // psDeleteDir(cWorkingDir() + qsl("tdata/temp")); + //} + } + + namespace ThirdParty { + void start() { + } + + void finish() { + } + } + +} + +namespace { + //void _psLogError(const char *str, LSTATUS code) { + // LPTSTR errorText = NULL, errorTextDefault = L"(Unknown error)"; + // FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&errorText, 0, 0); + // if (!errorText) { + // errorText = errorTextDefault; + // } + // LOG((str).arg(code).arg(QString::fromStdWString(errorText))); + // if (errorText != errorTextDefault) { + // LocalFree(errorText); + // } + //} + + //bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) { + // DEBUG_LOG(("App Info: opening reg key %1...").arg(QString::fromStdWString(key))); + // LSTATUS status = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE | KEY_WRITE, rkey); + // if (status != ERROR_SUCCESS) { + // if (status == ERROR_FILE_NOT_FOUND) { + // status = RegCreateKeyEx(HKEY_CURRENT_USER, key, 0, 0, REG_OPTION_NON_VOLATILE, KEY_QUERY_VALUE | KEY_WRITE, 0, rkey, 0); + // if (status != ERROR_SUCCESS) { + // QString msg = qsl("App Error: could not create '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2")); + // _psLogError(msg.toUtf8().constData(), status); + // return false; + // } + // } else { + // QString msg = qsl("App Error: could not open '%1' registry key, error %2").arg(QString::fromStdWString(key)).arg(qsl("%1: %2")); + // _psLogError(msg.toUtf8().constData(), status); + // return false; + // } + // } + // return true; + //} + + //bool _psSetKeyValue(HKEY rkey, LPCWSTR value, QString v) { + // static const int bufSize = 4096; + // DWORD defaultType, defaultSize = bufSize * 2; + // WCHAR defaultStr[bufSize] = { 0 }; + // if (RegQueryValueEx(rkey, value, 0, &defaultType, (BYTE*)defaultStr, &defaultSize) != ERROR_SUCCESS || defaultType != REG_SZ || defaultSize != (v.size() + 1) * 2 || QString::fromStdWString(defaultStr) != v) { + // WCHAR tmp[bufSize] = { 0 }; + // if (!v.isEmpty()) wsprintf(tmp, v.replace(QChar('%'), qsl("%%")).toStdWString().c_str()); + // LSTATUS status = RegSetValueEx(rkey, value, 0, REG_SZ, (BYTE*)tmp, (wcslen(tmp) + 1) * sizeof(WCHAR)); + // if (status != ERROR_SUCCESS) { + // QString msg = qsl("App Error: could not set %1, error %2").arg(value ? ('\'' + QString::fromStdWString(value) + '\'') : qsl("(Default)")).arg("%1: %2"); + // _psLogError(msg.toUtf8().constData(), status); + // return false; + // } + // } + // return true; + //} +} + +void RegisterCustomScheme() { +#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME + DEBUG_LOG(("App Info: Checking custom scheme 'tg'...")); + + //HKEY rkey; + //QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()); + + //if (!_psOpenRegKey(L"Software\\Classes\\tg", &rkey)) return; + //if (!_psSetKeyValue(rkey, L"URL Protocol", QString())) return; + //if (!_psSetKeyValue(rkey, 0, qsl("URL:Telegram Link"))) return; + + //if (!_psOpenRegKey(L"Software\\Classes\\tg\\DefaultIcon", &rkey)) return; + //if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl(",1\""))) return; + + //if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell", &rkey)) return; + //if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open", &rkey)) return; + //if (!_psOpenRegKey(L"Software\\Classes\\tg\\shell\\open\\command", &rkey)) return; + //if (!_psSetKeyValue(rkey, 0, '"' + exe + qsl("\" -workdir \"") + cWorkingDir() + qsl("\" -- \"%1\""))) return; +#endif +} + +void psNewVersion() { + RegisterCustomScheme(); + if (Local::oldSettingsVersion() < 8051) { + CheckPinnedAppUserModelId(); + } +} + +void psExecUpdater() { + QString targs = qsl("-update"); + if (cLaunchMode() == LaunchModeAutoStart) targs += qsl(" -autostart"); + if (cDebug()) targs += qsl(" -debug"); + if (cStartInTray()) targs += qsl(" -startintray"); + if (cWriteProtected()) targs += qsl(" -writeprotected \"") + cExeDir() + '"'; + + QString updaterPath = cWriteProtected() ? (cWorkingDir() + qsl("tupdates/temp/Updater.exe")) : (cExeDir() + qsl("Updater.exe")); + + QString updater(QDir::toNativeSeparators(updaterPath)), wdir(QDir::toNativeSeparators(cWorkingDir())); + + //DEBUG_LOG(("Application Info: executing %1 %2").arg(cExeDir() + "Updater.exe").arg(targs)); + //HINSTANCE r = ShellExecute(0, cWriteProtected() ? L"runas" : 0, updater.toStdWString().c_str(), targs.toStdWString().c_str(), wdir.isEmpty() ? 0 : wdir.toStdWString().c_str(), SW_SHOWNORMAL); + //if (long(r) < 32) { + // DEBUG_LOG(("Application Error: failed to execute %1, working directory: '%2', result: %3").arg(updater).arg(wdir).arg(long(r))); + // psDeleteDir(cWorkingDir() + qsl("tupdates/temp")); + //} +} + +void psExecTelegram(const QString &crashreport) { + QString targs = crashreport.isEmpty() ? qsl("-noupdate") : ('"' + crashreport + '"'); + if (crashreport.isEmpty()) { + if (cRestartingToSettings()) targs += qsl(" -tosettings"); + if (cLaunchMode() == LaunchModeAutoStart) targs += qsl(" -autostart"); + if (cDebug()) targs += qsl(" -debug"); + if (cStartInTray()) targs += qsl(" -startintray"); + if (cTestMode()) targs += qsl(" -testmode"); + if (cDataFile() != qsl("data")) targs += qsl(" -key \"") + cDataFile() + '"'; + } + QString telegram(QDir::toNativeSeparators(cExeDir() + cExeName())), wdir(QDir::toNativeSeparators(cWorkingDir())); + + DEBUG_LOG(("Application Info: executing %1 %2").arg(cExeDir() + cExeName()).arg(targs)); + Logs::closeMain(); + SignalHandlers::finish(); + //HINSTANCE r = ShellExecute(0, 0, telegram.toStdWString().c_str(), targs.toStdWString().c_str(), wdir.isEmpty() ? 0 : wdir.toStdWString().c_str(), SW_SHOWNORMAL); + //if (long(r) < 32) { + // DEBUG_LOG(("Application Error: failed to execute %1, working directory: '%2', result: %3").arg(telegram).arg(wdir).arg(long(r))); + //} +} + +void _manageAppLnk(bool create, bool silent, int path_csidl, const wchar_t *args, const wchar_t *description) { + //WCHAR startupFolder[MAX_PATH]; + //HRESULT hr = SHGetFolderPath(0, path_csidl, 0, SHGFP_TYPE_CURRENT, startupFolder); + //if (SUCCEEDED(hr)) { + // QString lnk = QString::fromWCharArray(startupFolder) + '\\' + QString::fromWCharArray(AppFile) + qsl(".lnk"); + // if (create) { + // ComPtr shellLink; + // hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); + // if (SUCCEEDED(hr)) { + // ComPtr persistFile; + + // QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()), dir = QDir::toNativeSeparators(QDir(cWorkingDir()).absolutePath()); + // shellLink->SetArguments(args); + // shellLink->SetPath(exe.toStdWString().c_str()); + // shellLink->SetWorkingDirectory(dir.toStdWString().c_str()); + // shellLink->SetDescription(description); + + // ComPtr propertyStore; + // hr = shellLink.As(&propertyStore); + // if (SUCCEEDED(hr)) { + // PROPVARIANT appIdPropVar; + // hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar); + // if (SUCCEEDED(hr)) { + // hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); + // PropVariantClear(&appIdPropVar); + // if (SUCCEEDED(hr)) { + // hr = propertyStore->Commit(); + // } + // } + // } + + // hr = shellLink.As(&persistFile); + // if (SUCCEEDED(hr)) { + // hr = persistFile->Save(lnk.toStdWString().c_str(), TRUE); + // } else { + // if (!silent) LOG(("App Error: could not create interface IID_IPersistFile %1").arg(hr)); + // } + // } else { + // if (!silent) LOG(("App Error: could not create instance of IID_IShellLink %1").arg(hr)); + // } + // } else { + // QFile::remove(lnk); + // } + //} else { + // if (!silent) LOG(("App Error: could not get CSIDL %1 folder %2").arg(path_csidl).arg(hr)); + //} +} + +void psAutoStart(bool start, bool silent) { + //_manageAppLnk(start, silent, CSIDL_STARTUP, L"-autostart", L"Telegram autorun link.\nYou can disable autorun in Telegram settings."); +} + +void psSendToMenu(bool send, bool silent) { + //_manageAppLnk(send, silent, CSIDL_SENDTO, L"-sendpath", L"Telegram send to link.\nYou can disable send to menu item in Telegram settings."); +} + +void psUpdateOverlayed(TWidget *widget) { + bool wm = widget->testAttribute(Qt::WA_Mapped), wv = widget->testAttribute(Qt::WA_WState_Visible); + if (!wm) widget->setAttribute(Qt::WA_Mapped, true); + if (!wv) widget->setAttribute(Qt::WA_WState_Visible, true); + widget->update(); + QEvent e(QEvent::UpdateRequest); + widget->event(&e); + if (!wm) widget->setAttribute(Qt::WA_Mapped, false); + if (!wv) widget->setAttribute(Qt::WA_WState_Visible, false); +} + +static const WCHAR *_programName = AppName; // folder in APPDATA, if current path is unavailable for writing +static const WCHAR *_exeName = L"Telegram.exe"; + +void psWriteDump() { +} + +//class StringReferenceWrapper { +//public: +// +// StringReferenceWrapper(_In_reads_(length) PCWSTR stringRef, _In_ UINT32 length) throw() { +// HRESULT hr = windowsCreateStringReference(stringRef, length, &_header, &_hstring); +// if (!SUCCEEDED(hr)) { +// RaiseException(static_cast(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr); +// } +// } +// +// ~StringReferenceWrapper() { +// windowsDeleteString(_hstring); +// } +// +// template +// StringReferenceWrapper(_In_reads_(N) wchar_t const (&stringRef)[N]) throw() { +// UINT32 length = N - 1; +// HRESULT hr = windowsCreateStringReference(stringRef, length, &_header, &_hstring); +// if (!SUCCEEDED(hr)) { +// RaiseException(static_cast(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr); +// } +// } +// +// template +// StringReferenceWrapper(_In_reads_(_) wchar_t(&stringRef)[_]) throw() { +// UINT32 length; +// HRESULT hr = SizeTToUInt32(wcslen(stringRef), &length); +// if (!SUCCEEDED(hr)) { +// RaiseException(static_cast(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr); +// } +// +// windowsCreateStringReference(stringRef, length, &_header, &_hstring); +// } +// +// HSTRING Get() const throw() { +// return _hstring; +// } +// +//private: +// HSTRING _hstring; +// HSTRING_HEADER _header; +// +//}; + +//HRESULT SetNodeValueString(_In_ HSTRING inputString, _In_ IXmlNode *node, _In_ IXmlDocument *xml) { +// ComPtr inputText; +// +// HRESULT hr = xml->CreateTextNode(inputString, &inputText); +// if (!SUCCEEDED(hr)) return hr; +// ComPtr inputTextNode; +// +// hr = inputText.As(&inputTextNode); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr pAppendedChild; +// return node->AppendChild(inputTextNode.Get(), &pAppendedChild); +//} + +//HRESULT SetAudioSilent(_In_ IXmlDocument *toastXml) { +// ComPtr nodeList; +// HRESULT hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"audio").Get(), &nodeList); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr audioNode; +// hr = nodeList->Item(0, &audioNode); +// if (!SUCCEEDED(hr)) return hr; +// +// if (audioNode) { +// ComPtr audioElement; +// hr = audioNode.As(&audioElement); +// if (!SUCCEEDED(hr)) return hr; +// +// hr = audioElement->SetAttribute(StringReferenceWrapper(L"silent").Get(), StringReferenceWrapper(L"true").Get()); +// if (!SUCCEEDED(hr)) return hr; +// } else { +// ComPtr audioElement; +// hr = toastXml->CreateElement(StringReferenceWrapper(L"audio").Get(), &audioElement); +// if (!SUCCEEDED(hr)) return hr; +// +// hr = audioElement->SetAttribute(StringReferenceWrapper(L"silent").Get(), StringReferenceWrapper(L"true").Get()); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr audioNode; +// hr = audioElement.As(&audioNode); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr nodeList; +// hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"toast").Get(), &nodeList); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr toastNode; +// hr = nodeList->Item(0, &toastNode); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr appendedNode; +// hr = toastNode->AppendChild(audioNode.Get(), &appendedNode); +// } +// return hr; +//} + +//HRESULT SetImageSrc(_In_z_ const wchar_t *imagePath, _In_ IXmlDocument *toastXml) { +// wchar_t imageSrc[MAX_PATH] = L"file:///"; +// HRESULT hr = StringCchCat(imageSrc, ARRAYSIZE(imageSrc), imagePath); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr nodeList; +// hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"image").Get(), &nodeList); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr imageNode; +// hr = nodeList->Item(0, &imageNode); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr attributes; +// hr = imageNode->get_Attributes(&attributes); +// if (!SUCCEEDED(hr)) return hr; +// +// ComPtr srcAttribute; +// hr = attributes->GetNamedItem(StringReferenceWrapper(L"src").Get(), &srcAttribute); +// if (!SUCCEEDED(hr)) return hr; +// +// return SetNodeValueString(StringReferenceWrapper(imageSrc).Get(), srcAttribute.Get(), toastXml); +//} + +//typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastActivatedEventHandler; +//typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastDismissedEventHandler; +//typedef ABI::Windows::Foundation::ITypedEventHandler DesktopToastFailedEventHandler; + +//class ToastEventHandler : public Implements { +//public: +// +// ToastEventHandler::ToastEventHandler(const PeerId &peer, MsgId msg) : _ref(1), _peerId(peer), _msgId(msg) { +// } +// ~ToastEventHandler() { +// } +// +// // DesktopToastActivatedEventHandler +// IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IInspectable* args) { +// ToastNotifications::iterator i = toastNotifications.find(_peerId); +// if (i != toastNotifications.cend()) { +// i.value().remove(_msgId); +// if (i.value().isEmpty()) { +// toastNotifications.erase(i); +// } +// } +// if (App::wnd()) { +// History *history = App::history(_peerId); +// +// App::wnd()->showFromTray(); +// if (App::passcoded()) { +// App::wnd()->setInnerFocus(); +// App::wnd()->notifyClear(); +// } else { +// App::wnd()->hideSettings(); +// bool tomsg = !history->peer->isUser() && (_msgId > 0); +// if (tomsg) { +// HistoryItem *item = App::histItemById(peerToChannel(_peerId), _msgId); +// if (!item || !item->mentionsMe()) { +// tomsg = false; +// } +// } +// Ui::showPeerHistory(history, tomsg ? _msgId : ShowAtUnreadMsgId); +// App::wnd()->notifyClear(history); +// } +// //SetForegroundWindow(App::wnd()->psHwnd()); +// } +// return S_OK; +// } +// +// // DesktopToastDismissedEventHandler +// IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IToastDismissedEventArgs *e) { +// ToastDismissalReason tdr; +// if (SUCCEEDED(e->get_Reason(&tdr))) { +// switch (tdr) { +// case ToastDismissalReason_ApplicationHidden: +// break; +// case ToastDismissalReason_UserCanceled: +// case ToastDismissalReason_TimedOut: +// default: +// ToastNotifications::iterator i = toastNotifications.find(_peerId); +// if (i != toastNotifications.cend()) { +// i.value().remove(_msgId); +// if (i.value().isEmpty()) { +// toastNotifications.erase(i); +// } +// } +// break; +// } +// } +// return S_OK; +// } +// +// // DesktopToastFailedEventHandler +// IFACEMETHODIMP Invoke(_In_ IToastNotification *sender, _In_ IToastFailedEventArgs *e) { +// ToastNotifications::iterator i = toastNotifications.find(_peerId); +// if (i != toastNotifications.cend()) { +// i.value().remove(_msgId); +// if (i.value().isEmpty()) { +// toastNotifications.erase(i); +// } +// } +// return S_OK; +// } +// +// // IUnknown +// IFACEMETHODIMP_(ULONG) AddRef() { +// return InterlockedIncrement(&_ref); +// } +// +// IFACEMETHODIMP_(ULONG) Release() { +// ULONG l = InterlockedDecrement(&_ref); +// if (l == 0) delete this; +// return l; +// } +// +// IFACEMETHODIMP QueryInterface(_In_ REFIID riid, _COM_Outptr_ void **ppv) { +// if (IsEqualIID(riid, IID_IUnknown)) +// *ppv = static_cast(static_cast(this)); +// else if (IsEqualIID(riid, __uuidof(DesktopToastActivatedEventHandler))) +// *ppv = static_cast(this); +// else if (IsEqualIID(riid, __uuidof(DesktopToastDismissedEventHandler))) +// *ppv = static_cast(this); +// else if (IsEqualIID(riid, __uuidof(DesktopToastFailedEventHandler))) +// *ppv = static_cast(this); +// else *ppv = nullptr; +// +// if (*ppv) { +// reinterpret_cast(*ppv)->AddRef(); +// return S_OK; +// } +// +// return E_NOINTERFACE; +// } +// +//private: +// +// ULONG _ref; +// PeerId _peerId; +// MsgId _msgId; +//}; +// +//template +//_Check_return_ __inline HRESULT _1_GetActivationFactory(_In_ HSTRING activatableClassId, _COM_Outptr_ T** factory) { +// return roGetActivationFactory(activatableClassId, IID_INS_ARGS(factory)); +//} +// +//template +//inline HRESULT wrap_GetActivationFactory(_In_ HSTRING activatableClassId, _Inout_ Details::ComPtrRef factory) throw() { +// return _1_GetActivationFactory(activatableClassId, factory.ReleaseAndGetAddressOf()); +//} + +//QString toastImage(const StorageKey &key, PeerData *peer) { +// uint64 ms = getms(true); +// ToastImages::iterator i = toastImages.find(key); +// if (i != toastImages.cend()) { +// if (i->until) { +// i->until = ms + NotifyDeletePhotoAfter; +// if (App::wnd()) App::wnd()->psCleanNotifyPhotosIn(-NotifyDeletePhotoAfter); +// } +// } else { +// ToastImage v; +// if (key.first) { +// v.until = ms + NotifyDeletePhotoAfter; +// if (App::wnd()) App::wnd()->psCleanNotifyPhotosIn(-NotifyDeletePhotoAfter); +// } else { +// v.until = 0; +// } +// v.path = cWorkingDir() + qsl("tdata/temp/") + QString::number(rand_value(), 16) + qsl(".png"); +// if (key.first || key.second) { +// peer->saveUserpic(v.path); +// } else { +// App::wnd()->iconLarge().save(v.path, "PNG"); +// } +// i = toastImages.insert(key, v); +// ToastImageSavedFlag = true; +// } +// return i->path; +//} + +//bool CreateToast(PeerData *peer, int32 msgId, bool showpix, const QString &title, const QString &subtitle, const QString &msg) { +// if (!useToast || !toastNotificationManager || !toastNotifier || !toastNotificationFactory) return false; +// +// ComPtr toastXml; +// bool withSubtitle = !subtitle.isEmpty(); +// +// HRESULT hr = toastNotificationManager->GetTemplateContent(withSubtitle ? ToastTemplateType_ToastImageAndText04 : ToastTemplateType_ToastImageAndText02, &toastXml); +// if (!SUCCEEDED(hr)) return false; +// +// //hr = SetAudioSilent(toastXml.Get()); +// //if (!SUCCEEDED(hr)) return false; +// +// StorageKey key; +// QString imagePath; +// if (showpix) { +// key = peer->userpicUniqueKey(); +// } else { +// key = StorageKey(0, 0); +// } +// QString image = toastImage(key, peer); +// std::wstring wimage = QDir::toNativeSeparators(image).toStdWString(); +// +// //hr = SetImageSrc(wimage.c_str(), toastXml.Get()); +// //if (!SUCCEEDED(hr)) return false; +// +// ComPtr nodeList; +// //hr = toastXml->GetElementsByTagName(StringReferenceWrapper(L"text").Get(), &nodeList); +// //if (!SUCCEEDED(hr)) return false; +// +// UINT32 nodeListLength; +// hr = nodeList->get_Length(&nodeListLength); +// if (!SUCCEEDED(hr)) return false; +// +// if (nodeListLength < (withSubtitle ? 3U : 2U)) return false; +// +// { +// ComPtr textNode; +// hr = nodeList->Item(0, &textNode); +// if (!SUCCEEDED(hr)) return false; +// +// std::wstring wtitle = title.toStdWString(); +// //hr = SetNodeValueString(StringReferenceWrapper(wtitle.data(), wtitle.size()).Get(), textNode.Get(), toastXml.Get()); +// //if (!SUCCEEDED(hr)) return false; +// } +// if (withSubtitle) { +// ComPtr textNode; +// hr = nodeList->Item(1, &textNode); +// if (!SUCCEEDED(hr)) return false; +// +// std::wstring wsubtitle = subtitle.toStdWString(); +// //hr = SetNodeValueString(StringReferenceWrapper(wsubtitle.data(), wsubtitle.size()).Get(), textNode.Get(), toastXml.Get()); +// //if (!SUCCEEDED(hr)) return false; +// } +// { +// ComPtr textNode; +// hr = nodeList->Item(withSubtitle ? 2 : 1, &textNode); +// if (!SUCCEEDED(hr)) return false; +// +// std::wstring wmsg = msg.toStdWString(); +// //hr = SetNodeValueString(StringReferenceWrapper(wmsg.data(), wmsg.size()).Get(), textNode.Get(), toastXml.Get()); +// //if (!SUCCEEDED(hr)) return false; +// } +// +// ComPtr toast; +// hr = toastNotificationFactory->CreateToastNotification(toastXml.Get(), &toast); +// if (!SUCCEEDED(hr)) return false; +// +// //EventRegistrationToken activatedToken, dismissedToken, failedToken; +// //ComPtr eventHandler(new ToastEventHandler(peer->id, msgId)); +// +// //hr = toast->add_Activated(eventHandler.Get(), &activatedToken); +// //if (!SUCCEEDED(hr)) return false; +// +// //hr = toast->add_Dismissed(eventHandler.Get(), &dismissedToken); +// //if (!SUCCEEDED(hr)) return false; +// +// //hr = toast->add_Failed(eventHandler.Get(), &failedToken); +// //if (!SUCCEEDED(hr)) return false; +// +// ToastNotifications::iterator i = toastNotifications.find(peer->id); +// if (i != toastNotifications.cend()) { +// QMap::iterator j = i->find(msgId); +// if (j != i->cend()) { +// ComPtr notify = j->p; +// i->erase(j); +// toastNotifier->Hide(notify.Get()); +// i = toastNotifications.find(peer->id); +// } +// } +// if (i == toastNotifications.cend()) { +// i = toastNotifications.insert(peer->id, QMap()); +// } +// hr = toastNotifier->Show(toast.Get()); +// if (!SUCCEEDED(hr)) { +// i = toastNotifications.find(peer->id); +// if (i != toastNotifications.cend() && i->isEmpty()) toastNotifications.erase(i); +// return false; +// } +// toastNotifications[peer->id].insert(msgId, toast); +// +// return true; +//} + +QString pinnedPath() { + //static const int maxFileLen = MAX_PATH * 10; + //WCHAR wstrPath[maxFileLen]; + //if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { + // QDir appData(QString::fromStdWString(std::wstring(wstrPath))); + // return appData.absolutePath() + qsl("/Microsoft/Internet Explo7rer/Quick Launch/User Pinned/TaskBar/"); + //} + return QString(); +} + +void CheckPinnedAppUserModelId() { + //if (!propVariantToString) return; + + //static const int maxFileLen = MAX_PATH * 10; + + //HRESULT hr = CoInitialize(0); + //if (!SUCCEEDED(hr)) return; + + //QString path = pinnedPath(); + //std::wstring p = QDir::toNativeSeparators(path).toStdWString(); + + //WCHAR src[MAX_PATH]; + //GetModuleFileName(GetModuleHandle(0), src, MAX_PATH); + //BY_HANDLE_FILE_INFORMATION srcinfo = { 0 }; + //HANDLE srcfile = CreateFile(src, 0x00, 0x00, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + //if (srcfile == INVALID_HANDLE_VALUE) return; + //BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo); + //CloseHandle(srcfile); + //if (!srcres) return; + //LOG(("Checking...")); + //WIN32_FIND_DATA findData; + //HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0); + //if (findHandle == INVALID_HANDLE_VALUE) { + // LOG(("Init Error: could not find files in pinned folder")); + // return; + //} + //do { + // std::wstring fname = p + findData.cFileName; + // LOG(("Checking %1").arg(QString::fromStdWString(fname))); + // if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + // continue; + // } else { + // DWORD attributes = GetFileAttributes(fname.c_str()); + // if (attributes >= 0xFFFFFFF) continue; // file does not exist + + // ComPtr shellLink; + // HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); + // if (!SUCCEEDED(hr)) continue; + + // ComPtr persistFile; + // hr = shellLink.As(&persistFile); + // if (!SUCCEEDED(hr)) continue; + + // hr = persistFile->Load(fname.c_str(), STGM_READWRITE); + // if (!SUCCEEDED(hr)) continue; + + // WCHAR dst[MAX_PATH]; + // hr = shellLink->GetPath(dst, MAX_PATH, 0, 0); + // if (!SUCCEEDED(hr)) continue; + + // BY_HANDLE_FILE_INFORMATION dstinfo = { 0 }; + // HANDLE dstfile = CreateFile(dst, 0x00, 0x00, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + // if (dstfile == INVALID_HANDLE_VALUE) continue; + // BOOL dstres = GetFileInformationByHandle(dstfile, &dstinfo); + // CloseHandle(dstfile); + // if (!dstres) continue; + + // if (srcinfo.dwVolumeSerialNumber == dstinfo.dwVolumeSerialNumber && srcinfo.nFileIndexLow == dstinfo.nFileIndexLow && srcinfo.nFileIndexHigh == dstinfo.nFileIndexHigh) { + // ComPtr propertyStore; + // hr = shellLink.As(&propertyStore); + // if (!SUCCEEDED(hr)) return; + + // PROPVARIANT appIdPropVar; + // hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar); + // if (!SUCCEEDED(hr)) return; + // LOG(("Reading...")); + // WCHAR already[MAX_PATH]; + // hr = propVariantToString(appIdPropVar, already, MAX_PATH); + // if (SUCCEEDED(hr)) { + // if (std::wstring(AppUserModelId()) == already) { + // LOG(("Already!")); + // PropVariantClear(&appIdPropVar); + // return; + // } + // } + // if (appIdPropVar.vt != VT_EMPTY) { + // PropVariantClear(&appIdPropVar); + // return; + // } + // PropVariantClear(&appIdPropVar); + + // hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar); + // if (!SUCCEEDED(hr)) return; + + // hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); + // PropVariantClear(&appIdPropVar); + // if (!SUCCEEDED(hr)) return; + + // hr = propertyStore->Commit(); + // if (!SUCCEEDED(hr)) return; + + // if (persistFile->IsDirty() == S_OK) { + // persistFile->Save(fname.c_str(), TRUE); + // } + // return; + // } + // } + //} while (FindNextFile(findHandle, &findData)); + //DWORD errorCode = GetLastError(); + //if (errorCode && errorCode != ERROR_NO_MORE_FILES) { // everything is found + // LOG(("Init Error: could not find some files in pinned folder")); + // return; + //} + //FindClose(findHandle); +} + +QString systemShortcutPath() { + //static const int maxFileLen = MAX_PATH * 10; + //WCHAR wstrPath[maxFileLen]; + //if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { + // QDir appData(QString::fromStdWString(std::wstring(wstrPath))); + // return appData.absolutePath() + qsl("/Microsoft/Windows/Start Menu/Programs/"); + //} + return QString(); +} + +void CleanupAppUserModelIdShortcut() { + static const int maxFileLen = MAX_PATH * 10; + + QString path = systemShortcutPath() + qsl("Telegram.lnk"); + std::wstring p = QDir::toNativeSeparators(path).toStdWString(); + + //DWORD attributes = GetFileAttributes(p.c_str()); + //if (attributes >= 0xFFFFFFF) return; // file does not exist + + //ComPtr shellLink; + //HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); + //if (!SUCCEEDED(hr)) return; + + //ComPtr persistFile; + //hr = shellLink.As(&persistFile); + //if (!SUCCEEDED(hr)) return; + + //hr = persistFile->Load(p.c_str(), STGM_READWRITE); + //if (!SUCCEEDED(hr)) return; + + //WCHAR szGotPath[MAX_PATH]; + //WIN32_FIND_DATA wfd; + //hr = shellLink->GetPath(szGotPath, MAX_PATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH); + //if (!SUCCEEDED(hr)) return; + + //if (QDir::toNativeSeparators(cExeDir() + cExeName()).toStdWString() == szGotPath) { + // QFile().remove(path); + //} +} + +bool ValidateAppUserModelIdShortcutAt(const QString &path) { + static const int maxFileLen = MAX_PATH * 10; + + std::wstring p = QDir::toNativeSeparators(path).toStdWString(); + + //DWORD attributes = GetFileAttributes(p.c_str()); + //if (attributes >= 0xFFFFFFF) return false; // file does not exist + + //ComPtr shellLink; + //HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); + //if (!SUCCEEDED(hr)) return false; + + //ComPtr persistFile; + //hr = shellLink.As(&persistFile); + //if (!SUCCEEDED(hr)) return false; + + //hr = persistFile->Load(p.c_str(), STGM_READWRITE); + //if (!SUCCEEDED(hr)) return false; + + //ComPtr propertyStore; + //hr = shellLink.As(&propertyStore); + //if (!SUCCEEDED(hr)) return false; + + //PROPVARIANT appIdPropVar; + //hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar); + //if (!SUCCEEDED(hr)) return false; + + //WCHAR already[MAX_PATH]; + //hr = propVariantToString(appIdPropVar, already, MAX_PATH); + //if (SUCCEEDED(hr)) { + // if (std::wstring(AppUserModelId()) == already) { + // PropVariantClear(&appIdPropVar); + // return true; + // } + //} + //if (appIdPropVar.vt != VT_EMPTY) { + // PropVariantClear(&appIdPropVar); + // return false; + //} + //PropVariantClear(&appIdPropVar); + + //hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar); + //if (!SUCCEEDED(hr)) return false; + + //hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); + //PropVariantClear(&appIdPropVar); + //if (!SUCCEEDED(hr)) return false; + + //hr = propertyStore->Commit(); + //if (!SUCCEEDED(hr)) return false; + + //if (persistFile->IsDirty() == S_OK) { + // persistFile->Save(p.c_str(), TRUE); + //} + + return true; +} + +bool ValidateAppUserModelIdShortcut() { + if (!useToast) return false; + + QString path = systemShortcutPath(); + if (path.isEmpty()) return false; + + if (cBetaVersion()) { + path += qsl("TelegramBeta.lnk"); + if (ValidateAppUserModelIdShortcutAt(path)) return true; + } else { + if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Desktop/Telegram.lnk"))) return true; + if (ValidateAppUserModelIdShortcutAt(path + qsl("Telegram Win (Unofficial)/Telegram.lnk"))) return true; + + path += qsl("Telegram.lnk"); + if (ValidateAppUserModelIdShortcutAt(path)) return true; + } + + //ComPtr shellLink; + //HRESULT hr = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&shellLink)); + //if (!SUCCEEDED(hr)) return false; + + //hr = shellLink->SetPath(QDir::toNativeSeparators(cExeDir() + cExeName()).toStdWString().c_str()); + //if (!SUCCEEDED(hr)) return false; + + //hr = shellLink->SetArguments(L""); + //if (!SUCCEEDED(hr)) return false; + + //hr = shellLink->SetWorkingDirectory(QDir::toNativeSeparators(QDir(cWorkingDir()).absolutePath()).toStdWString().c_str()); + //if (!SUCCEEDED(hr)) return false; + + //ComPtr propertyStore; + //hr = shellLink.As(&propertyStore); + //if (!SUCCEEDED(hr)) return false; + + //PROPVARIANT appIdPropVar; + //hr = InitPropVariantFromString(AppUserModelId(), &appIdPropVar); + //if (!SUCCEEDED(hr)) return false; + + //hr = propertyStore->SetValue(pkey_AppUserModel_ID, appIdPropVar); + //PropVariantClear(&appIdPropVar); + //if (!SUCCEEDED(hr)) return false; + + //PROPVARIANT startPinPropVar; + //hr = InitPropVariantFromUInt32(APPUSERMODEL_STARTPINOPTION_NOPINONINSTALL, &startPinPropVar); + //if (!SUCCEEDED(hr)) return false; + + //hr = propertyStore->SetValue(pkey_AppUserModel_StartPinOption, startPinPropVar); + //PropVariantClear(&startPinPropVar); + //if (!SUCCEEDED(hr)) return false; + + //hr = propertyStore->Commit(); + //if (!SUCCEEDED(hr)) return false; + + //ComPtr persistFile; + //hr = shellLink.As(&persistFile); + //if (!SUCCEEDED(hr)) return false; + + //hr = persistFile->Save(QDir::toNativeSeparators(path).toStdWString().c_str(), TRUE); + //if (!SUCCEEDED(hr)) return false; + + return true; +} + +bool InitToastManager() { + if (!useToast || !ValidateAppUserModelIdShortcut()) return false; + //if (!SUCCEEDED(setCurrentProcessExplicitAppUserModelID(AppUserModelId()))) { + // return false; + //} + //if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), &toastNotificationManager))) { + // return false; + //} + //if (!SUCCEEDED(toastNotificationManager->CreateToastNotifierWithId(StringReferenceWrapper(AppUserModelId(), wcslen(AppUserModelId())).Get(), &toastNotifier))) { + // return false; + //} + //if (!SUCCEEDED(wrap_GetActivationFactory(StringReferenceWrapper(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(), &toastNotificationFactory))) { + // return false; + //} + QDir().mkpath(cWorkingDir() + qsl("tdata/temp")); + return true; +} + +bool psLaunchMaps(const LocationCoords &coords) { + return QDesktopServices::openUrl(qsl("bingmaps:?lvl=16&collection=point.%1_%2_Point").arg(coords.lat).arg(coords.lon)); +} + +bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *ev) { + return QCoreApplication::sendSpontaneousEvent(receiver, ev); +} diff --git a/Telegram/SourceFiles/pspecific_winrt.h b/Telegram/SourceFiles/pspecific_winrt.h new file mode 100644 index 000000000..75238b789 --- /dev/null +++ b/Telegram/SourceFiles/pspecific_winrt.h @@ -0,0 +1,197 @@ + +/* +This file is part of Telegram Desktop, +the official desktop version of Telegram messaging app, see https://telegram.org + +Telegram Desktop is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +It is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +In addition, as a special exception, the copyright holders give permission +to link the code of portions of this program with the OpenSSL library. + +Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE +Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org +*/ +#pragma once + +inline QString psServerPrefix() { + return qsl("Global\\"); +} +inline void psCheckLocalSocket(const QString &) { +} + +class NotifyWindow; + +class PsMainWindow : public QMainWindow { + Q_OBJECT + +public: + PsMainWindow(QWidget *parent = 0); + + int32 psResizeRowWidth() const { + return 0;//st::wndResizeAreaWidth; + } + + void psInitFrameless(); + void psInitSize(); + HWND psHwnd() const; + HMENU psMenu() const; + + void psFirstShow(); + void psInitSysMenu(); + void psUpdateSysMenu(Qt::WindowState state); + void psUpdateMargins(); + void psUpdatedPosition(); + + bool psHandleTitle(); + + void psFlash(); + void psNotifySettingGot(); + + void psUpdateWorkmode(); + + void psRefreshTaskbarIcon(); + + bool psPosInited() const { + return posInited; + } + + void psActivateNotify(NotifyWindow *w); + void psClearNotifies(PeerId peerId = 0); + void psNotifyShown(NotifyWindow *w); + void psPlatformNotify(HistoryItem *item, int32 fwdCount); + + void psUpdateCounter(); + + bool psHasNativeNotifications(); + void psCleanNotifyPhotosIn(int32 dt); + + virtual QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon) = 0; + + ~PsMainWindow(); + +public slots: + + void psUpdateDelegate(); + void psSavePosition(Qt::WindowState state = Qt::WindowActive); + void psShowTrayMenu(); + + void psCleanNotifyPhotos(); + +protected: + + bool psHasTrayIcon() const { + return trayIcon; + } + + bool posInited; + QSystemTrayIcon *trayIcon; + PopupMenu *trayIconMenu; + QImage icon256, iconbig256; + QIcon wndIcon; + + void psTrayMenuUpdated(); + void psSetupTrayIcon(); + + QTimer psUpdatedPositionTimer; + +private: + HWND ps_hWnd; +// HWND ps_tbHider_hWnd; + HMENU ps_menu; + HICON ps_iconBig, ps_iconSmall, ps_iconOverlay; + + SingleTimer ps_cleanNotifyPhotosTimer; + + void psDestroyIcons(); +}; + +void psWriteDump(); +void psWriteStackTrace(); + +void psDeleteDir(const QString &dir); + +void psUserActionDone(); +bool psIdleSupported(); +uint64 psIdleTime(); + +bool psSkipAudioNotify(); +bool psSkipDesktopNotify(); + +QStringList psInitLogs(); +void psClearInitLogs(); + +void psActivateProcess(uint64 pid = 0); +QString psLocalServerPrefix(); +QString psCurrentCountry(); +QString psCurrentLanguage(); +QString psAppDataPath(); +QString psAppDataPathOld(); +QString psDownloadPath(); +QString psCurrentExeDirectory(int argc, char *argv[]); +QString psCurrentExeName(int argc, char *argv[]); +void psAutoStart(bool start, bool silent = false); +void psSendToMenu(bool send, bool silent = false); + +QRect psDesktopRect(); +void psShowOverAll(QWidget *w, bool canFocus = true); +void psBringToBack(QWidget *w); + +int psCleanup(); +int psFixPrevious(); + +void psExecUpdater(); +void psExecTelegram(const QString &arg = QString()); + +bool psShowOpenWithMenu(int x, int y, const QString &file); + +void psPostprocessFile(const QString &name); +void psOpenFile(const QString &name, bool openWith = false); +void psShowInFolder(const QString &name); + +QAbstractNativeEventFilter *psNativeEventFilter(); + +void psNewVersion(); + +void psUpdateOverlayed(TWidget *widget); +inline QString psConvertFileUrl(const QString &url) { + return url; +} +inline QByteArray psDownloadPathBookmark(const QString &path) { + return QByteArray(); +} +inline QByteArray psPathBookmark(const QString &path) { + return QByteArray(); +} +inline void psDownloadPathEnableAccess() { +} + +class PsFileBookmark { +public: + PsFileBookmark(const QByteArray &bookmark) { + } + bool check() const { + return true; + } + bool enable() const { + return true; + } + void disable() const { + } + const QString &name(const QString &original) const { + return original; + } + QByteArray bookmark() const { + return QByteArray(); + } + +}; + +bool psLaunchMaps(const LocationCoords &coords); diff --git a/Telegram/SourceFiles/settings.cpp b/Telegram/SourceFiles/settings.cpp index c98fe4a55..8e7b0321b 100644 --- a/Telegram/SourceFiles/settings.cpp +++ b/Telegram/SourceFiles/settings.cpp @@ -28,8 +28,6 @@ Qt::LayoutDirection gLangDir = gRtl ? Qt::RightToLeft : Qt::LeftToRight; QString gArguments; -mtpDcOptions gDcOptions; - bool gDevVersion = DevVersion; uint64 gBetaVersion = BETA_VERSION; uint64 gRealBetaVersion = BETA_VERSION; @@ -110,9 +108,6 @@ EmojiColorVariants gEmojiVariants; RecentStickerPreload gRecentStickersPreload; RecentStickerPack gRecentStickers; -StickerSets gStickerSets; -StickerSetsOrder gStickerSetsOrder; -uint64 gLastStickersUpdate = 0; SavedGifs gSavedGifs; uint64 gLastSavedGifsUpdate = 0; diff --git a/Telegram/SourceFiles/settings.h b/Telegram/SourceFiles/settings.h index 93524bba8..18b069258 100644 --- a/Telegram/SourceFiles/settings.h +++ b/Telegram/SourceFiles/settings.h @@ -55,18 +55,6 @@ inline bool rtl() { DeclareReadSetting(QString, Arguments); -struct mtpDcOption { - mtpDcOption(int id, int flags, const string &ip, int port) : id(id), flags(flags), ip(ip), port(port) { - } - - int id; - int flags; - string ip; - int port; -}; -typedef QMap mtpDcOptions; -DeclareSetting(mtpDcOptions, DcOptions); - DeclareSetting(bool, DevVersion); DeclareSetting(uint64, BetaVersion); DeclareSetting(uint64, RealBetaVersion); @@ -215,24 +203,6 @@ RecentStickerPack &cGetRecentStickers(); typedef QMap StickersByEmojiMap; -static const uint64 DefaultStickerSetId = 0; // for backward compatibility -static const uint64 CustomStickerSetId = 0xFFFFFFFFFFFFFFFFULL, RecentStickerSetId = 0xFFFFFFFFFFFFFFFEULL; -static const uint64 NoneStickerSetId = 0xFFFFFFFFFFFFFFFDULL; // for emoji/stickers panel -struct StickerSet { - StickerSet(uint64 id, uint64 access, const QString &title, const QString &shortName, int32 count, int32 hash, int32 flags) : id(id), access(access), title(title), shortName(shortName), count(count), hash(hash), flags(flags) { - } - uint64 id, access; - QString title, shortName; - int32 count, hash, flags; - StickerPack stickers; - StickersByEmojiMap emoji; -}; -typedef QMap StickerSets; -DeclareRefSetting(StickerSets, StickerSets); -typedef QList StickerSetsOrder; -DeclareRefSetting(StickerSetsOrder, StickerSetsOrder); -DeclareSetting(uint64, LastStickersUpdate); - typedef QVector SavedGifs; DeclareRefSetting(SavedGifs, SavedGifs); DeclareSetting(uint64, LastSavedGifsUpdate); diff --git a/Telegram/SourceFiles/settingswidget.cpp b/Telegram/SourceFiles/settingswidget.cpp index a6c0b8d88..6eb623270 100644 --- a/Telegram/SourceFiles/settingswidget.cpp +++ b/Telegram/SourceFiles/settingswidget.cpp @@ -208,7 +208,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent) , _logOut(this, lang(lng_settings_logout), st::btnLogout) , _supportGetRequest(0) { if (self()) { - self()->photo->load(); + self()->loadUserpic(); connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update())); connect(App::api(), SIGNAL(fullPeerUpdated(PeerData*)), this, SLOT(onFullPeerUpdated(PeerData*))); @@ -319,7 +319,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent) connect(&_autoLock, SIGNAL(clicked()), this, SLOT(onAutoLock())); connect(&_passwordEdit, SIGNAL(clicked()), this, SLOT(onPassword())); connect(&_passwordTurnOff, SIGNAL(clicked()), this, SLOT(onPasswordOff())); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY connect(&_connectionType, SIGNAL(clicked()), this, SLOT(onConnectionType())); +#endif connect(&_showSessions, SIGNAL(clicked()), this, SLOT(onShowSessions())); connect(&_askQuestion, SIGNAL(clicked()), this, SLOT(onAskQuestion())); connect(&_telegramFAQ, SIGNAL(clicked()), this, SLOT(onTelegramFAQ())); @@ -382,7 +384,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) { updateChatBackground(); } - QPainter p(this); + Painter p(this); p.setClipRect(e->rect()); @@ -399,7 +401,7 @@ void SettingsInner::paintEvent(QPaintEvent *e) { } if (_photoLink) { - p.drawPixmap(_left, top, self()->photo->pix(st::setPhotoSize)); + self()->paintUserpicLeft(p, st::setPhotoSize, _left, top, st::setWidth); } else { if (a_photoOver.current() < 1) { p.drawPixmap(QPoint(_left, top), App::sprite(), st::setPhotoImg); @@ -811,11 +813,23 @@ void SettingsInner::keyPressEvent(QKeyEvent *e) { Ui::showLayer(box); from = size; break; - } else if (str == qstr("loadlang")) { - chooseCustomLang(); + } else if (str == qstr("loadlang")) { + chooseCustomLang(); + } else if (str == qstr("debugfiles") && cDebug()) { + if (DebugLogging::FileLoader()) { + Global::RefDebugLoggingFlags() &= ~DebugLogging::FileLoaderFlag; + } else { + Global::RefDebugLoggingFlags() |= DebugLogging::FileLoaderFlag; + } + Ui::showLayer(new InformBox(DebugLogging::FileLoader() ? "Enabled file download logging" : "Disabled file download logging")); } else if (str == qstr("crashplease")) { t_assert(!"Crashed in Settings!"); - } else if (qsl("debugmode").startsWith(str) || qsl("testmode").startsWith(str) || qsl("loadlang").startsWith(str) || qsl("crashplease").startsWith(str)) { + } else if ( + qsl("debugmode").startsWith(str) || + qsl("testmode").startsWith(str) || + qsl("loadlang").startsWith(str) || + qsl("debugfiles").startsWith(str) || + qsl("crashplease").startsWith(str)) { break; } ++from; @@ -1343,8 +1357,8 @@ void SettingsInner::onPasswordOff() { _passwordTurnOff.hide(); // int32 flags = MTPDaccount_passwordInputSettings::flag_new_salt | MTPDaccount_passwordInputSettings::flag_new_password_hash | MTPDaccount_passwordInputSettings::flag_hint | MTPDaccount_passwordInputSettings::flag_email; - int32 flags = MTPDaccount_passwordInputSettings::flag_email; - MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_int(flags), MTP_string(QByteArray()), MTP_string(QByteArray()), MTP_string(QString()), MTP_string(QString()))); + MTPDaccount_passwordInputSettings::Flags flags = MTPDaccount_passwordInputSettings::Flag::f_email; + MTPaccount_PasswordInputSettings settings(MTP_account_passwordInputSettings(MTP_flags(flags), MTP_string(QByteArray()), MTP_string(QByteArray()), MTP_string(QString()), MTP_string(QString()))); MTP::send(MTPaccount_UpdatePasswordSettings(MTP_string(QByteArray()), settings), rpcDone(&SettingsInner::offPasswordDone), rpcFail(&SettingsInner::offPasswordFail)); } else { PasscodeBox *box = new PasscodeBox(_newPasswordSalt, _curPasswordSalt, _hasPasswordRecovery, _curPasswordHint, true); @@ -1365,11 +1379,13 @@ void SettingsInner::onAutoLock() { Ui::showLayer(box); } +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY void SettingsInner::onConnectionType() { ConnectionBox *box = new ConnectionBox(); connect(box, SIGNAL(closed()), this, SLOT(updateConnectionType()), Qt::QueuedConnection); Ui::showLayer(box); } +#endif void SettingsInner::onUsername() { UsernameBox *box = new UsernameBox(); diff --git a/Telegram/SourceFiles/settingswidget.h b/Telegram/SourceFiles/settingswidget.h index d2ed56902..667921ba4 100644 --- a/Telegram/SourceFiles/settingswidget.h +++ b/Telegram/SourceFiles/settingswidget.h @@ -101,10 +101,10 @@ public slots: void onUpdatePhoto(); void onUpdatePhotoCancel(); - #ifndef TDESKTOP_DISABLE_AUTOUPDATE +#ifndef TDESKTOP_DISABLE_AUTOUPDATE void onAutoUpdate(); void onCheckNow(); - #endif +#endif void onRestartNow(); void onFullPeerUpdated(PeerData *peer); @@ -116,7 +116,9 @@ public slots: void onPasswordOff(); void onReloadPassword(Qt::ApplicationState state = Qt::ApplicationActive); +#ifndef TDESKTOP_DISABLE_NETWORK_PROXY void onConnectionType(); +#endif void onUsername(); @@ -162,13 +164,13 @@ public slots: void onLocalStorageClear(); - #ifndef TDESKTOP_DISABLE_AUTOUPDATE +#ifndef TDESKTOP_DISABLE_AUTOUPDATE void onUpdateChecking(); void onUpdateLatest(); void onUpdateDownloading(qint64 ready, qint64 total); void onUpdateReady(); void onUpdateFailed(); - #endif +#endif void onShowSessions(); diff --git a/Telegram/SourceFiles/stdafx.cpp b/Telegram/SourceFiles/stdafx.cpp index 53a464500..987153bf2 100644 --- a/Telegram/SourceFiles/stdafx.cpp +++ b/Telegram/SourceFiles/stdafx.cpp @@ -21,10 +21,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "stdafx.h" #include -#ifdef Q_OS_WIN +#ifdef Q_OS_WINRT +//Q_IMPORT_PLUGIN(QWinRTIntegrationPlugin) +//Q_IMPORT_PLUGIN(QWbmpPlugin) +#elif defined Q_OS_WIN // Q_OS_WINRT Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) Q_IMPORT_PLUGIN(QWebpPlugin) -#elif defined Q_OS_MAC +#elif defined Q_OS_MAC // Q_OS_WIN Q_IMPORT_PLUGIN(QGenericEnginePlugin) Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) Q_IMPORT_PLUGIN(QDDSPlugin) @@ -36,7 +39,7 @@ Q_IMPORT_PLUGIN(QTgaPlugin) Q_IMPORT_PLUGIN(QTiffPlugin) Q_IMPORT_PLUGIN(QWbmpPlugin) Q_IMPORT_PLUGIN(QWebpPlugin) -#elif defined Q_OS_LINUX +#elif defined Q_OS_LINUX // Q_OS_LINUX Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin) Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin) Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin) diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h index 22bc15115..12885f468 100644 --- a/Telegram/SourceFiles/stdafx.h +++ b/Telegram/SourceFiles/stdafx.h @@ -18,55 +18,21 @@ to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ -#define __HUGE -#define PSAPI_VERSION 1 // fix WinXP +#define NOMINMAX // no min() and max() macro declarations +#define __HUGE #define __STDC_FORMAT_MACROS // fix breakpad for mac #ifdef __cplusplus -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include -#ifdef Q_OS_WIN // use Lzma SDK for win -#include -#else -#include -#endif - -extern "C" { - -#endif - -#include "zip.h" - -#include -#include -#include -#include -#include - -#ifdef __cplusplus - -} - #include "types.h" #include "config.h" -#include "mtproto/mtp.h" +#include "mtproto/facade.h" #include "gui/style_core.h" #include "gui/twidget.h" @@ -83,4 +49,4 @@ extern "C" { #include "app.h" -#endif +#endif // __cplusplus diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index b1122e559..122380730 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -35,8 +35,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org #include "localstorage.h" namespace { - int32 peerColorIndex(const PeerId &peer) { - int32 myId(MTP::authedId()), peerId(peerToBareInt(peer)); + int peerColorIndex(const PeerId &peer) { + UserId myId(MTP::authedId()), peerId(peerToBareInt(peer)); QByteArray both(qsl("%1%2").arg(peerId).arg(myId).toUtf8()); if (both.size() > 15) { both = both.mid(0, 15); @@ -47,7 +47,7 @@ namespace { } } -style::color peerColor(int32 index) { +style::color peerColor(int index) { static const style::color peerColors[8] = { style::color(st::color1), style::color(st::color2), @@ -61,7 +61,7 @@ style::color peerColor(int32 index) { return peerColors[index]; } -ImagePtr userDefPhoto(int32 index) { +ImagePtr userDefPhoto(int index) { static const ImagePtr userDefPhotos[UserColorsCount] = { ImagePtr(qsl(":/ava/art/usercolor1.png"), "PNG"), ImagePtr(qsl(":/ava/art/usercolor2.png"), "PNG"), @@ -75,7 +75,7 @@ ImagePtr userDefPhoto(int32 index) { return userDefPhotos[index]; } -ImagePtr chatDefPhoto(int32 index) { +ImagePtr chatDefPhoto(int index) { static const ImagePtr chatDefPhotos[4] = { ImagePtr(qsl(":/ava/art/chatcolor1.png"), "PNG"), ImagePtr(qsl(":/ava/art/chatcolor2.png"), "PNG"), @@ -85,7 +85,7 @@ ImagePtr chatDefPhoto(int32 index) { return chatDefPhotos[index]; } -ImagePtr channelDefPhoto(int32 index) { +ImagePtr channelDefPhoto(int index) { static const ImagePtr channelDefPhotos[4] = { ImagePtr(qsl(":/ava/art/channelcolor1.png"), "PNG"), ImagePtr(qsl(":/ava/art/channelcolor2.png"), "PNG"), @@ -100,13 +100,13 @@ NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersP PeerData::PeerData(const PeerId &id) : id(id) , lnk(new PeerLink(this)) -, loaded(false) +, loadedStatus(NotLoaded) , colorIndex(peerColorIndex(id)) , color(peerColor(colorIndex)) -, photo((isChat() || isMegagroup()) ? chatDefPhoto(colorIndex) : (isChannel() ? channelDefPhoto(colorIndex) : userDefPhoto(colorIndex))) , photoId(UnknownPeerPhotoId) , nameVersion(0) -, notify(UnknownNotifySettings) { +, notify(UnknownNotifySettings) +, _userpic(isUser() ? userDefPhoto(colorIndex) : ((isChat() || isMegagroup()) ? chatDefPhoto(colorIndex) : channelDefPhoto(colorIndex))) { if (!peerIsUser(id) && !peerIsChannel(id)) updateName(QString(), QString(), QString()); } @@ -135,9 +135,9 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, if (asChannel()->username != newUsername) { asChannel()->username = newUsername; if (newUsername.isEmpty()) { - asChannel()->flags &= ~MTPDchannel::flag_username; + asChannel()->flags &= ~MTPDchannel::Flag::f_username; } else { - asChannel()->flags |= MTPDchannel::flag_username; + asChannel()->flags |= MTPDchannel::Flag::f_username; } if (App::main()) { App::main()->peerUsernameChanged(this); @@ -154,6 +154,43 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, } } +void PeerData::setUserpic(ImagePtr userpic) { + _userpic = userpic; +} + +ImagePtr PeerData::currentUserpic() const { + if (_userpic->loaded()) { + return _userpic; + } + _userpic->load(); + + if (isUser()) { + return userDefPhoto(colorIndex); + } else if (isMegagroup() || isChat()) { + return chatDefPhoto(colorIndex); + } + return channelDefPhoto(colorIndex); +} + +void PeerData::paintUserpic(Painter &p, int size, int x, int y) const { + p.drawPixmap(x, y, currentUserpic()->pixCircled(size, size)); +} + +StorageKey PeerData::userpicUniqueKey() const { + if (photoLoc.isNull() || !_userpic->loaded()) { + return StorageKey(0, (isUser() ? 0x1000 : ((isChat() || isMegagroup()) ? 0x2000 : 0x3000)) | colorIndex); + } + return storageKey(photoLoc); +} + +void PeerData::saveUserpic(const QString &path) const { + currentUserpic()->pixCircled().save(path, "PNG"); +} + +QPixmap PeerData::genUserpic(int size) const { + return currentUserpic()->pixCircled(size, size); +} + const Text &BotCommand::descriptionText() const { if (_descriptionText.isEmpty() && !_description.isEmpty()) { _descriptionText.setText(st::mentionFont, _description, _textNameOptions); @@ -163,7 +200,7 @@ const Text &BotCommand::descriptionText() const { void UserData::setPhoto(const MTPUserProfilePhoto &p) { // see Local::readPeer as well PhotoId newPhotoId = photoId; - ImagePtr newPhoto = photo; + ImagePtr newPhoto = _userpic; StorageImageLocation newPhotoLoc = photoLoc; switch (p.type()) { case mtpc_userProfilePhoto: { @@ -176,7 +213,7 @@ void UserData::setPhoto(const MTPUserProfilePhoto &p) { // see Local::readPeer a default: { newPhotoId = 0; if (id == ServiceUserId) { - if (photo->isNull()) { + if (_userpic->isNull()) { newPhoto = ImagePtr(QPixmap::fromImage(App::wnd()->iconLarge().scaledToWidth(160, Qt::SmoothTransformation), Qt::ColorOnly), "PNG"); } } else { @@ -185,9 +222,9 @@ void UserData::setPhoto(const MTPUserProfilePhoto &p) { // see Local::readPeer a newPhotoLoc = StorageImageLocation(); } break; } - if (newPhotoId != photoId || newPhoto.v() != photo.v() || newPhotoLoc != photoLoc) { + if (newPhotoId != photoId || newPhoto.v() != _userpic.v() || newPhotoLoc != photoLoc) { photoId = newPhotoId; - photo = newPhoto; + setUserpic(newPhoto); photoLoc = newPhotoLoc; if (App::main()) { emit App::main()->peerPhotoChanged(this); @@ -242,7 +279,7 @@ void UserData::setPhone(const QString &newPhone) { phone = newPhone; } -void UserData::setBotInfoVersion(int32 version) { +void UserData::setBotInfoVersion(int version) { if (version < 0) { if (botInfo) { if (!botInfo->commands.isEmpty()) { @@ -338,7 +375,7 @@ void UserData::madeAction() { void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Local::readPeer as well PhotoId newPhotoId = photoId; - ImagePtr newPhoto = photo; + ImagePtr newPhoto = _userpic; StorageImageLocation newPhotoLoc = photoLoc; switch (p.type()) { case mtpc_chatPhoto: { @@ -357,9 +394,9 @@ void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Loc // photoFull = ImagePtr(); } break; } - if (newPhotoId != photoId || newPhoto.v() != photo.v() || newPhotoLoc != photoLoc) { + if (newPhotoId != photoId || newPhoto.v() != _userpic.v() || newPhotoLoc != photoLoc) { photoId = newPhotoId; - photo = newPhoto; + setUserpic(newPhoto); photoLoc = newPhotoLoc; emit App::main()->peerPhotoChanged(this); } @@ -367,7 +404,7 @@ void ChatData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Loc void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see Local::readPeer as well PhotoId newPhotoId = photoId; - ImagePtr newPhoto = photo; + ImagePtr newPhoto = _userpic; StorageImageLocation newPhotoLoc = photoLoc; switch (p.type()) { case mtpc_chatPhoto: { @@ -386,9 +423,9 @@ void ChannelData::setPhoto(const MTPChatPhoto &p, const PhotoId &phId) { // see // photoFull = ImagePtr(); } break; } - if (newPhotoId != photoId || newPhoto.v() != photo.v() || newPhotoLoc != photoLoc) { + if (newPhotoId != photoId || newPhoto.v() != _userpic.v() || newPhotoLoc != photoLoc) { photoId = newPhotoId; - photo = newPhoto; + setUserpic(newPhoto); photoLoc = newPhotoLoc; if (App::main()) emit App::main()->peerPhotoChanged(this); } @@ -772,14 +809,14 @@ QString saveFileName(const QString &title, const QString &filter, const QString bool StickerData::setInstalled() const { switch (set.type()) { case mtpc_inputStickerSetID: { - StickerSets::const_iterator it = cStickerSets().constFind(set.c_inputStickerSetID().vid.v); - return (it != cStickerSets().cend()) && !(it->flags & MTPDstickerSet::flag_disabled); + auto it = Global::StickerSets().constFind(set.c_inputStickerSetID().vid.v); + return (it != Global::StickerSets().cend()) && !(it->flags & MTPDstickerSet::Flag::f_disabled); } break; case mtpc_inputStickerSetShortName: { QString name = qs(set.c_inputStickerSetShortName().vshort_name).toLower(); - for (StickerSets::const_iterator it = cStickerSets().cbegin(), e = cStickerSets().cend(); it != e; ++it) { + for (auto it = Global::StickerSets().cbegin(), e = Global::StickerSets().cend(); it != e; ++it) { if (it->shortName.toLower() == name) { - return !(it->flags & MTPDstickerSet::flag_disabled); + return !(it->flags & MTPDstickerSet::Flag::f_disabled); } } } break; @@ -787,7 +824,7 @@ bool StickerData::setInstalled() const { return false; } -QString documentSaveFilename(DocumentData *data, bool forceSavingAs = false, const QString already = QString(), const QDir &dir = QDir()) { +QString documentSaveFilename(const DocumentData *data, bool forceSavingAs = false, const QString already = QString(), const QDir &dir = QDir()) { QString name, filter, caption, prefix; MimeType mimeType = mimeTypeForName(data->mime); QStringList p = mimeType.globPatterns(); @@ -813,7 +850,7 @@ QString documentSaveFilename(DocumentData *data, bool forceSavingAs = false, con } else { filter = mimeType.filterString() + qsl(";;All files (*.*)"); } - caption = lang(lng_save_file); + caption = lang(data->song() ? lng_save_audio_file : lng_save_file); prefix = qsl("doc"); } @@ -914,22 +951,21 @@ void GifOpenLink::onClick(Qt::MouseButton button) const { void DocumentSaveLink::doSave(DocumentData *data, bool forceSavingAs) { if (!data->date) return; - QString already = data->already(true); - bool openWith = !already.isEmpty(); - if (openWith && !forceSavingAs) { + QString filepath = data->filepath(DocumentData::FilePathResolveSaveFromDataSilent, forceSavingAs); + if (!filepath.isEmpty() && !forceSavingAs) { QPoint pos(QCursor::pos()); - if (!psShowOpenWithMenu(pos.x(), pos.y(), already)) { - psOpenFile(already, true); + if (!psShowOpenWithMenu(pos.x(), pos.y(), filepath)) { + psOpenFile(filepath, true); } } else { - QFileInfo alreadyInfo(already); - QDir alreadyDir(already.isEmpty() ? QDir() : alreadyInfo.dir()); - QString alreadyName(already.isEmpty() ? QString() : alreadyInfo.fileName()); - QString filename = documentSaveFilename(data, forceSavingAs, alreadyName, alreadyDir); - if (!filename.isEmpty()) { - ActionOnLoad action = already.isEmpty() ? ActionOnLoadNone : ActionOnLoadOpenWith; + QFileInfo fileinfo(filepath); + QDir filedir(filepath.isEmpty() ? QDir() : fileinfo.dir()); + QString filename(filepath.isEmpty() ? QString() : fileinfo.fileName()); + QString newfname = documentSaveFilename(data, forceSavingAs, filename, filedir); + if (!newfname.isEmpty()) { + ActionOnLoad action = filename.isEmpty() ? ActionOnLoadNone : ActionOnLoadOpenWith; FullMsgId actionMsgId = App::hoveredLinkItem() ? App::hoveredLinkItem()->fullId() : (App::contextItem() ? App::contextItem()->fullId() : FullMsgId()); - data->save(filename, action, actionMsgId); + data->save(newfname, action, actionMsgId); } } } @@ -1180,7 +1216,7 @@ void DocumentData::performActionOnLoad() { _actionOnLoad = ActionOnLoadNone; } -bool DocumentData::loaded(bool check) const { +bool DocumentData::loaded(FilePathResolveType type) const { if (loading() && _loader->done()) { if (_loader->fileType() == mtpc_storage_fileUnknown) { _loader->deleteLater(); @@ -1200,7 +1236,7 @@ bool DocumentData::loaded(bool check) const { } notifyLayoutChanged(); } - return !_data.isEmpty() || !already(check).isEmpty(); + return !data().isEmpty() || !filepath(type).isEmpty(); } bool DocumentData::loading() const { @@ -1230,18 +1266,26 @@ bool DocumentData::uploading() const { } void DocumentData::save(const QString &toFile, ActionOnLoad action, const FullMsgId &actionMsgId, LoadFromCloudSetting fromCloud, bool autoLoading) { - if (loaded(true)) { + _actionOnLoad = action; + _actionOnLoadMsgId = actionMsgId; + + if (loaded(FilePathResolveChecked)) { const FileLocation &l(location(true)); if (!toFile.isEmpty()) { if (!_data.isEmpty()) { QFile f(toFile); f.open(QIODevice::WriteOnly); f.write(_data); + f.close(); + + setLocation(FileLocation(StorageFilePartial, toFile)); + Local::writeFileLocation(mediaKey(), FileLocation(mtpToStorageType(mtpc_storage_filePartial), toFile)); } else if (l.accessEnable()) { QFile(l.name()).copy(toFile); l.accessDisable(); } } + performActionOnLoad(); return; } @@ -1253,15 +1297,11 @@ void DocumentData::save(const QString &toFile, ActionOnLoad action, const FullMs } } - _actionOnLoad = action; - _actionOnLoadMsgId = actionMsgId; - if (_loader) { if (fromCloud == LoadFromCloudOrLocal) _loader->permitLoadFromCloud(); } else { status = FileReady; - LocationType type = voice() ? AudioFileLocation : (isVideo() ? VideoFileLocation : DocumentFileLocation); - _loader = new mtpFileLoader(dc, id, access, type, toFile, size, (saveToCache() ? LoadToCacheAsWell : LoadToFileOnly), fromCloud, autoLoading); + _loader = new mtpFileLoader(dc, id, access, locationType(), toFile, size, (saveToCache() ? LoadToCacheAsWell : LoadToFileOnly), fromCloud, autoLoading); _loader->connect(_loader, SIGNAL(progress(FileLoader*)), App::main(), SLOT(documentLoadProgress(FileLoader*))); _loader->connect(_loader, SIGNAL(failed(FileLoader*,bool)), App::main(), SLOT(documentLoadFailed(FileLoader*,bool))); _loader->start(); @@ -1312,11 +1352,6 @@ QByteArray documentWaveformEncode5bit(const VoiceWaveform &waveform) { return result; } -QString DocumentData::already(bool check) const { - if (check && _location.name().isEmpty()) return QString(); - return location(check).name(); -} - QByteArray DocumentData::data() const { return _data; } @@ -1334,6 +1369,34 @@ void DocumentData::setLocation(const FileLocation &loc) { } } +QString DocumentData::filepath(FilePathResolveType type, bool forceSavingAs) const { + bool check = (type != FilePathResolveCached); + QString result = (check && _location.name().isEmpty()) ? QString() : location(check).name(); + bool saveFromData = result.isEmpty() && !data().isEmpty(); + if (saveFromData) { + if (type != FilePathResolveSaveFromData && type != FilePathResolveSaveFromDataSilent) { + saveFromData = false; + } else if (type == FilePathResolveSaveFromDataSilent && (cAskDownloadPath() || forceSavingAs)) { + saveFromData = false; + } + } + if (saveFromData) { + QString filename = documentSaveFilename(this, forceSavingAs); + if (!filename.isEmpty()) { + QFile f(filename); + if (f.open(QIODevice::WriteOnly)) { + if (f.write(data()) == data().size()) { + f.close(); + const_cast(this)->_location = FileLocation(StorageFilePartial, filename); + Local::writeFileLocation(mediaKey(), _location); + result = filename; + } + } + } + } + return result; +} + ImagePtr DocumentData::makeReplyPreview() { if (replyPreview->isNull() && !thumb->isNull()) { if (thumb->loaded()) { diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index a5c5c8a0b..6546a8c03 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -20,9 +20,21 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once +typedef int32 UserId; +typedef int32 ChatId; typedef int32 ChannelId; static const ChannelId NoChannel = 0; +typedef int32 MsgId; +struct FullMsgId { + FullMsgId() : channel(NoChannel), msg(0) { + } + FullMsgId(ChannelId channel, MsgId msg) : channel(channel), msg(msg) { + } + ChannelId channel; + MsgId msg; +}; + typedef uint64 PeerId; static const uint64 PeerIdMask = 0xFFFFFFFFULL; static const uint64 PeerIdTypeMask = 0x300000000ULL; @@ -38,10 +50,10 @@ inline bool peerIsChat(const PeerId &id) { inline bool peerIsChannel(const PeerId &id) { return (id & PeerIdTypeMask) == PeerIdChannelShift; } -inline PeerId peerFromUser(int32 user_id) { +inline PeerId peerFromUser(UserId user_id) { return PeerIdUserShift | uint64(uint32(user_id)); } -inline PeerId peerFromChat(int32 chat_id) { +inline PeerId peerFromChat(ChatId chat_id) { return PeerIdChatShift | uint64(uint32(chat_id)); } inline PeerId peerFromChannel(ChannelId channel_id) { @@ -59,10 +71,10 @@ inline PeerId peerFromChannel(const MTPint &channel_id) { inline int32 peerToBareInt(const PeerId &id) { return int32(uint32(id & PeerIdMask)); } -inline int32 peerToUser(const PeerId &id) { +inline UserId peerToUser(const PeerId &id) { return peerIsUser(id) ? peerToBareInt(id) : 0; } -inline int32 peerToChat(const PeerId &id) { +inline ChatId peerToChat(const PeerId &id) { return peerIsChat(id) ? peerToBareInt(id) : 0; } inline ChannelId peerToChannel(const PeerId &id) { @@ -103,14 +115,16 @@ inline PeerId peerFromMessage(const MTPmessage &msg) { } return (from_id && peerToUser(to_id) == MTP::authedId()) ? from_id : to_id; } -inline int32 flagsFromMessage(const MTPmessage &msg) { +inline MTPDmessage::Flags flagsFromMessage(const MTPmessage &msg) { switch (msg.type()) { case mtpc_message: return msg.c_message().vflags.v; - case mtpc_messageService: return msg.c_messageService().vflags.v; + + // dirty type hack :( we assume that MTPDmessage::Flags has the same flags and perhaps more + case mtpc_messageService: return MTPDmessage::Flags(QFlag(msg.c_messageService().vflags.v)); } return 0; } -inline int32 idFromMessage(const MTPmessage &msg) { +inline MsgId idFromMessage(const MTPmessage &msg) { switch (msg.type()) { case mtpc_messageEmpty: return msg.c_messageEmpty().vid.v; case mtpc_message: return msg.c_message().vid.v; @@ -118,7 +132,7 @@ inline int32 idFromMessage(const MTPmessage &msg) { } return 0; } -inline int32 dateFromMessage(const MTPmessage &msg) { +inline TimeId dateFromMessage(const MTPmessage &msg) { switch (msg.type()) { case mtpc_message: return msg.c_message().vdate.v; case mtpc_messageService: return msg.c_messageService().vdate.v; @@ -133,15 +147,6 @@ typedef uint64 DocumentId; typedef uint64 WebPageId; static const WebPageId CancelledWebPageId = 0xFFFFFFFFFFFFFFFFULL; -typedef int32 MsgId; -struct FullMsgId { - FullMsgId() : channel(NoChannel), msg(0) { - } - FullMsgId(ChannelId channel, MsgId msg) : channel(channel), msg(msg) { - } - ChannelId channel; - MsgId msg; -}; inline bool operator==(const FullMsgId &a, const FullMsgId &b) { return (a.channel == b.channel) && (a.msg == b.msg); } @@ -163,15 +168,16 @@ static const MsgId ServerMaxMsgId = 0x3FFFFFFF; static const MsgId ShowAtUnreadMsgId = 0; struct NotifySettings { - NotifySettings() : flags(MTPDinputPeerNotifySettings::flag_show_previews), mute(0), sound("default") { + NotifySettings() : flags(MTPDpeerNotifySettings::Flag::f_show_previews), mute(0), sound("default") { } - int32 flags, mute; + MTPDpeerNotifySettings::Flags flags; + TimeId mute; string sound; bool previews() const { - return flags & MTPDinputPeerNotifySettings::flag_show_previews; + return flags & MTPDpeerNotifySettings::Flag::f_show_previews; } bool silent() const { - return flags & MTPDinputPeerNotifySettings::flag_silent; + return flags & MTPDpeerNotifySettings::Flag::f_silent; } }; typedef NotifySettings *NotifySettingsPtr; @@ -181,9 +187,9 @@ static const NotifySettingsPtr EmptyNotifySettings = NotifySettingsPtr(1); extern NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; extern NotifySettingsPtr globalNotifyAllPtr, globalNotifyUsersPtr, globalNotifyChatsPtr; -inline bool isNotifyMuted(NotifySettingsPtr settings, int32 *changeIn = 0) { +inline bool isNotifyMuted(NotifySettingsPtr settings, TimeId *changeIn = 0) { if (settings != UnknownNotifySettings && settings != EmptyNotifySettings) { - int32 t = unixtime(); + TimeId t = unixtime(); if (settings->mute > t) { if (changeIn) *changeIn = settings->mute - t + 1; return true; @@ -193,12 +199,12 @@ inline bool isNotifyMuted(NotifySettingsPtr settings, int32 *changeIn = 0) { return false; } -static const int32 UserColorsCount = 8; +static const int UserColorsCount = 8; -style::color peerColor(int32 index); -ImagePtr userDefPhoto(int32 index); -ImagePtr chatDefPhoto(int32 index); -ImagePtr channelDefPhoto(int32 index); +style::color peerColor(int index); +ImagePtr userDefPhoto(int index); +ImagePtr chatDefPhoto(int index); +ImagePtr channelDefPhoto(int index); static const PhotoId UnknownPeerPhotoId = 0xFFFFFFFFFFFFFFFFULL; @@ -211,6 +217,12 @@ class UserData; class ChatData; class ChannelData; class PeerData { +protected: + + PeerData(const PeerId &id); + PeerData(const PeerData &other) = delete; + PeerData &operator=(const PeerData &other) = delete; + public: virtual ~PeerData() { @@ -267,25 +279,46 @@ public: typedef QSet NameFirstChars; NameFirstChars chars; - bool loaded; + enum LoadedStatus { + NotLoaded = 0x00, + MinimalLoaded = 0x01, + FullLoaded = 0x02, + }; + LoadedStatus loadedStatus; MTPinputPeer input; - int32 colorIndex; + int colorIndex; style::color color; - ImagePtr photo; + + void setUserpic(ImagePtr userpic); + void paintUserpic(Painter &p, int size, int x, int y) const; + void paintUserpicLeft(Painter &p, int size, int x, int y, int w) const { + paintUserpic(p, size, rtl() ? (w - x - size) : x, y); + } + void loadUserpic(bool loadFirst = false, bool prior = true) { + _userpic->load(loadFirst, prior); + } + StorageKey userpicUniqueKey() const; + void saveUserpic(const QString &path) const; + QPixmap genUserpic(int size) const; + PhotoId photoId; StorageImageLocation photoLoc; - int32 nameVersion; + int nameVersion; NotifySettingsPtr notify; -private: + // if this string is not empty we must not allow to open the + // conversation and we must show this string instead + virtual QString restrictionReason() const { + return QString(); + } - PeerData(const PeerId &id); - friend class UserData; - friend class ChatData; - friend class ChannelData; +protected: + + ImagePtr _userpic; + ImagePtr currentUserpic() const; }; static const uint64 UserNoAccess = 0xFFFFFFFFFFFFFFFFULL; @@ -333,7 +366,7 @@ struct BotInfo { } bool inited; bool readsAllHistory, cantJoinGroups; - int32 version; + int version; QString description, inlinePlaceholder; QList commands; Text text; // description @@ -351,31 +384,24 @@ class PhotoData; class UserData : public PeerData { public: - UserData(const PeerId &id) : PeerData(id) - , access(0) - , flags(0) - , onlineTill(0) - , contact(-1) - , blocked(UserBlockUnknown) - , photosCount(-1) - , botInfo(0) { + UserData(const PeerId &id) : PeerData(id) { setName(QString(), QString(), QString(), QString()); } void setPhoto(const MTPUserProfilePhoto &photo); void setName(const QString &first, const QString &last, const QString &phoneName, const QString &username); void setPhone(const QString &newPhone); - void setBotInfoVersion(int32 version); + void setBotInfoVersion(int version); void setBotInfo(const MTPBotInfo &info); void setNameOrPhone(const QString &newNameOrPhone); void madeAction(); // pseudo-online - uint64 access; + uint64 access = 0; - int32 flags; + MTPDuser::Flags flags = { 0 }; bool isVerified() const { - return flags & MTPDuser::flag_verified; + return flags & MTPDuser::Flag::f_verified; } bool canWrite() const { return access != UserNoAccess; @@ -389,17 +415,28 @@ public: QString phone; QString nameOrPhone; Text phoneText; - int32 onlineTill; - int32 contact; // -1 - not contact, cant add (self, empty, deleted, foreign), 0 - not contact, can add (request), 1 - contact - UserBlockedStatus blocked; + TimeId onlineTill = 0; + int32 contact = -1; // -1 - not contact, cant add (self, empty, deleted, foreign), 0 - not contact, can add (request), 1 - contact + UserBlockedStatus blocked = UserBlockUnknown; typedef QList Photos; Photos photos; - int32 photosCount; // -1 not loaded, 0 all loaded + int photosCount = -1; // -1 not loaded, 0 all loaded QString about; - BotInfo *botInfo; + BotInfo *botInfo = nullptr; + + QString restrictionReason() const override { + return _restrictionReason; + } + void setRestrictionReason(const QString &reason) { + _restrictionReason = reason; + } + +private: + QString _restrictionReason; + }; static UserData * const InlineBotLookingUpData = SharedMemoryLocation(); @@ -421,7 +458,7 @@ public: void invalidateParticipants() { participants = ChatData::Participants(); admins = ChatData::Admins(); - flags &= ~MTPDchat::flag_admin; + flags &= ~MTPDchat::Flag::f_admin; invitedByMe = ChatData::InvitedByMe(); botStatus = 0; } @@ -433,12 +470,12 @@ public: ChannelData *migrateToPtr; - int32 count; - int32 date; - int32 version; - int32 creator; + int count; + TimeId date; + int version; + UserId creator; - int32 flags; + MTPDchat::Flags flags; bool isForbidden; bool amIn() const { return !isForbidden && !haveLeft() && !wasKicked(); @@ -450,27 +487,27 @@ public: return !isDeactivated() && amIn(); } bool haveLeft() const { - return flags & MTPDchat::flag_left; + return flags & MTPDchat::Flag::f_left; } bool wasKicked() const { - return flags & MTPDchat::flag_kicked; + return flags & MTPDchat::Flag::f_kicked; } bool adminsEnabled() const { - return flags & MTPDchat::flag_admins_enabled; + return flags & MTPDchat::Flag::f_admins_enabled; } bool amCreator() const { - return flags & MTPDchat::flag_creator; + return flags & MTPDchat::Flag::f_creator; } bool amAdmin() const { - return flags & MTPDchat::flag_admin; + return (flags & MTPDchat::Flag::f_admin) && adminsEnabled(); } bool isDeactivated() const { - return flags & MTPDchat::flag_deactivated; + return flags & MTPDchat::Flag::f_deactivated; } bool isMigrated() const { - return flags & MTPDchat::flag_migrated_to; + return flags & MTPDchat::Flag::f_migrated_to; } - typedef QMap Participants; + typedef QMap Participants; Participants participants; typedef OrderedSet InvitedByMe; InvitedByMe invitedByMe; @@ -583,18 +620,8 @@ class ChannelData : public PeerData { public: ChannelData(const PeerId &id) : PeerData(id) - , access(0) , inputChannel(MTP_inputChannel(MTP_int(bareId()), MTP_long(0))) - , count(1) - , adminsCount(1) - , date(0) - , version(0) - , flags(0) - , flagsFull(0) - , mgInfo(nullptr) - , isForbidden(true) - , inviter(0) - , _lastFullUpdate(0) { + , mgInfo(nullptr) { setName(QString(), QString()); } void setPhoto(const MTPChatPhoto &photo, const PhotoId &phId = UnknownPeerPhotoId); @@ -603,17 +630,19 @@ public: void updateFull(bool force = false); void fullUpdated(); - uint64 access; + uint64 access = 0; MTPinputChannel inputChannel; QString username, about; - int32 count, adminsCount; - int32 date; - int32 version; - int32 flags, flagsFull; - MegagroupInfo *mgInfo; + int count = 1; + int adminsCount = 1; + int32 date = 0; + int version = 0; + MTPDchannel::Flags flags = { 0 }; + MTPDchannelFull::Flags flagsFull = { 0 }; + MegagroupInfo *mgInfo = nullptr; bool lastParticipantsCountOutdated() const { if (!mgInfo || !(mgInfo->lastParticipantsStatus & MegagroupInfo::LastParticipantsCountOutdated)) { return false; @@ -626,31 +655,31 @@ public: } void flagsUpdated(); bool isMegagroup() const { - return flags & MTPDchannel::flag_megagroup; + return flags & MTPDchannel::Flag::f_megagroup; } bool isBroadcast() const { - return flags & MTPDchannel::flag_broadcast; + return flags & MTPDchannel::Flag::f_broadcast; } bool isPublic() const { - return flags & MTPDchannel::flag_username; + return flags & MTPDchannel::Flag::f_username; } bool canEditUsername() const { - return amCreator() && (flagsFull & MTPDchannelFull::flag_can_set_username); + return amCreator() && (flagsFull & MTPDchannelFull::Flag::f_can_set_username); } bool amCreator() const { - return flags & MTPDchannel::flag_creator; + return flags & MTPDchannel::Flag::f_creator; } bool amEditor() const { - return flags & MTPDchannel::flag_editor; + return flags & MTPDchannel::Flag::f_editor; } bool amModerator() const { - return flags & MTPDchannel::flag_moderator; + return flags & MTPDchannel::Flag::f_moderator; } bool haveLeft() const { - return flags & MTPDchannel::flag_left; + return flags & MTPDchannel::Flag::f_left; } bool wasKicked() const { - return flags & MTPDchannel::flag_kicked; + return flags & MTPDchannel::Flag::f_kicked; } bool amIn() const { return !isForbidden && !haveLeft() && !wasKicked(); @@ -662,23 +691,23 @@ public: return amIn() && (canPublish() || !isBroadcast()); } bool canViewParticipants() const { - return flagsFull & MTPDchannelFull::flag_can_view_participants; + return flagsFull & MTPDchannelFull::Flag::f_can_view_participants; } bool addsSignature() const { - return flags & MTPDchannel::flag_signatures; + return flags & MTPDchannel::Flag::f_signatures; } - bool isForbidden; + bool isForbidden = true; bool isVerified() const { - return flags & MTPDchannel::flag_verified; + return flags & MTPDchannel::Flag::f_verified; } bool canAddParticipants() const { - return amCreator() || amEditor() || (flags & MTPDchannel::flag_democracy); + return amCreator() || amEditor() || (flags & MTPDchannel::Flag::f_democracy); } // ImagePtr photoFull; QString invitationUrl; - int32 inviter; // > 0 - user who invited me to channel, < 0 - not in channel + int32 inviter = 0; // > 0 - user who invited me to channel, < 0 - not in channel QDateTime inviteDate; void ptsInit(int32 pts) { @@ -714,37 +743,77 @@ public: return _ptsWaiter.setWaitingForShortPoll(this, ms); } + QString restrictionReason() const override { + return _restrictionReason; + } + void setRestrictionReason(const QString &reason) { + _restrictionReason = reason; + } + ~ChannelData(); private: PtsWaiter _ptsWaiter; - uint64 _lastFullUpdate; + uint64 _lastFullUpdate = 0; + + QString _restrictionReason; + }; +inline bool isUser(const PeerData *peer) { + return peer ? peer->isUser() : false; +} inline UserData *PeerData::asUser() { - return isUser() ? static_cast(this) : 0; + return isUser() ? static_cast(this) : nullptr; +} +inline UserData *asUser(PeerData *peer) { + return peer ? peer->asUser() : nullptr; } inline const UserData *PeerData::asUser() const { - return isUser() ? static_cast(this) : 0; + return isUser() ? static_cast(this) : nullptr; +} +inline const UserData *asUser(const PeerData *peer) { + return peer ? peer->asUser() : nullptr; +} +inline bool isChat(const PeerData *peer) { + return peer ? peer->isChat() : false; } inline ChatData *PeerData::asChat() { - return isChat() ? static_cast(this) : 0; + return isChat() ? static_cast(this) : nullptr; +} +inline ChatData *asChat(PeerData *peer) { + return peer ? peer->asChat() : nullptr; } inline const ChatData *PeerData::asChat() const { - return isChat() ? static_cast(this) : 0; + return isChat() ? static_cast(this) : nullptr; +} +inline const ChatData *asChat(const PeerData *peer) { + return peer ? peer->asChat() : nullptr; +} +inline bool isChannel(const PeerData *peer) { + return peer ? peer->isChannel() : false; } inline ChannelData *PeerData::asChannel() { - return isChannel() ? static_cast(this) : 0; + return isChannel() ? static_cast(this) : nullptr; +} +inline ChannelData *asChannel(PeerData *peer) { + return peer ? peer->asChannel() : nullptr; } inline const ChannelData *PeerData::asChannel() const { - return isChannel() ? static_cast(this) : 0; + return isChannel() ? static_cast(this) : nullptr; +} +inline const ChannelData *asChannel(const PeerData *peer) { + return peer ? peer->asChannel() : nullptr; +} +inline bool isMegagroup(const PeerData *peer) { + return peer ? peer->isMegagroup() : false; } inline ChatData *PeerData::migrateFrom() const { - return (isMegagroup() && asChannel()->amIn()) ? asChannel()->mgInfo->migrateFromPtr : 0; + return (isMegagroup() && asChannel()->amIn()) ? asChannel()->mgInfo->migrateFromPtr : nullptr; } inline ChannelData *PeerData::migrateTo() const { - return (isChat() && asChat()->migrateToPtr && asChat()->migrateToPtr->amIn()) ? asChat()->migrateToPtr : 0; + return (isChat() && asChat()->migrateToPtr && asChat()->migrateToPtr->amIn()) ? asChat()->migrateToPtr : nullptr; } inline const Text &PeerData::dialogName() const { return migrateTo() ? migrateTo()->dialogName() : ((isUser() && !asUser()->phoneText.isEmpty()) ? asUser()->phoneText : nameText); @@ -916,7 +985,13 @@ public: void automaticLoad(const HistoryItem *item); // auto load sticker or video void automaticLoadSettingsChanged(); - bool loaded(bool check = false) const; + enum FilePathResolveType { + FilePathResolveCached, + FilePathResolveChecked, + FilePathResolveSaveFromData, + FilePathResolveSaveFromDataSilent, + }; + bool loaded(FilePathResolveType type = FilePathResolveCached) const; bool loading() const; bool displayLoading() const; void save(const QString &toFile, ActionOnLoad action = ActionOnLoadNone, const FullMsgId &actionMsgId = FullMsgId(), LoadFromCloudSetting fromCloud = LoadFromCloudOrLocal, bool autoLoading = false); @@ -925,11 +1000,12 @@ public: int32 loadOffset() const; bool uploading() const; - QString already(bool check = false) const; QByteArray data() const; const FileLocation &location(bool check = false) const; void setLocation(const FileLocation &loc); + QString filepath(FilePathResolveType type = FilePathResolveCached, bool forceSavingAs = false) const; + bool saveToCache() const; void performActionOnLoad(); @@ -960,11 +1036,14 @@ public: SongData *song() { return (type == SongDocument) ? static_cast(_additional) : 0; } + const SongData *song() const { + return (type == SongDocument) ? static_cast(_additional) : 0; + } VoiceData *voice() { return (type == VoiceDocument) ? static_cast(_additional) : 0; } const VoiceData *voice() const { - return (type == VoiceDocument) ? static_cast(_additional) : 0; + return (type == VoiceDocument) ? static_cast(_additional) : 0; } bool isAnimation() const { return (type == AnimatedDocument) || !mime.compare(qstr("image/gif"), Qt::CaseInsensitive); @@ -1007,8 +1086,7 @@ public: int32 md5[8]; MediaKey mediaKey() const { - LocationType t = isVideo() ? VideoFileLocation : (voice() ? AudioFileLocation : DocumentFileLocation); - return ::mediaKey(t, dc, id); + return ::mediaKey(locationType(), dc, id); } private: @@ -1018,6 +1096,10 @@ private: DocumentAdditionalData *_additional; int32 _duration; + LocationType locationType() const { + return voice() ? AudioFileLocation : (isVideo() ? VideoFileLocation : DocumentFileLocation); + } + ActionOnLoad _actionOnLoad; FullMsgId _actionOnLoadMsgId; mutable mtpFileLoader *_loader; @@ -1197,7 +1279,7 @@ public: int32 width, height, duration; QString message; // botContextMessageText - bool noWebPage; + bool noWebPage; //currently not used EntitiesInText entities; QString caption; // if message.isEmpty() use botContextMessageMediaAuto diff --git a/Telegram/SourceFiles/types.cpp b/Telegram/SourceFiles/types.cpp index 231b9bdf3..e4541be90 100644 --- a/Telegram/SourceFiles/types.cpp +++ b/Telegram/SourceFiles/types.cpp @@ -20,6 +20,16 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" +#include "types.h" + +#include +#include + +extern "C" { +#include +#include +} + #include "application.h" uint64 _SharedMemoryLocation[4] = { 0x00, 0x01, 0x02, 0x03 }; @@ -110,8 +120,8 @@ namespace { } } -int32 myunixtime() { - return (int32)time(NULL); +TimeId myunixtime() { + return (TimeId)time(NULL); } void unixtimeInit() { @@ -139,19 +149,19 @@ void unixtimeSet(int32 serverTime, bool force) { _initMsgIdConstants(); } -int32 unixtime() { - int32 result = myunixtime(); +TimeId unixtime() { + TimeId result = myunixtime(); QReadLocker locker(&unixtimeLock); return result + unixtimeDelta; } -int32 fromServerTime(const MTPint &serverTime) { +TimeId fromServerTime(const MTPint &serverTime) { QReadLocker locker(&unixtimeLock); return serverTime.v - unixtimeDelta; } -MTPint toServerTime(const int32 &clientTime) { +MTPint toServerTime(const TimeId &clientTime) { QReadLocker locker(&unixtimeLock); return MTP_int(clientTime + unixtimeDelta); } @@ -280,7 +290,7 @@ namespace ThirdParty { uchar sha256Buffer[32]; RAND_seed(hashSha256(buf, 16, sha256Buffer), 32); if (!RAND_status()) { - LOG(("MTP Error: Could not init OpenSSL rand, RAND_status() is 0..")); + LOG(("MTP Error: Could not init OpenSSL rand, RAND_status() is 0...")); } } @@ -1024,35 +1034,32 @@ MimeType mimeTypeForData(const QByteArray &data) { return MimeType(QMimeDatabase().mimeTypeForData(data)); } -class InterfacesMetadatasMap : public QMap { -public: - ~InterfacesMetadatasMap() { - for (const_iterator i = cbegin(), e = cend(); i != e; ++i) { - delete i.value(); +struct ComposerMetadatasMap { + QMap data; + ~ComposerMetadatasMap() { + for_const (const ComposerMetadata *p, data) { + delete p; } } }; -const InterfacesMetadata *GetInterfacesMetadata(uint64 mask) { - typedef QMap InterfacesMetadatasMap; - static InterfacesMetadatasMap InterfacesMetadatas; - static QMutex InterfacesMetadatasMutex; +const ComposerMetadata *GetComposerMetadata(uint64 mask) { + static ComposerMetadatasMap ComposerMetadatas; + static QMutex ComposerMetadatasMutex; - QMutexLocker lock(&InterfacesMetadatasMutex); - InterfacesMetadatasMap::const_iterator i = InterfacesMetadatas.constFind(mask); - if (i == InterfacesMetadatas.cend()) { - InterfacesMetadata *meta = new InterfacesMetadata(mask); - if (!meta) { // terminate if we can't allocate memory - throw "Can't allocate memory!"; - } + QMutexLocker lock(&ComposerMetadatasMutex); + auto i = ComposerMetadatas.data.constFind(mask); + if (i == ComposerMetadatas.data.cend()) { + ComposerMetadata *meta = new ComposerMetadata(mask); + t_assert(meta != nullptr); - i = InterfacesMetadatas.insert(mask, meta); + i = ComposerMetadatas.data.insert(mask, meta); } return i.value(); } -const InterfacesMetadata *Interfaces::ZeroInterfacesMetadata = GetInterfacesMetadata(0); +const ComposerMetadata *Composer::ZeroComposerMetadata = GetComposerMetadata(0); -InterfaceWrapStruct InterfaceWraps[64]; +ComponentWrapStruct ComponentWraps[64]; -QAtomicInt InterfaceIndexLast(0); +QAtomicInt ComponentIndexLast; diff --git a/Telegram/SourceFiles/types.h b/Telegram/SourceFiles/types.h index 9adbd6b08..836b7af37 100644 --- a/Telegram/SourceFiles/types.h +++ b/Telegram/SourceFiles/types.h @@ -27,8 +27,8 @@ void deleteAndMark(T *&link) { } template -T *exchange(T *&ptr) { - T *result = 0; +T *getPointerAndReset(T *&ptr) { + T *result = nullptr; qSwap(result, ptr); return result; } @@ -36,16 +36,133 @@ T *exchange(T *&ptr) { struct NullType { }; +// ordered set template based on QMap template -class OrderedSet : public QMap { +class OrderedSet { + typedef OrderedSet Self; + typedef QMap Impl; + typedef typename Impl::iterator IteratorImpl; + typedef typename Impl::const_iterator ConstIteratorImpl; + Impl impl_; + public: - void insert(const T &v) { - QMap::insert(v, NullType()); - } + inline bool operator==(const Self &other) const { return impl_ == other.impl_; } + inline bool operator!=(const Self &other) const { return impl_ != other.impl_; } + inline int size() const { return impl_.size(); } + inline bool isEmpty() const { return impl_.isEmpty(); } + inline void detach() { return impl_.detach(); } + inline bool isDetached() const { return impl_.isDetached(); } + inline void clear() { return impl_.clear(); } + inline QList values() const { return impl_.keys(); } + inline const T &first() const { return impl_.firstKey(); } + inline const T &last() const { return impl_.lastKey(); } + + class const_iterator; + class iterator { + public: + typedef typename IteratorImpl::iterator_category iterator_category; + typedef typename IteratorImpl::difference_type difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + explicit iterator(const IteratorImpl &impl) : impl_(impl) { + } + inline const T &operator*() const { return impl_.key(); } + inline const T *operator->() const { return &impl_.key(); } + inline bool operator==(const iterator &other) const { return impl_ == other.impl_; } + inline bool operator!=(const iterator &other) const { return impl_ != other.impl_; } + inline iterator &operator++() { ++impl_; return *this; } + inline iterator operator++(int) { return iterator(impl_++); } + inline iterator &operator--() { --impl_; return *this; } + inline iterator operator--(int) { return iterator(impl_--); } + inline iterator operator+(int j) const { return iterator(impl_ + j); } + inline iterator operator-(int j) const { return iterator(impl_ - j); } + inline iterator &operator+=(int j) { impl_ += j; return *this; } + inline iterator &operator-=(int j) { impl_ -= j; return *this; } + + friend class const_iterator; + inline bool operator==(const const_iterator &other) const { return impl_ == other.impl_; } + inline bool operator!=(const const_iterator &other) const { return impl_ != other.impl_; } + + private: + IteratorImpl impl_; + friend class OrderedSet; + + }; + friend class iterator; + + class const_iterator { + public: + typedef typename IteratorImpl::iterator_category iterator_category; + typedef typename IteratorImpl::difference_type difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + + explicit const_iterator(const ConstIteratorImpl &impl) : impl_(impl) { + } + inline const T &operator*() const { return impl_.key(); } + inline const T *operator->() const { return &impl_.key(); } + inline bool operator==(const const_iterator &other) const { return impl_ == other.impl_; } + inline bool operator!=(const const_iterator &other) const { return impl_ != other.impl_; } + inline const_iterator &operator++() { ++impl_; return *this; } + inline const_iterator operator++(int) { return const_iterator(impl_++); } + inline const_iterator &operator--() { --impl_; return *this; } + inline const_iterator operator--(int) { return const_iterator(impl_--); } + inline const_iterator operator+(int j) const { return const_iterator(impl_ + j); } + inline const_iterator operator-(int j) const { return const_iterator(impl_ - j); } + inline const_iterator &operator+=(int j) { impl_ += j; return *this; } + inline const_iterator &operator-=(int j) { impl_ -= j; return *this; } + + friend class iterator; + inline bool operator==(const iterator &other) const { return impl_ == other.impl_; } + inline bool operator!=(const iterator &other) const { return impl_ != other.impl_; } + + private: + ConstIteratorImpl impl_; + friend class OrderedSet; + + }; + friend class const_iterator; + + // STL style + inline iterator begin() { return iterator(impl_.begin()); } + inline const_iterator begin() const { return const_iterator(impl_.cbegin()); } + inline const_iterator constBegin() const { return const_iterator(impl_.cbegin()); } + inline const_iterator cbegin() const { return const_iterator(impl_.cbegin()); } + inline iterator end() { detach(); return iterator(impl_.end()); } + inline const_iterator end() const { return const_iterator(impl_.cend()); } + inline const_iterator constEnd() const { return const_iterator(impl_.cend()); } + inline const_iterator cend() const { return const_iterator(impl_.cend()); } + inline iterator erase(iterator it) { return iterator(impl_.erase(it.impl_)); } + + inline iterator insert(const T &value) { return iterator(impl_.insert(value, NullType())); } + inline iterator insert(const_iterator pos, const T &value) { return iterator(impl_.insert(pos.impl_, value, NullType())); } + inline int remove(const T &value) { return impl_.remove(value); } + inline bool contains(const T &value) const { return impl_.contains(value); } + + // more Qt + typedef iterator Iterator; + typedef const_iterator ConstIterator; + inline int count() const { return impl_.count(); } + inline iterator find(const T &value) { return iterator(impl_.find(value)); } + inline const_iterator find(const T &value) const { return const_iterator(impl_.constFind(value)); } + inline const_iterator constFind(const T &value) const { return const_iterator(impl_.constFind(value)); } + inline Self &unite(const Self &other) { impl_.unite(other.impl_); return *this; } + + // STL compatibility + typedef typename Impl::difference_type difference_type; + typedef typename Impl::size_type size_type; + inline bool empty() const { return impl_.empty(); } }; +// thanks Chromium see https://blogs.msdn.microsoft.com/the1/2004/05/07/how-would-you-get-the-count-of-an-array-in-c-2/ +template char(&ArraySizeHelper(T(&array)[N]))[N]; +#define arraysize(array) (sizeof(ArraySizeHelper(array))) + #define qsl(s) QStringLiteral(s) #define qstr(s) QLatin1String(s, sizeof(s) - 1) @@ -59,6 +176,11 @@ struct ForConstTraits { }; #define for_const(range_declaration, range_expression) for (range_declaration : static_cast::ExpressionType>(range_expression)) +template +inline QFlags qFlags(Enum v) { + return QFlags(v); +} + //typedef unsigned char uchar; // Qt has uchar typedef qint16 int16; typedef quint16 uint16; @@ -95,6 +217,30 @@ using std::string; using std::exception; using std::swap; +// we copy some parts of C++11 std:: library, because on OS X 10.6+ +// version we can use C++11, but we can't use its library :( +namespace std11 { + +template +struct remove_reference { + typedef T type; +}; +template +struct remove_reference { + typedef T type; +}; +template +struct remove_reference { + typedef T type; +}; + +template +inline typename remove_reference::type &&move(T &&value) { + return static_cast::type&&>(value); +} + +} // namespace std11 + #include "logs.h" static volatile int *t_assert_nullptr = 0; @@ -131,12 +277,12 @@ private: }; class MTPint; - -int32 myunixtime(); +typedef int32 TimeId; +TimeId myunixtime(); void unixtimeInit(); -void unixtimeSet(int32 servertime, bool force = false); -int32 unixtime(); -int32 fromServerTime(const MTPint &serverTime); +void unixtimeSet(TimeId servertime, bool force = false); +TimeId unixtime(); +TimeId fromServerTime(const MTPint &serverTime); uint64 msgid(); int32 reqid(); @@ -230,11 +376,13 @@ inline char *hashMd5Hex(const void *data, uint32 len, void *dest) { // dest = pt return hashMd5Hex(HashMd5(data, len).result(), dest); } +// good random (using openssl implementation) void memset_rand(void *data, uint32 len); - template -inline void memsetrnd(T &value) { - memset_rand(&value, sizeof(value)); +T rand_value() { + T result; + memset_rand(&result, sizeof(result)); + return result; } inline void memset_rand_bad(void *data, uint32 len) { @@ -530,24 +678,26 @@ inline void destroyImplementation(I *&ptr) { deleteAndMark(ptr); } -class Interfaces; -typedef void(*InterfaceConstruct)(void *location, Interfaces *interfaces); -typedef void(*InterfaceDestruct)(void *location); -typedef void(*InterfaceAssign)(void *location, void *waslocation); +class Composer; +typedef void(*ComponentConstruct)(void *location, Composer *composer); +typedef void(*ComponentDestruct)(void *location); +typedef void(*ComponentMove)(void *location, void *waslocation); -struct InterfaceWrapStruct { - InterfaceWrapStruct() : Size(0), Construct(0), Destruct(0) { +struct ComponentWrapStruct { + // don't init any fields, because it is only created in + // global scope, so it will be filled by zeros from the start + ComponentWrapStruct() { } - InterfaceWrapStruct(int size, InterfaceConstruct construct, InterfaceDestruct destruct, InterfaceAssign assign) + ComponentWrapStruct(int size, ComponentConstruct construct, ComponentDestruct destruct, ComponentMove move) : Size(size) , Construct(construct) , Destruct(destruct) - , Assign(assign) { + , Move(move) { } int Size; - InterfaceConstruct Construct; - InterfaceDestruct Destruct; - InterfaceAssign Assign; + ComponentConstruct Construct; + ComponentDestruct Destruct; + ComponentMove Move; }; template @@ -556,36 +706,43 @@ struct CeilDivideMinimumOne { }; template -struct InterfaceWrapTemplate { +struct ComponentWrapTemplate { static const int Size = CeilDivideMinimumOne::Result * sizeof(uint64); - static void Construct(void *location, Interfaces *interfaces) { - new (location) Type(interfaces); + static void Construct(void *location, Composer *composer) { + new (location) Type(composer); } static void Destruct(void *location) { ((Type*)location)->~Type(); } - static void Assign(void *location, void *waslocation) { - *((Type*)location) = *((Type*)waslocation); + static void Move(void *location, void *waslocation) { + *(Type*)location = std11::move(*(Type*)waslocation); } }; -extern InterfaceWrapStruct InterfaceWraps[64]; -extern QAtomicInt InterfaceIndexLast; +extern ComponentWrapStruct ComponentWraps[64]; +extern QAtomicInt ComponentIndexLast; template -class BasicInterface { +class BaseComponent { public: + BaseComponent() { + } + BaseComponent(const BaseComponent &other) = delete; + BaseComponent &operator=(const BaseComponent &other) = delete; + BaseComponent(BaseComponent &&other) = delete; + BaseComponent &operator=(BaseComponent &&other) = default; + static int Index() { static QAtomicInt _index(0); if (int index = _index.loadAcquire()) { return index - 1; } while (true) { - int last = InterfaceIndexLast.loadAcquire(); - if (InterfaceIndexLast.testAndSetOrdered(last, last + 1)) { + int last = ComponentIndexLast.loadAcquire(); + if (ComponentIndexLast.testAndSetOrdered(last, last + 1)) { t_assert(last < 64); if (_index.testAndSetOrdered(0, last + 1)) { - InterfaceWraps[last] = InterfaceWrapStruct(InterfaceWrapTemplate::Size, InterfaceWrapTemplate::Construct, InterfaceWrapTemplate::Destruct, InterfaceWrapTemplate::Assign); + ComponentWraps[last] = ComponentWrapStruct(ComponentWrapTemplate::Size, ComponentWrapTemplate::Construct, ComponentWrapTemplate::Destruct, ComponentWrapTemplate::Move); } break; } @@ -593,27 +750,19 @@ public: return _index.loadAcquire() - 1; } static uint64 Bit() { - return (1 << Index()); + return (1ULL << Index()); } }; -template -class BasicInterfaceWithPointer : public BasicInterface { -public: - BasicInterfaceWithPointer(Interfaces *interfaces) : interfaces(interfaces) { - } - Interfaces *interfaces = 0; -}; - -class InterfacesMetadata { +class ComposerMetadata { public: - InterfacesMetadata(uint64 mask) : size(0), last(64), _mask(mask) { + ComposerMetadata(uint64 mask) : size(0), last(64), _mask(mask) { for (int i = 0; i < 64; ++i) { uint64 m = (1 << i); if (_mask & m) { - int s = InterfaceWraps[i].Size; + int s = ComponentWraps[i].Size; if (s) { offsets[i] = size; size += s; @@ -634,25 +783,31 @@ public: int size, last; int offsets[64]; - bool equals(const uint64 &mask) const { + bool equals(uint64 mask) const { return _mask == mask; } + uint64 maskadd(uint64 mask) const { + return _mask | mask; + } + uint64 maskremove(uint64 mask) const { + return _mask & (~mask); + } private: uint64 _mask; }; -const InterfacesMetadata *GetInterfacesMetadata(uint64 mask); +const ComposerMetadata *GetComposerMetadata(uint64 mask); -class Interfaces { +class Composer { public: - Interfaces(uint64 mask = 0) : _data(zerodata()) { + Composer(uint64 mask = 0) : _data(zerodata()) { if (mask) { - const InterfacesMetadata *meta = GetInterfacesMetadata(mask); - int32 size = sizeof(const InterfacesMetadata *) + meta->size; - void *data = malloc(size); + const ComposerMetadata *meta = GetComposerMetadata(mask); + int size = sizeof(meta) + meta->size; + void *data = operator new(size); if (!data) { // terminate if we can't allocate memory throw "Can't allocate memory!"; } @@ -663,13 +818,13 @@ public: int offset = meta->offsets[i]; if (offset >= 0) { try { - InterfaceWraps[i].Construct(_dataptrunsafe(offset), this); + ComponentWraps[i].Construct(_dataptrunsafe(offset), this); } catch (...) { while (i > 0) { --i; offset = meta->offsets[--i]; if (offset >= 0) { - InterfaceWraps[i].Destruct(_dataptrunsafe(offset)); + ComponentWraps[i].Destruct(_dataptrunsafe(offset)); } } throw; @@ -678,33 +833,41 @@ public: } } } - void UpdateInterfaces(uint64 mask = 0) { - if (!_meta()->equals(mask)) { - Interfaces tmp(mask); - tmp.swap(*this); + Composer(const Composer &other) = delete; + Composer &operator=(const Composer &other) = delete; + ~Composer() { + if (_data != zerodata()) { + const ComposerMetadata *meta = _meta(); + for (int i = 0; i < meta->last; ++i) { + int offset = meta->offsets[i]; + if (offset >= 0) { + ComponentWraps[i].Destruct(_dataptrunsafe(offset)); + } + } + operator delete(_data); + } + } + void UpdateComponents(uint64 mask = 0) { + if (!_meta()->equals(mask)) { + Composer tmp(mask); + tmp.swap(*this); if (_data != zerodata() && tmp._data != zerodata()) { - const InterfacesMetadata *meta = _meta(), *wasmeta = tmp._meta(); + const ComposerMetadata *meta = _meta(), *wasmeta = tmp._meta(); for (int i = 0; i < meta->last; ++i) { int offset = meta->offsets[i], wasoffset = wasmeta->offsets[i]; if (offset >= 0 && wasoffset >= 0) { - InterfaceWraps[i].Assign(_dataptrunsafe(offset), tmp._dataptrunsafe(wasoffset)); + ComponentWraps[i].Move(_dataptrunsafe(offset), tmp._dataptrunsafe(wasoffset)); } } } } } - ~Interfaces() { - if (_data != zerodata()) { - const InterfacesMetadata *meta = _meta(); - for (int i = 0; i < meta->last; ++i) { - int offset = meta->offsets[i]; - if (offset >= 0) { - InterfaceWraps[i].Destruct(_dataptrunsafe(offset)); - } - } - free(_data); - } + void AddComponents(uint64 mask = 0) { + UpdateComponents(_meta()->maskadd(mask)); + } + void RemoveComponents(uint64 mask = 0) { + UpdateComponents(_meta()->maskremove(mask)); } template @@ -716,31 +879,28 @@ public: return static_cast(_dataptr(_meta()->offsets[Type::Index()])); } template - bool Is() const { + bool Has() const { return (_meta()->offsets[Type::Index()] >= 0); } private: - static const InterfacesMetadata *ZeroInterfacesMetadata; + static const ComposerMetadata *ZeroComposerMetadata; static void *zerodata() { - return &ZeroInterfacesMetadata; + return &ZeroComposerMetadata; } void *_dataptrunsafe(int skip) const { - return (char*)_data + sizeof(const InterfacesMetadata*) + skip; + return (char*)_data + sizeof(_meta()) + skip; } void *_dataptr(int skip) const { return (skip >= 0) ? _dataptrunsafe(skip) : 0; } - const InterfacesMetadata *&_meta() const { - return *static_cast(_data); + const ComposerMetadata *&_meta() const { + return *static_cast(_data); } void *_data; - Interfaces(const Interfaces &other); - Interfaces &operator=(const Interfaces &other); - - void swap(Interfaces &other) { + void swap(Composer &other) { std::swap(_data, other._data); } @@ -776,7 +936,7 @@ class FunctionCreator { public: FunctionCreator(FunctionImplementation *ptr) : _ptr(ptr) {} FunctionCreator(const FunctionCreator &other) : _ptr(other.create()) {} - FunctionImplementation *create() const { return exchange(_ptr); } + FunctionImplementation *create() const { return getPointerAndReset(_ptr); } ~FunctionCreator() { destroyImplementation(_ptr); } private: FunctionCreator &operator=(const FunctionCreator &other); @@ -845,7 +1005,7 @@ class Function1Creator { public: Function1Creator(Function1Implementation *ptr) : _ptr(ptr) {} Function1Creator(const Function1Creator &other) : _ptr(other.create()) {} - Function1Implementation *create() const { return exchange(_ptr); } + Function1Implementation *create() const { return getPointerAndReset(_ptr); } ~Function1Creator() { destroyImplementation(_ptr); } private: Function1Creator &operator=(const Function1Creator &other); @@ -914,7 +1074,7 @@ class Function2Creator { public: Function2Creator(Function2Implementation *ptr) : _ptr(ptr) {} Function2Creator(const Function2Creator &other) : _ptr(other.create()) {} - Function2Implementation *create() const { return exchange(_ptr); } + Function2Implementation *create() const { return getPointerAndReset(_ptr); } ~Function2Creator() { destroyImplementation(_ptr); } private: Function2Creator &operator=(const Function2Creator &other); diff --git a/Telegram/SourceFiles/window.cpp b/Telegram/SourceFiles/window.cpp index aef78db08..d2ce17a4f 100644 --- a/Telegram/SourceFiles/window.cpp +++ b/Telegram/SourceFiles/window.cpp @@ -19,27 +19,26 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #include "stdafx.h" -#include "style.h" -#include "lang.h" - -#include "shortcuts.h" #include "window.h" -#include "application.h" +#include "zip.h" + +#include "style.h" +#include "lang.h" +#include "shortcuts.h" +#include "application.h" #include "pspecific.h" #include "title.h" #include "passcodewidget.h" -#include "intro/intro.h" +#include "intro/introwidget.h" #include "mainwidget.h" #include "layerwidget.h" #include "settingswidget.h" #include "boxes/confirmbox.h" #include "boxes/contactsbox.h" #include "boxes/addcontactbox.h" - #include "autoupdater.h" - #include "mediaview.h" #include "localstorage.h" @@ -82,9 +81,9 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) : , history(msg->history()) , item(msg) , fwdCount(fwdCount) -#ifdef Q_OS_WIN +#if defined Q_OS_WIN && !defined Q_OS_WINRT , started(GetTickCount()) -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT , close(this, st::notifyClose) , alphaDuration(st::notifyFastAnim) , posDuration(st::notifyFastAnim) @@ -126,7 +125,7 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) : } void NotifyWindow::checkLastInput() { -#ifdef Q_OS_WIN +#if defined Q_OS_WIN && !defined Q_OS_WINRT LASTINPUTINFO lii; lii.cbSize = sizeof(LASTINPUTINFO); BOOL res = GetLastInputInfo(&lii); @@ -135,14 +134,14 @@ void NotifyWindow::checkLastInput() { } else { inputTimer.start(300); } -#else +#else // Q_OS_WIN && !Q_OS_WINRT // TODO if (true) { hideTimer.start(st::notifyWaitLongHide); } else { inputTimer.start(300); } -#endif +#endif // else for Q_OS_WIN && !Q_OS_WINRT } void NotifyWindow::moveTo(int32 x, int32 y, int32 index) { @@ -172,13 +171,8 @@ void NotifyWindow::updateNotifyDisplay() { p.fillRect(0, st::notifyBorderWidth, st::notifyBorderWidth, h - st::notifyBorderWidth, st::notifyBorder->b); if (!App::passcoded() && cNotifyView() <= dbinvShowName) { - if (history->peer->photo->loaded()) { - p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), history->peer->photo->pix(st::notifyPhotoSize)); - } else { - MTP::clearLoaderPriorities(); - peerPhoto = history->peer->photo; - peerPhoto->load(true, true); - } + history->peer->loadUserpic(true, true); + history->peer->paintUserpicLeft(p, st::notifyPhotoSize, st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), width()); } else { static QPixmap icon = QPixmap::fromImage(App::wnd()->iconLarge().scaled(st::notifyPhotoSize, st::notifyPhotoSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), Qt::ColorOnly); p.drawPixmap(st::notifyPhotoPos.x(), st::notifyPhotoPos.y(), icon); @@ -666,8 +660,8 @@ void Window::sendServiceHistoryRequest() { UserData *user = App::userLoaded(ServiceUserId); if (!user) { - int32 userFlags = MTPDuser::flag_first_name | MTPDuser::flag_phone | MTPDuser::flag_status | MTPDuser::flag_verified; - user = App::feedUsers(MTP_vector(1, MTP_user(MTP_int(userFlags), MTP_int(ServiceUserId), MTPlong(), MTP_string("Telegram"), MTPstring(), MTPstring(), MTP_string("42777"), MTP_userProfilePhotoEmpty(), MTP_userStatusRecently(), MTPint(), MTPstring(), MTPstring()))); + MTPDuser::Flags userFlags = MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_phone | MTPDuser::Flag::f_status | MTPDuser::Flag::f_verified; + user = App::feedUsers(MTP_vector(1, MTP_user(MTP_flags(userFlags), MTP_int(ServiceUserId), MTPlong(), MTP_string("Telegram"), MTPstring(), MTPstring(), MTP_string("42777"), MTP_userProfilePhotoEmpty(), MTP_userStatusRecently(), MTPint(), MTPstring(), MTPstring()))); } _serviceHistoryRequest = MTP::send(MTPmessages_GetHistory(user->input, MTP_int(0), MTP_int(0), MTP_int(0), MTP_int(1), MTP_int(0), MTP_int(0)), main->rpcDone(&MainWidget::serviceHistoryDone), main->rpcFail(&MainWidget::serviceHistoryFail)); } @@ -770,7 +764,7 @@ void Window::mtpStateChanged(int32 dc, int32 state) { void Window::updateTitleStatus() { int32 state = MTP::dcstate(); - if (state == MTProtoConnection::Connecting || state == MTProtoConnection::Disconnected || (state < 0 && state > -600)) { + if (state == MTP::ConnectingState || state == MTP::DisconnectedState || (state < 0 && state > -600)) { if (main || getms() > 5000 || _connecting) { showConnecting(lang(lng_connecting)); } @@ -1042,7 +1036,6 @@ bool Window::eventFilter(QObject *obj, QEvent *e) { break; case QEvent::ShortcutOverride: // handle shortcuts ourselves - DEBUG_LOG(("Shortcut override declined: %1").arg(static_cast(e)->key())); return true; case QEvent::Shortcut: @@ -1417,7 +1410,7 @@ void Window::notifySchedule(History *history, HistoryItem *item) { haveSetting = false; } - int delay = item->Is() ? 500 : 100, t = unixtime(); + int delay = item->Has() ? 500 : 100, t = unixtime(); uint64 ms = getms(true); bool isOnline = main->lastWasOnline(), otherNotOld = ((cOtherOnline() * uint64(1000)) + Global::OnlineCloudTimeout() > t * uint64(1000)); bool otherLaterThanMe = (cOtherOnline() * uint64(1000) + (ms - main->lastSetOnline()) > t * uint64(1000)); @@ -1636,7 +1629,7 @@ void Window::notifyShowNext(NotifyWindow *remove) { notifyWaitTimer.start(next - ms); break; } else { - HistoryItem *fwd = notifyItem->Is() ? notifyItem : 0; // forwarded notify grouping + HistoryItem *fwd = notifyItem->Has() ? notifyItem : nullptr; // forwarded notify grouping int32 fwdCount = 1; uint64 ms = getms(true); @@ -1664,7 +1657,7 @@ void Window::notifyShowNext(NotifyWindow *remove) { } while (history->hasNotification()); if (nextNotify) { if (fwd) { - HistoryItem *nextFwd = nextNotify->Is() ? nextNotify : 0; + HistoryItem *nextFwd = nextNotify->Has() ? nextNotify : nullptr; if (nextFwd && fwd->author() == nextFwd->author() && qAbs(int64(nextFwd->date.toTime_t()) - int64(fwd->date.toTime_t())) < 2) { fwd = nextFwd; ++fwdCount; @@ -2355,7 +2348,7 @@ void LastCrashedWindow::onSendReport() { connect(_checkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError))); connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished())); - _pleaseSendReport.setText(qsl("Sending crash report..")); + _pleaseSendReport.setText(qsl("Sending crash report...")); _sendingState = SendingProgress; _reportShown = false; updateControls(); @@ -2823,7 +2816,7 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) { } break; case UpdatingCheck: - _updating.setText(qsl("Checking for updates..")); + _updating.setText(qsl("Checking for updates...")); break; case UpdatingFail: _updating.setText(qsl("Update check failed :(")); @@ -2930,9 +2923,9 @@ void LastCrashedWindow::onSendingProgress(qint64 uploaded, qint64 total) { _sendingState = SendingUploading; if (total < 0) { - _pleaseSendReport.setText(qsl("Sending crash report %1 KB..").arg(uploaded / 1024)); + _pleaseSendReport.setText(qsl("Sending crash report %1 KB...").arg(uploaded / 1024)); } else { - _pleaseSendReport.setText(qsl("Sending crash report %1 / %2 KB..").arg(uploaded / 1024).arg(total / 1024)); + _pleaseSendReport.setText(qsl("Sending crash report %1 / %2 KB...").arg(uploaded / 1024).arg(total / 1024)); } updateControls(); } @@ -3102,6 +3095,7 @@ void ShowCrashReportWindow::closeEvent(QCloseEvent *e) { deleteLater(); } +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS int showCrashReportWindow(const QString &crashdump) { QString text; @@ -3126,3 +3120,4 @@ int showCrashReportWindow(const QString &crashdump) { ShowCrashReportWindow *wnd = new ShowCrashReportWindow(text); return app.exec(); } +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS diff --git a/Telegram/SourceFiles/window.h b/Telegram/SourceFiles/window.h index 29b8566f9..cecad8cf7 100644 --- a/Telegram/SourceFiles/window.h +++ b/Telegram/SourceFiles/window.h @@ -98,9 +98,9 @@ public slots: private: -#ifdef Q_OS_WIN +#if defined Q_OS_WIN && !defined Q_OS_WINRT DWORD started; -#endif +#endif // Q_OS_WIN && !Q_OS_WINRT History *history; HistoryItem *item; int32 fwdCount; @@ -573,4 +573,6 @@ private: }; +#ifndef TDESKTOP_DISABLE_CRASH_REPORTS int showCrashReportWindow(const QString &crashdump); +#endif // !TDESKTOP_DISABLE_CRASH_REPORTS diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index ccbf8be3b..8e055f9b7 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.32 + 0.9.36 CFBundleSignature ???? CFBundleURLTypes diff --git a/Telegram/Telegram.pro b/Telegram/Telegram.pro index 3ea190507..775839e3e 100644 --- a/Telegram/Telegram.pro +++ b/Telegram/Telegram.pro @@ -114,15 +114,20 @@ SOURCES += \ ./SourceFiles/title.cpp \ ./SourceFiles/types.cpp \ ./SourceFiles/window.cpp \ - ./SourceFiles/mtproto/mtp.cpp \ - ./SourceFiles/mtproto/mtpAuthKey.cpp \ - ./SourceFiles/mtproto/mtpConnection.cpp \ - ./SourceFiles/mtproto/mtpCoreTypes.cpp \ - ./SourceFiles/mtproto/mtpDC.cpp \ - ./SourceFiles/mtproto/mtpFileLoader.cpp \ - ./SourceFiles/mtproto/mtpRPC.cpp \ - ./SourceFiles/mtproto/mtpScheme.cpp \ - ./SourceFiles/mtproto/mtpSession.cpp \ + ./SourceFiles/mtproto/facade.cpp \ + ./SourceFiles/mtproto/auth_key.cpp \ + ./SourceFiles/mtproto/connection.cpp \ + ./SourceFiles/mtproto/connection_abstract.cpp \ + ./SourceFiles/mtproto/connection_auto.cpp \ + ./SourceFiles/mtproto/connection_http.cpp \ + ./SourceFiles/mtproto/connection_tcp.cpp \ + ./SourceFiles/mtproto/core_types.cpp \ + ./SourceFiles/mtproto/dcenter.cpp \ + ./SourceFiles/mtproto/file_download.cpp \ + ./SourceFiles/mtproto/rsa_public_key.cpp \ + ./SourceFiles/mtproto/rpc_sender.cpp \ + ./SourceFiles/mtproto/scheme_auto.cpp \ + ./SourceFiles/mtproto/session.cpp \ ./SourceFiles/gui/animation.cpp \ ./SourceFiles/gui/boxshadow.cpp \ ./SourceFiles/gui/button.cpp \ @@ -160,12 +165,12 @@ SOURCES += \ ./SourceFiles/boxes/sessionsbox.cpp \ ./SourceFiles/boxes/stickersetbox.cpp \ ./SourceFiles/boxes/usernamebox.cpp \ - ./SourceFiles/intro/intro.cpp \ + ./SourceFiles/intro/introwidget.cpp \ ./SourceFiles/intro/introcode.cpp \ ./SourceFiles/intro/introphone.cpp \ ./SourceFiles/intro/intropwdcheck.cpp \ ./SourceFiles/intro/introsignup.cpp \ - ./SourceFiles/intro/introsteps.cpp + ./SourceFiles/intro/introstart.cpp HEADERS += \ ./SourceFiles/stdafx.h \ @@ -205,17 +210,20 @@ HEADERS += \ ./SourceFiles/title.h \ ./SourceFiles/types.h \ ./SourceFiles/window.h \ - ./SourceFiles/mtproto/mtpSessionImpl.h \ - ./SourceFiles/mtproto/mtp.h \ - ./SourceFiles/mtproto/mtpAuthKey.h \ - ./SourceFiles/mtproto/mtpConnection.h \ - ./SourceFiles/mtproto/mtpCoreTypes.h \ - ./SourceFiles/mtproto/mtpDC.h \ - ./SourceFiles/mtproto/mtpFileLoader.h \ - ./SourceFiles/mtproto/mtpPublicRSA.h \ - ./SourceFiles/mtproto/mtpRPC.h \ - ./SourceFiles/mtproto/mtpScheme.h \ - ./SourceFiles/mtproto/mtpSession.h \ + ./SourceFiles/mtproto/facade.h \ + ./SourceFiles/mtproto/auth_key.h \ + ./SourceFiles/mtproto/connection.h \ + ./SourceFiles/mtproto/connection_abstract.h \ + ./SourceFiles/mtproto/connection_auto.h \ + ./SourceFiles/mtproto/connection_http.h \ + ./SourceFiles/mtproto/connection_tcp.h \ + ./SourceFiles/mtproto/core_types.h \ + ./SourceFiles/mtproto/dcenter.h \ + ./SourceFiles/mtproto/file_download.h \ + ./SourceFiles/mtproto/rsa_public_key.h \ + ./SourceFiles/mtproto/rpc_sender.h \ + ./SourceFiles/mtproto/scheme_auto.h \ + ./SourceFiles/mtproto/session.h \ ./SourceFiles/pspecific.h \ ./SourceFiles/gui/animation.h \ ./SourceFiles/gui/boxshadow.h \ @@ -254,18 +262,25 @@ HEADERS += \ ./SourceFiles/boxes/sessionsbox.h \ ./SourceFiles/boxes/stickersetbox.h \ ./SourceFiles/boxes/usernamebox.h \ - ./SourceFiles/intro/intro.h \ + ./SourceFiles/intro/introwidget.h \ ./SourceFiles/intro/introcode.h \ ./SourceFiles/intro/introphone.h \ ./SourceFiles/intro/intropwdcheck.h \ ./SourceFiles/intro/introsignup.h \ - ./SourceFiles/intro/introsteps.h + ./SourceFiles/intro/introstart.h win32 { SOURCES += \ - ./SourceFiles/pspecific_wnd.cpp + ./SourceFiles/pspecific_win.cpp HEADERS += \ - ./SourceFiles/pspecific_wnd.h + ./SourceFiles/pspecific_win.h +} + +winrt { +SOURCES += \ + ./SourceFiles/pspecific_winrt.cpp +HEADERS += \ + ./SourceFiles/pspecific_winrt.h } macx { diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index a798dcff0..a6392a42a 100644 --- a/Telegram/Telegram.rc +++ b/Telegram/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,9,32,0 - PRODUCTVERSION 0,9,32,0 + FILEVERSION 0,9,36,0 + PRODUCTVERSION 0,9,36,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "0.9.32.0" + VALUE "FileVersion", "0.9.36.0" VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "0.9.32.0" + VALUE "ProductVersion", "0.9.36.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Telegram.vcxproj b/Telegram/Telegram.vcxproj index 6f0ffc653..8b18f8ada 100644 --- a/Telegram/Telegram.vcxproj +++ b/Telegram/Telegram.vcxproj @@ -78,6 +78,7 @@ MultiThreadedDebug Disabled /Zm152 %(AdditionalOptions) + Level3 Windows @@ -88,6 +89,7 @@ LIBCMT $(SolutionDir)$(Platform)\$(Configuration)Intermediate\$(TargetName).lib + /ignore:4099 %(AdditionalOptions) @@ -203,10 +205,30 @@ true true + + true + true + true true + + true + true + + + true + true + + + true + true + + + true + true + true true @@ -215,6 +237,10 @@ true true + + true + true + true true @@ -231,10 +257,18 @@ true true + + true + true + true true + + true + true + true true @@ -263,10 +297,6 @@ true true - - true - true - true true @@ -283,6 +313,10 @@ true true + + true + true + true true @@ -307,26 +341,6 @@ true true - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - true true @@ -369,14 +383,23 @@ true true - + true true + + true + true + true + true true + + true + true + true true @@ -461,10 +484,30 @@ true true + + true + true + true true + + true + true + + + true + true + + + true + true + + + true + true + true true @@ -473,6 +516,10 @@ true true + + true + true + true true @@ -489,10 +536,18 @@ true true + + true + true + true true + + true + true + true true @@ -521,10 +576,6 @@ true true - - true - true - true true @@ -541,6 +592,10 @@ true true + + true + true + true true @@ -565,26 +620,6 @@ true true - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - true true @@ -627,14 +662,23 @@ true true - + true true + + true + true + true + true true + + true + true + true true @@ -745,10 +789,30 @@ true true + + true + true + true true + + true + true + + + true + true + + + true + true + + + true + true + true true @@ -757,6 +821,10 @@ true true + + true + true + true true @@ -773,10 +841,18 @@ true true + + true + true + true true + + true + true + true true @@ -805,10 +881,6 @@ true true - - true - true - true true @@ -825,6 +897,10 @@ true true + + true + true + true true @@ -849,26 +925,6 @@ true true - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - true true @@ -911,14 +967,23 @@ true true - + true true + + true + true + true + true true + + true + true + true true @@ -1001,12 +1066,12 @@ - + - + @@ -1017,15 +1082,20 @@ - - - - - - - - - + + + + + + + + + + + + + + @@ -1040,7 +1110,12 @@ true true - + + + true + true + true + @@ -1061,6 +1136,154 @@ + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing pspecific_winrt.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/pspecific_winrt.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing pspecific_winrt.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/pspecific_winrt.h" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing pspecific_winrt.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/pspecific_winrt.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + true + true + true + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_http.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_http.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_http.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_http.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_http.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_http.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_tcp.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_tcp.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_tcp.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_tcp.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_tcp.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_tcp.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_abstract.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_abstract.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_abstract.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_abstract.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_abstract.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_abstract.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_auto.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_auto.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_auto.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_auto.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing connection_auto.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/connection_auto.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing dcenter.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/dcenter.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing dcenter.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/dcenter.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing dcenter.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/dcenter.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing facade.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/facade.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing facade.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/facade.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing facade.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/facade.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing file_download.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/file_download.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing file_download.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/file_download.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing file_download.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/file_download.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing session.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/session.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing session.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/session.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing session.h... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/mtproto/session.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + @@ -1662,19 +1885,19 @@ $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) - - Moc%27ing intro.h... + + Moc%27ing introwidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/intro.h" - Moc%27ing intro.h... - Moc%27ing intro.h... + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/introwidget.h" + Moc%27ing introwidget.h... + Moc%27ing introwidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/intro.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/intro.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/intro/introwidget.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/intro/introwidget.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing introcode.h... @@ -1732,7 +1955,7 @@ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/intro/intropwdcheck.h" - + Moc%27ing layerwidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp @@ -1798,20 +2021,6 @@ - - Moc%27ing mtpConnection.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpConnection.h" - Moc%27ing mtpConnection.h... - Moc%27ing mtpConnection.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpConnection.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpConnection.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing mainwidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp @@ -1826,20 +2035,6 @@ $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) - - Moc%27ing mtp.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtp.h" - Moc%27ing mtp.h... - Moc%27ing mtp.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtp.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtp.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing mediaview.h... @@ -1854,53 +2049,6 @@ .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mediaview.h" - - - Moc%27ing mtpFileLoader.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpFileLoader.h" - Moc%27ing mtpFileLoader.h... - Moc%27ing mtpFileLoader.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpFileLoader.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpFileLoader.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - - - - - Moc%27ing mtpDC.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpDC.h" - Moc%27ing mtpDC.h... - Moc%27ing mtpDC.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpDC.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpDC.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - - - - - Moc%27ing mtpSession.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpSession.h" - Moc%27ing mtpSession.h... - Moc%27ing mtpSession.h... - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpSession.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/mtproto/mtpSession.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - Moc%27ing settingswidget.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp @@ -1929,21 +2077,20 @@ $(QTDIR)\bin\moc.exe;%(FullPath) $(QTDIR)\bin\moc.exe;%(FullPath) - - Moc%27ing pspecific_wnd.h... + + Moc%27ing pspecific_win.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/pspecific_wnd.h" - Moc%27ing pspecific_wnd.h... - Moc%27ing pspecific_wnd.h... + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl_debug\Debug\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h" + Moc%27ing pspecific_win.h... + Moc%27ing pspecific_win.h... .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/pspecific_wnd.h" - "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" "-fstdafx.h" "-f../../SourceFiles/pspecific_wnd.h" - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h" -DAL_LIBTYPE_STATIC -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + "$(QTDIR)\bin\moc.exe" "%(FullPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" "-fstdafx.h" "-f../../SourceFiles/pspecific_win.h" -DAL_LIBTYPE_STATIC -DCUSTOM_API_ID -DUNICODE -DWIN32 -DWIN64 -DHAVE_STDINT_H -DZLIB_WINAPI -DQT_NO_DEBUG -DNDEBUG -D_SCL_SECURE_NO_WARNINGS "-I.\..\..\Libraries\lzma\C" "-I.\..\..\Libraries\libexif-0.6.20" "-I.\..\..\Libraries\zlib-1.2.8" "-I.\..\..\Libraries\openssl\Release\include" "-I.\..\..\Libraries\ffmpeg" "-I.\..\..\Libraries\openal-soft\include" "-I.\SourceFiles" "-I.\GeneratedFiles" "-I.\..\..\Libraries\breakpad\src" "-I.\ThirdParty\minizip" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I.\..\..\Libraries\QtStatic\qtbase\include\QtCore\5.5.1\QtCore" "-I.\..\..\Libraries\QtStatic\qtbase\include\QtGui\5.5.1\QtGui" + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) + $(QTDIR)\bin\moc.exe;%(FullPath);$(QTDIR)\bin\moc.exe;%(FullPath) - $(QTDIR)\bin\moc.exe;%(FullPath) Moc%27ing overviewwidget.h... @@ -2139,6 +2286,8 @@ + + true true diff --git a/Telegram/Telegram.vcxproj.filters b/Telegram/Telegram.vcxproj.filters index 3c80ea71f..86d65c3fb 100644 --- a/Telegram/Telegram.vcxproj.filters +++ b/Telegram/Telegram.vcxproj.filters @@ -63,15 +63,6 @@ Source Files - - mtproto - - - mtproto - - - mtproto - Source Files @@ -102,9 +93,6 @@ gui - - mtproto - Source Files @@ -117,9 +105,6 @@ Source Files - - mtproto - Source Files @@ -138,9 +123,6 @@ gui - - mtproto - Source Files @@ -165,9 +147,6 @@ gui - - Source Files - Source Files @@ -201,9 +180,6 @@ boxes - - intro - intro @@ -213,9 +189,6 @@ intro - - intro - Source Files @@ -291,15 +264,6 @@ Generated Files\Release - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - Generated Files\Deploy @@ -327,51 +291,6 @@ Generated Files\Release - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - Generated Files\Deploy @@ -426,15 +345,6 @@ Generated Files\Release - - Generated Files\Deploy - - - Generated Files\Debug - - - Generated Files\Release - Generated Files\Deploy @@ -651,12 +561,6 @@ Generated Files\Release - - mtproto - - - mtproto - boxes @@ -888,9 +792,6 @@ Source Files - - mtproto - Source Files @@ -909,26 +810,176 @@ Source Files + + intro + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + intro + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + Source Files + + + Source Files + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Deploy + + + mtproto + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Deploy + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + mtproto + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + mtproto + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Debug + + + Generated Files\Release + + + Generated Files\Deploy + + + Generated Files\Debug + + + Generated Files\Release + Source Files - - mtproto - - - mtproto - - - mtproto - Source Files - - mtproto - Generated Files @@ -941,9 +992,6 @@ Source Files - - mtproto - Source Files @@ -962,9 +1010,6 @@ gui - - intro - gui @@ -977,9 +1022,6 @@ Source Files - - mtproto - Generated Files @@ -1010,17 +1052,26 @@ Source Files + + intro + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + - - mtproto - - - mtproto - - - mtproto - Source Files @@ -1060,18 +1111,12 @@ gui - - mtproto - Source Files Source Files - - mtproto - gui @@ -1084,9 +1129,6 @@ gui - - Source Files - Source Files @@ -1117,9 +1159,6 @@ boxes - - intro - intro @@ -1234,6 +1273,42 @@ Source Files + + intro + + + Source Files + + + Source Files + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + + + mtproto + @@ -1272,6 +1347,12 @@ Version + + mtproto + + + mtproto + diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj index b2574c90f..7c99556fb 100644 --- a/Telegram/Telegram.xcodeproj/project.pbxproj +++ b/Telegram/Telegram.xcodeproj/project.pbxproj @@ -37,12 +37,12 @@ 0250AB6761AC71A2E3155EEA /* moc_introphone.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 1B4A65B84270FF2FED008EB6 /* moc_introphone.cpp */; settings = {ATTRIBUTES = (); }; }; 02F93BF511880983D3C57B84 /* dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = E466873F01ABA1E55E914489 /* dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; }; 03270F718426CFE84729079E /* flattextarea.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5C7FD422BBEDA858D7237AE9 /* flattextarea.cpp */; settings = {ATTRIBUTES = (); }; }; - 06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */; settings = {ATTRIBUTES = (); }; }; + 06EABCC49D2EEE4076322BE7 /* moc_facade.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 924D4939FD169BB4B8AEB1C9 /* moc_facade.cpp */; settings = {ATTRIBUTES = (); }; }; 07080BCF1A43588C00741A51 /* lang_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07080BCD1A43588C00741A51 /* lang_auto.cpp */; }; 07080BD21A436A5000741A51 /* lang.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07080BD01A436A5000741A51 /* lang.cpp */; }; 0710C9FE1B0B9376001B4272 /* stickersetbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0710C9FC1B0B9376001B4272 /* stickersetbox.cpp */; }; 0710CA051B0B9404001B4272 /* moc_stickersetbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0710CA041B0B9404001B4272 /* moc_stickersetbox.cpp */; }; - 07129D6A1C16D230002DC495 /* mtpAuthKey.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07129D691C16D230002DC495 /* mtpAuthKey.cpp */; }; + 07129D6A1C16D230002DC495 /* auth_key.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07129D691C16D230002DC495 /* auth_key.cpp */; }; 07129D6E1C16D245002DC495 /* facades.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07129D6C1C16D245002DC495 /* facades.cpp */; }; 071AD8D21C5E8E6D008C9E90 /* zip.c in Compile Sources */ = {isa = PBXBuildFile; fileRef = 071AD8D11C5E8E6D008C9E90 /* zip.c */; }; 071AD8F81C5E99D6008C9E90 /* ioapi.c in Compile Sources */ = {isa = PBXBuildFile; fileRef = 071AD8F71C5E99D6008C9E90 /* ioapi.c */; }; @@ -64,6 +64,17 @@ 075FEBEC1C82336D0003ECA3 /* shortcuts.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 075FEBEA1C82336D0003ECA3 /* shortcuts.cpp */; }; 0764D55A1ABAD6F900FBFEED /* apiwrap.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0764D5581ABAD6F900FBFEED /* apiwrap.cpp */; }; 0764D55D1ABAD71B00FBFEED /* moc_apiwrap.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0764D55C1ABAD71B00FBFEED /* moc_apiwrap.cpp */; }; + 077A4AF71CA41C38002188D2 /* connection_abstract.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AEC1CA41C38002188D2 /* connection_abstract.cpp */; }; + 077A4AF81CA41C38002188D2 /* connection_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AEE1CA41C38002188D2 /* connection_auto.cpp */; }; + 077A4AF91CA41C38002188D2 /* connection_http.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF01CA41C38002188D2 /* connection_http.cpp */; }; + 077A4AFA1CA41C38002188D2 /* connection_tcp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF21CA41C38002188D2 /* connection_tcp.cpp */; }; + 077A4AFB1CA41C38002188D2 /* generate.py in Resources */ = {isa = PBXBuildFile; fileRef = 077A4AF41CA41C38002188D2 /* generate.py */; }; + 077A4AFC1CA41C38002188D2 /* rsa_public_key.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AF51CA41C38002188D2 /* rsa_public_key.cpp */; }; + 077A4AFD1CA41C38002188D2 /* scheme.tl in Resources */ = {isa = PBXBuildFile; fileRef = 077A4AF61CA41C38002188D2 /* scheme.tl */; }; + 077A4B031CA41EE2002188D2 /* moc_connection_abstract.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4AFF1CA41EE2002188D2 /* moc_connection_abstract.cpp */; }; + 077A4B041CA41EE2002188D2 /* moc_connection_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4B001CA41EE2002188D2 /* moc_connection_auto.cpp */; }; + 077A4B051CA41EE2002188D2 /* moc_connection_http.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4B011CA41EE2002188D2 /* moc_connection_http.cpp */; }; + 077A4B061CA41EE2002188D2 /* moc_connection_tcp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 077A4B021CA41EE2002188D2 /* moc_connection_tcp.cpp */; }; 078A2FCA1A811C5900CCC7A0 /* moc_backgroundbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 078A2FC91A811C5900CCC7A0 /* moc_backgroundbox.cpp */; }; 078A2FCD1A811CA600CCC7A0 /* backgroundbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 078A2FCB1A811CA600CCC7A0 /* backgroundbox.cpp */; }; 07A69332199277BA0099CB9F /* mediaview.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07A69330199277BA0099CB9F /* mediaview.cpp */; }; @@ -83,8 +94,8 @@ 07D703BB19B88FB900C4EED2 /* moc_audio.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D703BA19B88FB900C4EED2 /* moc_audio.cpp */; }; 07D7954A1B5544B200DE9598 /* qtpcre in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 07D795491B5544B200DE9598 /* qtpcre */; }; 07D7EABA1A597DD000838BA2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 07D7EABC1A597DD000838BA2 /* Localizable.strings */; }; - 07D8509419F5C97E00623D75 /* mtpCoreTypes.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509219F5C97E00623D75 /* mtpCoreTypes.cpp */; }; - 07D8509519F5C97E00623D75 /* mtpScheme.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509319F5C97E00623D75 /* mtpScheme.cpp */; }; + 07D8509419F5C97E00623D75 /* core_types.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509219F5C97E00623D75 /* core_types.cpp */; }; + 07D8509519F5C97E00623D75 /* scheme_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509319F5C97E00623D75 /* scheme_auto.cpp */; }; 07D8509919F8320900623D75 /* usernamebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8509719F8320900623D75 /* usernamebox.cpp */; }; 07D8510819F8340A00623D75 /* moc_usernamebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07D8510719F8340A00623D75 /* moc_usernamebox.cpp */; }; 07DB67471AD07C4F00A51329 /* structs.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DB67451AD07C4F00A51329 /* structs.cpp */; }; @@ -98,8 +109,8 @@ 07DE92AA1AA4928200A18F6F /* moc_autolockbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE92A91AA4928200A18F6F /* moc_autolockbox.cpp */; }; 07DE92AD1AA4928B00A18F6F /* moc_passcodebox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE92AB1AA4928B00A18F6F /* moc_passcodebox.cpp */; }; 07DE92AE1AA4928B00A18F6F /* moc_passcodewidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 07DE92AC1AA4928B00A18F6F /* moc_passcodewidget.cpp */; }; - 0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* mtp.cpp */; settings = {ATTRIBUTES = (); }; }; - 0F7872E39EA570249D420912 /* moc_intro.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = A37C7E516201B0264A4CDA38 /* moc_intro.cpp */; settings = {ATTRIBUTES = (); }; }; + 0CB7DE9A54CC9BF86FB7B5CA /* facade.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6D50D70712776D7ED3B00E5C /* facade.cpp */; settings = {ATTRIBUTES = (); }; }; + 0F7872E39EA570249D420912 /* moc_introwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = A37C7E516201B0264A4CDA38 /* moc_introwidget.cpp */; settings = {ATTRIBUTES = (); }; }; 113AA97DEE7847C7D2DCFF71 /* logs.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 974DB34EEB8F83B91614C0B0 /* logs.cpp */; settings = {ATTRIBUTES = (); }; }; 1299DDAE203A7EDFED9F5D6B /* main.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5271C394C1E7646D117CE67E /* main.cpp */; settings = {ATTRIBUTES = (); }; }; 15364689D2AB5A30E87A689F /* Security.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 205259EEEE2BADA5E64741E3 /* Security.framework */; }; @@ -110,7 +121,7 @@ 1DF53374E3B6A31661548D08 /* historywidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = A83D2C19F756D3371E5999A8 /* historywidget.cpp */; settings = {ATTRIBUTES = (); }; }; 26A81090DC8B5BCF7278FDFF /* qrc_telegram.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = D6FF6676816C4E374D374060 /* qrc_telegram.cpp */; settings = {ATTRIBUTES = (); }; }; 298BFAB73BF182297584F96F /* contactsbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8C800AAC9549E6E9E7046BED /* contactsbox.cpp */; settings = {ATTRIBUTES = (); }; }; - 2A500B102B7CE80F3EB6E13E /* moc_mtpFileLoader.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5591A965D1DC024FBDB40151 /* moc_mtpFileLoader.cpp */; settings = {ATTRIBUTES = (); }; }; + 2A500B102B7CE80F3EB6E13E /* moc_file_download.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5591A965D1DC024FBDB40151 /* moc_file_download.cpp */; settings = {ATTRIBUTES = (); }; }; 2EF5D0AC9A18F9FE9B8A1ACA /* moc_introsignup.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 58A7114F60E7D09E73283983 /* moc_introsignup.cpp */; settings = {ATTRIBUTES = (); }; }; 328FD74542F6E2C873EE4D4B /* ApplicationServices.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = DFD7912080BC557230093752 /* ApplicationServices.framework */; }; 352349751855EF76DECA4D60 /* moc_historywidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 2C99425D7670941EAF07B453 /* moc_historywidget.cpp */; settings = {ATTRIBUTES = (); }; }; @@ -156,26 +167,26 @@ 8771A8C96E9C391044035D99 /* OpenGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D4B32C2222F82AC56BADEB21 /* OpenGL.framework */; }; 8883FF366F2623E89D90A9E6 /* qgenericbearer in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 9A55B8F7C143D66AD9EAE304 /* qgenericbearer */; }; 89ADB41E48A3B5E24ABB626C /* profilewidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = CF32DF59C7823E4F3397EF3C /* profilewidget.cpp */; settings = {ATTRIBUTES = (); }; }; - 8B22E794EFF0EAFF964A3043 /* introsteps.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C34459FA465B57DF4DB80D12 /* introsteps.cpp */; settings = {ATTRIBUTES = (); }; }; + 8B22E794EFF0EAFF964A3043 /* introstart.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C34459FA465B57DF4DB80D12 /* introstart.cpp */; settings = {ATTRIBUTES = (); }; }; 8B71D1C7BB9DCEE6511219C2 /* moc_flatlabel.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 2181F5E34DE0A4B2F811E2E2 /* moc_flatlabel.cpp */; settings = {ATTRIBUTES = (); }; }; 8C4BA0DB55E2C40DE5F5E990 /* moc_pspecific_mac.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 74772222DA764BE4623EAC5D /* moc_pspecific_mac.cpp */; settings = {ATTRIBUTES = (); }; }; 8D267F2E4776F0ECA2F49DC8 /* IOKit.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = A1A67BEAA744704B29168D39 /* IOKit.framework */; }; 8D33FE22B9BBADC7FA46C15B /* qtharfbuzzng in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D6193B79CECC9DD0142D1200 /* qtharfbuzzng */; }; 8E26A0653012B8E8C3E865EC /* application.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C20F9DD8C7B031B8E20D5653 /* application.cpp */; settings = {ATTRIBUTES = (); }; }; 8F65F0D95B1F0CEB859F2FB3 /* boxshadow.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 08A7682548FB7E671FF03822 /* boxshadow.cpp */; settings = {ATTRIBUTES = (); }; }; - 8F6F5D7F82036331E8C6DAE6 /* moc_mtpConnection.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = B714EA71A09A832FAA846A0A /* moc_mtpConnection.cpp */; settings = {ATTRIBUTES = (); }; }; + 8F6F5D7F82036331E8C6DAE6 /* moc_connection.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = B714EA71A09A832FAA846A0A /* moc_connection.cpp */; settings = {ATTRIBUTES = (); }; }; 90085DF442550A0845D5AF37 /* style_core.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 420A06A32B66D250142B4B6D /* style_core.cpp */; settings = {ATTRIBUTES = (); }; }; 9357E7B12AD6D88B157ACA05 /* introcode.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = A0090709DE1B155085362C36 /* introcode.cpp */; settings = {ATTRIBUTES = (); }; }; 9809A3AF1946D51ACB41D716 /* moc_photocropbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = AF61D864B8C444ADD4E1B391 /* moc_photocropbox.cpp */; settings = {ATTRIBUTES = (); }; }; 98E4F55DB5D8E64AB9F08C83 /* moc_localimageloader.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 1D7899ACAA9F973CADFA34C1 /* moc_localimageloader.cpp */; settings = {ATTRIBUTES = (); }; }; - 99F0A9B2AFE5ABDCBFC04510 /* mtpRPC.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 89F92B278CA31C393E245056 /* mtpRPC.cpp */; settings = {ATTRIBUTES = (); }; }; + 99F0A9B2AFE5ABDCBFC04510 /* rpc_sender.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 89F92B278CA31C393E245056 /* rpc_sender.cpp */; settings = {ATTRIBUTES = (); }; }; 9A0D5DDC7816FC2538EB6A96 /* moc_window.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6B46A0EE3C3B9D3B5A24946E /* moc_window.cpp */; settings = {ATTRIBUTES = (); }; }; - 9A523F51135FD4E2464673A6 /* moc_mtpSession.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 63AF8520023B4EA40306CB03 /* moc_mtpSession.cpp */; settings = {ATTRIBUTES = (); }; }; + 9A523F51135FD4E2464673A6 /* moc_session.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 63AF8520023B4EA40306CB03 /* moc_session.cpp */; settings = {ATTRIBUTES = (); }; }; 9D294F23E02CFDF22C288382 /* moc_emojibox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0C0DC15EB416789673526AA5 /* moc_emojibox.cpp */; settings = {ATTRIBUTES = (); }; }; 9F33AC0693BC81B27D8F518D /* Qt5Gui in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 04391BE7A8B9D811E255100A /* Qt5Gui */; }; A0A6B97F7DBEC81004EC9461 /* confirmbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6610564B876E47D289A596DB /* confirmbox.cpp */; settings = {ATTRIBUTES = (); }; }; A24E4B5B683764E07683ECEC /* moc_mainwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 3A220FD1AE5AD9FE3DC073A4 /* moc_mainwidget.cpp */; settings = {ATTRIBUTES = (); }; }; - A297B1E3CE33CC501DFEDB6E /* mtpSession.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0FBED3C6654EA3753EB39831 /* mtpSession.cpp */; settings = {ATTRIBUTES = (); }; }; + A297B1E3CE33CC501DFEDB6E /* session.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0FBED3C6654EA3753EB39831 /* session.cpp */; settings = {ATTRIBUTES = (); }; }; A3F8F2284013928A02AE5C38 /* qwbmp in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8CF51323544B886B8F4A2232 /* qwbmp */; }; A469EC9C4C367E0B773A9BB7 /* moc_settingswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 93AFE74928551FC3D7E8390B /* moc_settingswidget.cpp */; settings = {ATTRIBUTES = (); }; }; A9563D9C9FD0D76FAAF1CA96 /* qdds in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = D3D1BE0BEA3AEE0551AD39AC /* qdds */; }; @@ -184,10 +195,10 @@ B0B88EFE444C0DE673389418 /* moc_flatbutton.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C9FFCCE4FCB845744636795F /* moc_flatbutton.cpp */; settings = {ATTRIBUTES = (); }; }; B2F5B08BFFBBE7E37D3863BB /* moc_button.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 46292F489228B60010794CE4 /* moc_button.cpp */; settings = {ATTRIBUTES = (); }; }; B460F624007324313696BE86 /* QuartzCore.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 7EC00404ACD5AB0E97726B0E /* QuartzCore.framework */; }; - B6346B66B0A2228A91D8A5D9 /* mtpDC.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 315C7FACB4A9E18AA95486CA /* mtpDC.cpp */; settings = {ATTRIBUTES = (); }; }; - B780F9E21269259B90A1F32A /* moc_mtpDC.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 2C540BAEABD7F9B5FA11008E /* moc_mtpDC.cpp */; settings = {ATTRIBUTES = (); }; }; + B6346B66B0A2228A91D8A5D9 /* dcenter.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 315C7FACB4A9E18AA95486CA /* dcenter.cpp */; settings = {ATTRIBUTES = (); }; }; + B780F9E21269259B90A1F32A /* moc_dcenter.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 2C540BAEABD7F9B5FA11008E /* moc_dcenter.cpp */; settings = {ATTRIBUTES = (); }; }; B78304F135DEF1F7A68393A6 /* CoreMedia.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 547CCADBD1CC5050167EF948 /* CoreMedia.framework */; }; - B8CA3E1E11A7E0E7DF9E1CDE /* mtpFileLoader.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 01D6341DC31FE5997F7BB159 /* mtpFileLoader.cpp */; settings = {ATTRIBUTES = (); }; }; + B8CA3E1E11A7E0E7DF9E1CDE /* file_download.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 01D6341DC31FE5997F7BB159 /* file_download.cpp */; settings = {ATTRIBUTES = (); }; }; B8DA82DA1B195A933A0805E7 /* sysbuttons.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6B90F69947805586A6FAE80E /* sysbuttons.cpp */; settings = {ATTRIBUTES = (); }; }; B91D13BCC3963CB9C12D24A4 /* flatcheckbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = AF4585F593B1C9D0D4FD061C /* flatcheckbox.cpp */; settings = {ATTRIBUTES = (); }; }; B99CCE43EEFCD3E18F6D16D1 /* settingswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8CCCACE96535180FEB557712 /* settingswidget.cpp */; settings = {ATTRIBUTES = (); }; }; @@ -211,13 +222,13 @@ D846C6F212B438DC2FD5FF71 /* moc_dialogswidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 3B3ED09AB00290D78CF1181B /* moc_dialogswidget.cpp */; settings = {ATTRIBUTES = (); }; }; D87463318C8E5211C8C8670A /* stdafx.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 5A5431331A13AA7B07414240 /* stdafx.cpp */; settings = {ATTRIBUTES = (); }; }; DE6A34CA3A5561888FA01AF1 /* flatlabel.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 763ED3C6815ED6C89E352652 /* flatlabel.cpp */; settings = {ATTRIBUTES = (); }; }; - DF259E9677CC63AF8754032B /* mtpConnection.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = B8D9AFA42E8633154A9817A2 /* mtpConnection.cpp */; settings = {ATTRIBUTES = (); }; }; + DF259E9677CC63AF8754032B /* connection.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = B8D9AFA42E8633154A9817A2 /* connection.cpp */; settings = {ATTRIBUTES = (); }; }; DF36EA42D67ED39E58CB7DF9 /* settings.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 8A28F7789408AA839F48A5F2 /* settings.cpp */; settings = {ATTRIBUTES = (); }; }; E3194392BD6D0726F75FA72E /* mainwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 047DAFB0A7DE92C63033A43C /* mainwidget.cpp */; settings = {ATTRIBUTES = (); }; }; E3D7A5CA24541D5DB69D6606 /* images.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 6A510365F9F6367ECB0DB065 /* images.cpp */; settings = {ATTRIBUTES = (); }; }; E45E51A644D5FC9F942ECE55 /* AGL.framework in Link Binary With Libraries */ = {isa = PBXBuildFile; fileRef = 8D9815BDB5BD9F90D2BC05C5 /* AGL.framework */; }; E8B28580819B882A5964561A /* moc_addcontactbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 81780025807318AEA3B8A6FF /* moc_addcontactbox.cpp */; settings = {ATTRIBUTES = (); }; }; - E8D95529CED88F18818C9A8B /* intro.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0771C4C94B623FC34BF62983 /* intro.cpp */; settings = {ATTRIBUTES = (); }; }; + E8D95529CED88F18818C9A8B /* introwidget.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 0771C4C94B623FC34BF62983 /* introwidget.cpp */; settings = {ATTRIBUTES = (); }; }; E97B3CFAB59B49BACFFC5F7C /* moc_title.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 1080B6D395843B8F76A2E45E /* moc_title.cpp */; settings = {ATTRIBUTES = (); }; }; E9F1CE7F9B18C7C85A50E62D /* style_auto.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = 99B8D38F7F5858601230911E /* style_auto.cpp */; settings = {ATTRIBUTES = (); }; }; EBE29731916DB43BF49FE7A4 /* aboutbox.cpp in Compile Sources */ = {isa = PBXBuildFile; fileRef = C194EDD00F76216057D48A5C /* aboutbox.cpp */; settings = {ATTRIBUTES = (); }; }; @@ -260,7 +271,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 01D6341DC31FE5997F7BB159 /* mtpFileLoader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtpFileLoader.cpp; path = SourceFiles/mtproto/mtpFileLoader.cpp; sourceTree = ""; }; + 01D6341DC31FE5997F7BB159 /* file_download.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = file_download.cpp; path = SourceFiles/mtproto/file_download.cpp; sourceTree = ""; }; 032C1BF3E727B450A4851D48 /* emojibox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = emojibox.h; path = SourceFiles/boxes/emojibox.h; sourceTree = ""; }; 04391BE7A8B9D811E255100A /* Qt5Gui */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = Qt5Gui; path = "/usr/local/Qt-5.5.1/lib/libQt5Gui$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; 047DAFB0A7DE92C63033A43C /* mainwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mainwidget.cpp; path = SourceFiles/mainwidget.cpp; sourceTree = ""; }; @@ -276,7 +287,7 @@ 0710C9FC1B0B9376001B4272 /* stickersetbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stickersetbox.cpp; path = SourceFiles/boxes/stickersetbox.cpp; sourceTree = SOURCE_ROOT; }; 0710C9FD1B0B9376001B4272 /* stickersetbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stickersetbox.h; path = SourceFiles/boxes/stickersetbox.h; sourceTree = SOURCE_ROOT; }; 0710CA041B0B9404001B4272 /* moc_stickersetbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_stickersetbox.cpp; path = GeneratedFiles/Debug/moc_stickersetbox.cpp; sourceTree = SOURCE_ROOT; }; - 07129D691C16D230002DC495 /* mtpAuthKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mtpAuthKey.cpp; path = SourceFiles/mtproto/mtpAuthKey.cpp; sourceTree = SOURCE_ROOT; }; + 07129D691C16D230002DC495 /* auth_key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = auth_key.cpp; path = SourceFiles/mtproto/auth_key.cpp; sourceTree = SOURCE_ROOT; }; 07129D6C1C16D245002DC495 /* facades.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = facades.cpp; path = SourceFiles/facades.cpp; sourceTree = SOURCE_ROOT; }; 07129D6D1C16D245002DC495 /* facades.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = facades.h; path = SourceFiles/facades.h; sourceTree = SOURCE_ROOT; }; 071AD86B1C5E8536008C9E90 /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = ThirdParty/minizip/crypt.h; sourceTree = SOURCE_ROOT; }; @@ -284,8 +295,6 @@ 071AD86E1C5E8536008C9E90 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zip.h; path = ThirdParty/minizip/zip.h; sourceTree = SOURCE_ROOT; }; 071AD8D11C5E8E6D008C9E90 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zip.c; path = ThirdParty/minizip/zip.c; sourceTree = SOURCE_ROOT; }; 071AD8F71C5E99D6008C9E90 /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = ThirdParty/minizip/ioapi.c; sourceTree = SOURCE_ROOT; }; - 071AD9091C5EA2A5008C9E90 /* Breakpad.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Breakpad.framework; path = Users/antanubis/TBuild/Libraries/breakpad/Breakpad.framework; sourceTree = ""; }; - 071AD90B1C5EA37D008C9E90 /* Breakpad.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Breakpad.framework; path = "Users/antanubis/Library/Developer/Xcode/DerivedData/Breakpad-ffxagkgqghkohhawycvgjexmnjhs/Build/Products/Debug/Breakpad.framework"; sourceTree = ""; }; 072E117A1A56EB9400A87ACC /* lang_pt_BR.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = lang_pt_BR.strings; path = SourceFiles/langs/lang_pt_BR.strings; sourceTree = SOURCE_ROOT; }; 0732E4A7199E262300D50FE7 /* overviewwidget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = overviewwidget.cpp; path = SourceFiles/overviewwidget.cpp; sourceTree = SOURCE_ROOT; }; 0732E4A8199E262300D50FE7 /* overviewwidget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = overviewwidget.h; path = SourceFiles/overviewwidget.h; sourceTree = SOURCE_ROOT; }; @@ -313,7 +322,22 @@ 0764D5581ABAD6F900FBFEED /* apiwrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = apiwrap.cpp; path = SourceFiles/apiwrap.cpp; sourceTree = SOURCE_ROOT; }; 0764D5591ABAD6F900FBFEED /* apiwrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = apiwrap.h; path = SourceFiles/apiwrap.h; sourceTree = SOURCE_ROOT; }; 0764D55C1ABAD71B00FBFEED /* moc_apiwrap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_apiwrap.cpp; path = GeneratedFiles/Debug/moc_apiwrap.cpp; sourceTree = SOURCE_ROOT; }; - 0771C4C94B623FC34BF62983 /* intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = intro.cpp; path = SourceFiles/intro/intro.cpp; sourceTree = ""; }; + 0771C4C94B623FC34BF62983 /* introwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introwidget.cpp; path = SourceFiles/intro/introwidget.cpp; sourceTree = ""; }; + 077A4AEC1CA41C38002188D2 /* connection_abstract.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = connection_abstract.cpp; path = SourceFiles/mtproto/connection_abstract.cpp; sourceTree = SOURCE_ROOT; }; + 077A4AED1CA41C38002188D2 /* connection_abstract.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = connection_abstract.h; path = SourceFiles/mtproto/connection_abstract.h; sourceTree = SOURCE_ROOT; }; + 077A4AEE1CA41C38002188D2 /* connection_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = connection_auto.cpp; path = SourceFiles/mtproto/connection_auto.cpp; sourceTree = SOURCE_ROOT; }; + 077A4AEF1CA41C38002188D2 /* connection_auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = connection_auto.h; path = SourceFiles/mtproto/connection_auto.h; sourceTree = SOURCE_ROOT; }; + 077A4AF01CA41C38002188D2 /* connection_http.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = connection_http.cpp; path = SourceFiles/mtproto/connection_http.cpp; sourceTree = SOURCE_ROOT; }; + 077A4AF11CA41C38002188D2 /* connection_http.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = connection_http.h; path = SourceFiles/mtproto/connection_http.h; sourceTree = SOURCE_ROOT; }; + 077A4AF21CA41C38002188D2 /* connection_tcp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = connection_tcp.cpp; path = SourceFiles/mtproto/connection_tcp.cpp; sourceTree = SOURCE_ROOT; }; + 077A4AF31CA41C38002188D2 /* connection_tcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = connection_tcp.h; path = SourceFiles/mtproto/connection_tcp.h; sourceTree = SOURCE_ROOT; }; + 077A4AF41CA41C38002188D2 /* generate.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = generate.py; path = SourceFiles/mtproto/generate.py; sourceTree = SOURCE_ROOT; }; + 077A4AF51CA41C38002188D2 /* rsa_public_key.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rsa_public_key.cpp; path = SourceFiles/mtproto/rsa_public_key.cpp; sourceTree = SOURCE_ROOT; }; + 077A4AF61CA41C38002188D2 /* scheme.tl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = scheme.tl; path = SourceFiles/mtproto/scheme.tl; sourceTree = SOURCE_ROOT; }; + 077A4AFF1CA41EE2002188D2 /* moc_connection_abstract.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_connection_abstract.cpp; path = GeneratedFiles/Debug/moc_connection_abstract.cpp; sourceTree = SOURCE_ROOT; }; + 077A4B001CA41EE2002188D2 /* moc_connection_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_connection_auto.cpp; path = GeneratedFiles/Debug/moc_connection_auto.cpp; sourceTree = SOURCE_ROOT; }; + 077A4B011CA41EE2002188D2 /* moc_connection_http.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_connection_http.cpp; path = GeneratedFiles/Debug/moc_connection_http.cpp; sourceTree = SOURCE_ROOT; }; + 077A4B021CA41EE2002188D2 /* moc_connection_tcp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_connection_tcp.cpp; path = GeneratedFiles/Debug/moc_connection_tcp.cpp; sourceTree = SOURCE_ROOT; }; 078A2FC91A811C5900CCC7A0 /* moc_backgroundbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_backgroundbox.cpp; path = GeneratedFiles/Debug/moc_backgroundbox.cpp; sourceTree = SOURCE_ROOT; }; 078A2FCB1A811CA600CCC7A0 /* backgroundbox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = backgroundbox.cpp; path = SourceFiles/boxes/backgroundbox.cpp; sourceTree = SOURCE_ROOT; }; 078A2FCC1A811CA600CCC7A0 /* backgroundbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = backgroundbox.h; path = SourceFiles/boxes/backgroundbox.h; sourceTree = SOURCE_ROOT; }; @@ -351,8 +375,8 @@ 07D7EABF1A597DD400838BA2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/Localizable.strings; sourceTree = ""; }; 07D7EAC01A597DD500838BA2 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = ""; }; 07D7EAC11A597DD600838BA2 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = ""; }; - 07D8509219F5C97E00623D75 /* mtpCoreTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mtpCoreTypes.cpp; path = SourceFiles/mtproto/mtpCoreTypes.cpp; sourceTree = SOURCE_ROOT; }; - 07D8509319F5C97E00623D75 /* mtpScheme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mtpScheme.cpp; path = SourceFiles/mtproto/mtpScheme.cpp; sourceTree = SOURCE_ROOT; }; + 07D8509219F5C97E00623D75 /* core_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = core_types.cpp; path = SourceFiles/mtproto/core_types.cpp; sourceTree = SOURCE_ROOT; }; + 07D8509319F5C97E00623D75 /* scheme_auto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scheme_auto.cpp; path = SourceFiles/mtproto/scheme_auto.cpp; sourceTree = SOURCE_ROOT; }; 07D8509719F8320900623D75 /* usernamebox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = usernamebox.cpp; path = SourceFiles/boxes/usernamebox.cpp; sourceTree = SOURCE_ROOT; }; 07D8509819F8320900623D75 /* usernamebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = usernamebox.h; path = SourceFiles/boxes/usernamebox.h; sourceTree = SOURCE_ROOT; }; 07D8510719F8340A00623D75 /* moc_usernamebox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_usernamebox.cpp; path = GeneratedFiles/Debug/moc_usernamebox.cpp; sourceTree = SOURCE_ROOT; }; @@ -384,7 +408,7 @@ 0CAA815FFFEDCD84808E11F5 /* logs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = logs.h; path = SourceFiles/logs.h; sourceTree = ""; }; 0ECF1EB9BF3786A16731F685 /* emojibox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = emojibox.cpp; path = SourceFiles/boxes/emojibox.cpp; sourceTree = ""; }; 0F8FFD87AEBAC448568570DC /* images.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = images.h; path = SourceFiles/gui/images.h; sourceTree = ""; }; - 0FBED3C6654EA3753EB39831 /* mtpSession.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtpSession.cpp; path = SourceFiles/mtproto/mtpSession.cpp; sourceTree = ""; }; + 0FBED3C6654EA3753EB39831 /* session.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = session.cpp; path = SourceFiles/mtproto/session.cpp; sourceTree = ""; }; 0FC38EE7F29EF895925A2C49 /* style_core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = style_core.h; path = SourceFiles/gui/style_core.h; sourceTree = ""; }; 1080B6D395843B8F76A2E45E /* moc_title.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_title.cpp; path = GeneratedFiles/Debug/moc_title.cpp; sourceTree = ""; }; 111BBEE3D1432C3B517FD539 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qdds.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qdds.pri"; sourceTree = ""; }; @@ -393,7 +417,7 @@ 135FD3715BFDC50AD7B00E04 /* text.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = text.cpp; path = SourceFiles/gui/text.cpp; sourceTree = ""; }; 143405635D04698F421A12EA /* aboutbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = aboutbox.h; path = SourceFiles/boxes/aboutbox.h; sourceTree = ""; }; 14437BFDCD58FF1742EF1B35 /* photocropbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = photocropbox.h; path = SourceFiles/boxes/photocropbox.h; sourceTree = ""; }; - 152B8D1BCECEB7B0C77E073C /* intro.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = intro.h; path = SourceFiles/intro/intro.h; sourceTree = ""; }; + 152B8D1BCECEB7B0C77E073C /* introwidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = introwidget.h; path = SourceFiles/intro/introwidget.h; sourceTree = ""; }; 16DD53E17C65AC8B450CC6C3 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_quick.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_quick.pri"; sourceTree = ""; }; 186D09F4CB713AD4B8BDD260 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; 19618554524B8D928F13940D /* emoji_config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = emoji_config.h; path = SourceFiles/gui/emoji_config.h; sourceTree = ""; }; @@ -418,11 +442,11 @@ 25CA12A22B83B0B038C5B5DE /* langloaderplain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = langloaderplain.h; path = SourceFiles/langloaderplain.h; sourceTree = ""; }; 26083D8E535AFF927591E1A5 /* moc_contactsbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_contactsbox.cpp; path = GeneratedFiles/Debug/moc_contactsbox.cpp; sourceTree = ""; }; 26B83A58EE268598E703875D /* history.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = history.cpp; path = SourceFiles/history.cpp; sourceTree = ""; }; - 27E7471A4EC90E84353AA16F /* mtpCoreTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpCoreTypes.h; path = SourceFiles/mtproto/mtpCoreTypes.h; sourceTree = ""; }; + 27E7471A4EC90E84353AA16F /* core_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_types.h; path = SourceFiles/mtproto/core_types.h; sourceTree = ""; }; 28BD0D10214709D95B161E24 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_multimediawidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_multimediawidgets.pri"; sourceTree = ""; }; 293C8DEEE270847AC20E70F9 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_network.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_network.pri"; sourceTree = ""; }; 2BB2A1BB8DB0993F78F4E3C7 /* title.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = title.cpp; path = SourceFiles/title.cpp; sourceTree = ""; }; - 2C540BAEABD7F9B5FA11008E /* moc_mtpDC.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mtpDC.cpp; path = GeneratedFiles/Debug/moc_mtpDC.cpp; sourceTree = ""; }; + 2C540BAEABD7F9B5FA11008E /* moc_dcenter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_dcenter.cpp; path = GeneratedFiles/Debug/moc_dcenter.cpp; sourceTree = ""; }; 2C99425D7670941EAF07B453 /* moc_historywidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_historywidget.cpp; path = GeneratedFiles/Debug/moc_historywidget.cpp; sourceTree = ""; }; 2E48BB382B895A5ACD79AF9F /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_bluetooth_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_bluetooth_private.pri"; sourceTree = ""; }; 2E6D9B1D2743D24E31B0B284 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_xmlpatterns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_xmlpatterns.pri"; sourceTree = ""; }; @@ -430,7 +454,7 @@ 301BB513F2F5D447B3BF22DF /* window.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = window.h; path = SourceFiles/window.h; sourceTree = ""; }; 311004331A04F3D69C98643C /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_serialport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_serialport_private.pri"; sourceTree = ""; }; 31120EDB269DFF13E1D49847 /* qicns */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qicns; path = "/usr/local/Qt-5.5.1/plugins/imageformats/libqicns$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; - 315C7FACB4A9E18AA95486CA /* mtpDC.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtpDC.cpp; path = SourceFiles/mtproto/mtpDC.cpp; sourceTree = ""; }; + 315C7FACB4A9E18AA95486CA /* dcenter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = dcenter.cpp; path = SourceFiles/mtproto/dcenter.cpp; sourceTree = ""; }; 33F165B1DB8CBF182C56FAB5 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_macextras_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_macextras_private.pri"; sourceTree = ""; }; 346287C9E754E7C458153F03 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qwbmp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qwbmp.pri"; sourceTree = ""; }; 34E1DF19219C52D7DB20224A /* flatlabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = flatlabel.h; path = SourceFiles/gui/flatlabel.h; sourceTree = ""; }; @@ -457,7 +481,7 @@ 48003469151B9DDE82E851FB /* moc_profilewidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_profilewidget.cpp; path = GeneratedFiles/Debug/moc_profilewidget.cpp; sourceTree = ""; }; 4AF15B5A0A43EB62D6DAF211 /* libexif.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libexif.a; path = "../../Libraries/libexif-0.6.20/libexif/.libs/libexif.a"; sourceTree = ""; }; 4C6C71914B1926119120DACD /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_enginio_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_enginio_private.pri"; sourceTree = ""; }; - 4D1099F2D3696E8A0E17D37D /* mtpSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpSession.h; path = SourceFiles/mtproto/mtpSession.h; sourceTree = ""; }; + 4D1099F2D3696E8A0E17D37D /* session.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = session.h; path = SourceFiles/mtproto/session.h; sourceTree = ""; }; 4D504A849F15EB58E53A4E5F /* title.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = title.h; path = SourceFiles/title.h; sourceTree = ""; }; 4D55B83DFDFE3D492CDBD27A /* button.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = button.cpp; path = SourceFiles/gui/button.cpp; sourceTree = ""; }; 4D765E1B1EA6C757220C63E7 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; @@ -468,7 +492,7 @@ 51355181C0E6689B0B764543 /* connectionbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = connectionbox.cpp; path = SourceFiles/boxes/connectionbox.cpp; sourceTree = ""; }; 5271C394C1E7646D117CE67E /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = SourceFiles/main.cpp; sourceTree = ""; }; 547CCADBD1CC5050167EF948 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = /System/Library/Frameworks/CoreMedia.framework; sourceTree = ""; }; - 5591A965D1DC024FBDB40151 /* moc_mtpFileLoader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mtpFileLoader.cpp; path = GeneratedFiles/Debug/moc_mtpFileLoader.cpp; sourceTree = ""; }; + 5591A965D1DC024FBDB40151 /* moc_file_download.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_file_download.cpp; path = GeneratedFiles/Debug/moc_file_download.cpp; sourceTree = ""; }; 5597304BEC94BFB9EAAEBC4B /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_openglextensions_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_openglextensions_private.pri"; sourceTree = ""; }; 55A654A2EE8554FF062742B8 /* moc_twidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_twidget.cpp; path = GeneratedFiles/Debug/moc_twidget.cpp; sourceTree = ""; }; 55B4A93DD455EED91C899A8E /* dialogswidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dialogswidget.h; path = SourceFiles/dialogswidget.h; sourceTree = ""; }; @@ -487,7 +511,7 @@ 6102C69805B6398AF6FA5BEB /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_qml_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_qml_private.pri"; sourceTree = ""; }; 61C679D8B4B332026BD34200 /* introphone.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introphone.cpp; path = SourceFiles/intro/introphone.cpp; sourceTree = ""; }; 62807F13DBD204D0716143AD /* Telegram.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Telegram.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 63AF8520023B4EA40306CB03 /* moc_mtpSession.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mtpSession.cpp; path = GeneratedFiles/Debug/moc_mtpSession.cpp; sourceTree = ""; }; + 63AF8520023B4EA40306CB03 /* moc_session.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_session.cpp; path = GeneratedFiles/Debug/moc_session.cpp; sourceTree = ""; }; 63E722139886C87BC82DBDF5 /* /usr/local/Qt-5.5.1/mkspecs/macx-clang/qmake.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/macx-clang/qmake.conf"; sourceTree = ""; }; 6532A0DC7EFE446967682E83 /* moc_downloadpathbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_downloadpathbox.cpp; path = GeneratedFiles/Debug/moc_downloadpathbox.cpp; sourceTree = ""; }; 6610564B876E47D289A596DB /* confirmbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = confirmbox.cpp; path = SourceFiles/boxes/confirmbox.cpp; sourceTree = ""; }; @@ -500,7 +524,7 @@ 6B90F69947805586A6FAE80E /* sysbuttons.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = sysbuttons.cpp; path = SourceFiles/sysbuttons.cpp; sourceTree = ""; }; 6C08BFC27C4C303A3A5181DB /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_printsupport.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_printsupport.pri"; sourceTree = ""; }; 6C86B6E6AB1857B735B720D6 /* layerwidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = layerwidget.h; path = SourceFiles/layerwidget.h; sourceTree = ""; }; - 6D50D70712776D7ED3B00E5C /* mtp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtp.cpp; path = SourceFiles/mtproto/mtp.cpp; sourceTree = ""; }; + 6D50D70712776D7ED3B00E5C /* facade.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = facade.cpp; path = SourceFiles/mtproto/facade.cpp; sourceTree = ""; }; 6E1859D714E4471E053D90C9 /* scrollarea.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = scrollarea.cpp; path = SourceFiles/gui/scrollarea.cpp; sourceTree = ""; }; 6E67D23B15FC4B628DB2E0B2 /* /usr/local/Qt-5.5.1/mkspecs/qdevice.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/qdevice.pri"; sourceTree = ""; }; 6E8FD0ED1B60D43929944CD2 /* text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = text.h; path = SourceFiles/gui/text.h; sourceTree = ""; }; @@ -508,7 +532,7 @@ 723F90793B2C195E2CCB2233 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 73737DC91E390C4AB18FB595 /* pspecific_mac_p.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = pspecific_mac_p.mm; path = SourceFiles/pspecific_mac_p.mm; sourceTree = ""; }; 74772222DA764BE4623EAC5D /* moc_pspecific_mac.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_pspecific_mac.cpp; path = GeneratedFiles/Debug/moc_pspecific_mac.cpp; sourceTree = ""; }; - 748F1BCCBEEB3675768960FB /* mtpAuthKey.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpAuthKey.h; path = SourceFiles/mtproto/mtpAuthKey.h; sourceTree = ""; }; + 748F1BCCBEEB3675768960FB /* auth_key.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = auth_key.h; path = SourceFiles/mtproto/auth_key.h; sourceTree = ""; }; 74C1C232DFAA71028A0412CA /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtmultimedia_m3u.pri"; sourceTree = ""; }; 763ED3C6815ED6C89E352652 /* flatlabel.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = flatlabel.cpp; path = SourceFiles/gui/flatlabel.cpp; sourceTree = ""; }; 77FF486B1F9BCD55A8A3F35D /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_concurrent.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_concurrent.pri"; sourceTree = ""; }; @@ -518,7 +542,7 @@ 7CDE9D7CB2C729BC3612372B /* addcontactbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = addcontactbox.h; path = SourceFiles/boxes/addcontactbox.h; sourceTree = ""; }; 7D075A915E8739C1B6BC5F43 /* types.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = types.cpp; path = SourceFiles/types.cpp; sourceTree = ""; }; 7D28E9003CE64D8A7F2E292E /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_concurrent_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_concurrent_private.pri"; sourceTree = ""; }; - 7DBFC0B5EAF874BA10E3D603 /* mtpScheme.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpScheme.h; path = SourceFiles/mtproto/mtpScheme.h; sourceTree = ""; }; + 7DBFC0B5EAF874BA10E3D603 /* scheme_auto.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = scheme_auto.h; path = SourceFiles/mtproto/scheme_auto.h; sourceTree = ""; }; 7DE30A90667C03C4F91A2A91 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_sql.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_sql.pri"; sourceTree = ""; }; 7EC00404ACD5AB0E97726B0E /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = ""; }; 7ECCC1F9442988B4F2707CC1 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_core.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_core.pri"; sourceTree = ""; }; @@ -534,11 +558,11 @@ 87A4C1983FD641360BF80A02 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtaccessiblewidgets.pri"; sourceTree = ""; }; 87EEF25EE25CF21572D1438C /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_websockets_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_websockets_private.pri"; sourceTree = ""; }; 8849E60AEC7DB97A475C17EA /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_testlib_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_testlib_private.pri"; sourceTree = ""; }; - 8880067F9BFD46108777E134 /* mtp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtp.h; path = SourceFiles/mtproto/mtp.h; sourceTree = ""; }; + 8880067F9BFD46108777E134 /* facade.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = facade.h; path = SourceFiles/mtproto/facade.h; sourceTree = ""; }; 8918F4B71ED5FC138AFD3F70 /* moc_scrollarea.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_scrollarea.cpp; path = GeneratedFiles/Debug/moc_scrollarea.cpp; sourceTree = ""; }; 892D36BEF797BA4AF48D378A /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtsensors_dummy.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtsensors_dummy.pri"; sourceTree = ""; }; 89863CCAF1D29037AE95755D /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_declarative_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_declarative_private.pri"; sourceTree = ""; }; - 89F92B278CA31C393E245056 /* mtpRPC.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtpRPC.cpp; path = SourceFiles/mtproto/mtpRPC.cpp; sourceTree = ""; }; + 89F92B278CA31C393E245056 /* rpc_sender.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = rpc_sender.cpp; path = SourceFiles/mtproto/rpc_sender.cpp; sourceTree = ""; }; 8A04A4A3625204D12A1207F6 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_nfc.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_nfc.pri"; sourceTree = ""; }; 8A28F7789408AA839F48A5F2 /* settings.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = settings.cpp; path = SourceFiles/settings.cpp; sourceTree = ""; }; 8A9D926C08392F7A9BC83B0C /* fileuploader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fileuploader.h; path = SourceFiles/fileuploader.h; sourceTree = ""; }; @@ -557,11 +581,11 @@ 8F500B5166907B6D9A7C3E3D /* qico */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qico; path = "/usr/local/Qt-5.5.1/plugins/imageformats/libqico$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; 8F572030CE9AB8CC5F672201 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_platformsupport_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_platformsupport_private.pri"; sourceTree = ""; }; 8F97C9CAE38CA3AFAC0B3953 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_websockets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_websockets.pri"; sourceTree = ""; }; - 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mtp.cpp; path = GeneratedFiles/Debug/moc_mtp.cpp; sourceTree = ""; }; + 924D4939FD169BB4B8AEB1C9 /* moc_facade.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_facade.cpp; path = GeneratedFiles/Debug/moc_facade.cpp; sourceTree = ""; }; 93AFE74928551FC3D7E8390B /* moc_settingswidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_settingswidget.cpp; path = GeneratedFiles/Debug/moc_settingswidget.cpp; sourceTree = ""; }; 946BEA667170DC1A7A8F9DB0 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmng.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmng.pri"; sourceTree = ""; }; - 963123025C466CB8DD9CF4AF /* mtpConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpConnection.h; path = SourceFiles/mtproto/mtpConnection.h; sourceTree = ""; }; - 96ACDDE3DCB798B97F9EA2F4 /* mtpFileLoader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpFileLoader.h; path = SourceFiles/mtproto/mtpFileLoader.h; sourceTree = ""; }; + 963123025C466CB8DD9CF4AF /* connection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = connection.h; path = SourceFiles/mtproto/connection.h; sourceTree = ""; }; + 96ACDDE3DCB798B97F9EA2F4 /* file_download.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = file_download.h; path = SourceFiles/mtproto/file_download.h; sourceTree = ""; }; 9742F24EE18EA44D52824F1E /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = /System/Library/Frameworks/CoreServices.framework; sourceTree = ""; }; 974DB34EEB8F83B91614C0B0 /* logs.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = logs.cpp; path = SourceFiles/logs.cpp; sourceTree = ""; }; 99B8D38F7F5858601230911E /* style_auto.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = style_auto.cpp; path = GeneratedFiles/style_auto.cpp; sourceTree = ""; }; @@ -579,8 +603,8 @@ A022AF919D1977534CA66BB8 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_widgets.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_widgets.pri"; sourceTree = ""; }; A1479F94376F9732B57C69DB /* moc_animation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_animation.cpp; path = GeneratedFiles/Debug/moc_animation.cpp; sourceTree = ""; }; A1A67BEAA744704B29168D39 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - A3622760CEC6D6827A25E710 /* mtpPublicRSA.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpPublicRSA.h; path = SourceFiles/mtproto/mtpPublicRSA.h; sourceTree = ""; }; - A37C7E516201B0264A4CDA38 /* moc_intro.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_intro.cpp; path = GeneratedFiles/Debug/moc_intro.cpp; sourceTree = ""; }; + A3622760CEC6D6827A25E710 /* rsa_public_key.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = rsa_public_key.h; path = SourceFiles/mtproto/rsa_public_key.h; sourceTree = ""; }; + A37C7E516201B0264A4CDA38 /* moc_introwidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_introwidget.cpp; path = GeneratedFiles/Debug/moc_introwidget.cpp; sourceTree = ""; }; A4D8AC60897F435C1C3B9D02 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtsensors_generic.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtsensors_generic.pri"; sourceTree = ""; }; A59F74CD76FDC2B4B9910E18 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_scripttools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_scripttools_private.pri"; sourceTree = ""; }; A5B17ABEFBA1C2F43443D644 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_macextras.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_macextras.pri"; sourceTree = ""; }; @@ -596,7 +620,7 @@ AC9B5F6FB4B984C8D76F7AE2 /* moc_dropdown.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_dropdown.cpp; path = GeneratedFiles/Debug/moc_dropdown.cpp; sourceTree = ""; }; ACC8A73268E5D9AF64E97AF4 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_bluetooth.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_bluetooth.pri"; sourceTree = ""; }; AD0C395D671BC024083A5FC7 /* localimageloader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = localimageloader.h; path = SourceFiles/localimageloader.h; sourceTree = ""; }; - AD90723EF02EAD016FD49CC9 /* introsteps.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = introsteps.h; path = SourceFiles/intro/introsteps.h; sourceTree = ""; }; + AD90723EF02EAD016FD49CC9 /* introstart.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = introstart.h; path = SourceFiles/intro/introstart.h; sourceTree = ""; }; ADC6308023253CEA51F86E21 /* qwebp */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qwebp; path = "/usr/local/Qt-5.5.1/plugins/imageformats/libqwebp$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; ADFC79902C14A612AE93A89A /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_svg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_svg.pri"; sourceTree = ""; }; AEA456A2F75ED9F5CDA7BCBE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; @@ -609,15 +633,15 @@ B26239063A068F800A2C95F4 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qwebp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qwebp.pri"; sourceTree = ""; }; B3062303CE8F4EB9325CB3DC /* emoji_config.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = emoji_config.cpp; path = SourceFiles/gui/emoji_config.cpp; sourceTree = ""; }; B382B645B34234E451AE5D94 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_qml.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_qml.pri"; sourceTree = ""; }; - B3D42654F18B1FE49512C404 /* mtpDC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpDC.h; path = SourceFiles/mtproto/mtpDC.h; sourceTree = ""; }; + B3D42654F18B1FE49512C404 /* dcenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = dcenter.h; path = SourceFiles/mtproto/dcenter.h; sourceTree = ""; }; B518DA4EE7376002AFC71FD5 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_uitools_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_uitools_private.pri"; sourceTree = ""; }; B51B01657BFE9EAEF5590561 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_nfc_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_nfc_private.pri"; sourceTree = ""; }; B678DA730B4ECE863AD631AE /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qminimal.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qminimal.pri"; sourceTree = ""; }; - B714EA71A09A832FAA846A0A /* moc_mtpConnection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_mtpConnection.cpp; path = GeneratedFiles/Debug/moc_mtpConnection.cpp; sourceTree = ""; }; + B714EA71A09A832FAA846A0A /* moc_connection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_connection.cpp; path = GeneratedFiles/Debug/moc_connection.cpp; sourceTree = ""; }; B8525798C5AA7D7C6D68E1B3 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmldbg_qtquick2.pri"; sourceTree = ""; }; B88236FC554B694F618D848C /* moc_sysbuttons.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = moc_sysbuttons.cpp; path = GeneratedFiles/Debug/moc_sysbuttons.cpp; sourceTree = ""; }; B8C1F6C965A7A14FBA8D4518 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtmedia_audioengine.pri"; sourceTree = ""; }; - B8D9AFA42E8633154A9817A2 /* mtpConnection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = mtpConnection.cpp; path = SourceFiles/mtproto/mtpConnection.cpp; sourceTree = ""; }; + B8D9AFA42E8633154A9817A2 /* connection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = connection.cpp; path = SourceFiles/mtproto/connection.cpp; sourceTree = ""; }; B97D4DB97FE881648644211A /* downloadpathbox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = downloadpathbox.h; path = SourceFiles/boxes/downloadpathbox.h; sourceTree = ""; }; BB1602EA641643DE565005B1 /* twidget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = twidget.cpp; path = SourceFiles/gui/twidget.cpp; sourceTree = ""; }; BD22EFEFCC02644B1883CE19 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtiff.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qtiff.pri"; sourceTree = ""; }; @@ -629,7 +653,7 @@ C194EDD00F76216057D48A5C /* aboutbox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = aboutbox.cpp; path = SourceFiles/boxes/aboutbox.cpp; sourceTree = ""; }; C19DF71B273A4843553518F2 /* app.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = app.h; path = SourceFiles/app.h; sourceTree = ""; }; C20F9DD8C7B031B8E20D5653 /* application.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = application.cpp; path = SourceFiles/application.cpp; sourceTree = ""; }; - C34459FA465B57DF4DB80D12 /* introsteps.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introsteps.cpp; path = SourceFiles/intro/introsteps.cpp; sourceTree = ""; }; + C34459FA465B57DF4DB80D12 /* introstart.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = introstart.cpp; path = SourceFiles/intro/introstart.cpp; sourceTree = ""; }; C4295BE59CCEBCDD16268349 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qico.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qico.pri"; sourceTree = ""; }; C505A18319B9B63C63877858 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_script_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_script_private.pri"; sourceTree = ""; }; C63C6D083EBEB13A60256DF3 /* historywidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = historywidget.h; path = SourceFiles/historywidget.h; sourceTree = ""; }; @@ -683,7 +707,6 @@ EB1F99FD112917157F3C3F6E /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qicns.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qicns.pri"; sourceTree = ""; }; EB29AC635054C09EFA749AE1 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmldbg_tcp.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qmldbg_tcp.pri"; sourceTree = ""; }; EBD39B69F368CEEAC360A16D /* /usr/local/Qt-5.5.1/mkspecs/common/mac.conf */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/common/mac.conf"; sourceTree = ""; }; - EC4D4A7398CAAD47386D9CA0 /* mtpSessionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpSessionImpl.h; path = SourceFiles/mtproto/mtpSessionImpl.h; sourceTree = ""; }; EE03BC5CA4628A6D6BEB0122 /* qcorewlanbearer */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qcorewlanbearer; path = "/usr/local/Qt-5.5.1/plugins/bearer/libqcorewlanbearer$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; EF1AD6A66D0C28A6A15E2C30 /* introphone.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = introphone.h; path = SourceFiles/intro/introphone.h; sourceTree = ""; }; F0681BC551FC8A2B132FC646 /* qjp2 */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = qjp2; path = "/usr/local/Qt-5.5.1/plugins/imageformats/libqjp2$(QT_LIBRARY_SUFFIX).a"; sourceTree = ""; }; @@ -699,7 +722,7 @@ F80095A026AF9453E9C2B8BD /* settingswidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = settingswidget.h; path = SourceFiles/settingswidget.h; sourceTree = ""; }; F83F87F8A60C9DF666911D42 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qsvg.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_plugin_qsvg.pri"; sourceTree = ""; }; F9BEAA743A908603687DA204 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_xmlpatterns_private.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_xmlpatterns_private.pri"; sourceTree = ""; }; - FB61F72601D91BF3AC730D20 /* mtpRPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mtpRPC.h; path = SourceFiles/mtproto/mtpRPC.h; sourceTree = ""; }; + FB61F72601D91BF3AC730D20 /* rpc_sender.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = rpc_sender.h; path = SourceFiles/mtproto/rpc_sender.h; sourceTree = ""; }; FCC237CA5AD60B9BA4447615 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; FD944B80F033DFE737D401A2 /* /usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_help.pri */ = {isa = PBXFileReference; lastKnownFileType = text; path = "/usr/local/Qt-5.5.1/mkspecs/modules/qt_lib_help.pri"; sourceTree = ""; }; FE8FD20832B4C226E345CFBA /* mainwidget.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = mainwidget.h; path = SourceFiles/mainwidget.h; sourceTree = ""; }; @@ -816,26 +839,36 @@ 1A6AA22F4A758C4B5F5138FB /* mtproto */ = { isa = PBXGroup; children = ( - 6D50D70712776D7ED3B00E5C /* mtp.cpp */, - 07129D691C16D230002DC495 /* mtpAuthKey.cpp */, - B8D9AFA42E8633154A9817A2 /* mtpConnection.cpp */, - 07D8509219F5C97E00623D75 /* mtpCoreTypes.cpp */, - 315C7FACB4A9E18AA95486CA /* mtpDC.cpp */, - 01D6341DC31FE5997F7BB159 /* mtpFileLoader.cpp */, - 89F92B278CA31C393E245056 /* mtpRPC.cpp */, - 07D8509319F5C97E00623D75 /* mtpScheme.cpp */, - 0FBED3C6654EA3753EB39831 /* mtpSession.cpp */, - EC4D4A7398CAAD47386D9CA0 /* mtpSessionImpl.h */, - 8880067F9BFD46108777E134 /* mtp.h */, - 748F1BCCBEEB3675768960FB /* mtpAuthKey.h */, - 963123025C466CB8DD9CF4AF /* mtpConnection.h */, - 27E7471A4EC90E84353AA16F /* mtpCoreTypes.h */, - B3D42654F18B1FE49512C404 /* mtpDC.h */, - 96ACDDE3DCB798B97F9EA2F4 /* mtpFileLoader.h */, - A3622760CEC6D6827A25E710 /* mtpPublicRSA.h */, - FB61F72601D91BF3AC730D20 /* mtpRPC.h */, - 7DBFC0B5EAF874BA10E3D603 /* mtpScheme.h */, - 4D1099F2D3696E8A0E17D37D /* mtpSession.h */, + 07129D691C16D230002DC495 /* auth_key.cpp */, + 748F1BCCBEEB3675768960FB /* auth_key.h */, + B8D9AFA42E8633154A9817A2 /* connection.cpp */, + 963123025C466CB8DD9CF4AF /* connection.h */, + 077A4AEC1CA41C38002188D2 /* connection_abstract.cpp */, + 077A4AED1CA41C38002188D2 /* connection_abstract.h */, + 077A4AEE1CA41C38002188D2 /* connection_auto.cpp */, + 077A4AEF1CA41C38002188D2 /* connection_auto.h */, + 077A4AF01CA41C38002188D2 /* connection_http.cpp */, + 077A4AF11CA41C38002188D2 /* connection_http.h */, + 077A4AF21CA41C38002188D2 /* connection_tcp.cpp */, + 077A4AF31CA41C38002188D2 /* connection_tcp.h */, + 07D8509219F5C97E00623D75 /* core_types.cpp */, + 27E7471A4EC90E84353AA16F /* core_types.h */, + 315C7FACB4A9E18AA95486CA /* dcenter.cpp */, + B3D42654F18B1FE49512C404 /* dcenter.h */, + 6D50D70712776D7ED3B00E5C /* facade.cpp */, + 8880067F9BFD46108777E134 /* facade.h */, + 01D6341DC31FE5997F7BB159 /* file_download.cpp */, + 96ACDDE3DCB798B97F9EA2F4 /* file_download.h */, + 89F92B278CA31C393E245056 /* rpc_sender.cpp */, + FB61F72601D91BF3AC730D20 /* rpc_sender.h */, + 077A4AF51CA41C38002188D2 /* rsa_public_key.cpp */, + A3622760CEC6D6827A25E710 /* rsa_public_key.h */, + 07D8509319F5C97E00623D75 /* scheme_auto.cpp */, + 7DBFC0B5EAF874BA10E3D603 /* scheme_auto.h */, + 0FBED3C6654EA3753EB39831 /* session.cpp */, + 4D1099F2D3696E8A0E17D37D /* session.h */, + 077A4AF41CA41C38002188D2 /* generate.py */, + 077A4AF61CA41C38002188D2 /* scheme.tl */, ); name = mtproto; sourceTree = ""; @@ -908,18 +941,18 @@ 5E35A03E5F2C51353EBCBF00 /* intro */ = { isa = PBXGroup; children = ( - 0771C4C94B623FC34BF62983 /* intro.cpp */, + 0771C4C94B623FC34BF62983 /* introwidget.cpp */, A0090709DE1B155085362C36 /* introcode.cpp */, 61C679D8B4B332026BD34200 /* introphone.cpp */, 07DB674F1AD07CB800A51329 /* intropwdcheck.cpp */, A9FF4818C6775109B3DBFA18 /* introsignup.cpp */, - C34459FA465B57DF4DB80D12 /* introsteps.cpp */, - 152B8D1BCECEB7B0C77E073C /* intro.h */, + C34459FA465B57DF4DB80D12 /* introstart.cpp */, + 152B8D1BCECEB7B0C77E073C /* introwidget.h */, 098EA7CE256AAFAE4A17EB77 /* introcode.h */, EF1AD6A66D0C28A6A15E2C30 /* introphone.h */, 07DB67501AD07CB800A51329 /* intropwdcheck.h */, DC23E0B79FF53F35BA8F76A1 /* introsignup.h */, - AD90723EF02EAD016FD49CC9 /* introsteps.h */, + AD90723EF02EAD016FD49CC9 /* introstart.h */, ); name = intro; sourceTree = ""; @@ -1146,6 +1179,10 @@ 801973D3334D0FCA849CF485 /* Debug */ = { isa = PBXGroup; children = ( + 077A4AFF1CA41EE2002188D2 /* moc_connection_abstract.cpp */, + 077A4B001CA41EE2002188D2 /* moc_connection_auto.cpp */, + 077A4B011CA41EE2002188D2 /* moc_connection_http.cpp */, + 077A4B021CA41EE2002188D2 /* moc_connection_tcp.cpp */, 07B604341B46A20900CA29FE /* moc_playerwidget.cpp */, 07C759711B1F7E2800662169 /* moc_autoupdater.cpp */, 0710CA041B0B9404001B4272 /* moc_stickersetbox.cpp */, @@ -1179,11 +1216,11 @@ B88236FC554B694F618D848C /* moc_sysbuttons.cpp */, 1080B6D395843B8F76A2E45E /* moc_title.cpp */, 6B46A0EE3C3B9D3B5A24946E /* moc_window.cpp */, - 924D4939FD169BB4B8AEB1C9 /* moc_mtp.cpp */, - B714EA71A09A832FAA846A0A /* moc_mtpConnection.cpp */, - 2C540BAEABD7F9B5FA11008E /* moc_mtpDC.cpp */, - 5591A965D1DC024FBDB40151 /* moc_mtpFileLoader.cpp */, - 63AF8520023B4EA40306CB03 /* moc_mtpSession.cpp */, + 924D4939FD169BB4B8AEB1C9 /* moc_facade.cpp */, + B714EA71A09A832FAA846A0A /* moc_connection.cpp */, + 2C540BAEABD7F9B5FA11008E /* moc_dcenter.cpp */, + 5591A965D1DC024FBDB40151 /* moc_file_download.cpp */, + 63AF8520023B4EA40306CB03 /* moc_session.cpp */, A1479F94376F9732B57C69DB /* moc_animation.cpp */, 46292F489228B60010794CE4 /* moc_button.cpp */, 9D9F4744B2F9FF22569D4535 /* moc_countryinput.cpp */, @@ -1203,7 +1240,7 @@ 0C0DC15EB416789673526AA5 /* moc_emojibox.cpp */, AF61D864B8C444ADD4E1B391 /* moc_photocropbox.cpp */, 9E0704DE8650D7952DC6B7AE /* moc_photosendbox.cpp */, - A37C7E516201B0264A4CDA38 /* moc_intro.cpp */, + A37C7E516201B0264A4CDA38 /* moc_introwidget.cpp */, 8B98A212C068D6CC7CE73CAA /* moc_introcode.cpp */, 1B4A65B84270FF2FED008EB6 /* moc_introphone.cpp */, 58A7114F60E7D09E73283983 /* moc_introsignup.cpp */, @@ -1256,8 +1293,6 @@ AF39DD055C3EF8226FBE929D /* Frameworks */ = { isa = PBXGroup; children = ( - 071AD90B1C5EA37D008C9E90 /* Breakpad.framework */, - 071AD9091C5EA2A5008C9E90 /* Breakpad.framework */, 0752F8741C2C89F40026D0BC /* VideoToolbox.framework */, 0752F8721C2C89220026D0BC /* VideoDecodeAcceleration.framework */, 07CAACD71AEA64F00058E508 /* AudioUnit.framework */, @@ -1433,9 +1468,11 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 077A4AFB1CA41C38002188D2 /* generate.py in Resources */, 0749CE69194D723400345D61 /* Images.xcassets in Resources */, 07AF95FA1AFD03C80060B057 /* telegram_mac.qrc in Resources */, 07D7EABA1A597DD000838BA2 /* Localizable.strings in Resources */, + 077A4AFD1CA41C38002188D2 /* scheme.tl in Resources */, 07AF95F91AFD03C80060B057 /* telegram_emojis.qrc in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1542,6 +1579,7 @@ 6E4DB0CBEF415196AFD4149F /* fileuploader.cpp in Compile Sources */, 700925F3B2C6163D38140CEA /* history.cpp in Compile Sources */, 0732E4A9199E262300D50FE7 /* overviewwidget.cpp in Compile Sources */, + 077A4B041CA41EE2002188D2 /* moc_connection_auto.cpp in Compile Sources */, 1DF53374E3B6A31661548D08 /* historywidget.cpp in Compile Sources */, 078A2FCD1A811CA600CCC7A0 /* backgroundbox.cpp in Compile Sources */, 37A3C6C782A0E4BC7B09536B /* langloaderplain.cpp in Compile Sources */, @@ -1551,21 +1589,23 @@ 113AA97DEE7847C7D2DCFF71 /* logs.cpp in Compile Sources */, E3194392BD6D0726F75FA72E /* mainwidget.cpp in Compile Sources */, DF36EA42D67ED39E58CB7DF9 /* settings.cpp in Compile Sources */, + 077A4B031CA41EE2002188D2 /* moc_connection_abstract.cpp in Compile Sources */, B99CCE43EEFCD3E18F6D16D1 /* settingswidget.cpp in Compile Sources */, B8DA82DA1B195A933A0805E7 /* sysbuttons.cpp in Compile Sources */, 5CE57D44510AB2A11886AB52 /* title.cpp in Compile Sources */, + 077A4AF81CA41C38002188D2 /* connection_auto.cpp in Compile Sources */, 4078D5D614EB3ECF7F1848C7 /* types.cpp in Compile Sources */, 68FFEB7CA30BF0149161B809 /* window.cpp in Compile Sources */, - 0CB7DE9A54CC9BF86FB7B5CA /* mtp.cpp in Compile Sources */, - DF259E9677CC63AF8754032B /* mtpConnection.cpp in Compile Sources */, + 0CB7DE9A54CC9BF86FB7B5CA /* facade.cpp in Compile Sources */, + DF259E9677CC63AF8754032B /* connection.cpp in Compile Sources */, 074FCB9119D36E60004C6EB2 /* moc_popupmenu.cpp in Compile Sources */, - B6346B66B0A2228A91D8A5D9 /* mtpDC.cpp in Compile Sources */, + B6346B66B0A2228A91D8A5D9 /* dcenter.cpp in Compile Sources */, 0755AEDF1AD12A80004D738A /* moc_sessionsbox.cpp in Compile Sources */, 07129D6E1C16D245002DC495 /* facades.cpp in Compile Sources */, - B8CA3E1E11A7E0E7DF9E1CDE /* mtpFileLoader.cpp in Compile Sources */, + B8CA3E1E11A7E0E7DF9E1CDE /* file_download.cpp in Compile Sources */, 0755AEDD1AD12A80004D738A /* moc_abstractbox.cpp in Compile Sources */, - 99F0A9B2AFE5ABDCBFC04510 /* mtpRPC.cpp in Compile Sources */, - A297B1E3CE33CC501DFEDB6E /* mtpSession.cpp in Compile Sources */, + 99F0A9B2AFE5ABDCBFC04510 /* rpc_sender.cpp in Compile Sources */, + A297B1E3CE33CC501DFEDB6E /* session.cpp in Compile Sources */, D1FC601FC2F9F3E33F3A14E9 /* animation.cpp in Compile Sources */, 8F65F0D95B1F0CEB859F2FB3 /* boxshadow.cpp in Compile Sources */, D7EF8F129FCCE9AB3F3F081F /* button.cpp in Compile Sources */, @@ -1582,10 +1622,11 @@ 03270F718426CFE84729079E /* flattextarea.cpp in Compile Sources */, E3D7A5CA24541D5DB69D6606 /* images.cpp in Compile Sources */, ADE99904299B99EB6135E8D9 /* scrollarea.cpp in Compile Sources */, - 07129D6A1C16D230002DC495 /* mtpAuthKey.cpp in Compile Sources */, + 07129D6A1C16D230002DC495 /* auth_key.cpp in Compile Sources */, 90085DF442550A0845D5AF37 /* style_core.cpp in Compile Sources */, 074FCB8E19D36851004C6EB2 /* popupmenu.cpp in Compile Sources */, 3AA6E7264581F82856FB37F7 /* text.cpp in Compile Sources */, + 077A4B061CA41EE2002188D2 /* moc_connection_tcp.cpp in Compile Sources */, FCE6518C548DF7BC82228A4A /* twidget.cpp in Compile Sources */, 071AD8D21C5E8E6D008C9E90 /* zip.c in Compile Sources */, E9F1CE7F9B18C7C85A50E62D /* style_auto.cpp in Compile Sources */, @@ -1603,20 +1644,22 @@ 07D703BB19B88FB900C4EED2 /* moc_audio.cpp in Compile Sources */, 77B998AC22A13EF3DDEE07AC /* photocropbox.cpp in Compile Sources */, F278C423357CA99797EA30AB /* photosendbox.cpp in Compile Sources */, - E8D95529CED88F18818C9A8B /* intro.cpp in Compile Sources */, + E8D95529CED88F18818C9A8B /* introwidget.cpp in Compile Sources */, 9357E7B12AD6D88B157ACA05 /* introcode.cpp in Compile Sources */, 4BF3F8D0797BC8A0C1FAD13C /* introphone.cpp in Compile Sources */, 4978DE680549639AE9AA9CA6 /* introsignup.cpp in Compile Sources */, - 8B22E794EFF0EAFF964A3043 /* introsteps.cpp in Compile Sources */, + 8B22E794EFF0EAFF964A3043 /* introstart.cpp in Compile Sources */, 74343521EECC740F777DAFE6 /* pspecific_mac.cpp in Compile Sources */, 26A81090DC8B5BCF7278FDFF /* qrc_telegram.cpp in Compile Sources */, 07AF95F51AFD03B90060B057 /* qrc_telegram_mac.cpp in Compile Sources */, C1F9D5CA8AF3AD8EBC9D7310 /* moc_application.cpp in Compile Sources */, D846C6F212B438DC2FD5FF71 /* moc_dialogswidget.cpp in Compile Sources */, 6C79FBC5CFA36AC3EA6ABBD4 /* moc_dropdown.cpp in Compile Sources */, + 077A4AFA1CA41C38002188D2 /* connection_tcp.cpp in Compile Sources */, 822C2860FBFAF3EAE42C5A3F /* moc_fileuploader.cpp in Compile Sources */, 352349751855EF76DECA4D60 /* moc_historywidget.cpp in Compile Sources */, 4B0036C794BEA27AF9419768 /* moc_layerwidget.cpp in Compile Sources */, + 077A4AF71CA41C38002188D2 /* connection_abstract.cpp in Compile Sources */, C14E6C902F6435B3149ECD64 /* moc_profilewidget.cpp in Compile Sources */, 071AD8F81C5E99D6008C9E90 /* ioapi.c in Compile Sources */, 074756191A1372C600CA07F7 /* moc_types.cpp in Compile Sources */, @@ -1630,18 +1673,19 @@ E97B3CFAB59B49BACFFC5F7C /* moc_title.cpp in Compile Sources */, 07D8510819F8340A00623D75 /* moc_usernamebox.cpp in Compile Sources */, 9A0D5DDC7816FC2538EB6A96 /* moc_window.cpp in Compile Sources */, - 06EABCC49D2EEE4076322BE7 /* moc_mtp.cpp in Compile Sources */, + 06EABCC49D2EEE4076322BE7 /* moc_facade.cpp in Compile Sources */, 0755AEDE1AD12A80004D738A /* moc_intropwdcheck.cpp in Compile Sources */, 07DE92AA1AA4928200A18F6F /* moc_autolockbox.cpp in Compile Sources */, 07B604351B46A20900CA29FE /* moc_playerwidget.cpp in Compile Sources */, - 8F6F5D7F82036331E8C6DAE6 /* moc_mtpConnection.cpp in Compile Sources */, - B780F9E21269259B90A1F32A /* moc_mtpDC.cpp in Compile Sources */, + 8F6F5D7F82036331E8C6DAE6 /* moc_connection.cpp in Compile Sources */, + B780F9E21269259B90A1F32A /* moc_dcenter.cpp in Compile Sources */, 07080BCF1A43588C00741A51 /* lang_auto.cpp in Compile Sources */, 07539B1D1A1416AF00083EFC /* moc_history.cpp in Compile Sources */, - 2A500B102B7CE80F3EB6E13E /* moc_mtpFileLoader.cpp in Compile Sources */, + 077A4AFC1CA41C38002188D2 /* rsa_public_key.cpp in Compile Sources */, + 2A500B102B7CE80F3EB6E13E /* moc_file_download.cpp in Compile Sources */, 07A6933519927B160099CB9F /* moc_mediaview.cpp in Compile Sources */, 07A69332199277BA0099CB9F /* mediaview.cpp in Compile Sources */, - 9A523F51135FD4E2464673A6 /* moc_mtpSession.cpp in Compile Sources */, + 9A523F51135FD4E2464673A6 /* moc_session.cpp in Compile Sources */, C329997D36D34D568CE16C9A /* moc_animation.cpp in Compile Sources */, B2F5B08BFFBBE7E37D3863BB /* moc_button.cpp in Compile Sources */, 6A8BC88AB464B92706EFE6FF /* moc_countryinput.cpp in Compile Sources */, @@ -1659,6 +1703,7 @@ 07DB674D1AD07C9200A51329 /* abstractbox.cpp in Compile Sources */, 3F6EB1F5B98E704960FEA686 /* moc_scrollarea.cpp in Compile Sources */, 60CB4898955209B665E7B07D /* moc_twidget.cpp in Compile Sources */, + 077A4B051CA41EE2002188D2 /* moc_connection_http.cpp in Compile Sources */, 7062978F12EEA525893A5E6F /* moc_aboutbox.cpp in Compile Sources */, E8B28580819B882A5964561A /* moc_addcontactbox.cpp in Compile Sources */, 07B604321B46A0EC00CA29FE /* playerwidget.cpp in Compile Sources */, @@ -1667,6 +1712,7 @@ ED2557A57C6782721DC494AF /* moc_connectionbox.cpp in Compile Sources */, 5FC914F652D1B16FDA8F0634 /* moc_contactsbox.cpp in Compile Sources */, 074968D01A44D14C00394F46 /* languagebox.cpp in Compile Sources */, + 077A4AF91CA41C38002188D2 /* connection_http.cpp in Compile Sources */, 07BE85121A20961F008ACB9F /* moc_localstorage.cpp in Compile Sources */, 07AF95F41AFD03B90060B057 /* qrc_telegram_emojis.cpp in Compile Sources */, 07C759721B1F7E2800662169 /* moc_autoupdater.cpp in Compile Sources */, @@ -1675,11 +1721,11 @@ 9D294F23E02CFDF22C288382 /* moc_emojibox.cpp in Compile Sources */, 9809A3AF1946D51ACB41D716 /* moc_photocropbox.cpp in Compile Sources */, AC6C131416AEC557C854BA70 /* moc_photosendbox.cpp in Compile Sources */, - 0F7872E39EA570249D420912 /* moc_intro.cpp in Compile Sources */, + 0F7872E39EA570249D420912 /* moc_introwidget.cpp in Compile Sources */, 4F27F5F76AA3F78C8CA27339 /* moc_introcode.cpp in Compile Sources */, - 07D8509519F5C97E00623D75 /* mtpScheme.cpp in Compile Sources */, + 07D8509519F5C97E00623D75 /* scheme_auto.cpp in Compile Sources */, 0250AB6761AC71A2E3155EEA /* moc_introphone.cpp in Compile Sources */, - 07D8509419F5C97E00623D75 /* mtpCoreTypes.cpp in Compile Sources */, + 07D8509419F5C97E00623D75 /* core_types.cpp in Compile Sources */, 2EF5D0AC9A18F9FE9B8A1ACA /* moc_introsignup.cpp in Compile Sources */, 8C4BA0DB55E2C40DE5F5E990 /* moc_pspecific_mac.cpp in Compile Sources */, 07DE92AE1AA4928B00A18F6F /* moc_passcodewidget.cpp in Compile Sources */, @@ -1726,7 +1772,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.32; + CURRENT_PROJECT_VERSION = 0.9.36; DEBUG_INFORMATION_FORMAT = dwarf; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -1745,7 +1791,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 0.9.32; + CURRENT_PROJECT_VERSION = 0.9.36; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_OPTIMIZATION_LEVEL = fast; GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h; @@ -1774,10 +1820,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.32; + CURRENT_PROJECT_VERSION = 0.9.36; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.32; + DYLIB_CURRENT_VERSION = 0.9.36; ENABLE_STRICT_OBJC_MSGSEND = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; @@ -1915,10 +1961,10 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.9.32; + CURRENT_PROJECT_VERSION = 0.9.36; DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 0.9; - DYLIB_CURRENT_VERSION = 0.9.32; + DYLIB_CURRENT_VERSION = 0.9.36; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; diff --git a/Telegram/Telegram.xcodeproj/qt_preprocess.mak b/Telegram/Telegram.xcodeproj/qt_preprocess.mak index 109bb8a07..0da30a8da 100644 --- a/Telegram/Telegram.xcodeproj/qt_preprocess.mak +++ b/Telegram/Telegram.xcodeproj/qt_preprocess.mak @@ -37,8 +37,12 @@ compilers: GeneratedFiles/qrc_telegram.cpp GeneratedFiles/qrc_telegram_emojis.cp GeneratedFiles/Debug/moc_passcodewidget.cpp\ GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp\ GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp\ - GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp\ - GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp\ + GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_facade.cpp GeneratedFiles/Debug/moc_connection.cpp\ + GeneratedFiles/Debug/moc_connection_abstract.cpp\ + GeneratedFiles/Debug/moc_connection_auto.cpp\ + GeneratedFiles/Debug/moc_connection_http.cpp\ + GeneratedFiles/Debug/moc_connection_tcp.cpp\ + GeneratedFiles/Debug/moc_dcenter.cpp GeneratedFiles/Debug/moc_file_download.cpp GeneratedFiles/Debug/moc_session.cpp\ GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp\ GeneratedFiles/Debug/moc_popupmenu.cpp\ GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp\ @@ -50,7 +54,7 @@ compilers: GeneratedFiles/qrc_telegram.cpp GeneratedFiles/qrc_telegram_emojis.cp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp\ GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp\ GeneratedFiles/Debug/moc_passcodebox.cpp\ - GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_intro.cpp\ + GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_introwidget.cpp\ GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp\ GeneratedFiles/Debug/moc_pspecific_mac.cpp compiler_objective_c_make_all: @@ -99,9 +103,9 @@ GeneratedFiles/qrc_telegram_mac.cpp: SourceFiles/telegram_mac.qrc \ SourceFiles/art/osxtray.png /usr/local/Qt-5.5.1/bin/rcc -name telegram_mac SourceFiles/telegram_mac.qrc -o GeneratedFiles/qrc_telegram_mac.cpp -compiler_moc_header_make_all: GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp +compiler_moc_header_make_all: GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_facade.cpp GeneratedFiles/Debug/moc_connection.cpp GeneratedFiles/Debug/moc_connection_abstract.cpp GeneratedFiles/Debug/moc_connection_auto.cpp GeneratedFiles/Debug/moc_connection_http.cpp GeneratedFiles/Debug/moc_connection_tcp.cpp GeneratedFiles/Debug/moc_dcenter.cpp GeneratedFiles/Debug/moc_file_download.cpp GeneratedFiles/Debug/moc_session.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamebox.cpp GeneratedFiles/Debug/moc_introwidget.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp compiler_moc_header_clean: - -$(DEL_FILE) GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_mtp.cpp GeneratedFiles/Debug/moc_mtpConnection.cpp GeneratedFiles/Debug/moc_mtpDC.cpp GeneratedFiles/Debug/moc_mtpFileLoader.cpp GeneratedFiles/Debug/moc_mtpSession.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamedbox.cpp GeneratedFiles/Debug/moc_intro.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp + -$(DEL_FILE) GeneratedFiles/Debug/moc_apiwrap.cpp GeneratedFiles/Debug/moc_application.cpp GeneratedFiles/Debug/moc_audio.cpp GeneratedFiles/Debug/moc_autoupdater.cpp GeneratedFiles/Debug/moc_dialogswidget.cpp GeneratedFiles/Debug/moc_dropdown.cpp GeneratedFiles/Debug/moc_fileuploader.cpp GeneratedFiles/Debug/moc_history.cpp GeneratedFiles/Debug/moc_historywidget.cpp GeneratedFiles/Debug/moc_layerwidget.cpp GeneratedFiles/Debug/moc_mediaview.cpp GeneratedFiles/Debug/moc_overviewwidget.cpp GeneratedFiles/Debug/moc_playerwidget.cpp GeneratedFiles/Debug/moc_profilewidget.cpp GeneratedFiles/Debug/moc_passcodewidget.cpp GeneratedFiles/Debug/moc_localimageloader.cpp GeneratedFiles/Debug/moc_localstorage.cpp GeneratedFiles/Debug/moc_mainwidget.cpp GeneratedFiles/Debug/moc_settingswidget.cpp GeneratedFiles/Debug/moc_sysbuttons.cpp GeneratedFiles/Debug/moc_title.cpp GeneratedFiles/Debug/moc_types.cpp GeneratedFiles/Debug/moc_window.cpp GeneratedFiles/Debug/moc_facade.cpp GeneratedFiles/Debug/moc_connection.cpp GeneratedFiles/Debug/moc_connection_abstract.cpp GeneratedFiles/Debug/moc_connection_auto.cpp GeneratedFiles/Debug/moc_connection_http.cpp GeneratedFiles/Debug/moc_connection_tcp.cpp GeneratedFiles/Debug/moc_dcenter.cpp GeneratedFiles/Debug/moc_file_download.cpp GeneratedFiles/Debug/moc_session.cpp GeneratedFiles/Debug/moc_animation.cpp GeneratedFiles/Debug/moc_button.cpp GeneratedFiles/Debug/moc_popupmenu.cpp GeneratedFiles/Debug/moc_countryinput.cpp GeneratedFiles/Debug/moc_flatbutton.cpp GeneratedFiles/Debug/moc_flatcheckbox.cpp GeneratedFiles/Debug/moc_flatinput.cpp GeneratedFiles/Debug/moc_flatlabel.cpp GeneratedFiles/Debug/moc_flattextarea.cpp GeneratedFiles/Debug/moc_scrollarea.cpp GeneratedFiles/Debug/moc_twidget.cpp GeneratedFiles/Debug/moc_aboutbox.cpp GeneratedFiles/Debug/moc_abstractbox.cpp GeneratedFiles/Debug/moc_addcontactbox.cpp GeneratedFiles/Debug/moc_autolockbox.cpp GeneratedFiles/Debug/moc_backgroundbox.cpp GeneratedFiles/Debug/moc_confirmbox.cpp GeneratedFiles/Debug/moc_connectionbox.cpp GeneratedFiles/Debug/moc_contactsbox.cpp GeneratedFiles/Debug/moc_downloadpathbox.cpp GeneratedFiles/Debug/moc_emojibox.cpp GeneratedFiles/Debug/moc_languagebox.cpp GeneratedFiles/Debug/moc_passcodebox.cpp GeneratedFiles/Debug/moc_photocropbox.cpp GeneratedFiles/Debug/moc_photosendbox.cpp GeneratedFiles/Debug/moc_sessionsbox.cpp GeneratedFiles/Debug/moc_stickersetbox.cpp GeneratedFiles/Debug/moc_usernamedbox.cpp GeneratedFiles/Debug/moc_introwidget.cpp GeneratedFiles/Debug/moc_introcode.cpp GeneratedFiles/Debug/moc_introphone.cpp GeneratedFiles/Debug/moc_intropwdcheck.cpp GeneratedFiles/Debug/moc_introsignup.cpp GeneratedFiles/Debug/moc_pspecific_mac.cpp GeneratedFiles/Debug/moc_apiwrap.cpp: SourceFiles/types.h \ SourceFiles/logs.h \ SourceFiles/apiwrap.h @@ -125,7 +129,8 @@ GeneratedFiles/Debug/moc_application.cpp: ../../Libraries/QtStatic/qtbase/includ SourceFiles/pspecific.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QMainWindow \ SourceFiles/pspecific_mac.h \ - SourceFiles/pspecific_wnd.h \ + SourceFiles/pspecific_win.h \ + SourceFiles/pspecific_winrt.h \ SourceFiles/gui/boxshadow.h \ SourceFiles/application.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/application.h -o GeneratedFiles/Debug/moc_application.cpp @@ -284,56 +289,104 @@ GeneratedFiles/Debug/moc_window.cpp: SourceFiles/title.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QMainWindow \ ../../Libraries/QtStatic/qtbase/include/QtNetwork/QNetworkReply \ SourceFiles/pspecific_mac.h \ - SourceFiles/pspecific_wnd.h \ + SourceFiles/pspecific_win.h \ + SourceFiles/pspecific_winrt.h \ SourceFiles/passcodewidget.h \ SourceFiles/gui/boxshadow.h \ SourceFiles/window.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/window.h -o GeneratedFiles/Debug/moc_window.cpp -GeneratedFiles/Debug/moc_mtp.cpp: SourceFiles/mtproto/mtpSession.h \ - SourceFiles/mtproto/mtpConnection.h \ - SourceFiles/mtproto/mtpCoreTypes.h \ +GeneratedFiles/Debug/moc_facade.cpp: SourceFiles/mtproto/session.h \ + SourceFiles/mtproto/connection.h \ + SourceFiles/mtproto/connection_abstract.h \ + SourceFiles/mtproto/connection_auto.h \ + SourceFiles/mtproto/connection_http.h \ + SourceFiles/mtproto/connection_tcp.h \ + SourceFiles/mtproto/core_types.h \ SourceFiles/types.h \ ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ SourceFiles/logs.h \ - SourceFiles/mtproto/mtpScheme.h \ - SourceFiles/mtproto/mtpPublicRSA.h \ - SourceFiles/mtproto/mtpAuthKey.h \ - SourceFiles/mtproto/mtpDC.h \ - SourceFiles/mtproto/mtpRPC.h \ - SourceFiles/mtproto/mtpFileLoader.h \ - SourceFiles/mtproto/mtpSessionImpl.h \ - SourceFiles/mtproto/mtp.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/mtp.h -o GeneratedFiles/Debug/moc_mtp.cpp + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/dcenter.h \ + SourceFiles/mtproto/rpc_sender.h \ + SourceFiles/mtproto/file_download.h \ + SourceFiles/mtproto/facade.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/facade.h -o GeneratedFiles/Debug/moc_facade.cpp -GeneratedFiles/Debug/moc_mtpConnection.cpp: SourceFiles/mtproto/mtpCoreTypes.h \ +GeneratedFiles/Debug/moc_connection.cpp: SourceFiles/mtproto/core_types.h \ SourceFiles/types.h \ ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ SourceFiles/logs.h \ - SourceFiles/mtproto/mtpScheme.h \ - SourceFiles/mtproto/mtpPublicRSA.h \ - SourceFiles/mtproto/mtpAuthKey.h \ - SourceFiles/mtproto/mtpConnection.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/mtpConnection.h -o GeneratedFiles/Debug/moc_mtpConnection.cpp + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/connection.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/connection.h -o GeneratedFiles/Debug/moc_connection.cpp -GeneratedFiles/Debug/moc_mtpDC.cpp: SourceFiles/mtproto/mtpDC.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/mtpDC.h -o GeneratedFiles/Debug/moc_mtpDC.cpp - -GeneratedFiles/Debug/moc_mtpFileLoader.cpp: SourceFiles/mtproto/mtpFileLoader.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/mtpFileLoader.h -o GeneratedFiles/Debug/moc_mtpFileLoader.cpp - -GeneratedFiles/Debug/moc_mtpSession.cpp: SourceFiles/mtproto/mtpConnection.h \ - SourceFiles/mtproto/mtpCoreTypes.h \ +GeneratedFiles/Debug/moc_connection_abstract.cpp: SourceFiles/mtproto/core_types.h \ SourceFiles/types.h \ ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ SourceFiles/logs.h \ - SourceFiles/mtproto/mtpScheme.h \ - SourceFiles/mtproto/mtpPublicRSA.h \ - SourceFiles/mtproto/mtpAuthKey.h \ - SourceFiles/mtproto/mtpDC.h \ - SourceFiles/mtproto/mtpRPC.h \ - SourceFiles/mtproto/mtpSession.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/mtpSession.h -o GeneratedFiles/Debug/moc_mtpSession.cpp + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/connection_abstract.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/connection_abstract.h -o GeneratedFiles/Debug/moc_connection_abstract.cpp + +GeneratedFiles/Debug/moc_connection_auto.cpp: SourceFiles/mtproto/core_types.h \ + SourceFiles/types.h \ + ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ + SourceFiles/logs.h \ + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/connection_auto.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/connection_auto.h -o GeneratedFiles/Debug/moc_connection_auto.cpp + +GeneratedFiles/Debug/moc_connection_http.cpp: SourceFiles/mtproto/core_types.h \ + SourceFiles/types.h \ + ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ + SourceFiles/logs.h \ + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/connection_http.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/connection_http.h -o GeneratedFiles/Debug/moc_connection_http.cpp + +GeneratedFiles/Debug/moc_connection_tcp.cpp: SourceFiles/mtproto/core_types.h \ + SourceFiles/types.h \ + ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ + SourceFiles/logs.h \ + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/connection_tcp.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/connection_tcp.h -o GeneratedFiles/Debug/moc_connection_tcp.cpp + +GeneratedFiles/Debug/moc_dcenter.cpp: SourceFiles/mtproto/dcenter.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/dcenter.h -o GeneratedFiles/Debug/moc_dcenter.cpp + +GeneratedFiles/Debug/moc_file_download.cpp: SourceFiles/mtproto/file_download.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/file_download.h -o GeneratedFiles/Debug/moc_file_download.cpp + +GeneratedFiles/Debug/moc_session.cpp: SourceFiles/mtproto/connection.h \ + SourceFiles/mtproto/connection_abstract.h \ + SourceFiles/mtproto/connection_auto.h \ + SourceFiles/mtproto/connection_http.h \ + SourceFiles/mtproto/connection_tcp.h \ + SourceFiles/mtproto/core_types.h \ + SourceFiles/types.h \ + ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ + SourceFiles/logs.h \ + SourceFiles/mtproto/scheme_auto.h \ + SourceFiles/mtproto/rsa_public_key.h \ + SourceFiles/mtproto/auth_key.h \ + SourceFiles/mtproto/dcenter.h \ + SourceFiles/mtproto/rpc_sender.h \ + SourceFiles/mtproto/session.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/mtproto/session.h -o GeneratedFiles/Debug/moc_session.cpp GeneratedFiles/Debug/moc_animation.cpp: SourceFiles/types.h \ ../../Libraries/QtStatic/qtbase/include/QtCore/QReadWriteLock \ @@ -548,7 +601,7 @@ GeneratedFiles/Debug/moc_usernamebox.cpp: SourceFiles/boxes/abstractbox.h \ SourceFiles/boxes/usernamebox.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/boxes/usernamebox.h -o GeneratedFiles/Debug/moc_usernamebox.cpp -GeneratedFiles/Debug/moc_intro.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \ +GeneratedFiles/Debug/moc_introwidget.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \ SourceFiles/gui/flatbutton.h \ SourceFiles/gui/button.h \ SourceFiles/gui/twidget.h \ @@ -562,8 +615,8 @@ GeneratedFiles/Debug/moc_intro.cpp: ../../Libraries/QtStatic/qtbase/include/QtWi SourceFiles/style.h \ GeneratedFiles/style_classes.h \ GeneratedFiles/style_auto.h \ - SourceFiles/intro/intro.h - /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/intro.h -o GeneratedFiles/Debug/moc_intro.cpp + SourceFiles/intro/introwidget.h + /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/introwidget.h -o GeneratedFiles/Debug/moc_introwidget.cpp GeneratedFiles/Debug/moc_introcode.cpp: ../../Libraries/QtStatic/qtbase/include/QtWidgets/QWidget \ SourceFiles/gui/flatbutton.h \ @@ -581,7 +634,7 @@ GeneratedFiles/Debug/moc_introcode.cpp: ../../Libraries/QtStatic/qtbase/include/ GeneratedFiles/style_auto.h \ SourceFiles/gui/flatinput.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \ - SourceFiles/intro/intro.h \ + SourceFiles/intro/introwidget.h \ SourceFiles/intro/introcode.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/introcode.h -o GeneratedFiles/Debug/moc_introcode.cpp @@ -605,7 +658,7 @@ GeneratedFiles/Debug/moc_introphone.cpp: ../../Libraries/QtStatic/qtbase/include SourceFiles/gui/scrollarea.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QScrollArea \ SourceFiles/gui/boxshadow.h \ - SourceFiles/intro/intro.h \ + SourceFiles/intro/introwidget.h \ SourceFiles/intro/introphone.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/introphone.h -o GeneratedFiles/Debug/moc_introphone.cpp @@ -629,7 +682,7 @@ GeneratedFiles/Debug/moc_intropwdcheck.cpp: ../../Libraries/QtStatic/qtbase/incl SourceFiles/gui/scrollarea.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QScrollArea \ SourceFiles/gui/boxshadow.h \ - SourceFiles/intro/intro.h \ + SourceFiles/intro/introwidget.h \ SourceFiles/intro/intropwdcheck.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/intropwdcheck.h -o GeneratedFiles/Debug/moc_intropwdcheck.cpp @@ -649,7 +702,7 @@ GeneratedFiles/Debug/moc_introsignup.cpp: ../../Libraries/QtStatic/qtbase/includ GeneratedFiles/style_auto.h \ SourceFiles/gui/flatinput.h \ ../../Libraries/QtStatic/qtbase/include/QtWidgets/QLineEdit \ - SourceFiles/intro/intro.h \ + SourceFiles/intro/introwidget.h \ SourceFiles/intro/introsignup.h /usr/local/Qt-5.5.1/bin/moc $(DEFINES) -D__APPLE__ -D__GNUC__=4 -I/usr/local/Qt-5.5.1/mkspecs/macx-clang -I. -I/usr/local/Qt-5.5.1/include/QtGui/5.5.1/QtGui -I/usr/local/Qt-5.5.1/include/QtCore/5.5.1/QtCore -I/usr/local/Qt-5.5.1/include -I./SourceFiles -I./GeneratedFiles -I../../Libraries/lzma/C -I../../Libraries/libexif-0.6.20 -I/usr/local/Qt-5.5.1/include -I/usr/local/Qt-5.5.1/include/QtMultimedia -I/usr/local/Qt-5.5.1/include/QtWidgets -I/usr/local/Qt-5.5.1/include/QtNetwork -I/usr/local/Qt-5.5.1/include/QtGui -I/usr/local/Qt-5.5.1/include/QtCore -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1/backward -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/5.1/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include SourceFiles/intro/introsignup.h -o GeneratedFiles/Debug/moc_introsignup.cpp diff --git a/Telegram/Version b/Telegram/Version index f6b6466c7..2227962ec 100644 --- a/Telegram/Version +++ b/Telegram/Version @@ -1,6 +1,6 @@ -AppVersion 9033 +AppVersion 9036 AppVersionStrMajor 0.9 -AppVersionStrSmall 0.9.33 -AppVersionStr 0.9.33 -DevChannel 0 -BetaVersion 0 9030002 +AppVersionStrSmall 0.9.36 +AppVersionStr 0.9.36 +DevChannel 1 +BetaVersion 0 9034004 diff --git a/doc/building-msvc.md b/doc/building-msvc.md index 644839a30..a0f1140f0 100644 --- a/doc/building-msvc.md +++ b/doc/building-msvc.md @@ -178,7 +178,7 @@ If you already have Windows SDKs then find the library folder and correct it at #####Building library - configure -debug-and-release -opensource -confirm-license -static -I "D:\TBuild\Libraries\openssl\Release\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\openssl_debug\Debug\lib\ssleay32.lib D:\TBuild\Libraries\openssl_debug\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\openssl\Release\lib\ssleay32.lib D:\TBuild\Libraries\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 + configure -debug-and-release -force-debug-info -opensource -confirm-license -static -I "D:\TBuild\Libraries\openssl\Release\include" -L "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib" -l Gdi32 -no-opengl -openssl-linked OPENSSL_LIBS_DEBUG="D:\TBuild\Libraries\openssl_debug\Debug\lib\ssleay32.lib D:\TBuild\Libraries\openssl_debug\Debug\lib\libeay32.lib" OPENSSL_LIBS_RELEASE="D:\TBuild\Libraries\openssl\Release\lib\ssleay32.lib D:\TBuild\Libraries\openssl\Release\lib\libeay32.lib" -mp -nomake examples -nomake tests -platform win32-msvc2015 nmake nmake install diff --git a/doc/building-qtcreator.md b/doc/building-qtcreator.md index 28184888b..30b93ab9c 100644 --- a/doc/building-qtcreator.md +++ b/doc/building-qtcreator.md @@ -147,7 +147,7 @@ Install some packages for Qt (see **/home/user/TBuild/Libraries/QtStatic/qtbase/ In Terminal go to **/home/user/TBuild/Libraries/QtStatic** and there run - OPENSSL_LIBS='/usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a' ./configure -release -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests + OPENSSL_LIBS='/usr/local/ssl/lib/libssl.a /usr/local/ssl/lib/libcrypto.a' ./configure -release -force-debug-info -opensource -confirm-license -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-xkbcommon-x11 -no-opengl -static -openssl-linked -nomake examples -nomake tests make -j4 sudo make -j4 install diff --git a/doc/building-xcode-old.md b/doc/building-xcode-old.md index a42f03f1f..332fa3447 100644 --- a/doc/building-xcode-old.md +++ b/doc/building-xcode-old.md @@ -183,7 +183,7 @@ From **/Users/user/TBuild/Libraries/QtStatic/qtimageformats**, run: Go to **/Users/user/TBuild/Libraries/QtStatic** and run: - ./configure -debug-and-release -opensource -confirm-license -static -opengl desktop -nomake examples -nomake tests -platform macx-g++ + ./configure -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -nomake examples -nomake tests -platform macx-g++ make -j4 sudo make -j4 install diff --git a/doc/building-xcode.md b/doc/building-xcode.md index c63831068..4b56cb4b5 100644 --- a/doc/building-xcode.md +++ b/doc/building-xcode.md @@ -215,7 +215,7 @@ From **/Users/user/TBuild/Libraries/QtStatic/qtbase**, run: Go to **/Users/user/TBuild/Libraries/QtStatic** and run: - ./configure -debug-and-release -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang + ./configure -debug-and-release -force-debug-info -opensource -confirm-license -static -opengl desktop -no-openssl -securetransport -nomake examples -nomake tests -platform macx-clang make -j4 sudo make -j4 install