This commit is contained in:
John Preston 2016-03-24 21:12:37 +03:00
commit 3e79d7477e
31 changed files with 188 additions and 147 deletions

View File

@ -80,7 +80,7 @@ The source code is published under GPLv3 with OpenSSL exception, the license is
* ### MetaLang * ### 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.h
* GeneratedFiles/lang.cpp * GeneratedFiles/lang.cpp

View File

@ -86,8 +86,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_cancel" = "Cancel"; "lng_cancel" = "Cancel";
"lng_continue" = "Continue"; "lng_continue" = "Continue";
"lng_close" = "Close"; "lng_close" = "Close";
"lng_connecting" = "Connecting.."; "lng_connecting" = "Connecting...";
"lng_reconnecting" = "Reconnect {count:now|in # s|in # s}.."; "lng_reconnecting" = "Reconnect {count:now|in # s|in # s}...";
"lng_reconnecting_try_now" = "Try now"; "lng_reconnecting_try_now" = "Try now";
"lng_status_service_notifications" = "service notifications"; "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" = "last seen {date}";
"lng_status_lastseen_date_time" = "last seen {date} at {time}"; "lng_status_lastseen_date_time" = "last seen {date} at {time}";
"lng_status_online" = "online"; "lng_status_online" = "online";
"lng_status_connecting" = "connecting.."; "lng_status_connecting" = "connecting...";
"lng_chat_status_unaccessible" = "group is unaccessible"; "lng_chat_status_unaccessible" = "group is unaccessible";
"lng_chat_status_members" = "{count:no members|# member|# members}"; "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_deleted" = "This message was deleted";
"lng_edit_too_long" = "Your message text is too long"; "lng_edit_too_long" = "Your message text is too long";
"lng_edit_message" = "Edit message"; "lng_edit_message" = "Edit message";
"lng_edit_message_text" = "New message text.."; "lng_edit_message_text" = "New message text...";
"lng_deleted" = "Unknown"; "lng_deleted" = "Unknown";
"lng_deleted_message" = "Deleted message"; "lng_deleted_message" = "Deleted message";
"lng_pinned_message" = "Pinned 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_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_no_telegram" = "Send code via SMS";
"lng_code_call" = "Telegram will dial your number in {minutes}:{seconds}"; "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_code_called" = "Telegram dialed your number";
"lng_bad_phone" = "Invalid phone number. Please try again."; "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_dlg_new_channel_name" = "Channel name";
"lng_no_contacts" = "You have no contacts"; "lng_no_contacts" = "You have no contacts";
"lng_no_chats" = "Your chats will be here"; "lng_no_chats" = "Your chats will be here";
"lng_contacts_loading" = "Loading.."; "lng_contacts_loading" = "Loading...";
"lng_contacts_not_found" = "No contacts found"; "lng_contacts_not_found" = "No contacts found";
"lng_dlg_search_chat" = "Search in this chat"; "lng_dlg_search_chat" = "Search in this chat";
"lng_dlg_search_channel" = "Search in this channel"; "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_save" = "Save";
"lng_settings_upload" = "Set Profile Photo"; "lng_settings_upload" = "Set Profile Photo";
"lng_settings_crop_profile" = "Select a square area for your 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_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."; "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_auto_update" = "Update automatically";
"lng_settings_current_version" = "Version {version}"; "lng_settings_current_version" = "Version {version}";
"lng_settings_check_now" = "Check for updates"; "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_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_ready" = "New version is ready";
"lng_settings_update_now" = "Restart Now"; "lng_settings_update_now" = "Restart Now";
"lng_settings_update_fail" = "Update check failed :("; "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_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_path_settings" = "Settings";
"lng_download_finish_failed" = "File download could not be finished.\n\nWould you like to try again?"; "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_cleared" = "Cleared!";
"lng_download_path_clear_failed" = "Clear failed :("; "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_images_cached" = "{count:_not_used_|# image|# images}, {size}";
"lng_settings_audios_cached" = "{count:_not_used_|# voice message|# voice messages}, {size}"; "lng_settings_audios_cached" = "{count:_not_used_|# voice message|# voice messages}, {size}";
"lng_local_storage_clear" = "Clear all"; "lng_local_storage_clear" = "Clear all";
"lng_local_storage_clearing" = "Clearing.."; "lng_local_storage_clearing" = "Clearing...";
"lng_local_storage_cleared" = "Cleared!"; "lng_local_storage_cleared" = "Cleared!";
"lng_local_storage_clear_failed" = "Clear failed :("; "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_logout" = "Log out";
"lng_passcode_need_unblock" = "You need to unlock me first."; "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_change" = "Change cloud password";
"lng_cloud_password_create" = "Cloud password"; "lng_cloud_password_create" = "Cloud password";
"lng_cloud_password_remove" = "Remove 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_cloud_password_is_same" = "Password was not changed";
"lng_connection_type" = "Connection type:"; "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_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_proxy" = "{transport} with proxy";
"lng_connection_header" = "Connection type"; "lng_connection_header" = "Connection type";
"lng_connection_auto_rb" = "Auto (TCP if available or HTTP)"; "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_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_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_profile_chat_unaccessible" = "Group is unaccessible";
"lng_topbar_info" = "Info"; "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" = "Remove {user} from the group?";
"lng_profile_sure_kick_channel" = "Remove {user} from the channel?"; "lng_profile_sure_kick_channel" = "Remove {user} from the channel?";
"lng_profile_sure_kick_admin" = "Remove {user} from administrators?"; "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_shared_media" = "Shared media";
"lng_profile_no_media" = "No media in this conversation."; "lng_profile_no_media" = "No media in this conversation.";
"lng_profile_photos" = "{count:_not_used_|# photo|# photos} »"; "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" = "{count:_not_used_|# shared link|# shared links} »";
"lng_profile_shared_links_header" = "Shared links overview"; "lng_profile_shared_links_header" = "Shared links overview";
"lng_profile_copy_phone" = "Copy phone number"; "lng_profile_copy_phone" = "Copy phone number";
"lng_profile_copy_fullname" = "Copy name";
"lng_channel_add_admins" = "New administrator"; "lng_channel_add_admins" = "New administrator";
"lng_channel_add_members" = "Add members"; "lng_channel_add_members" = "Add members";
@ -659,7 +660,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_stickers_remove" = "Delete"; "lng_stickers_remove" = "Delete";
"lng_stickers_return" = "Undo"; "lng_stickers_return" = "Undo";
"lng_stickers_restore" = "Restore"; "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_photo" = "Photo";
"lng_in_dlg_video" = "Video"; "lng_in_dlg_video" = "Video";
@ -685,12 +686,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_cant_invite_banned" = "Sorry, only admin can add this user."; "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" = "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_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_send_button" = "Send";
"lng_message_ph" = "Write a message.."; "lng_message_ph" = "Write a message...";
"lng_comment_ph" = "Write a comment.."; "lng_comment_ph" = "Write a comment...";
"lng_broadcast_ph" = "Broadcast a message.."; "lng_broadcast_ph" = "Broadcast a message...";
"lng_broadcast_silent_ph" = "Silent broadcast.."; "lng_broadcast_silent_ph" = "Silent broadcast...";
"lng_record_cancel" = "Release outside this field to cancel"; "lng_record_cancel" = "Release outside this field to cancel";
"lng_will_be_notified" = "Members will be notified when you post"; "lng_will_be_notified" = "Members will be notified when you post";
"lng_wont_be_notified" = "Members will not be notified when you post"; "lng_wont_be_notified" = "Members will not be notified when you post";
@ -719,21 +721,21 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_users_typing" = "{user} and {second_user} are typing"; "lng_users_typing" = "{user} and {second_user} are typing";
"lng_many_typing" = "{count:_not_used_|# is|# are} typing"; "lng_many_typing" = "{count:_not_used_|# is|# are} typing";
"lng_send_action_record_video" = "recording video"; "lng_send_action_record_video" = "recording video";
"lng_user_action_record_video" = "{user} is recording video"; "lng_user_action_record_video" = "{user} is recording a video";
"lng_send_action_upload_video" = "sending video"; "lng_send_action_upload_video" = "sending video";
"lng_user_action_upload_video" = "{user} is sending video"; "lng_user_action_upload_video" = "{user} is sending a video";
"lng_send_action_record_audio" = "recording audio"; "lng_send_action_record_audio" = "recording audio";
"lng_user_action_record_audio" = "{user} is recording audio"; "lng_user_action_record_audio" = "{user} is recording an audio";
"lng_send_action_upload_audio" = "sending audio"; "lng_send_action_upload_audio" = "sending audio";
"lng_user_action_upload_audio" = "{user} is sending audio"; "lng_user_action_upload_audio" = "{user} is sending an audio";
"lng_send_action_upload_photo" = "sending photo"; "lng_send_action_upload_photo" = "sending photo";
"lng_user_action_upload_photo" = "{user} is sending photo"; "lng_user_action_upload_photo" = "{user} is sending a photo";
"lng_send_action_upload_file" = "sending file"; "lng_send_action_upload_file" = "sending file";
"lng_user_action_upload_file" = "{user} is sending file"; "lng_user_action_upload_file" = "{user} is sending a file";
"lng_send_action_geo_location" = "picking location"; "lng_send_action_geo_location" = "picking location";
"lng_user_action_geo_location" = "{user} is picking location"; "lng_user_action_geo_location" = "{user} is picking a location";
"lng_send_action_choose_contact" = "choosing contact"; "lng_send_action_choose_contact" = "choosing contact";
"lng_user_action_choose_contact" = "{user} is choosing contact"; "lng_user_action_choose_contact" = "{user} is choosing a contact";
"lng_unread_bar" = "{count:_not_used_|# unread message|# unread messages}"; "lng_unread_bar" = "{count:_not_used_|# unread message|# unread messages}";
"lng_maps_point" = "Location"; "lng_maps_point" = "Location";
@ -756,7 +758,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_copy_email" = "Copy email address"; "lng_context_copy_email" = "Copy email address";
"lng_context_copy_hashtag" = "Copy hashtag"; "lng_context_copy_hashtag" = "Copy hashtag";
"lng_context_copy_mention" = "Copy username"; "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_forward_image" = "Forward Image";
"lng_context_delete_image" = "Delete Image"; "lng_context_delete_image" = "Delete Image";
"lng_context_copy_image" = "Copy Image"; "lng_context_copy_image" = "Copy Image";
@ -764,11 +766,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_context_cancel_download" = "Cancel Download"; "lng_context_cancel_download" = "Cancel Download";
"lng_context_show_in_folder" = "Show in Folder"; "lng_context_show_in_folder" = "Show in Folder";
"lng_context_show_in_finder" = "Show in Finder"; "lng_context_show_in_finder" = "Show in Finder";
"lng_context_save_video" = "Save Video As.."; "lng_context_save_video" = "Save Video As...";
"lng_context_save_audio" = "Save Audio As.."; "lng_context_save_audio" = "Save Audio As...";
"lng_context_pack_info" = "Pack Info"; "lng_context_pack_info" = "Pack Info";
"lng_context_pack_add" = "Add Stickers"; "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_forward_file" = "Forward File";
"lng_context_delete_file" = "Delete File"; "lng_context_delete_file" = "Delete File";
"lng_context_close_file" = "Close File"; "lng_context_close_file" = "Close File";
@ -795,7 +797,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_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_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_cant" = "Sorry, no way to forward here :(";
"lng_forward_confirm" = "Forward to {recipient}?"; "lng_forward_confirm" = "Forward to {recipient}?";
"lng_forward_share_contact" = "Share contact to {recipient}?"; "lng_forward_share_contact" = "Share contact to {recipient}?";
@ -858,7 +860,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_search_global_results" = "Global search results"; "lng_search_global_results" = "Global search results";
"lng_media_save_progress" = "{ready} of {total} {mb}"; "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_copy" = "Copy";
"lng_mediaview_forward" = "Forward"; "lng_mediaview_forward" = "Forward";
"lng_mediaview_delete" = "Delete"; "lng_mediaview_delete" = "Delete";

View File

@ -391,7 +391,7 @@ bool genLang(const QString &lang_in, const QString &lang_out) {
th.setCodec("ISO 8859-1"); th.setCodec("ISO 8859-1");
th << "\ th << "\
/*\n\ /*\n\
Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\ Created from \'/Resources/lang.strings\' by \'/MetaLang\' project\n\
\n\ \n\
WARNING! All changes made in this file will be lost!\n\ WARNING! All changes made in this file will be lost!\n\
\n\ \n\
@ -475,7 +475,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org\n\
tcpp << "\ tcpp << "\
/*\n\ /*\n\
Created from \'/Resources/lang.txt\' by \'/MetaLang\' project\n\ Created from \'/Resources/lang.strings\' by \'/MetaLang\' project\n\
\n\ \n\
WARNING! All changes made in this file will be lost!\n\ WARNING! All changes made in this file will be lost!\n\
\n\ \n\

View File

@ -891,7 +891,6 @@ namespace App {
} }
} else { } else {
chat->flags &= ~MTPDchat::Flag::f_admins_enabled; chat->flags &= ~MTPDchat::Flag::f_admins_enabled;
chat->flags &= ~MTPDchat::Flag::f_admin;
} }
if (emitPeerUpdated) { if (emitPeerUpdated) {
App::main()->peerUpdated(chat); App::main()->peerUpdated(chat);

View File

@ -120,16 +120,16 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
#endif #endif
if (cManyInstance()) { if (cManyInstance()) {
LOG(("Many instance allowed, starting..")); LOG(("Many instance allowed, starting..."));
singleInstanceChecked(); singleInstanceChecked();
} else { } else {
LOG(("Connecting local socket to %1..").arg(_localServerName)); LOG(("Connecting local socket to %1...").arg(_localServerName));
_localSocket.connectToServer(_localServerName); _localSocket.connectToServer(_localServerName);
} }
} }
void Application::socketConnected() { 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; _secondInstance = true;
QString commands; QString commands;
@ -154,7 +154,7 @@ void Application::socketWritten(qint64/* bytes*/) {
if (_localSocket.bytesToWrite()) { if (_localSocket.bytesToWrite()) {
return; return;
} }
LOG(("Show command written, waiting response..")); LOG(("Show command written, waiting response..."));
} }
void Application::socketReading() { void Application::socketReading() {
@ -166,7 +166,7 @@ void Application::socketReading() {
if (QRegularExpression("RES:(\\d+);").match(_localSocketReadData).hasMatch()) { if (QRegularExpression("RES:(\\d+);").match(_localSocketReadData).hasMatch()) {
uint64 pid = _localSocketReadData.mid(4, _localSocketReadData.length() - 5).toULongLong(); uint64 pid = _localSocketReadData.mid(4, _localSocketReadData.length() - 5).toULongLong();
psActivateProcess(pid); 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(); return App::quit();
} }
} }
@ -175,14 +175,14 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
if (App::quitting()) return; if (App::quitting()) return;
if (_secondInstance) { 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(); return App::quit();
} }
if (e == QLocalSocket::ServerNotFoundError) { 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 { } 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(); _localSocket.close();
@ -196,7 +196,7 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (!cNoStartUpdate() && checkReadyUpdate()) { if (!cNoStartUpdate() && checkReadyUpdate()) {
cSetRestartingUpdate(true); 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(); return App::quit();
} }
#endif #endif
@ -235,7 +235,7 @@ void Application::singleInstanceChecked() {
void Application::socketDisconnected() { void Application::socketDisconnected() {
if (_secondInstance) { 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(); return App::quit();
} }
} }
@ -704,7 +704,7 @@ AppClass::AppClass() : QObject()
anim::startManager(); anim::startManager();
historyInit(); historyInit();
DEBUG_LOG(("Application Info: inited..")); DEBUG_LOG(("Application Info: inited..."));
application()->installNativeEventFilter(psNativeEventFilter()); application()->installNativeEventFilter(psNativeEventFilter());
@ -714,7 +714,7 @@ AppClass::AppClass() : QObject()
connect(&killDownloadSessionsTimer, SIGNAL(timeout()), this, SLOT(killDownloadSessions())); 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 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))); 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(); Shortcuts::start();
@ -734,16 +734,16 @@ AppClass::AppClass() : QObject()
Local::ReadMapState state = Local::readMap(QByteArray()); Local::ReadMapState state = Local::readMap(QByteArray());
if (state == Local::ReadMapPassNeeded) { if (state == Local::ReadMapPassNeeded) {
cSetHasPasscode(true); cSetHasPasscode(true);
DEBUG_LOG(("Application Info: passcode nneded..")); DEBUG_LOG(("Application Info: passcode needed..."));
} else { } else {
DEBUG_LOG(("Application Info: local map read..")); DEBUG_LOG(("Application Info: local map read..."));
MTP::start(); MTP::start();
} }
MTP::setStateChangedHandler(mtpStateChanged); MTP::setStateChangedHandler(mtpStateChanged);
MTP::setSessionResetHandler(mtpSessionReset); MTP::setSessionResetHandler(mtpSessionReset);
DEBUG_LOG(("Application Info: MTP started..")); DEBUG_LOG(("Application Info: MTP started..."));
DEBUG_LOG(("Application Info: showing.")); DEBUG_LOG(("Application Info: showing."));
if (state == Local::ReadMapPassNeeded) { if (state == Local::ReadMapPassNeeded) {

View File

@ -569,7 +569,7 @@ bool checkReadyUpdate() {
} }
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
QDir().mkpath(QFileInfo(curUpdater).absolutePath()); 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)) { if (!objc_moveFile(updater.absoluteFilePath(), curUpdater)) {
UpdateChecker::clearAll(); UpdateChecker::clearAll();
return false; return false;

View File

@ -540,6 +540,9 @@ bool GroupInfoBox::creationFail(const RPCError &error) {
_title.setFocus(); _title.setFocus();
_title.showError(); _title.showError();
return true; return true;
} else if (error.type() == qstr("USER_RESTRICTED")) {
Ui::showLayer(new InformBox(lang(lng_cant_do_this)));
return true;
} }
return false; return false;
} }

View File

@ -284,6 +284,8 @@ bool ContactsInner::addAdminFail(const RPCError &error, mtpRequestId req) {
Ui::showLayer(new MaxInviteBox(_channel->invitationUrl), KeepOtherLayers); Ui::showLayer(new MaxInviteBox(_channel->invitationUrl), KeepOtherLayers);
} else if (error.type() == "ADMINS_TOO_MUCH") { } else if (error.type() == "ADMINS_TOO_MUCH") {
Ui::showLayer(new InformBox(lang(lng_channel_admins_too_much)), KeepOtherLayers); 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 { } else {
emit adminAdded(); emit adminAdded();
} }
@ -783,7 +785,9 @@ void ContactsInner::changeCheckState(ContactData *data, PeerData *peer) {
data->check = true; data->check = true;
_checkedContacts.insert(peer, true); _checkedContacts.insert(peer, true);
++_selCount; ++_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); Ui::showLayer(new InformBox(lng_profile_add_more_after_upgrade(lt_count, Global::MegagroupSizeMax())), KeepOtherLayers);
} }
if (cnt != _selCount) emit chosenChanged(); if (cnt != _selCount) emit chosenChanged();
@ -1549,7 +1553,7 @@ void ContactsBox::paintEvent(QPaintEvent *e) {
paintTitle(p, lang(lng_channel_admins)); paintTitle(p, lang(lng_channel_admins));
} else if (_inner.chat() || _inner.creating() != CreatingGroupNone) { } else if (_inner.chat() || _inner.creating() != CreatingGroupNone) {
QString title(lang(addingAdmin ? lng_channel_add_admin : lng_profile_add_participant)); 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); paintTitle(p, title, additional);
} else if (_inner.bot()) { } else if (_inner.bot()) {
paintTitle(p, lang(lng_bot_choose_group)); paintTitle(p, lang(lng_bot_choose_group));
@ -1718,7 +1722,13 @@ bool ContactsBox::editAdminFail(const RPCError &error) {
if (mtpIsFlood(error)) return true; if (mtpIsFlood(error)) return true;
--_saveRequestId; --_saveRequestId;
_inner.chat()->invalidateParticipants(); _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; return false;
} }
@ -1765,6 +1775,9 @@ bool ContactsBox::creationFail(const RPCError &error) {
} else if (error.type() == "PEER_FLOOD") { } 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); 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; return true;
} else if (error.type() == qstr("USER_RESTRICTED")) {
Ui::showLayer(new InformBox(lang(lng_cant_do_this)));
return true;
} }
return false; return false;
} }

View File

@ -88,7 +88,7 @@ void LanguageBox::mousePressEvent(QMouseEvent *e) {
return; return;
} else if (!loader.warnings().isEmpty()) { } else if (!loader.warnings().isEmpty()) {
QString warn = loader.warnings(); 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)); Ui::showLayer(new InformBox(qsl("Lang \"") + LanguageCodes[i] + qsl("\" warnings :(\n\nWarnings: ") + warn));
return; return;
} }

View File

@ -23,7 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
static const int32 AppVersion = 9034; static const int32 AppVersion = 9034;
static const wchar_t *AppVersionStr = L"0.9.34"; static const wchar_t *AppVersionStr = L"0.9.34";
static const bool DevVersion = false; static const bool DevVersion = false;
#define BETA_VERSION (9034002ULL) // just comment this line to build public version #define BETA_VERSION (9034003ULL) // just comment this line to build public version
static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
static const wchar_t *AppName = L"Telegram Desktop"; static const wchar_t *AppName = L"Telegram Desktop";

View File

@ -1828,15 +1828,26 @@ StickerPanInner::InlineRow &StickerPanInner::layoutInlineRow(InlineRow &row, int
int32 count = row.items.size(); int32 count = row.items.size();
t_assert(count <= SavedGifsMaxPerRow); 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; row.height = 0;
int32 availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1); int availw = width() - st::inlineResultsLeft - st::inlineResultsSkip * (count - 1);
for (int32 i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
int32 w = sumWidth ? (row.items.at(i)->maxWidth() * availw / sumWidth) : row.items.at(i)->maxWidth(); int index = indices[i];
int32 actualw = qMax(w, int32(st::inlineResultsMinWidth)); int w = sumWidth ? (row.items.at(index)->maxWidth() * availw / sumWidth) : row.items.at(index)->maxWidth();
row.height = qMax(row.height, row.items.at(i)->resizeGetHeight(actualw)); int actualw = qMax(w, int(st::inlineResultsMinWidth));
row.height = qMax(row.height, row.items.at(index)->resizeGetHeight(actualw));
if (sumWidth) { if (sumWidth) {
availw -= actualw; availw -= actualw;
sumWidth -= row.items.at(i)->maxWidth(); sumWidth -= row.items.at(index)->maxWidth();
} }
} }
return row; return row;

View File

@ -3471,7 +3471,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
if (length) { if (length) {
style::font blockFont = font; style::font blockFont = font;
if (!flags && lnkIndex) { if (!flags && lnkIndex) {
// should use textStyle lnkFlags somehow.. not supported // should use textStyle lnkFlags somehow... not supported
} }
if ((flags & TextBlockFPre) || (flags & TextBlockFCode)) { if ((flags & TextBlockFPre) || (flags & TextBlockFCode)) {

View File

@ -1819,7 +1819,7 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice, const QVector<MTPM
// some checks if there was some message history already // some checks if there was some message history already
if (block && blocks.size() > 1) { if (block && blocks.size() > 1) {
HistoryItem *last = block->items.back(); // .. item, item, item, last ], [ first, item, item .. HistoryItem *last = block->items.back(); // ... item, item, item, last ], [ first, item, item ...
HistoryItem *first = blocks.at(1)->items.front(); HistoryItem *first = blocks.at(1)->items.front();
// we've added a new front block, so previous item for // we've added a new front block, so previous item for
@ -3902,6 +3902,9 @@ void HistoryDocument::initDimensions(const HistoryItem *parent) {
if (thumbed) { if (thumbed) {
_minh = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom(); _minh = st::msgFileThumbPadding.top() + st::msgFileThumbSize + st::msgFileThumbPadding.bottom();
if (!captioned && parent->Is<HistoryMessageSigned>()) {
_minh += st::msgDateFont->height - st::msgDateDelta.y();
}
} else { } else {
_minh = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom(); _minh = st::msgFilePadding.top() + st::msgFileSize + st::msgFilePadding.bottom();
} }
@ -6946,7 +6949,7 @@ QString HistoryMessage::notificationHeader() const {
QString HistoryMessage::notificationText() const { QString HistoryMessage::notificationText() const {
QString msg(inDialogsText()); 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; return msg;
} }
@ -7513,7 +7516,7 @@ bool HistoryServiceMessage::updatePinnedText(const QString *pfrom, QString *ptex
} }
} }
if (!limit && cutat + 5 < size) { 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)); text = lng_action_pinned_message(lt_from, from, lt_text, textcmdLink(2, original));
} else { } else {
@ -7796,7 +7799,7 @@ void HistoryServiceMessage::drawInDialog(Painter &p, const QRect &r, bool act, c
QString HistoryServiceMessage::notificationText() const { QString HistoryServiceMessage::notificationText() const {
QString msg = _text.original(); 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; return msg;
} }
@ -7817,7 +7820,7 @@ HistoryServiceMessage::~HistoryServiceMessage() {
} }
HistoryGroup::HistoryGroup(History *history, const MTPDmessageGroup &group, const QDateTime &date) HistoryGroup::HistoryGroup(History *history, const MTPDmessageGroup &group, const QDateTime &date)
: HistoryServiceMessage(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)*/) : HistoryServiceMessage(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) , _minId(group.vmin_id.v)
, _maxId(group.vmax_id.v) , _maxId(group.vmax_id.v)
, _count(group.vcount.v) , _count(group.vcount.v)
@ -7825,7 +7828,7 @@ HistoryGroup::HistoryGroup(History *history, const MTPDmessageGroup &group, cons
} }
HistoryGroup::HistoryGroup(History *history, HistoryItem *newItem, const QDateTime &date) HistoryGroup::HistoryGroup(History *history, HistoryItem *newItem, const QDateTime &date)
: HistoryServiceMessage(history, clientMsgId(), date, lng_channel_comments_count(lt_count, 1)/* + qsl(" (%1 .. %2)").arg(newItem->id - 1).arg(newItem->id + 1)*/) : HistoryServiceMessage(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) , _minId(newItem->id - 1)
, _maxId(newItem->id + 1) , _maxId(newItem->id + 1)
, _count(1) , _count(1)
@ -7891,7 +7894,7 @@ bool HistoryGroup::decrementCount() {
} }
void HistoryGroup::updateText() { 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, MsgId wasMinId, const QDateTime &date) HistoryCollapse::HistoryCollapse(History *history, MsgId wasMinId, const QDateTime &date)

View File

@ -8021,6 +8021,7 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
drawPinnedBar(p); drawPinnedBar(p);
} }
if (_scroll.isHidden()) { 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); QPoint dogPos((width() - st::msgDogImg.pxWidth()) / 2, ((height() - _field.height() - 2 * st::sendPadding - st::msgDogImg.pxHeight()) * 4) / 9);
p.drawPixmap(dogPos, *cChatDogImage()); p.drawPixmap(dogPos, *cChatDogImage());
} }

View File

@ -1370,7 +1370,7 @@ namespace {
bool result = false; bool result = false;
QFile file(cWorkingDir() + qsl("tdata/config")); QFile file(cWorkingDir() + qsl("tdata/config"));
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
LOG(("App Info: reading old config..")); LOG(("App Info: reading old config..."));
QDataStream stream(&file); QDataStream stream(&file);
stream.setVersion(QDataStream::Qt_5_1); stream.setVersion(QDataStream::Qt_5_1);
@ -1450,7 +1450,7 @@ namespace {
QBuffer decryptedStream(&decrypted); QBuffer decryptedStream(&decrypted);
decryptedStream.open(QIODevice::ReadOnly); decryptedStream.open(QIODevice::ReadOnly);
decryptedStream.seek(4); // skip size decryptedStream.seek(4); // skip size
LOG(("App Info: reading encrypted old user config..")); LOG(("App Info: reading encrypted old user config..."));
_readOldUserSettingsFields(&decryptedStream, version); _readOldUserSettingsFields(&decryptedStream, version);
} else if (!_readSetting(blockId, stream, version)) { } else if (!_readSetting(blockId, stream, version)) {
@ -1463,7 +1463,7 @@ namespace {
bool result = false; bool result = false;
QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString()) + qsl("_config")); QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString()) + qsl("_config"));
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
LOG(("App Info: reading old user config..")); LOG(("App Info: reading old user config..."));
qint32 version = 0; qint32 version = 0;
MTP::DcOptions dcOpts; MTP::DcOptions dcOpts;
@ -1537,7 +1537,7 @@ namespace {
QBuffer decryptedStream(&decrypted); QBuffer decryptedStream(&decrypted);
decryptedStream.open(QIODevice::ReadOnly); decryptedStream.open(QIODevice::ReadOnly);
decryptedStream.seek(4); // skip size decryptedStream.seek(4); // skip size
LOG(("App Info: reading encrypted old keys..")); LOG(("App Info: reading encrypted old keys..."));
_readOldMtpDataFields(&decryptedStream, version); _readOldMtpDataFields(&decryptedStream, version);
} else if (!_readSetting(blockId, stream, version)) { } else if (!_readSetting(blockId, stream, version)) {
@ -1550,7 +1550,7 @@ namespace {
bool result = false; bool result = false;
QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString())); QFile file(cWorkingDir() + cDataFile() + (cTestMode() ? qsl("_test") : QString()));
if (file.open(QIODevice::ReadOnly)) { if (file.open(QIODevice::ReadOnly)) {
LOG(("App Info: reading old keys..")); LOG(("App Info: reading old keys..."));
qint32 version = 0; qint32 version = 0;
MTP::DcOptions dcOpts; MTP::DcOptions dcOpts;
@ -1647,7 +1647,7 @@ namespace {
return _writeUserSettings(); return _writeUserSettings();
} }
LOG(("App Info: reading encrypted user settings..")); LOG(("App Info: reading encrypted user settings..."));
while (!userSettings.stream.atEnd()) { while (!userSettings.stream.atEnd()) {
quint32 blockId; quint32 blockId;
userSettings.stream >> blockId; userSettings.stream >> blockId;
@ -1693,7 +1693,7 @@ namespace {
return; return;
} }
LOG(("App Info: reading encrypted mtp data..")); LOG(("App Info: reading encrypted mtp data..."));
while (!mtp.stream.atEnd()) { while (!mtp.stream.atEnd()) {
quint32 blockId; quint32 blockId;
mtp.stream >> blockId; mtp.stream >> blockId;
@ -1719,7 +1719,7 @@ namespace {
if (!readFile(mapData, qsl("map"))) { if (!readFile(mapData, qsl("map"))) {
return Local::ReadMapFailed; return Local::ReadMapFailed;
} }
LOG(("App Info: reading map..")); LOG(("App Info: reading map..."));
QByteArray salt, keyEncrypted, mapEncrypted; QByteArray salt, keyEncrypted, mapEncrypted;
mapData.stream >> salt >> keyEncrypted >> mapEncrypted; mapData.stream >> salt >> keyEncrypted >> mapEncrypted;
@ -1735,7 +1735,7 @@ namespace {
EncryptedDescriptor keyData, map; EncryptedDescriptor keyData, map;
if (!decryptLocal(keyData, keyEncrypted, _passKey)) { 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; return Local::ReadMapPassNeeded;
} }
uchar key[LocalEncryptKeySize] = { 0 }; uchar key[LocalEncryptKeySize] = { 0 };
@ -1752,7 +1752,7 @@ namespace {
LOG(("App Error: could not decrypt map.")); LOG(("App Error: could not decrypt map."));
return Local::ReadMapFailed; return Local::ReadMapFailed;
} }
LOG(("App Info: reading encrypted map..")); LOG(("App Info: reading encrypted map..."));
DraftsMap draftsMap, draftCursorsMap; DraftsMap draftsMap, draftCursorsMap;
DraftsNotReadMap draftsNotReadMap; DraftsNotReadMap draftsNotReadMap;
@ -2101,7 +2101,7 @@ namespace Local {
_readOldMtpData(false); // needed further in _readMtpData _readOldMtpData(false); // needed further in _readMtpData
return writeSettings(); return writeSettings();
} }
LOG(("App Info: reading settings..")); LOG(("App Info: reading settings..."));
QByteArray salt, settingsEncrypted; QByteArray salt, settingsEncrypted;
settingsData.stream >> salt >> settingsEncrypted; settingsData.stream >> salt >> settingsEncrypted;
@ -2117,7 +2117,7 @@ namespace Local {
EncryptedDescriptor settings; EncryptedDescriptor settings;
if (!decryptLocal(settings, settingsEncrypted, _settingsKey)) { 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(); return writeSettings();
} }
MTP::DcOptions dcOpts; MTP::DcOptions dcOpts;
@ -2126,7 +2126,7 @@ namespace Local {
dcOpts = Global::DcOptions(); dcOpts = Global::DcOptions();
} }
_dcOpts = &dcOpts; _dcOpts = &dcOpts;
LOG(("App Info: reading encrypted settings..")); LOG(("App Info: reading encrypted settings..."));
while (!settings.stream.atEnd()) { while (!settings.stream.atEnd()) {
quint32 blockId; quint32 blockId;
settings.stream >> blockId; settings.stream >> blockId;

View File

@ -62,12 +62,12 @@ int main(int argc, char *argv[]) {
#ifndef TDESKTOP_DISABLE_AUTOUPDATE #ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (cRestartingUpdate()) { if (cRestartingUpdate()) {
DEBUG_LOG(("Application Info: executing updater to install update..")); DEBUG_LOG(("Application Info: executing updater to install update..."));
psExecUpdater(); psExecUpdater();
} else } else
#endif #endif
if (cRestarting()) { if (cRestarting()) {
DEBUG_LOG(("Application Info: executing Telegram, because of restart..")); DEBUG_LOG(("Application Info: executing Telegram, because of restart..."));
psExecTelegram(); psExecTelegram();
} }

View File

@ -54,7 +54,7 @@ public:
} }
void prepareAES(const MTPint128 &msgKey, MTPint256 &aesKey, MTPint256 &aesIV, bool send = true) const { 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; uint32 x = send ? 0 : 8;
@ -90,7 +90,7 @@ public:
} }
void write(QDataStream &to) const { void write(QDataStream &to) const {
if (!_isset) throw mtpErrorKeyNotReady("write(..)"); if (!_isset) throw mtpErrorKeyNotReady("write(...)");
to.writeRawData(_key, 256); to.writeRawData(_key, 256);
} }

View File

@ -447,7 +447,7 @@ ConnectionPrivate::ConnectionPrivate(QThread *thread, Connection *owner, Session
return; return;
} }
dc = options.cbegin().value().id; 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(started()), this, SLOT(socketStart()));
@ -1154,8 +1154,8 @@ void ConnectionPrivate::socketStart(bool afterConfig) {
_pingId = _pingMsgId = _pingIdToSend = _pingSendAt = 0; _pingId = _pingMsgId = _pingIdToSend = _pingSendAt = 0;
_pingSender.stop(); _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 (!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 (!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); _waitForConnectedTimer.start(_waitForConnected);
if (auto conn = _conn4) { if (auto conn = _conn4) {
@ -1188,7 +1188,7 @@ void ConnectionPrivate::restart(bool mayBeBadKey) {
clearMessages(); clearMessages();
keyId = AuthKey::RecreateKeyId; keyId = AuthKey::RecreateKeyId;
// retryTimeout = 1; // no ddos please // 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 { } else {
sessionData->setCheckedKey(false); sessionData->setCheckedKey(false);
@ -1254,7 +1254,7 @@ void ConnectionPrivate::onOldConnection() {
void ConnectionPrivate::onPingSender() { void ConnectionPrivate::onPingSender() {
if (_pingId) { if (_pingId) {
if (_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto - 1) * 1000ULL < getms(true)) { 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(); return restart();
} else { } else {
_pingSender.start(_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto) * 1000ULL - getms(true)); _pingSender.start(_pingSendAt + (MTPPingSendAfter - MTPPingSendAfterAuto) * 1000ULL - getms(true));
@ -1440,7 +1440,7 @@ void ConnectionPrivate::handleReceived() {
bool wasConnected = (getState() == ConnectedState); bool wasConnected = (getState() == ConnectedState);
if (serverSalt != mySalt) { if (serverSalt != mySalt) {
if (!badTime) { 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); sessionData->setSalt(serverSalt);
if (setState(ConnectedState, ConnectingState)) { // only connected if (setState(ConnectedState, ConnectingState)) { // only connected
if (restarted) { if (restarted) {
@ -1449,7 +1449,7 @@ void ConnectionPrivate::handleReceived() {
} }
} }
} else { } 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 { } else {
serverSalt = 0; // dont pass to handle method, so not to lock in setSalt() serverSalt = 0; // dont pass to handle method, so not to lock in setSalt()
@ -1659,7 +1659,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
if (serverSalt) sessionData->setSalt(serverSalt); if (serverSalt) sessionData->setSalt(serverSalt);
unixtimeSet(serverTime, true); 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); resend(resendId, 0, true);
} else { // must create new session, because msg_id and msg_seqno are inconsistent } else { // must create new session, because msg_id and msg_seqno are inconsistent
@ -1710,13 +1710,13 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
badTime = false; 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); resend(resendId);
} return 1; } return 1;
case mtpc_msgs_state_req: { case mtpc_msgs_state_req: {
if (badTime) { if (badTime) {
DEBUG_LOG(("Message Info: skipping with bad time..")); DEBUG_LOG(("Message Info: skipping with bad time..."));
return 0; return 0;
} }
MTPMsgsStateReq msg(from, end); MTPMsgsStateReq msg(from, end);
@ -1818,7 +1818,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
case mtpc_msgs_all_info: { case mtpc_msgs_all_info: {
if (badTime) { if (badTime) {
DEBUG_LOG(("Message Info: skipping with bad time..")); DEBUG_LOG(("Message Info: skipping with bad time..."));
return 0; return 0;
} }
@ -1862,14 +1862,14 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
if (received) { if (received) {
ackRequestData.push_back(resMsgId); ackRequestData.push_back(resMsgId);
} else { } 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); resendRequestData.push_back(resMsgId);
} }
} return 1; } return 1;
case mtpc_msg_new_detailed_info: { case mtpc_msg_new_detailed_info: {
if (badTime) { 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; return 0;
} }
MTPMsgDetailedInfo msg(from, end); MTPMsgDetailedInfo msg(from, end);
@ -1887,7 +1887,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
if (received) { if (received) {
ackRequestData.push_back(resMsgId); ackRequestData.push_back(resMsgId);
} else { } 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); resendRequestData.push_back(resMsgId);
} }
} return 1; } return 1;
@ -1914,7 +1914,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
MTPlong reqMsgId(++from, end); MTPlong reqMsgId(++from, end);
mtpTypeId typeId = from[0]; 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<MTPlong> ids(1, reqMsgId); QVector<MTPlong> ids(1, reqMsgId);
if (badTime) { if (badTime) {
@ -1995,7 +1995,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
if (badTime) return 0; if (badTime) return 0;
MTPPing msg(from, end); 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); emit sendPongAsync(msgId, msg.vping_id.v);
} return 1; } return 1;
@ -2012,7 +2012,7 @@ int32 ConnectionPrivate::handleOneReceived(const mtpPrime *from, const mtpPrime
if (data.vping_id.v == _pingId) { if (data.vping_id.v == _pingId) {
_pingId = 0; _pingId = 0;
} else { } else {
DEBUG_LOG(("Message Info: just pong..")); DEBUG_LOG(("Message Info: just pong..."));
} }
QVector<MTPlong> ids(1, data.vmsg_id); QVector<MTPlong> ids(1, data.vmsg_id);
@ -2154,7 +2154,7 @@ void ConnectionPrivate::requestsAcked(const QVector<MTPlong> &ids, bool byRespon
} }
} }
} else { } 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()); QWriteLocker locker3(sessionData->toResendMutex());
mtpRequestIdsMap &toResend(sessionData->toResendMap()); mtpRequestIdsMap &toResend(sessionData->toResendMap());
mtpRequestIdsMap::iterator reqIt = toResend.find(msgId); mtpRequestIdsMap::iterator reqIt = toResend.find(msgId);
@ -2228,7 +2228,7 @@ void ConnectionPrivate::handleMsgsStates(const QVector<MTPlong> &ids, const stri
const mtpRequestMap &haveSent(sessionData->haveSentMap()); const mtpRequestMap &haveSent(sessionData->haveSentMap());
mtpRequestMap::const_iterator haveSentEnd = haveSent.cend(); mtpRequestMap::const_iterator haveSentEnd = haveSent.cend();
if (haveSent.find(requestMsgId) == haveSentEnd) { 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()); QWriteLocker locker2(sessionData->toResendMutex());
mtpRequestIdsMap &toResend(sessionData->toResendMap()); mtpRequestIdsMap &toResend(sessionData->toResendMap());
mtpRequestIdsMap::iterator reqIt = toResend.find(requestMsgId); mtpRequestIdsMap::iterator reqIt = toResend.find(requestMsgId);
@ -2385,7 +2385,7 @@ void ConnectionPrivate::updateAuthKey() {
connect(_conn, SIGNAL(receivedData()), this, SLOT(pqAnswered())); connect(_conn, SIGNAL(receivedData()), this, SLOT(pqAnswered()));
DEBUG_LOG(("AuthKey Info: sending Req_pq..")); DEBUG_LOG(("AuthKey Info: sending Req_pq..."));
lockFinished.unlock(); lockFinished.unlock();
sendRequestNotSecure(req_pq); sendRequestNotSecure(req_pq);
} }
@ -2398,7 +2398,7 @@ void ConnectionPrivate::clearMessages() {
void ConnectionPrivate::pqAnswered() { void ConnectionPrivate::pqAnswered() {
disconnect(_conn, SIGNAL(receivedData()), this, SLOT(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; MTPReq_pq::ResponseType res_pq;
if (!readResponseNotSecure(res_pq)) { if (!readResponseNotSecure(res_pq)) {
@ -2490,13 +2490,13 @@ void ConnectionPrivate::pqAnswered() {
} }
connect(_conn, SIGNAL(receivedData()), this, SLOT(dhParamsAnswered())); 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); sendRequestNotSecure(req_DH_params);
} }
void ConnectionPrivate::dhParamsAnswered() { void ConnectionPrivate::dhParamsAnswered() {
disconnect(_conn, SIGNAL(receivedData()), this, SLOT(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; MTPReq_DH_params::ResponseType res_DH_params;
if (!readResponseNotSecure(res_DH_params)) { if (!readResponseNotSecure(res_DH_params)) {
@ -2672,7 +2672,7 @@ void ConnectionPrivate::dhClientParamsSend() {
connect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); 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); sendRequestNotSecure(req_client_DH_params);
} }
@ -2681,7 +2681,7 @@ void ConnectionPrivate::dhClientParamsAnswered() {
if (!sessionData) return; if (!sessionData) return;
disconnect(_conn, SIGNAL(receivedData()), this, SLOT(dhClientParamsAnswered())); 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; MTPSet_client_DH_params::ResponseType res_client_DH_params;
if (!readResponseNotSecure(res_client_DH_params)) { if (!readResponseNotSecure(res_client_DH_params)) {
@ -2839,7 +2839,7 @@ void ConnectionPrivate::onError4(bool mayBeBadKey) {
destroyConn(); destroyConn();
_waitForConnectedTimer.stop(); _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); return restart(mayBeBadKey);
} else { } else {
destroyConn(&_conn4); destroyConn(&_conn4);
@ -2853,7 +2853,7 @@ void ConnectionPrivate::onError6(bool mayBeBadKey) {
destroyConn(); destroyConn();
_waitForConnectedTimer.stop(); _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); return restart(mayBeBadKey);
} else { } else {
destroyConn(&_conn6); destroyConn(&_conn6);
@ -2940,7 +2940,7 @@ bool ConnectionPrivate::sendRequest(mtpRequest &request, bool needAnyResponse, Q
ReadLockerAttempt lock(sessionData->keyMutex()); ReadLockerAttempt lock(sessionData->keyMutex());
if (!lock) { 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(); lockFinished.unlock();
restart(); restart();

View File

@ -132,7 +132,7 @@ void AbstractTCPConnection::socketRead() {
emit error(); emit error();
return; return;
} else { } else {
TCP_LOG(("TCP Info: no bytes read, but bytes available was true..")); TCP_LOG(("TCP Info: no bytes read, but bytes available was true..."));
break; break;
} }
} while (sock.state() == QAbstractSocket::ConnectedState && sock.bytesAvailable()); } while (sock.state() == QAbstractSocket::ConnectedState && sock.bytesAvailable());

View File

@ -66,7 +66,7 @@ void mtpTextSerializeCore(MTPStringLogger &to, const mtpPrime *&from, const mtpP
} else if (strUtf8.size() < 64) { } else if (strUtf8.size() < 64) {
to.add(Logs::mb(strUtf8.constData(), strUtf8.size()).str()).add(" [").add(mtpWrapNumber(strUtf8.size())).add(" BYTES]"); to.add(Logs::mb(strUtf8.constData(), strUtf8.size()).str()).add(" [").add(mtpWrapNumber(strUtf8.size())).add(" BYTES]");
} else { } 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; } break;

View File

@ -388,7 +388,7 @@ void registerRequest(mtpRequestId requestId, int32 dcWithShift) {
QMutexLocker locker(&requestByDCLock); QMutexLocker locker(&requestByDCLock);
requestsByDC.insert(requestId, dcWithShift); requestsByDC.insert(requestId, dcWithShift);
} }
internal::performDelayedClear(); // need to do it somewhere.. internal::performDelayedClear(); // need to do it somewhere...
} }
void unregisterRequest(mtpRequestId requestId) { void unregisterRequest(mtpRequestId requestId) {
@ -517,7 +517,7 @@ void execCallback(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *
h = i.value(); h = i.value();
parserMap.erase(i); parserMap.erase(i);
DEBUG_LOG(("RPC Info: found parser for request %1, trying to parse response..").arg(requestId)); DEBUG_LOG(("RPC Info: found parser for request %1, trying to parse response...").arg(requestId));
} }
} }
if (h.onDone || h.onFail) { if (h.onDone || h.onFail) {

View File

@ -1034,7 +1034,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
data->online = App::onlineText(user, l_time); data->online = App::onlineText(user, l_time);
} }
if (_peerChat) { 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) { } else if (_peerChannel) {
data->admin = (_peerChannel->mgInfo->lastAdmins.constFind(user) != _peerChannel->mgInfo->lastAdmins.cend()); data->admin = (_peerChannel->mgInfo->lastAdmins.constFind(user) != _peerChannel->mgInfo->lastAdmins.cend());
} else { } else {
@ -1509,10 +1509,13 @@ void ProfileInner::contextMenuEvent(QContextMenuEvent *e) {
_menu->deleteLater(); _menu->deleteLater();
_menu = 0; _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); QRect info(_left + st::profilePhotoSize + st::profilePhoneLeft, st::profilePadding.top(), _width - st::profilePhotoSize - st::profilePhoneLeft, st::profilePhotoSize);
if (info.contains(mapFromGlobal(e->globalPos()))) { if (info.contains(mapFromGlobal(e->globalPos()))) {
_menu = new PopupMenu(); _menu = new PopupMenu();
if (_peerUser) {
_menu->addAction(lang(lng_profile_copy_fullname), this, SLOT(onCopyFullName()))->setEnabled(true);
}
if (!_phoneText.isEmpty()) { if (!_phoneText.isEmpty()) {
_menu->addAction(lang(lng_profile_copy_phone), this, SLOT(onCopyPhone()))->setEnabled(true); _menu->addAction(lang(lng_profile_copy_phone), this, SLOT(onCopyPhone()))->setEnabled(true);
} }
@ -1532,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() { void ProfileInner::onCopyPhone() {
QApplication::clipboard()->setText(_phoneText); QApplication::clipboard()->setText(_phoneText);
} }

View File

@ -109,6 +109,7 @@ public slots:
void onMediaLinks(); void onMediaLinks();
void onMenuDestroy(QObject *obj); void onMenuDestroy(QObject *obj);
void onCopyFullName();
void onCopyPhone(); void onCopyPhone();
void onCopyUsername(); void onCopyUsername();

View File

@ -347,7 +347,7 @@ namespace {
} }
bool loadLibrary(QLibrary &lib, const char *name, int version) { 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); lib.setFileNameAndVersion(QLatin1String(name), version);
if (lib.load()) { if (lib.load()) {
DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version)); DEBUG_LOG(("Loaded '%1' with version %2!").arg(QLatin1String(name)).arg(version));
@ -443,7 +443,7 @@ namespace {
} }
if (!useGtkBase && lib_gtk.isLoaded()) { 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); setupGtkBase(lib_gtk);
} }
if (!useGtkBase) { if (!useGtkBase) {

View File

@ -2197,7 +2197,7 @@ namespace {
} }
bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) { 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); LSTATUS status = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE | KEY_WRITE, rkey);
if (status != ERROR_SUCCESS) { if (status != ERROR_SUCCESS) {
if (status == ERROR_FILE_NOT_FOUND) { if (status == ERROR_FILE_NOT_FOUND) {
@ -2236,7 +2236,7 @@ namespace {
void RegisterCustomScheme() { void RegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME #ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
DEBUG_LOG(("App Info: Checking custom scheme 'tg'..")); DEBUG_LOG(("App Info: Checking custom scheme 'tg'..."));
HKEY rkey; HKEY rkey;
QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()); QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
@ -3385,7 +3385,7 @@ void CheckPinnedAppUserModelId() {
BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo); BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo);
CloseHandle(srcfile); CloseHandle(srcfile);
if (!srcres) return; if (!srcres) return;
LOG(("Checking..")); LOG(("Checking..."));
WIN32_FIND_DATA findData; WIN32_FIND_DATA findData;
HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0); HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0);
if (findHandle == INVALID_HANDLE_VALUE) { if (findHandle == INVALID_HANDLE_VALUE) {
@ -3431,7 +3431,7 @@ void CheckPinnedAppUserModelId() {
PROPVARIANT appIdPropVar; PROPVARIANT appIdPropVar;
hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar); hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar);
if (!SUCCEEDED(hr)) return; if (!SUCCEEDED(hr)) return;
LOG(("Reading..")); LOG(("Reading..."));
WCHAR already[MAX_PATH]; WCHAR already[MAX_PATH];
hr = propVariantToString(appIdPropVar, already, MAX_PATH); hr = propVariantToString(appIdPropVar, already, MAX_PATH);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {

View File

@ -2210,7 +2210,7 @@ namespace {
//} //}
//bool _psOpenRegKey(LPCWSTR key, PHKEY rkey) { //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); // LSTATUS status = RegOpenKeyEx(HKEY_CURRENT_USER, key, 0, KEY_QUERY_VALUE | KEY_WRITE, rkey);
// if (status != ERROR_SUCCESS) { // if (status != ERROR_SUCCESS) {
// if (status == ERROR_FILE_NOT_FOUND) { // if (status == ERROR_FILE_NOT_FOUND) {
@ -2249,7 +2249,7 @@ namespace {
void RegisterCustomScheme() { void RegisterCustomScheme() {
#ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME #ifndef TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME
DEBUG_LOG(("App Info: Checking custom scheme 'tg'..")); DEBUG_LOG(("App Info: Checking custom scheme 'tg'..."));
//HKEY rkey; //HKEY rkey;
//QString exe = QDir::toNativeSeparators(cExeDir() + cExeName()); //QString exe = QDir::toNativeSeparators(cExeDir() + cExeName());
@ -2799,7 +2799,7 @@ void CheckPinnedAppUserModelId() {
//BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo); //BOOL srcres = GetFileInformationByHandle(srcfile, &srcinfo);
//CloseHandle(srcfile); //CloseHandle(srcfile);
//if (!srcres) return; //if (!srcres) return;
//LOG(("Checking..")); //LOG(("Checking..."));
//WIN32_FIND_DATA findData; //WIN32_FIND_DATA findData;
//HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0); //HANDLE findHandle = FindFirstFileEx((p + L"*").c_str(), FindExInfoStandard, &findData, FindExSearchNameMatch, 0, 0);
//if (findHandle == INVALID_HANDLE_VALUE) { //if (findHandle == INVALID_HANDLE_VALUE) {
@ -2845,7 +2845,7 @@ void CheckPinnedAppUserModelId() {
// PROPVARIANT appIdPropVar; // PROPVARIANT appIdPropVar;
// hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar); // hr = propertyStore->GetValue(pkey_AppUserModel_ID, &appIdPropVar);
// if (!SUCCEEDED(hr)) return; // if (!SUCCEEDED(hr)) return;
// LOG(("Reading..")); // LOG(("Reading..."));
// WCHAR already[MAX_PATH]; // WCHAR already[MAX_PATH];
// hr = propVariantToString(appIdPropVar, already, MAX_PATH); // hr = propVariantToString(appIdPropVar, already, MAX_PATH);
// if (SUCCEEDED(hr)) { // if (SUCCEEDED(hr)) {

View File

@ -491,7 +491,7 @@ public:
return flags & MTPDchat::Flag::f_creator; return flags & MTPDchat::Flag::f_creator;
} }
bool amAdmin() const { bool amAdmin() const {
return flags & MTPDchat::Flag::f_admin; return (flags & MTPDchat::Flag::f_admin) && adminsEnabled();
} }
bool isDeactivated() const { bool isDeactivated() const {
return flags & MTPDchat::Flag::f_deactivated; return flags & MTPDchat::Flag::f_deactivated;

View File

@ -290,7 +290,7 @@ namespace ThirdParty {
uchar sha256Buffer[32]; uchar sha256Buffer[32];
RAND_seed(hashSha256(buf, 16, sha256Buffer), 32); RAND_seed(hashSha256(buf, 16, sha256Buffer), 32);
if (!RAND_status()) { 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..."));
} }
} }

View File

@ -2348,7 +2348,7 @@ void LastCrashedWindow::onSendReport() {
connect(_checkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError))); connect(_checkReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onSendingError(QNetworkReply::NetworkError)));
connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished())); connect(_checkReply, SIGNAL(finished()), this, SLOT(onCheckingFinished()));
_pleaseSendReport.setText(qsl("Sending crash report..")); _pleaseSendReport.setText(qsl("Sending crash report..."));
_sendingState = SendingProgress; _sendingState = SendingProgress;
_reportShown = false; _reportShown = false;
updateControls(); updateControls();
@ -2816,7 +2816,7 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
} }
break; break;
case UpdatingCheck: case UpdatingCheck:
_updating.setText(qsl("Checking for updates..")); _updating.setText(qsl("Checking for updates..."));
break; break;
case UpdatingFail: case UpdatingFail:
_updating.setText(qsl("Update check failed :(")); _updating.setText(qsl("Update check failed :("));
@ -2923,9 +2923,9 @@ void LastCrashedWindow::onSendingProgress(qint64 uploaded, qint64 total) {
_sendingState = SendingUploading; _sendingState = SendingUploading;
if (total < 0) { 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 { } 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(); updateControls();
} }

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "SourceFiles\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,9,34,2 FILEVERSION 0,9,34,3
PRODUCTVERSION 0,9,34,2 PRODUCTVERSION 0,9,34,3
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.9.34.2" VALUE "FileVersion", "0.9.34.3"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.9.34.2" VALUE "ProductVersion", "0.9.34.3"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -3,4 +3,4 @@ AppVersionStrMajor 0.9
AppVersionStrSmall 0.9.34 AppVersionStrSmall 0.9.34
AppVersionStr 0.9.34 AppVersionStr 0.9.34
DevChannel 0 DevChannel 0
BetaVersion 9034002 BetaVersion 9034003