mirror of https://github.com/procxx/kepka.git
Merge remote-tracking branch 'private/alpha' into cmake
This commit is contained in:
commit
e3fa17dd4f
|
@ -55,3 +55,12 @@
|
||||||
[submodule "cmake"]
|
[submodule "cmake"]
|
||||||
path = cmake
|
path = cmake
|
||||||
url = https://github.com/desktop-app/cmake_helpers.git
|
url = https://github.com/desktop-app/cmake_helpers.git
|
||||||
|
[submodule "Telegram/ThirdParty/expected"]
|
||||||
|
path = Telegram/ThirdParty/expected
|
||||||
|
url = https://github.com/TartanLlama/expected
|
||||||
|
[submodule "Telegram/ThirdParty/QR"]
|
||||||
|
path = Telegram/ThirdParty/QR
|
||||||
|
url = https://github.com/nayuki/QR-Code-generator
|
||||||
|
[submodule "Telegram/lib_qr"]
|
||||||
|
path = Telegram/lib_qr
|
||||||
|
url = https://github.com/desktop-app/lib_qr.git
|
||||||
|
|
|
@ -49,6 +49,7 @@ addons:
|
||||||
- libvdpau-dev
|
- libvdpau-dev
|
||||||
- libxcb-xkb-dev
|
- libxcb-xkb-dev
|
||||||
- libxkbcommon-dev
|
- libxkbcommon-dev
|
||||||
|
- libatspi2.0-dev
|
||||||
- lintian
|
- lintian
|
||||||
- quilt
|
- quilt
|
||||||
- valac
|
- valac
|
||||||
|
|
|
@ -17,7 +17,7 @@ XKB_PATH="$BUILD/libxkbcommon"
|
||||||
XKB_CACHE_VERSION="3"
|
XKB_CACHE_VERSION="3"
|
||||||
|
|
||||||
QT_PATH="$BUILD/qt"
|
QT_PATH="$BUILD/qt"
|
||||||
QT_CACHE_VERSION="4"
|
QT_CACHE_VERSION="5"
|
||||||
QT_PATCH="$EXTERNAL/patches/qtbase_${QT_VERSION//\./_}.diff"
|
QT_PATCH="$EXTERNAL/patches/qtbase_${QT_VERSION//\./_}.diff"
|
||||||
|
|
||||||
BREAKPAD_PATH="$BUILD/breakpad"
|
BREAKPAD_PATH="$BUILD/breakpad"
|
||||||
|
@ -694,7 +694,6 @@ buildTelegram() {
|
||||||
-Dlinux_path_qt=$QT_PATH \
|
-Dlinux_path_qt=$QT_PATH \
|
||||||
-Dlinux_path_breakpad=$BREAKPAD_PATH \
|
-Dlinux_path_breakpad=$BREAKPAD_PATH \
|
||||||
-Dlinux_path_libexif_lib=/usr/local/lib \
|
-Dlinux_path_libexif_lib=/usr/local/lib \
|
||||||
-Dlinux_path_opus_include=/usr/include/opus \
|
|
||||||
-Dlinux_lib_ssl=-lssl \
|
-Dlinux_lib_ssl=-lssl \
|
||||||
-Dlinux_lib_crypto=-lcrypto \
|
-Dlinux_lib_crypto=-lcrypto \
|
||||||
-Dlinux_lib_icu=-licuuc\ -licutu\ -licui18n \
|
-Dlinux_lib_icu=-licuuc\ -licutu\ -licui18n \
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 635 B |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -178,8 +178,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_photo_caption" = "Caption";
|
"lng_photo_caption" = "Caption";
|
||||||
"lng_photos_comment" = "Comment";
|
"lng_photos_comment" = "Comment";
|
||||||
|
|
||||||
|
"lng_intro_qr_title" = "Scan From Mobile Telegram";
|
||||||
|
"lng_intro_qr_step1" = "**1.** Open Telegram on your phone";
|
||||||
|
"lng_intro_qr_step2" = "**2.** Go to Settings > Devices > Scan QR Code";
|
||||||
|
"lng_intro_qr_step3" = "**3.** Scan this image to Log In";
|
||||||
|
"lng_intro_qr_skip" = "Or log in using your phone number";
|
||||||
|
|
||||||
"lng_phone_title" = "Your Phone Number";
|
"lng_phone_title" = "Your Phone Number";
|
||||||
"lng_phone_desc" = "Please confirm your country code and\nenter your mobile phone number.";
|
"lng_phone_desc" = "Please confirm your country code and\nenter your mobile phone number.";
|
||||||
|
"lng_phone_to_qr" = "Quick log in using QR code";
|
||||||
"lng_country_code" = "Country Code";
|
"lng_country_code" = "Country Code";
|
||||||
"lng_bad_country_code" = "Invalid Country Code";
|
"lng_bad_country_code" = "Invalid Country Code";
|
||||||
"lng_country_ph" = "Search";
|
"lng_country_ph" = "Search";
|
||||||
|
@ -2231,6 +2238,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_mac_menu_new_group" = "New Group";
|
"lng_mac_menu_new_group" = "New Group";
|
||||||
"lng_mac_menu_new_channel" = "New Channel";
|
"lng_mac_menu_new_channel" = "New Channel";
|
||||||
"lng_mac_menu_show" = "Show Telegram";
|
"lng_mac_menu_show" = "Show Telegram";
|
||||||
|
"lng_mac_menu_emoji_and_symbols" = "Emoji & Symbols";
|
||||||
|
|
||||||
"lng_mac_touchbar_favorite_stickers" = "Favorite stickers";
|
"lng_mac_touchbar_favorite_stickers" = "Favorite stickers";
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ inputDocumentFileLocation#bad07584 id:long access_hash:long file_reference:bytes
|
||||||
inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
|
inputSecureFileLocation#cbc7ee28 id:long access_hash:long = InputFileLocation;
|
||||||
inputTakeoutFileLocation#29be5899 = InputFileLocation;
|
inputTakeoutFileLocation#29be5899 = InputFileLocation;
|
||||||
inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
|
inputPhotoFileLocation#40181ffe id:long access_hash:long file_reference:bytes thumb_size:string = InputFileLocation;
|
||||||
|
inputPhotoLegacyFileLocation#d83466f3 id:long access_hash:long file_reference:bytes volume_id:long local_id:int secret:long = InputFileLocation;
|
||||||
inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
|
inputPeerPhotoFileLocation#27d69997 flags:# big:flags.0?true peer:InputPeer volume_id:long local_id:int = InputFileLocation;
|
||||||
inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
|
inputStickerSetThumb#dbaeae9 stickerset:InputStickerSet volume_id:long local_id:int = InputFileLocation;
|
||||||
|
|
||||||
|
@ -347,6 +348,8 @@ updatePeerLocated#b4afcfb0 peers:Vector<PeerLocated> = Update;
|
||||||
updateNewScheduledMessage#39a51dfb message:Message = Update;
|
updateNewScheduledMessage#39a51dfb message:Message = Update;
|
||||||
updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
|
updateDeleteScheduledMessages#90866cee peer:Peer messages:Vector<int> = Update;
|
||||||
updateTheme#8216fba3 theme:Theme = Update;
|
updateTheme#8216fba3 theme:Theme = Update;
|
||||||
|
updateGeoLiveViewed#871fb939 peer:Peer msg_id:int = Update;
|
||||||
|
updateLoginToken#564fe691 = Update;
|
||||||
|
|
||||||
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State;
|
||||||
|
|
||||||
|
@ -1082,6 +1085,12 @@ wallet.liteResponse#764386d7 response:bytes = wallet.LiteResponse;
|
||||||
|
|
||||||
wallet.secretSalt#dd484d64 salt:bytes = wallet.KeySecretSalt;
|
wallet.secretSalt#dd484d64 salt:bytes = wallet.KeySecretSalt;
|
||||||
|
|
||||||
|
auth.loginToken#629f1980 expires:int token:bytes = auth.LoginToken;
|
||||||
|
auth.loginTokenMigrateTo#68e9916 dc_id:int token:bytes = auth.LoginToken;
|
||||||
|
auth.loginTokenSuccess#390d5c5e authorization:auth.Authorization = auth.LoginToken;
|
||||||
|
|
||||||
|
auth.loginTokenInfo#5203303a dc_id:int auth_key_id:long device_model:string platform:string system_version:string api_id:int app_name:string app_version:string ip:string region:string = auth.LoginTokenInfo;
|
||||||
|
|
||||||
---functions---
|
---functions---
|
||||||
|
|
||||||
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
invokeAfterMsg#cb9f372d {X:Type} msg_id:long query:!X = X;
|
||||||
|
@ -1107,6 +1116,10 @@ auth.recoverPassword#4ea56e92 code:string = auth.Authorization;
|
||||||
auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
|
auth.resendCode#3ef1a9bf phone_number:string phone_code_hash:string = auth.SentCode;
|
||||||
auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;
|
auth.cancelCode#1f040578 phone_number:string phone_code_hash:string = Bool;
|
||||||
auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;
|
auth.dropTempAuthKeys#8e48a188 except_auth_keys:Vector<long> = Bool;
|
||||||
|
auth.exportLoginToken#b1b41517 api_id:int api_hash:string except_ids:Vector<int> = auth.LoginToken;
|
||||||
|
auth.importLoginToken#95ac5ce4 token:bytes = auth.LoginToken;
|
||||||
|
auth.acceptLoginToken#42e731b9 token:bytes = Updates;
|
||||||
|
auth.checkLoginToken#7d4fd4b0 token:bytes = auth.LoginTokenInfo;
|
||||||
|
|
||||||
account.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool;
|
account.registerDevice#68976c6f flags:# no_muted:flags.0?true token_type:int token:string app_sandbox:Bool secret:bytes other_uids:Vector<int> = Bool;
|
||||||
account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool;
|
account.unregisterDevice#3076c4bf token_type:int token:string other_uids:Vector<int> = Bool;
|
||||||
|
@ -1422,4 +1435,4 @@ folders.deleteFolder#1c295881 folder_id:int = Updates;
|
||||||
wallet.sendLiteRequest#e2c9d33e body:bytes = wallet.LiteResponse;
|
wallet.sendLiteRequest#e2c9d33e body:bytes = wallet.LiteResponse;
|
||||||
wallet.getKeySecretSalt#b57f346 revoke:Bool = wallet.KeySecretSalt;
|
wallet.getKeySecretSalt#b57f346 revoke:Bool = wallet.KeySecretSalt;
|
||||||
|
|
||||||
// LAYER 106
|
// LAYER 107
|
||||||
|
|
|
@ -21,6 +21,8 @@ p_q_inner_data_dc#a9f55f95 pq:string p:string q:string nonce:int128 server_nonce
|
||||||
p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;
|
p_q_inner_data_temp#3c6a84d4 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data;
|
||||||
p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
|
p_q_inner_data_temp_dc#56fddf88 pq:string p:string q:string nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data;
|
||||||
|
|
||||||
|
bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner;
|
||||||
|
|
||||||
server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
|
server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params;
|
||||||
server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
|
server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:string = Server_DH_Params;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||||
ProcessorArchitecture="ARCHITECTURE"
|
ProcessorArchitecture="ARCHITECTURE"
|
||||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||||
Version="1.9.1.0" />
|
Version="1.9.1.7" />
|
||||||
<Properties>
|
<Properties>
|
||||||
<DisplayName>Telegram Desktop</DisplayName>
|
<DisplayName>Telegram Desktop</DisplayName>
|
||||||
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>
|
<PublisherDisplayName>Telegram FZ-LLC</PublisherDisplayName>
|
||||||
|
|
|
@ -33,8 +33,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,9,1,0
|
FILEVERSION 1,9,1,7
|
||||||
PRODUCTVERSION 1,9,1,0
|
PRODUCTVERSION 1,9,1,7
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -51,10 +51,10 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||||
VALUE "FileDescription", "Telegram Desktop"
|
VALUE "FileDescription", "Telegram Desktop"
|
||||||
VALUE "FileVersion", "1.9.1.0"
|
VALUE "FileVersion", "1.9.1.7"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
||||||
VALUE "ProductName", "Telegram Desktop"
|
VALUE "ProductName", "Telegram Desktop"
|
||||||
VALUE "ProductVersion", "1.9.1.0"
|
VALUE "ProductVersion", "1.9.1.7"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 1,9,1,0
|
FILEVERSION 1,9,1,7
|
||||||
PRODUCTVERSION 1,9,1,0
|
PRODUCTVERSION 1,9,1,7
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -42,10 +42,10 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||||
VALUE "FileVersion", "1.9.1.0"
|
VALUE "FileVersion", "1.9.1.7"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
VALUE "LegalCopyright", "Copyright (C) 2014-2019"
|
||||||
VALUE "ProductName", "Telegram Desktop"
|
VALUE "ProductName", "Telegram Desktop"
|
||||||
VALUE "ProductVersion", "1.9.1.0"
|
VALUE "ProductVersion", "1.9.1.7"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
BLOCK "VarFileInfo"
|
BLOCK "VarFileInfo"
|
||||||
|
|
|
@ -40,6 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
//#include "history/feed/history_feed_section.h" // #feed
|
//#include "history/feed/history_feed_section.h" // #feed
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
|
#include "main/main_account.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/stickers_box.h"
|
#include "boxes/stickers_box.h"
|
||||||
#include "boxes/sticker_set_box.h"
|
#include "boxes/sticker_set_box.h"
|
||||||
|
@ -54,7 +55,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/emoji_config.h"
|
#include "ui/emoji_config.h"
|
||||||
#include "support/support_helper.h"
|
#include "support/support_helper.h"
|
||||||
#include "storage/localimageloader.h"
|
#include "storage/localimageloader.h"
|
||||||
#include "storage/file_download.h"
|
#include "storage/download_manager_mtproto.h"
|
||||||
#include "storage/file_upload.h"
|
#include "storage/file_upload.h"
|
||||||
#include "storage/storage_facade.h"
|
#include "storage/storage_facade.h"
|
||||||
#include "storage/storage_shared_media.h"
|
#include "storage/storage_shared_media.h"
|
||||||
|
@ -222,7 +223,8 @@ bool ApiWrap::BlockedUsersSlice::operator!=(const BlockedUsersSlice &other) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
||||||
: _session(session)
|
: MTP::Sender(session->account().mtp())
|
||||||
|
, _session(session)
|
||||||
, _messageDataResolveDelayed([=] { resolveMessageDatas(); })
|
, _messageDataResolveDelayed([=] { resolveMessageDatas(); })
|
||||||
, _webPagesTimer([=] { resolveWebPages(); })
|
, _webPagesTimer([=] { resolveWebPages(); })
|
||||||
, _draftsSaveTimer([=] { saveDraftsToCloud(); })
|
, _draftsSaveTimer([=] { saveDraftsToCloud(); })
|
||||||
|
@ -280,11 +282,11 @@ void ApiWrap::refreshProxyPromotion() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto key = [&]() -> std::pair<QString, uint32> {
|
const auto key = [&]() -> std::pair<QString, uint32> {
|
||||||
if (Global::ProxySettings() != ProxyData::Settings::Enabled) {
|
if (Global::ProxySettings() != MTP::ProxyData::Settings::Enabled) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const auto &proxy = Global::SelectedProxy();
|
const auto &proxy = Global::SelectedProxy();
|
||||||
if (proxy.type != ProxyData::Type::Mtproto) {
|
if (proxy.type != MTP::ProxyData::Type::Mtproto) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return { proxy.host, proxy.port };
|
return { proxy.host, proxy.port };
|
||||||
|
@ -2971,12 +2973,12 @@ void ApiWrap::requestFileReference(
|
||||||
|
|
||||||
void ApiWrap::refreshFileReference(
|
void ApiWrap::refreshFileReference(
|
||||||
Data::FileOrigin origin,
|
Data::FileOrigin origin,
|
||||||
not_null<mtpFileLoader*> loader,
|
not_null<Storage::DownloadMtprotoTask*> task,
|
||||||
int requestId,
|
int requestId,
|
||||||
const QByteArray ¤t) {
|
const QByteArray ¤t) {
|
||||||
return refreshFileReference(origin, crl::guard(loader, [=](
|
return refreshFileReference(origin, crl::guard(task, [=](
|
||||||
const UpdatedFileReferences &data) {
|
const UpdatedFileReferences &data) {
|
||||||
loader->refreshFileReferenceFrom(data, requestId, current);
|
task->refreshFileReferenceFrom(data, requestId, current);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct MessageGroupId;
|
||||||
struct SendingAlbum;
|
struct SendingAlbum;
|
||||||
enum class SendMediaType;
|
enum class SendMediaType;
|
||||||
struct FileLoadTo;
|
struct FileLoadTo;
|
||||||
class mtpFileLoader;
|
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
|
@ -38,6 +37,7 @@ class Result;
|
||||||
namespace Storage {
|
namespace Storage {
|
||||||
enum class SharedMediaType : signed char;
|
enum class SharedMediaType : signed char;
|
||||||
struct PreparedList;
|
struct PreparedList;
|
||||||
|
class DownloadMtprotoTask;
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
@ -201,7 +201,7 @@ public:
|
||||||
FileReferencesHandler &&handler);
|
FileReferencesHandler &&handler);
|
||||||
void refreshFileReference(
|
void refreshFileReference(
|
||||||
Data::FileOrigin origin,
|
Data::FileOrigin origin,
|
||||||
not_null<mtpFileLoader*> loader,
|
not_null<Storage::DownloadMtprotoTask*> task,
|
||||||
int requestId,
|
int requestId,
|
||||||
const QByteArray ¤t);
|
const QByteArray ¤t);
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ void ShowAddParticipantsError(
|
||||||
Ui::show(Box<InformBox>(text), Ui::LayerOption::KeepOther);
|
Ui::show(Box<InformBox>(text), Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
class RevokePublicLinkBox::Inner : public TWidget, private MTP::Sender {
|
class RevokePublicLinkBox::Inner : public TWidget {
|
||||||
public:
|
public:
|
||||||
Inner(
|
Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -228,6 +228,7 @@ private:
|
||||||
void updateSelected();
|
void updateSelected();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
PeerData *_selected = nullptr;
|
PeerData *_selected = nullptr;
|
||||||
PeerData *_pressed = nullptr;
|
PeerData *_pressed = nullptr;
|
||||||
|
@ -450,6 +451,7 @@ GroupInfoBox::GroupInfoBox(
|
||||||
const QString &title,
|
const QString &title,
|
||||||
Fn<void(not_null<ChannelData*>)> channelDone)
|
Fn<void(not_null<ChannelData*>)> channelDone)
|
||||||
: _navigation(navigation)
|
: _navigation(navigation)
|
||||||
|
, _api(_navigation->session().api().instance())
|
||||||
, _type(type)
|
, _type(type)
|
||||||
, _initialTitle(title)
|
, _initialTitle(title)
|
||||||
, _channelDone(std::move(channelDone)) {
|
, _channelDone(std::move(channelDone)) {
|
||||||
|
@ -569,7 +571,7 @@ void GroupInfoBox::createGroup(
|
||||||
if (inputs.empty()) {
|
if (inputs.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_creationRequestId = request(MTPmessages_CreateChat(
|
_creationRequestId = _api.request(MTPmessages_CreateChat(
|
||||||
MTP_vector<MTPInputUser>(inputs),
|
MTP_vector<MTPInputUser>(inputs),
|
||||||
MTP_string(title)
|
MTP_string(title)
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
@ -645,7 +647,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
||||||
const auto flags = (_type == Type::Megagroup)
|
const auto flags = (_type == Type::Megagroup)
|
||||||
? MTPchannels_CreateChannel::Flag::f_megagroup
|
? MTPchannels_CreateChannel::Flag::f_megagroup
|
||||||
: MTPchannels_CreateChannel::Flag::f_broadcast;
|
: MTPchannels_CreateChannel::Flag::f_broadcast;
|
||||||
_creationRequestId = request(MTPchannels_CreateChannel(
|
_creationRequestId = _api.request(MTPchannels_CreateChannel(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
MTP_string(title),
|
MTP_string(title),
|
||||||
MTP_string(description),
|
MTP_string(description),
|
||||||
|
@ -682,7 +684,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
||||||
std::move(image));
|
std::move(image));
|
||||||
}
|
}
|
||||||
_createdChannel = channel;
|
_createdChannel = channel;
|
||||||
_creationRequestId = request(MTPmessages_ExportChatInvite(
|
_creationRequestId = _api.request(MTPmessages_ExportChatInvite(
|
||||||
_createdChannel->input
|
_createdChannel->input
|
||||||
)).done([=](const MTPExportedChatInvite &result) {
|
)).done([=](const MTPExportedChatInvite &result) {
|
||||||
_creationRequestId = 0;
|
_creationRequestId = 0;
|
||||||
|
@ -1287,6 +1289,7 @@ RevokePublicLinkBox::Inner::Inner(
|
||||||
Fn<void()> revokeCallback)
|
Fn<void()> revokeCallback)
|
||||||
: TWidget(parent)
|
: TWidget(parent)
|
||||||
, _session(session)
|
, _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||||
, _revokeWidth(st::normalFont->width(tr::lng_channels_too_much_public_revoke(tr::now)))
|
, _revokeWidth(st::normalFont->width(tr::lng_channels_too_much_public_revoke(tr::now)))
|
||||||
, _revokeCallback(std::move(revokeCallback)) {
|
, _revokeCallback(std::move(revokeCallback)) {
|
||||||
|
@ -1294,7 +1297,7 @@ RevokePublicLinkBox::Inner::Inner(
|
||||||
|
|
||||||
resize(width(), 5 * _rowHeight);
|
resize(width(), 5 * _rowHeight);
|
||||||
|
|
||||||
request(MTPchannels_GetAdminedPublicChannels(
|
_api.request(MTPchannels_GetAdminedPublicChannels(
|
||||||
MTP_flags(0)
|
MTP_flags(0)
|
||||||
)).done([=](const MTPmessages_Chats &result) {
|
)).done([=](const MTPmessages_Chats &result) {
|
||||||
const auto &chats = result.match([](const auto &data) {
|
const auto &chats = result.match([](const auto &data) {
|
||||||
|
@ -1401,7 +1404,7 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
auto confirmText = tr::lng_channels_too_much_public_revoke(tr::now);
|
auto confirmText = tr::lng_channels_too_much_public_revoke(tr::now);
|
||||||
_weakRevokeConfirmBox = Ui::show(Box<ConfirmBox>(text, confirmText, crl::guard(this, [this, pressed]() {
|
_weakRevokeConfirmBox = Ui::show(Box<ConfirmBox>(text, confirmText, crl::guard(this, [this, pressed]() {
|
||||||
if (_revokeRequestId) return;
|
if (_revokeRequestId) return;
|
||||||
_revokeRequestId = request(MTPchannels_UpdateUsername(
|
_revokeRequestId = _api.request(MTPchannels_UpdateUsername(
|
||||||
pressed->asChannel()->inputChannel,
|
pressed->asChannel()->inputChannel,
|
||||||
MTP_string()
|
MTP_string()
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
|
|
|
@ -94,7 +94,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GroupInfoBox : public Ui::BoxContent, private MTP::Sender {
|
class GroupInfoBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type {
|
||||||
Group,
|
Group,
|
||||||
|
@ -124,6 +124,7 @@ private:
|
||||||
void updateMaxHeight();
|
void updateMaxHeight();
|
||||||
|
|
||||||
const not_null<Window::SessionNavigation*> _navigation;
|
const not_null<Window::SessionNavigation*> _navigation;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
Type _type = Type::Group;
|
Type _type = Type::Group;
|
||||||
QString _initialTitle;
|
QString _initialTitle;
|
||||||
|
|
|
@ -53,10 +53,7 @@ QImage TakeMiddleSample(QImage original, QSize size) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
class BackgroundBox::Inner
|
class BackgroundBox::Inner : public Ui::RpWidget, private base::Subscriber {
|
||||||
: public Ui::RpWidget
|
|
||||||
, private MTP::Sender
|
|
||||||
, private base::Subscriber {
|
|
||||||
public:
|
public:
|
||||||
Inner(
|
Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -114,6 +111,7 @@ private:
|
||||||
void validatePaperThumbnail(const Paper &paper) const;
|
void validatePaperThumbnail(const Paper &paper) const;
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
std::vector<Paper> _papers;
|
std::vector<Paper> _papers;
|
||||||
|
|
||||||
|
@ -185,6 +183,7 @@ BackgroundBox::Inner::Inner(
|
||||||
not_null<Main::Session*> session)
|
not_null<Main::Session*> session)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _session(session)
|
, _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _check(std::make_unique<Ui::RoundCheckbox>(st::overviewCheck, [=] { update(); })) {
|
, _check(std::make_unique<Ui::RoundCheckbox>(st::overviewCheck, [=] { update(); })) {
|
||||||
_check->setChecked(true, Ui::RoundCheckbox::SetStyle::Fast);
|
_check->setChecked(true, Ui::RoundCheckbox::SetStyle::Fast);
|
||||||
if (_session->data().wallpapers().empty()) {
|
if (_session->data().wallpapers().empty()) {
|
||||||
|
@ -209,7 +208,7 @@ BackgroundBox::Inner::Inner(
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundBox::Inner::requestPapers() {
|
void BackgroundBox::Inner::requestPapers() {
|
||||||
request(MTPaccount_GetWallPapers(
|
_api.request(MTPaccount_GetWallPapers(
|
||||||
MTP_int(_session->data().wallpapersHash())
|
MTP_int(_session->data().wallpapersHash())
|
||||||
)).done([=](const MTPaccount_WallPapers &result) {
|
)).done([=](const MTPaccount_WallPapers &result) {
|
||||||
if (_session->data().updateWallpapers(result)) {
|
if (_session->data().updateWallpapers(result)) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "boxes/calendar_box.h"
|
#include "boxes/calendar_box.h"
|
||||||
|
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
|
|
|
@ -30,6 +30,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
|
|
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "numbers.h"
|
#include "numbers.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "mtproto/facade.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class InputField;
|
class InputField;
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
|
#include "mtproto/facade.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
|
@ -38,6 +39,8 @@ namespace {
|
||||||
|
|
||||||
constexpr auto kSaveSettingsDelayedTimeout = crl::time(1000);
|
constexpr auto kSaveSettingsDelayedTimeout = crl::time(1000);
|
||||||
|
|
||||||
|
using ProxyData = MTP::ProxyData;
|
||||||
|
|
||||||
class Base64UrlInput : public Ui::MaskedInputField {
|
class Base64UrlInput : public Ui::MaskedInputField {
|
||||||
public:
|
public:
|
||||||
Base64UrlInput(
|
Base64UrlInput(
|
||||||
|
@ -1057,7 +1060,7 @@ void ProxiesBoxController::refreshChecker(Item &item) {
|
||||||
|
|
||||||
item.state = ItemState::Checking;
|
item.state = ItemState::Checking;
|
||||||
const auto setup = [&](Checker &checker, const bytes::vector &secret) {
|
const auto setup = [&](Checker &checker, const bytes::vector &secret) {
|
||||||
checker = MTP::internal::AbstractConnection::Create(
|
checker = MTP::details::AbstractConnection::Create(
|
||||||
mtproto,
|
mtproto,
|
||||||
type,
|
type,
|
||||||
QThread::currentThread(),
|
QThread::currentThread(),
|
||||||
|
@ -1105,7 +1108,7 @@ void ProxiesBoxController::refreshChecker(Item &item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProxiesBoxController::setupChecker(int id, const Checker &checker) {
|
void ProxiesBoxController::setupChecker(int id, const Checker &checker) {
|
||||||
using Connection = MTP::internal::AbstractConnection;
|
using Connection = MTP::details::AbstractConnection;
|
||||||
const auto pointer = checker.get();
|
const auto pointer = checker.get();
|
||||||
pointer->connect(pointer, &Connection::connected, [=] {
|
pointer->connect(pointer, &Connection::connected, [=] {
|
||||||
const auto item = findById(id);
|
const auto item = findById(id);
|
||||||
|
@ -1148,7 +1151,7 @@ object_ptr<Ui::BoxContent> ProxiesBoxController::create() {
|
||||||
for (const auto &item : _list) {
|
for (const auto &item : _list) {
|
||||||
updateView(item);
|
updateView(item);
|
||||||
}
|
}
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ProxiesBoxController::findById(int id) -> std::vector<Item>::iterator {
|
auto ProxiesBoxController::findById(int id) -> std::vector<Item>::iterator {
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
#include "mtproto/connection_abstract.h"
|
#include "mtproto/connection_abstract.h"
|
||||||
|
#include "mtproto/mtproto_proxy_data.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class BoxContent;
|
class BoxContent;
|
||||||
|
@ -25,6 +26,7 @@ class Radioenum;
|
||||||
|
|
||||||
class ProxiesBoxController : public base::Subscriber {
|
class ProxiesBoxController : public base::Subscriber {
|
||||||
public:
|
public:
|
||||||
|
using ProxyData = MTP::ProxyData;
|
||||||
using Type = ProxyData::Type;
|
using Type = ProxyData::Type;
|
||||||
|
|
||||||
ProxiesBoxController();
|
ProxiesBoxController();
|
||||||
|
@ -73,7 +75,7 @@ public:
|
||||||
~ProxiesBoxController();
|
~ProxiesBoxController();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using Checker = MTP::internal::ConnectionPointer;
|
using Checker = MTP::details::ConnectionPointer;
|
||||||
struct Item {
|
struct Item {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
ProxyData data;
|
ProxyData data;
|
||||||
|
|
|
@ -768,7 +768,7 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
|
||||||
FocusAtEnd(question);
|
FocusAtEnd(question);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreatePollBox::prepare() {
|
void CreatePollBox::prepare() {
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/storage_media_prepare.h"
|
#include "storage/storage_media_prepare.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "media/clip/media_clip_reader.h"
|
#include "media/clip/media_clip_reader.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
class TabbedPanel;
|
class TabbedPanel;
|
||||||
|
|
|
@ -100,7 +100,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditPrivacyBox : public Ui::BoxContent, private MTP::Sender {
|
class EditPrivacyBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
using Value = ApiWrap::Privacy;
|
using Value = ApiWrap::Privacy;
|
||||||
using Option = Value::Option;
|
using Option = Value::Option;
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/confirm_phone_box.h"
|
#include "boxes/confirm_phone_box.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
@ -47,6 +48,7 @@ PasscodeBox::PasscodeBox(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
bool turningOff)
|
bool turningOff)
|
||||||
: _session(session)
|
: _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _turningOff(turningOff)
|
, _turningOff(turningOff)
|
||||||
, _about(st::boxWidth - st::boxPadding.left() * 1.5)
|
, _about(st::boxWidth - st::boxPadding.left() * 1.5)
|
||||||
, _oldPasscode(this, st::defaultInputField, tr::lng_passcode_enter_old())
|
, _oldPasscode(this, st::defaultInputField, tr::lng_passcode_enter_old())
|
||||||
|
@ -62,6 +64,7 @@ PasscodeBox::PasscodeBox(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const CloudFields &fields)
|
const CloudFields &fields)
|
||||||
: _session(session)
|
: _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _turningOff(fields.turningOff)
|
, _turningOff(fields.turningOff)
|
||||||
, _cloudPwd(true)
|
, _cloudPwd(true)
|
||||||
, _cloudFields(fields)
|
, _cloudFields(fields)
|
||||||
|
@ -357,7 +360,7 @@ void PasscodeBox::validateEmail(
|
||||||
if (_setRequest) {
|
if (_setRequest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_setRequest = request(MTPaccount_ConfirmPasswordEmail(
|
_setRequest = _api.request(MTPaccount_ConfirmPasswordEmail(
|
||||||
MTP_string(code)
|
MTP_string(code)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
*set = true;
|
*set = true;
|
||||||
|
@ -387,7 +390,7 @@ void PasscodeBox::validateEmail(
|
||||||
if (_setRequest) {
|
if (_setRequest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_setRequest = request(MTPaccount_ResendPasswordEmail(
|
_setRequest = _api.request(MTPaccount_ResendPasswordEmail(
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
_setRequest = 0;
|
_setRequest = 0;
|
||||||
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
resent->fire(tr::lng_cloud_password_resent(tr::now));
|
||||||
|
@ -597,8 +600,8 @@ void PasscodeBox::requestPasswordData() {
|
||||||
return serverError();
|
return serverError();
|
||||||
}
|
}
|
||||||
|
|
||||||
request(base::take(_setRequest)).cancel();
|
_api.request(base::take(_setRequest)).cancel();
|
||||||
_setRequest = request(
|
_setRequest = _api.request(
|
||||||
MTPaccount_GetPassword()
|
MTPaccount_GetPassword()
|
||||||
).done([=](const MTPaccount_Password &result) {
|
).done([=](const MTPaccount_Password &result) {
|
||||||
_setRequest = 0;
|
_setRequest = 0;
|
||||||
|
@ -636,7 +639,7 @@ void PasscodeBox::sendClearCloudPassword(
|
||||||
| MTPDaccount_passwordInputSettings::Flag::f_new_password_hash
|
| MTPDaccount_passwordInputSettings::Flag::f_new_password_hash
|
||||||
| MTPDaccount_passwordInputSettings::Flag::f_hint
|
| MTPDaccount_passwordInputSettings::Flag::f_hint
|
||||||
| MTPDaccount_passwordInputSettings::Flag::f_email;
|
| MTPDaccount_passwordInputSettings::Flag::f_email;
|
||||||
_setRequest = request(MTPaccount_UpdatePasswordSettings(
|
_setRequest = _api.request(MTPaccount_UpdatePasswordSettings(
|
||||||
check.result,
|
check.result,
|
||||||
MTP_account_passwordInputSettings(
|
MTP_account_passwordInputSettings(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
|
@ -667,7 +670,7 @@ void PasscodeBox::setNewCloudPassword(const QString &newPassword) {
|
||||||
| MTPDaccount_passwordInputSettings::Flag::f_hint
|
| MTPDaccount_passwordInputSettings::Flag::f_hint
|
||||||
| MTPDaccount_passwordInputSettings::Flag::f_email;
|
| MTPDaccount_passwordInputSettings::Flag::f_email;
|
||||||
_checkPasswordCallback = nullptr;
|
_checkPasswordCallback = nullptr;
|
||||||
_setRequest = request(MTPaccount_UpdatePasswordSettings(
|
_setRequest = _api.request(MTPaccount_UpdatePasswordSettings(
|
||||||
MTP_inputCheckPasswordEmpty(),
|
MTP_inputCheckPasswordEmpty(),
|
||||||
MTP_account_passwordInputSettings(
|
MTP_account_passwordInputSettings(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
|
@ -695,7 +698,7 @@ void PasscodeBox::changeCloudPassword(
|
||||||
const QString &oldPassword,
|
const QString &oldPassword,
|
||||||
const Core::CloudPasswordResult &check,
|
const Core::CloudPasswordResult &check,
|
||||||
const QString &newPassword) {
|
const QString &newPassword) {
|
||||||
_setRequest = request(MTPaccount_GetPasswordSettings(
|
_setRequest = _api.request(MTPaccount_GetPasswordSettings(
|
||||||
check.result
|
check.result
|
||||||
)).done([=](const MTPaccount_PasswordSettings &result) {
|
)).done([=](const MTPaccount_PasswordSettings &result) {
|
||||||
_setRequest = 0;
|
_setRequest = 0;
|
||||||
|
@ -760,7 +763,7 @@ void PasscodeBox::resetSecret(
|
||||||
const QString &newPassword,
|
const QString &newPassword,
|
||||||
Fn<void()> callback) {
|
Fn<void()> callback) {
|
||||||
using Flag = MTPDaccount_passwordInputSettings::Flag;
|
using Flag = MTPDaccount_passwordInputSettings::Flag;
|
||||||
_setRequest = request(MTPaccount_UpdatePasswordSettings(
|
_setRequest = _api.request(MTPaccount_UpdatePasswordSettings(
|
||||||
check.result,
|
check.result,
|
||||||
MTP_account_passwordInputSettings(
|
MTP_account_passwordInputSettings(
|
||||||
MTP_flags(Flag::f_new_secure_settings),
|
MTP_flags(Flag::f_new_secure_settings),
|
||||||
|
@ -814,7 +817,7 @@ void PasscodeBox::sendChangeCloudPassword(
|
||||||
_cloudFields.newSecureSecretAlgo,
|
_cloudFields.newSecureSecretAlgo,
|
||||||
bytes::make_span(newPasswordBytes)));
|
bytes::make_span(newPasswordBytes)));
|
||||||
}
|
}
|
||||||
_setRequest = request(MTPaccount_UpdatePasswordSettings(
|
_setRequest = _api.request(MTPaccount_UpdatePasswordSettings(
|
||||||
check.result,
|
check.result,
|
||||||
MTP_account_passwordInputSettings(
|
MTP_account_passwordInputSettings(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
|
@ -873,7 +876,7 @@ void PasscodeBox::emailChanged() {
|
||||||
void PasscodeBox::recoverByEmail() {
|
void PasscodeBox::recoverByEmail() {
|
||||||
if (_pattern.isEmpty()) {
|
if (_pattern.isEmpty()) {
|
||||||
_pattern = "-";
|
_pattern = "-";
|
||||||
request(MTPauth_RequestPasswordRecovery(
|
_api.request(MTPauth_RequestPasswordRecovery(
|
||||||
)).done([=](const MTPauth_PasswordRecovery &result) {
|
)).done([=](const MTPauth_PasswordRecovery &result) {
|
||||||
recoverStarted(result);
|
recoverStarted(result);
|
||||||
}).fail([=](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Core {
|
||||||
struct CloudPasswordState;
|
struct CloudPasswordState;
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
class PasscodeBox : public Ui::BoxContent, private MTP::Sender {
|
class PasscodeBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
PasscodeBox(QWidget*, not_null<Main::Session*> session, bool turningOff);
|
PasscodeBox(QWidget*, not_null<Main::Session*> session, bool turningOff);
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ private:
|
||||||
void serverError();
|
void serverError();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
QString _pattern;
|
QString _pattern;
|
||||||
|
|
||||||
|
|
|
@ -1287,7 +1287,6 @@ void PeerListContent::loadProfilePhotos() {
|
||||||
|
|
||||||
auto yFrom = _visibleTop;
|
auto yFrom = _visibleTop;
|
||||||
auto yTo = _visibleBottom + (_visibleBottom - _visibleTop) * PreloadHeightsCount;
|
auto yTo = _visibleBottom + (_visibleBottom - _visibleTop) * PreloadHeightsCount;
|
||||||
_controller->session().downloader().clearPriorities();
|
|
||||||
|
|
||||||
if (yTo < 0) return;
|
if (yTo < 0) return;
|
||||||
if (yFrom < 0) yFrom = 0;
|
if (yFrom < 0) yFrom = 0;
|
||||||
|
|
|
@ -142,7 +142,8 @@ void PeerListRowWithLink::paintAction(
|
||||||
|
|
||||||
PeerListGlobalSearchController::PeerListGlobalSearchController(
|
PeerListGlobalSearchController::PeerListGlobalSearchController(
|
||||||
not_null<Window::SessionNavigation*> navigation)
|
not_null<Window::SessionNavigation*> navigation)
|
||||||
: _navigation(navigation) {
|
: _navigation(navigation)
|
||||||
|
, _api(_navigation->session().api().instance()) {
|
||||||
_timer.setCallback([this] { searchOnServer(); });
|
_timer.setCallback([this] { searchOnServer(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +170,7 @@ bool PeerListGlobalSearchController::searchInCache() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListGlobalSearchController::searchOnServer() {
|
void PeerListGlobalSearchController::searchOnServer() {
|
||||||
_requestId = request(MTPcontacts_Search(
|
_requestId = _api.request(MTPcontacts_Search(
|
||||||
MTP_string(_query),
|
MTP_string(_query),
|
||||||
MTP_int(SearchPeopleLimit)
|
MTP_int(SearchPeopleLimit)
|
||||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||||
|
|
|
@ -59,9 +59,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PeerListGlobalSearchController
|
class PeerListGlobalSearchController : public PeerListSearchController {
|
||||||
: public PeerListSearchController
|
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
PeerListGlobalSearchController(
|
PeerListGlobalSearchController(
|
||||||
not_null<Window::SessionNavigation*> navigation);
|
not_null<Window::SessionNavigation*> navigation);
|
||||||
|
@ -78,6 +76,7 @@ private:
|
||||||
void searchDone(const MTPcontacts_Found &result, mtpRequestId requestId);
|
void searchDone(const MTPcontacts_Found &result, mtpRequestId requestId);
|
||||||
|
|
||||||
const not_null<Window::SessionNavigation*> _navigation;
|
const not_null<Window::SessionNavigation*> _navigation;
|
||||||
|
MTP::Sender _api;
|
||||||
base::Timer _timer;
|
base::Timer _timer;
|
||||||
QString _query;
|
QString _query;
|
||||||
mtpRequestId _requestId = 0;
|
mtpRequestId _requestId = 0;
|
||||||
|
|
|
@ -276,6 +276,7 @@ AddSpecialBoxController::AddSpecialBoxController(
|
||||||
peer,
|
peer,
|
||||||
&_additional))
|
&_additional))
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
|
, _api(_peer->session().api().instance())
|
||||||
, _role(role)
|
, _role(role)
|
||||||
, _additional(peer, Role::Members)
|
, _additional(peer, Role::Members)
|
||||||
, _adminDoneCallback(std::move(adminDoneCallback))
|
, _adminDoneCallback(std::move(adminDoneCallback))
|
||||||
|
@ -408,7 +409,7 @@ void AddSpecialBoxController::loadMoreRows() {
|
||||||
const auto participantsHash = 0;
|
const auto participantsHash = 0;
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
|
|
||||||
_loadRequestId = request(MTPchannels_GetParticipants(
|
_loadRequestId = _api.request(MTPchannels_GetParticipants(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_channelParticipantsRecent(),
|
MTP_channelParticipantsRecent(),
|
||||||
MTP_int(_offset),
|
MTP_int(_offset),
|
||||||
|
@ -464,7 +465,7 @@ bool AddSpecialBoxController::checkInfoLoaded(
|
||||||
|
|
||||||
// We don't know what this user status is in the group.
|
// We don't know what this user status is in the group.
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
request(MTPchannels_GetParticipant(
|
_api.request(MTPchannels_GetParticipant(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
user->inputUser
|
user->inputUser
|
||||||
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
||||||
|
@ -829,6 +830,7 @@ AddSpecialBoxSearchController::AddSpecialBoxSearchController(
|
||||||
not_null<ParticipantsAdditionalData*> additional)
|
not_null<ParticipantsAdditionalData*> additional)
|
||||||
: _peer(peer)
|
: _peer(peer)
|
||||||
, _additional(additional)
|
, _additional(additional)
|
||||||
|
, _api(_peer->session().api().instance())
|
||||||
, _timer([=] { searchOnServer(); }) {
|
, _timer([=] { searchOnServer(); }) {
|
||||||
subscribeToMigration();
|
subscribeToMigration();
|
||||||
}
|
}
|
||||||
|
@ -924,7 +926,7 @@ void AddSpecialBoxSearchController::requestParticipants() {
|
||||||
const auto participantsHash = 0;
|
const auto participantsHash = 0;
|
||||||
const auto channel = _peer->asChannel();
|
const auto channel = _peer->asChannel();
|
||||||
|
|
||||||
_requestId = request(MTPchannels_GetParticipants(
|
_requestId = _api.request(MTPchannels_GetParticipants(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_channelParticipantsSearch(MTP_string(_query)),
|
MTP_channelParticipantsSearch(MTP_string(_query)),
|
||||||
MTP_int(_offset),
|
MTP_int(_offset),
|
||||||
|
@ -1012,7 +1014,7 @@ void AddSpecialBoxSearchController::requestGlobal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto perPage = SearchPeopleLimit;
|
auto perPage = SearchPeopleLimit;
|
||||||
_requestId = request(MTPcontacts_Search(
|
_requestId = _api.request(MTPcontacts_Search(
|
||||||
MTP_string(_query),
|
MTP_string(_query),
|
||||||
MTP_int(perPage)
|
MTP_int(perPage)
|
||||||
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
)).done([=](const MTPcontacts_Found &result, mtpRequestId requestId) {
|
||||||
|
|
|
@ -69,7 +69,6 @@ private:
|
||||||
class AddSpecialBoxController
|
class AddSpecialBoxController
|
||||||
: public PeerListController
|
: public PeerListController
|
||||||
, private base::Subscriber
|
, private base::Subscriber
|
||||||
, private MTP::Sender
|
|
||||||
, public base::has_weak_ptr {
|
, public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
using Role = ParticipantsBoxController::Role;
|
using Role = ParticipantsBoxController::Role;
|
||||||
|
@ -87,12 +86,12 @@ public:
|
||||||
AdminDoneCallback adminDoneCallback,
|
AdminDoneCallback adminDoneCallback,
|
||||||
BannedDoneCallback bannedDoneCallback);
|
BannedDoneCallback bannedDoneCallback);
|
||||||
|
|
||||||
Main::Session &session() const override;
|
[[nodiscard]] Main::Session &session() const override;
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
void loadMoreRows() override;
|
void loadMoreRows() override;
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> createSearchRow(
|
[[nodiscard]] std::unique_ptr<PeerListRow> createSearchRow(
|
||||||
not_null<PeerData*> peer) override;
|
not_null<PeerData*> peer) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -120,6 +119,7 @@ private:
|
||||||
void migrate(not_null<ChannelData*> channel);
|
void migrate(not_null<ChannelData*> channel);
|
||||||
|
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
MTP::Sender _api;
|
||||||
Role _role = Role::Admins;
|
Role _role = Role::Admins;
|
||||||
int _offset = 0;
|
int _offset = 0;
|
||||||
mtpRequestId _loadRequestId = 0;
|
mtpRequestId _loadRequestId = 0;
|
||||||
|
@ -139,7 +139,6 @@ protected:
|
||||||
// Finds chat/channel members, then contacts, then global search results.
|
// Finds chat/channel members, then contacts, then global search results.
|
||||||
class AddSpecialBoxSearchController
|
class AddSpecialBoxSearchController
|
||||||
: public PeerListSearchController
|
: public PeerListSearchController
|
||||||
, private MTP::Sender
|
|
||||||
, private base::Subscriber {
|
, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
using Role = ParticipantsBoxController::Role;
|
using Role = ParticipantsBoxController::Role;
|
||||||
|
@ -181,6 +180,7 @@ private:
|
||||||
|
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
not_null<ParticipantsAdditionalData*> _additional;
|
not_null<ParticipantsAdditionalData*> _additional;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
base::Timer _timer;
|
base::Timer _timer;
|
||||||
QString _query;
|
QString _query;
|
||||||
|
|
|
@ -223,7 +223,7 @@ object_ptr<Ui::RpWidget> SetupAbout(
|
||||||
tr::now,
|
tr::now,
|
||||||
Ui::Text::WithEntities);
|
Ui::Text::WithEntities);
|
||||||
}());
|
}());
|
||||||
return std::move(about);
|
return about;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> SetupFooter(
|
object_ptr<Ui::RpWidget> SetupFooter(
|
||||||
|
|
|
@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "base/unique_qptr.h"
|
#include "base/unique_qptr.h"
|
||||||
|
|
||||||
|
class RPCError;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
class LinkButton;
|
class LinkButton;
|
||||||
|
|
|
@ -745,6 +745,7 @@ ParticipantsBoxController::ParticipantsBoxController(
|
||||||
: PeerListController(CreateSearchController(peer, role, &_additional))
|
: PeerListController(CreateSearchController(peer, role, &_additional))
|
||||||
, _navigation(navigation)
|
, _navigation(navigation)
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
|
, _api(_peer->session().api().instance())
|
||||||
, _role(role)
|
, _role(role)
|
||||||
, _additional(peer, _role) {
|
, _additional(peer, _role) {
|
||||||
subscribeToMigration();
|
subscribeToMigration();
|
||||||
|
@ -1022,7 +1023,7 @@ void ParticipantsBoxController::restoreState(
|
||||||
: nullptr;
|
: nullptr;
|
||||||
if (const auto my = dynamic_cast<SavedState*>(typeErasedState)) {
|
if (const auto my = dynamic_cast<SavedState*>(typeErasedState)) {
|
||||||
if (const auto requestId = base::take(_loadRequestId)) {
|
if (const auto requestId = base::take(_loadRequestId)) {
|
||||||
request(requestId).cancel();
|
_api.request(requestId).cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
_additional = std::move(my->additional);
|
_additional = std::move(my->additional);
|
||||||
|
@ -1251,7 +1252,7 @@ void ParticipantsBoxController::loadMoreRows() {
|
||||||
: kParticipantsFirstPageCount;
|
: kParticipantsFirstPageCount;
|
||||||
const auto participantsHash = 0;
|
const auto participantsHash = 0;
|
||||||
|
|
||||||
_loadRequestId = request(MTPchannels_GetParticipants(
|
_loadRequestId = _api.request(MTPchannels_GetParticipants(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
filter,
|
filter,
|
||||||
MTP_int(_offset),
|
MTP_int(_offset),
|
||||||
|
@ -1786,7 +1787,7 @@ std::unique_ptr<PeerListRow> ParticipantsBoxController::createRow(
|
||||||
row->setActionLink(tr::lng_profile_kick(tr::now));
|
row->setActionLink(tr::lng_profile_kick(tr::now));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return std::move(row);
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ParticipantsBoxController::computeType(
|
auto ParticipantsBoxController::computeType(
|
||||||
|
@ -1906,7 +1907,8 @@ ParticipantsBoxSearchController::ParticipantsBoxSearchController(
|
||||||
not_null<ParticipantsAdditionalData*> additional)
|
not_null<ParticipantsAdditionalData*> additional)
|
||||||
: _channel(channel)
|
: _channel(channel)
|
||||||
, _role(role)
|
, _role(role)
|
||||||
, _additional(additional) {
|
, _additional(additional)
|
||||||
|
, _api(_channel->session().api().instance()) {
|
||||||
_timer.setCallback([=] { searchOnServer(); });
|
_timer.setCallback([=] { searchOnServer(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1931,14 +1933,14 @@ auto ParticipantsBoxSearchController::saveState() const
|
||||||
result->offset = _offset;
|
result->offset = _offset;
|
||||||
result->allLoaded = _allLoaded;
|
result->allLoaded = _allLoaded;
|
||||||
result->wasLoading = (_requestId != 0);
|
result->wasLoading = (_requestId != 0);
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticipantsBoxSearchController::restoreState(
|
void ParticipantsBoxSearchController::restoreState(
|
||||||
std::unique_ptr<SavedStateBase> state) {
|
std::unique_ptr<SavedStateBase> state) {
|
||||||
if (auto my = dynamic_cast<SavedState*>(state.get())) {
|
if (auto my = dynamic_cast<SavedState*>(state.get())) {
|
||||||
if (auto requestId = base::take(_requestId)) {
|
if (auto requestId = base::take(_requestId)) {
|
||||||
request(requestId).cancel();
|
_api.request(requestId).cancel();
|
||||||
}
|
}
|
||||||
_cache.clear();
|
_cache.clear();
|
||||||
_queries.clear();
|
_queries.clear();
|
||||||
|
@ -2002,7 +2004,7 @@ bool ParticipantsBoxSearchController::loadMoreRows() {
|
||||||
auto perPage = kParticipantsPerPage;
|
auto perPage = kParticipantsPerPage;
|
||||||
auto participantsHash = 0;
|
auto participantsHash = 0;
|
||||||
|
|
||||||
_requestId = request(MTPchannels_GetParticipants(
|
_requestId = _api.request(MTPchannels_GetParticipants(
|
||||||
_channel->inputChannel,
|
_channel->inputChannel,
|
||||||
filter,
|
filter,
|
||||||
MTP_int(_offset),
|
MTP_int(_offset),
|
||||||
|
|
|
@ -134,7 +134,6 @@ private:
|
||||||
class ParticipantsBoxController
|
class ParticipantsBoxController
|
||||||
: public PeerListController
|
: public PeerListController
|
||||||
, private base::Subscriber
|
, private base::Subscriber
|
||||||
, private MTP::Sender
|
|
||||||
, public base::has_weak_ptr {
|
, public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
using Role = ParticipantsRole;
|
using Role = ParticipantsRole;
|
||||||
|
@ -238,6 +237,7 @@ private:
|
||||||
|
|
||||||
not_null<Window::SessionNavigation*> _navigation;
|
not_null<Window::SessionNavigation*> _navigation;
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
MTP::Sender _api;
|
||||||
Role _role = Role::Admins;
|
Role _role = Role::Admins;
|
||||||
int _offset = 0;
|
int _offset = 0;
|
||||||
mtpRequestId _loadRequestId = 0;
|
mtpRequestId _loadRequestId = 0;
|
||||||
|
@ -251,9 +251,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Members, banned and restricted users server side search.
|
// Members, banned and restricted users server side search.
|
||||||
class ParticipantsBoxSearchController
|
class ParticipantsBoxSearchController : public PeerListSearchController {
|
||||||
: public PeerListSearchController
|
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
using Role = ParticipantsBoxController::Role;
|
using Role = ParticipantsBoxController::Role;
|
||||||
|
|
||||||
|
@ -295,6 +293,7 @@ private:
|
||||||
not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
Role _role = Role::Restricted;
|
Role _role = Role::Restricted;
|
||||||
not_null<ParticipantsAdditionalData*> _additional;
|
not_null<ParticipantsAdditionalData*> _additional;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
base::Timer _timer;
|
base::Timer _timer;
|
||||||
QString _query;
|
QString _query;
|
||||||
|
|
|
@ -240,9 +240,7 @@ namespace {
|
||||||
constexpr auto kMaxGroupChannelTitle = 128; // See also add_contact_box.
|
constexpr auto kMaxGroupChannelTitle = 128; // See also add_contact_box.
|
||||||
constexpr auto kMaxChannelDescription = 255; // See also add_contact_box.
|
constexpr auto kMaxChannelDescription = 255; // See also add_contact_box.
|
||||||
|
|
||||||
class Controller
|
class Controller : public base::has_weak_ptr {
|
||||||
: public base::has_weak_ptr
|
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
Controller(
|
Controller(
|
||||||
not_null<Window::SessionNavigation*> navigation,
|
not_null<Window::SessionNavigation*> navigation,
|
||||||
|
@ -334,6 +332,7 @@ private:
|
||||||
const not_null<Window::SessionNavigation*> _navigation;
|
const not_null<Window::SessionNavigation*> _navigation;
|
||||||
const not_null<Ui::BoxContent*> _box;
|
const not_null<Ui::BoxContent*> _box;
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
MTP::Sender _api;
|
||||||
const bool _isGroup = false;
|
const bool _isGroup = false;
|
||||||
|
|
||||||
base::unique_qptr<Ui::VerticalLayout> _wrap;
|
base::unique_qptr<Ui::VerticalLayout> _wrap;
|
||||||
|
@ -344,7 +343,6 @@ private:
|
||||||
|
|
||||||
const rpl::event_stream<Privacy> _privacyTypeUpdates;
|
const rpl::event_stream<Privacy> _privacyTypeUpdates;
|
||||||
const rpl::event_stream<ChannelData*> _linkedChatUpdates;
|
const rpl::event_stream<ChannelData*> _linkedChatUpdates;
|
||||||
MTP::Sender _linkedChatsRequester;
|
|
||||||
mtpRequestId _linkedChatsRequestId = 0;
|
mtpRequestId _linkedChatsRequestId = 0;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
@ -358,6 +356,7 @@ Controller::Controller(
|
||||||
: _navigation(navigation)
|
: _navigation(navigation)
|
||||||
, _box(box)
|
, _box(box)
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
|
, _api(_peer->session().api().instance())
|
||||||
, _isGroup(_peer->isChat() || _peer->isMegagroup()) {
|
, _isGroup(_peer->isChat() || _peer->isMegagroup()) {
|
||||||
_box->setTitle(_isGroup
|
_box->setTitle(_isGroup
|
||||||
? tr::lng_edit_group()
|
? tr::lng_edit_group()
|
||||||
|
@ -478,7 +477,7 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
|
||||||
[=] { submitTitle(); });
|
[=] { submitTitle(); });
|
||||||
|
|
||||||
_controls.title = result->entity();
|
_controls.title = result->entity();
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
||||||
|
@ -512,7 +511,7 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
||||||
[=] { submitDescription(); });
|
[=] { submitDescription(); });
|
||||||
|
|
||||||
_controls.description = result->entity();
|
_controls.description = result->entity();
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> Controller::createManageGroupButtons() {
|
object_ptr<Ui::RpWidget> Controller::createManageGroupButtons() {
|
||||||
|
@ -526,7 +525,7 @@ object_ptr<Ui::RpWidget> Controller::createManageGroupButtons() {
|
||||||
|
|
||||||
fillManageSection();
|
fillManageSection();
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||||
|
@ -564,7 +563,7 @@ object_ptr<Ui::RpWidget> Controller::createStickersEdit() {
|
||||||
Ui::show(Box<StickersBox>(channel), Ui::LayerOption::KeepOther);
|
Ui::show(Box<StickersBox>(channel), Ui::LayerOption::KeepOther);
|
||||||
});
|
});
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Controller::canEditInformation() const {
|
bool Controller::canEditInformation() const {
|
||||||
|
@ -644,7 +643,7 @@ void Controller::showEditLinkedChatBox() {
|
||||||
callback(_linkedChatOriginalValue);
|
callback(_linkedChatOriginalValue);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_linkedChatsRequestId = _linkedChatsRequester.request(
|
_linkedChatsRequestId = _api.request(
|
||||||
MTPchannels_GetGroupsForDiscussion()
|
MTPchannels_GetGroupsForDiscussion()
|
||||||
).done([=](const MTPmessages_Chats &result) {
|
).done([=](const MTPmessages_Chats &result) {
|
||||||
_linkedChatsRequestId = 0;
|
_linkedChatsRequestId = 0;
|
||||||
|
@ -1187,7 +1186,7 @@ void Controller::saveUsername() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
request(MTPchannels_UpdateUsername(
|
_api.request(MTPchannels_UpdateUsername(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_string(*_savingData.username)
|
MTP_string(*_savingData.username)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
|
@ -1242,7 +1241,7 @@ void Controller::saveLinkedChat() {
|
||||||
const auto input = *_savingData.linkedChat
|
const auto input = *_savingData.linkedChat
|
||||||
? (*_savingData.linkedChat)->inputChannel
|
? (*_savingData.linkedChat)->inputChannel
|
||||||
: MTP_inputChannelEmpty();
|
: MTP_inputChannelEmpty();
|
||||||
request(MTPchannels_SetDiscussionGroup(
|
_api.request(MTPchannels_SetDiscussionGroup(
|
||||||
(channel->isBroadcast() ? channel->inputChannel : input),
|
(channel->isBroadcast() ? channel->inputChannel : input),
|
||||||
(channel->isBroadcast() ? input : channel->inputChannel)
|
(channel->isBroadcast() ? input : channel->inputChannel)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
|
@ -1283,14 +1282,14 @@ void Controller::saveTitle() {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (const auto channel = _peer->asChannel()) {
|
if (const auto channel = _peer->asChannel()) {
|
||||||
request(MTPchannels_EditTitle(
|
_api.request(MTPchannels_EditTitle(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_string(*_savingData.title)
|
MTP_string(*_savingData.title)
|
||||||
)).done(std::move(onDone)
|
)).done(std::move(onDone)
|
||||||
).fail(std::move(onFail)
|
).fail(std::move(onFail)
|
||||||
).send();
|
).send();
|
||||||
} else if (const auto chat = _peer->asChat()) {
|
} else if (const auto chat = _peer->asChat()) {
|
||||||
request(MTPmessages_EditChatTitle(
|
_api.request(MTPmessages_EditChatTitle(
|
||||||
chat->inputChat,
|
chat->inputChat,
|
||||||
MTP_string(*_savingData.title)
|
MTP_string(*_savingData.title)
|
||||||
)).done(std::move(onDone)
|
)).done(std::move(onDone)
|
||||||
|
@ -1311,7 +1310,7 @@ void Controller::saveDescription() {
|
||||||
_peer->setAbout(*_savingData.description);
|
_peer->setAbout(*_savingData.description);
|
||||||
continueSave();
|
continueSave();
|
||||||
};
|
};
|
||||||
request(MTPmessages_EditChatAbout(
|
_api.request(MTPmessages_EditChatAbout(
|
||||||
_peer->input,
|
_peer->input,
|
||||||
MTP_string(*_savingData.description)
|
MTP_string(*_savingData.description)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
|
@ -1368,7 +1367,7 @@ void Controller::togglePreHistoryHidden(
|
||||||
|
|
||||||
done();
|
done();
|
||||||
};
|
};
|
||||||
request(MTPchannels_TogglePreHistoryHidden(
|
_api.request(MTPchannels_TogglePreHistoryHidden(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_bool(hidden)
|
MTP_bool(hidden)
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
@ -1390,7 +1389,7 @@ void Controller::saveSignatures() {
|
||||||
|| *_savingData.signatures == channel->addsSignature()) {
|
|| *_savingData.signatures == channel->addsSignature()) {
|
||||||
return continueSave();
|
return continueSave();
|
||||||
}
|
}
|
||||||
request(MTPchannels_ToggleSignatures(
|
_api.request(MTPchannels_ToggleSignatures(
|
||||||
channel->inputChannel,
|
channel->inputChannel,
|
||||||
MTP_bool(*_savingData.signatures)
|
MTP_bool(*_savingData.signatures)
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
|
|
@ -51,9 +51,7 @@ namespace {
|
||||||
constexpr auto kUsernameCheckTimeout = crl::time(200);
|
constexpr auto kUsernameCheckTimeout = crl::time(200);
|
||||||
constexpr auto kMinUsernameLength = 5;
|
constexpr auto kMinUsernameLength = 5;
|
||||||
|
|
||||||
class Controller
|
class Controller : public base::has_weak_ptr {
|
||||||
: public base::has_weak_ptr
|
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
Controller(
|
Controller(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
|
@ -144,6 +142,7 @@ private:
|
||||||
QString inviteLinkText();
|
QString inviteLinkText();
|
||||||
|
|
||||||
not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
MTP::Sender _api;
|
||||||
std::optional<Privacy> _privacySavedValue;
|
std::optional<Privacy> _privacySavedValue;
|
||||||
std::optional<QString> _usernameSavedValue;
|
std::optional<QString> _usernameSavedValue;
|
||||||
|
|
||||||
|
@ -169,6 +168,7 @@ Controller::Controller(
|
||||||
std::optional<Privacy> privacySavedValue,
|
std::optional<Privacy> privacySavedValue,
|
||||||
std::optional<QString> usernameSavedValue)
|
std::optional<QString> usernameSavedValue)
|
||||||
: _peer(peer)
|
: _peer(peer)
|
||||||
|
, _api(_peer->session().api().instance())
|
||||||
, _privacySavedValue(privacySavedValue)
|
, _privacySavedValue(privacySavedValue)
|
||||||
, _usernameSavedValue(usernameSavedValue)
|
, _usernameSavedValue(usernameSavedValue)
|
||||||
, _useLocationPhrases(useLocationPhrases)
|
, _useLocationPhrases(useLocationPhrases)
|
||||||
|
@ -364,7 +364,7 @@ object_ptr<Ui::RpWidget> Controller::createUsernameEdit() {
|
||||||
const auto shown = (_controls.privacy->value() == Privacy::HasUsername);
|
const auto shown = (_controls.privacy->value() == Privacy::HasUsername);
|
||||||
result->toggle(shown, anim::type::instant);
|
result->toggle(shown, anim::type::instant);
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::privacyChanged(Privacy value) {
|
void Controller::privacyChanged(Privacy value) {
|
||||||
|
@ -401,7 +401,7 @@ void Controller::privacyChanged(Privacy value) {
|
||||||
refreshVisibilities();
|
refreshVisibilities();
|
||||||
_controls.usernameInput->setDisplayFocused(true);
|
_controls.usernameInput->setDisplayFocused(true);
|
||||||
} else {
|
} else {
|
||||||
request(base::take(_checkUsernameRequestId)).cancel();
|
_api.request(base::take(_checkUsernameRequestId)).cancel();
|
||||||
_checkUsernameTimer.cancel();
|
_checkUsernameTimer.cancel();
|
||||||
refreshVisibilities();
|
refreshVisibilities();
|
||||||
}
|
}
|
||||||
|
@ -420,11 +420,11 @@ void Controller::checkUsernameAvailability() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_checkUsernameRequestId) {
|
if (_checkUsernameRequestId) {
|
||||||
request(_checkUsernameRequestId).cancel();
|
_api.request(_checkUsernameRequestId).cancel();
|
||||||
}
|
}
|
||||||
const auto channel = _peer->migrateToOrMe()->asChannel();
|
const auto channel = _peer->migrateToOrMe()->asChannel();
|
||||||
const auto username = channel ? channel->username : QString();
|
const auto username = channel ? channel->username : QString();
|
||||||
_checkUsernameRequestId = request(MTPchannels_CheckUsername(
|
_checkUsernameRequestId = _api.request(MTPchannels_CheckUsername(
|
||||||
channel ? channel->inputChannel : MTP_inputChannelEmpty(),
|
channel ? channel->inputChannel : MTP_inputChannelEmpty(),
|
||||||
MTP_string(checking)
|
MTP_string(checking)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
|
@ -630,7 +630,7 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkEdit() {
|
||||||
|
|
||||||
observeInviteLink();
|
observeInviteLink();
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::refreshEditInviteLink() {
|
void Controller::refreshEditInviteLink() {
|
||||||
|
@ -692,7 +692,7 @@ object_ptr<Ui::RpWidget> Controller::createInviteLinkCreate() {
|
||||||
|
|
||||||
observeInviteLink();
|
observeInviteLink();
|
||||||
|
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::refreshCreateInviteLink() {
|
void Controller::refreshCreateInviteLink() {
|
||||||
|
|
|
@ -31,6 +31,7 @@ RateCallBox::RateCallBox(
|
||||||
uint64 callId,
|
uint64 callId,
|
||||||
uint64 callAccessHash)
|
uint64 callAccessHash)
|
||||||
: _session(session)
|
: _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _callId(callId)
|
, _callId(callId)
|
||||||
, _callAccessHash(callAccessHash) {
|
, _callAccessHash(callAccessHash) {
|
||||||
}
|
}
|
||||||
|
@ -120,7 +121,7 @@ void RateCallBox::send() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto comment = _comment ? _comment->getLastText().trimmed() : QString();
|
auto comment = _comment ? _comment->getLastText().trimmed() : QString();
|
||||||
_requestId = request(MTPphone_SetCallRating(
|
_requestId = _api.request(MTPphone_SetCallRating(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_inputPhoneCall(MTP_long(_callId), MTP_long(_callAccessHash)),
|
MTP_inputPhoneCall(MTP_long(_callId), MTP_long(_callAccessHash)),
|
||||||
MTP_int(_rating),
|
MTP_int(_rating),
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
|
||||||
class RateCallBox : public Ui::BoxContent, private MTP::Sender {
|
class RateCallBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
RateCallBox(
|
RateCallBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
|
@ -41,6 +41,7 @@ private:
|
||||||
void commentResized();
|
void commentResized();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
uint64 _callId = 0;
|
uint64 _callId = 0;
|
||||||
uint64 _callAccessHash = 0;
|
uint64 _callAccessHash = 0;
|
||||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/toast/toast.h"
|
#include "ui/toast/toast.h"
|
||||||
|
#include "mtproto/facade.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
template <typename Enum>
|
template <typename Enum>
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
|
||||||
class SelfDestructionBox : public Ui::BoxContent, private MTP::Sender {
|
class SelfDestructionBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
SelfDestructionBox(
|
SelfDestructionBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
|
@ -77,6 +78,7 @@ private:
|
||||||
|
|
||||||
SessionsBox::SessionsBox(QWidget*, not_null<Main::Session*> session)
|
SessionsBox::SessionsBox(QWidget*, not_null<Main::Session*> session)
|
||||||
: _session(session)
|
: _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _shortPollTimer([=] { shortPollSessions(); }) {
|
, _shortPollTimer([=] { shortPollSessions(); }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,7 +282,7 @@ void SessionsBox::shortPollSessions() {
|
||||||
if (_shortPollRequest) {
|
if (_shortPollRequest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_shortPollRequest = request(MTPaccount_GetAuthorizations(
|
_shortPollRequest = _api.request(MTPaccount_GetAuthorizations(
|
||||||
)).done([=](const MTPaccount_Authorizations &result) {
|
)).done([=](const MTPaccount_Authorizations &result) {
|
||||||
got(result);
|
got(result);
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -294,7 +296,7 @@ void SessionsBox::terminateOne(uint64 hash) {
|
||||||
_terminateBox->closeBox();
|
_terminateBox->closeBox();
|
||||||
_terminateBox = nullptr;
|
_terminateBox = nullptr;
|
||||||
}
|
}
|
||||||
request(MTPaccount_ResetAuthorization(
|
_api.request(MTPaccount_ResetAuthorization(
|
||||||
MTP_long(hash)
|
MTP_long(hash)
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
_inner->terminatingOne(hash, false);
|
_inner->terminatingOne(hash, false);
|
||||||
|
@ -330,12 +332,12 @@ void SessionsBox::terminateAll() {
|
||||||
_terminateBox->closeBox();
|
_terminateBox->closeBox();
|
||||||
_terminateBox = nullptr;
|
_terminateBox = nullptr;
|
||||||
}
|
}
|
||||||
request(MTPauth_ResetAuthorizations(
|
_api.request(MTPauth_ResetAuthorizations(
|
||||||
)).done([=](const MTPBool &result) {
|
)).done([=](const MTPBool &result) {
|
||||||
request(base::take(_shortPollRequest)).cancel();
|
_api.request(base::take(_shortPollRequest)).cancel();
|
||||||
shortPollSessions();
|
shortPollSessions();
|
||||||
}).fail([=](const RPCError &result) {
|
}).fail([=](const RPCError &result) {
|
||||||
request(base::take(_shortPollRequest)).cancel();
|
_api.request(base::take(_shortPollRequest)).cancel();
|
||||||
shortPollSessions();
|
shortPollSessions();
|
||||||
}).send();
|
}).send();
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
|
||||||
class SessionsBox : public Ui::BoxContent, private MTP::Sender {
|
class SessionsBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
SessionsBox(QWidget*, not_null<Main::Session*> session);
|
SessionsBox(QWidget*, not_null<Main::Session*> session);
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ private:
|
||||||
void terminateAll();
|
void terminateAll();
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
bool _loading = false;
|
bool _loading = false;
|
||||||
Full _data;
|
Full _data;
|
||||||
|
|
|
@ -722,7 +722,6 @@ void ShareBox::Inner::loadProfilePhotos(int yFrom) {
|
||||||
yFrom *= _columnCount;
|
yFrom *= _columnCount;
|
||||||
yTo *= _columnCount;
|
yTo *= _columnCount;
|
||||||
|
|
||||||
_navigation->session().downloader().clearPriorities();
|
|
||||||
if (_filter.isEmpty()) {
|
if (_filter.isEmpty()) {
|
||||||
if (!_chatsIndexed->empty()) {
|
if (!_chatsIndexed->empty()) {
|
||||||
auto i = _chatsIndexed->cfind(yFrom, _rowHeight);
|
auto i = _chatsIndexed->cfind(yFrom, _rowHeight);
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/effects/round_checkbox.h"
|
#include "ui/effects/round_checkbox.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
enum class SendMenuType;
|
enum class SendMenuType;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "chat_helpers/stickers.h"
|
#include "chat_helpers/stickers.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
|
@ -99,7 +100,7 @@ private:
|
||||||
void showPreview();
|
void showPreview();
|
||||||
|
|
||||||
not_null<Window::SessionController*> _controller;
|
not_null<Window::SessionController*> _controller;
|
||||||
MTP::Sender _mtp;
|
MTP::Sender _api;
|
||||||
std::vector<Element> _elements;
|
std::vector<Element> _elements;
|
||||||
std::unique_ptr<Lottie::MultiPlayer> _lottiePlayer;
|
std::unique_ptr<Lottie::MultiPlayer> _lottiePlayer;
|
||||||
Stickers::Pack _pack;
|
Stickers::Pack _pack;
|
||||||
|
@ -220,6 +221,7 @@ StickerSetBox::Inner::Inner(
|
||||||
const MTPInputStickerSet &set)
|
const MTPInputStickerSet &set)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
|
, _api(_controller->session().api().instance())
|
||||||
, _input(set)
|
, _input(set)
|
||||||
, _previewTimer([=] { showPreview(); }) {
|
, _previewTimer([=] { showPreview(); }) {
|
||||||
set.match([&](const MTPDinputStickerSetID &data) {
|
set.match([&](const MTPDinputStickerSetID &data) {
|
||||||
|
@ -231,7 +233,7 @@ StickerSetBox::Inner::Inner(
|
||||||
}, [&](const MTPDinputStickerSetAnimatedEmoji &) {
|
}, [&](const MTPDinputStickerSetAnimatedEmoji &) {
|
||||||
});
|
});
|
||||||
|
|
||||||
_mtp.request(MTPmessages_GetStickerSet(
|
_api.request(MTPmessages_GetStickerSet(
|
||||||
_input
|
_input
|
||||||
)).done([=](const MTPmessages_StickerSet &result) {
|
)).done([=](const MTPmessages_StickerSet &result) {
|
||||||
gotSet(result);
|
gotSet(result);
|
||||||
|
@ -700,7 +702,7 @@ void StickerSetBox::Inner::install() {
|
||||||
} else if (_installRequest) {
|
} else if (_installRequest) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_installRequest = _mtp.request(MTPmessages_InstallStickerSet(
|
_installRequest = _api.request(MTPmessages_InstallStickerSet(
|
||||||
_input,
|
_input,
|
||||||
MTP_bool(false)
|
MTP_bool(false)
|
||||||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
@ -661,6 +662,7 @@ StickersBox::Inner::Inner(
|
||||||
StickersBox::Section section)
|
StickersBox::Section section)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _session(session)
|
, _session(session)
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _section(section)
|
, _section(section)
|
||||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||||
, _shiftingAnimation([=](crl::time now) {
|
, _shiftingAnimation([=](crl::time now) {
|
||||||
|
@ -677,6 +679,7 @@ StickersBox::Inner::Inner(
|
||||||
StickersBox::Inner::Inner(QWidget *parent, not_null<ChannelData*> megagroup)
|
StickersBox::Inner::Inner(QWidget *parent, not_null<ChannelData*> megagroup)
|
||||||
: RpWidget(parent)
|
: RpWidget(parent)
|
||||||
, _session(&megagroup->session())
|
, _session(&megagroup->session())
|
||||||
|
, _api(_session->api().instance())
|
||||||
, _section(StickersBox::Section::Installed)
|
, _section(StickersBox::Section::Installed)
|
||||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||||
, _shiftingAnimation([=](crl::time now) {
|
, _shiftingAnimation([=](crl::time now) {
|
||||||
|
@ -1469,11 +1472,13 @@ void StickersBox::Inner::handleMegagroupSetAddressChange() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!_megagroupSetRequestId) {
|
} else if (!_megagroupSetRequestId) {
|
||||||
_megagroupSetRequestId = request(MTPmessages_GetStickerSet(MTP_inputStickerSetShortName(MTP_string(text)))).done([this](const MTPmessages_StickerSet &result) {
|
_megagroupSetRequestId = _api.request(MTPmessages_GetStickerSet(
|
||||||
|
MTP_inputStickerSetShortName(MTP_string(text))
|
||||||
|
)).done([=](const MTPmessages_StickerSet &result) {
|
||||||
_megagroupSetRequestId = 0;
|
_megagroupSetRequestId = 0;
|
||||||
auto set = Stickers::FeedSetFull(result);
|
auto set = Stickers::FeedSetFull(result);
|
||||||
setMegagroupSelectedSet(MTP_inputStickerSetID(MTP_long(set->id), MTP_long(set->access)));
|
setMegagroupSelectedSet(MTP_inputStickerSetID(MTP_long(set->id), MTP_long(set->access)));
|
||||||
}).fail([this](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
_megagroupSetRequestId = 0;
|
_megagroupSetRequestId = 0;
|
||||||
setMegagroupSelectedSet(MTP_inputStickerSetEmpty());
|
setMegagroupSelectedSet(MTP_inputStickerSetEmpty());
|
||||||
}).send();
|
}).send();
|
||||||
|
|
|
@ -153,8 +153,7 @@ private:
|
||||||
// This class is hold in header because it requires Qt preprocessing.
|
// This class is hold in header because it requires Qt preprocessing.
|
||||||
class StickersBox::Inner
|
class StickersBox::Inner
|
||||||
: public Ui::RpWidget
|
: public Ui::RpWidget
|
||||||
, private base::Subscriber
|
, private base::Subscriber {
|
||||||
, private MTP::Sender {
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -320,6 +319,7 @@ private:
|
||||||
int countMaxNameWidth() const;
|
int countMaxNameWidth() const;
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
Section _section;
|
Section _section;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class UsernameInput;
|
class UsernameInput;
|
||||||
|
|
|
@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_media_types.h"
|
#include "data/data_media_types.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
|
@ -216,7 +217,8 @@ void BoxController::Row::stopLastActionRipple() {
|
||||||
}
|
}
|
||||||
|
|
||||||
BoxController::BoxController(not_null<Window::SessionController*> window)
|
BoxController::BoxController(not_null<Window::SessionController*> window)
|
||||||
: _window(window) {
|
: _window(window)
|
||||||
|
, _api(_window->session().api().instance()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Main::Session &BoxController::session() const {
|
Main::Session &BoxController::session() const {
|
||||||
|
@ -256,7 +258,7 @@ void BoxController::loadMoreRows() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_loadRequestId = request(MTPmessages_Search(
|
_loadRequestId = _api.request(MTPmessages_Search(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_inputPeerEmpty(),
|
MTP_inputPeerEmpty(),
|
||||||
MTP_string(),
|
MTP_string(),
|
||||||
|
@ -404,8 +406,7 @@ BoxController::Row *BoxController::rowForItem(not_null<const HistoryItem*> item)
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> BoxController::createRow(
|
std::unique_ptr<PeerListRow> BoxController::createRow(
|
||||||
not_null<HistoryItem*> item) const {
|
not_null<HistoryItem*> item) const {
|
||||||
auto row = std::make_unique<Row>(item);
|
return std::make_unique<Row>(item);
|
||||||
return std::move(row);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Calls
|
} // namespace Calls
|
||||||
|
|
|
@ -15,10 +15,7 @@ class SessionController;
|
||||||
|
|
||||||
namespace Calls {
|
namespace Calls {
|
||||||
|
|
||||||
class BoxController
|
class BoxController : public PeerListController, private base::Subscriber {
|
||||||
: public PeerListController
|
|
||||||
, private base::Subscriber
|
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
explicit BoxController(not_null<Window::SessionController*> window);
|
explicit BoxController(not_null<Window::SessionController*> window);
|
||||||
|
|
||||||
|
@ -44,6 +41,7 @@ private:
|
||||||
not_null<HistoryItem*> item) const;
|
not_null<HistoryItem*> item) const;
|
||||||
|
|
||||||
const not_null<Window::SessionController*> _window;
|
const not_null<Window::SessionController*> _window;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
MsgId _offsetId = 0;
|
MsgId _offsetId = 0;
|
||||||
mtpRequestId _loadRequestId = 0;
|
mtpRequestId _loadRequestId = 0;
|
||||||
|
|
|
@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/rate_call_box.h"
|
#include "boxes/rate_call_box.h"
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
#include "base/openssl_help.h"
|
#include "base/openssl_help.h"
|
||||||
#include "mtproto/connection.h"
|
#include "mtproto/mtproto_dh_utils.h"
|
||||||
#include "media/audio/media_audio_track.h"
|
#include "media/audio/media_audio_track.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "calls/calls_panel.h"
|
#include "calls/calls_panel.h"
|
||||||
|
@ -130,6 +130,7 @@ Call::Call(
|
||||||
Type type)
|
Type type)
|
||||||
: _delegate(delegate)
|
: _delegate(delegate)
|
||||||
, _user(user)
|
, _user(user)
|
||||||
|
, _api(_user->session().api().instance())
|
||||||
, _type(type) {
|
, _type(type) {
|
||||||
_discardByTimeoutTimer.setCallback([this] { hangup(); });
|
_discardByTimeoutTimer.setCallback([this] { hangup(); });
|
||||||
|
|
||||||
|
@ -189,7 +190,7 @@ void Call::startOutgoing() {
|
||||||
Expects(_state == State::Requesting);
|
Expects(_state == State::Requesting);
|
||||||
Expects(_gaHash.size() == kSha256Size);
|
Expects(_gaHash.size() == kSha256Size);
|
||||||
|
|
||||||
request(MTPphone_RequestCall(
|
_api.request(MTPphone_RequestCall(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
_user->inputUser,
|
_user->inputUser,
|
||||||
MTP_int(rand_value<int32>()),
|
MTP_int(rand_value<int32>()),
|
||||||
|
@ -236,11 +237,13 @@ void Call::startIncoming() {
|
||||||
Expects(_type == Type::Incoming);
|
Expects(_type == Type::Incoming);
|
||||||
Expects(_state == State::Starting);
|
Expects(_state == State::Starting);
|
||||||
|
|
||||||
request(MTPphone_ReceivedCall(MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash)))).done([this](const MTPBool &result) {
|
_api.request(MTPphone_ReceivedCall(
|
||||||
|
MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash))
|
||||||
|
)).done([=](const MTPBool &result) {
|
||||||
if (_state == State::Starting) {
|
if (_state == State::Starting) {
|
||||||
setState(State::WaitingIncoming);
|
setState(State::WaitingIncoming);
|
||||||
}
|
}
|
||||||
}).fail([this](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
handleRequestError(error);
|
handleRequestError(error);
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -267,7 +270,7 @@ void Call::actuallyAnswer() {
|
||||||
} else {
|
} else {
|
||||||
_answerAfterDhConfigReceived = false;
|
_answerAfterDhConfigReceived = false;
|
||||||
}
|
}
|
||||||
request(MTPphone_AcceptCall(
|
_api.request(MTPphone_AcceptCall(
|
||||||
MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash)),
|
MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash)),
|
||||||
MTP_bytes(_gb),
|
MTP_bytes(_gb),
|
||||||
MTP_phoneCallProtocol(
|
MTP_phoneCallProtocol(
|
||||||
|
@ -504,7 +507,7 @@ void Call::confirmAcceptedCall(const MTPDphoneCallAccepted &call) {
|
||||||
_keyFingerprint = ComputeFingerprint(_authKey);
|
_keyFingerprint = ComputeFingerprint(_authKey);
|
||||||
|
|
||||||
setState(State::ExchangingKeys);
|
setState(State::ExchangingKeys);
|
||||||
request(MTPphone_ConfirmCall(
|
_api.request(MTPphone_ConfirmCall(
|
||||||
MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash)),
|
MTP_inputPhoneCall(MTP_long(_id), MTP_long(_accessHash)),
|
||||||
MTP_bytes(_ga),
|
MTP_bytes(_ga),
|
||||||
MTP_long(_keyFingerprint),
|
MTP_long(_keyFingerprint),
|
||||||
|
@ -623,10 +626,10 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
|
||||||
_controller->SetEncryptionKey(reinterpret_cast<char*>(_authKey.data()), (_type == Type::Outgoing));
|
_controller->SetEncryptionKey(reinterpret_cast<char*>(_authKey.data()), (_type == Type::Outgoing));
|
||||||
_controller->SetCallbacks(callbacks);
|
_controller->SetCallbacks(callbacks);
|
||||||
if (Global::UseProxyForCalls()
|
if (Global::UseProxyForCalls()
|
||||||
&& (Global::ProxySettings() == ProxyData::Settings::Enabled)) {
|
&& (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled)) {
|
||||||
const auto &proxy = Global::SelectedProxy();
|
const auto &proxy = Global::SelectedProxy();
|
||||||
if (proxy.supportsCalls()) {
|
if (proxy.supportsCalls()) {
|
||||||
Assert(proxy.type == ProxyData::Type::Socks5);
|
Assert(proxy.type == MTP::ProxyData::Type::Socks5);
|
||||||
_controller->SetProxy(
|
_controller->SetProxy(
|
||||||
tgvoip::PROXY_SOCKS5,
|
tgvoip::PROXY_SOCKS5,
|
||||||
proxy.host.toStdString(),
|
proxy.host.toStdString(),
|
||||||
|
@ -840,7 +843,7 @@ void Call::finish(FinishType type, const MTPPhoneCallDiscardReason &reason) {
|
||||||
auto duration = getDurationMs() / 1000;
|
auto duration = getDurationMs() / 1000;
|
||||||
auto connectionId = _controller ? _controller->GetPreferredRelayID() : 0;
|
auto connectionId = _controller ? _controller->GetPreferredRelayID() : 0;
|
||||||
_finishByTimeoutTimer.call(kHangupTimeoutMs, [this, finalState] { setState(finalState); });
|
_finishByTimeoutTimer.call(kHangupTimeoutMs, [this, finalState] { setState(finalState); });
|
||||||
request(MTPphone_DiscardCall(
|
_api.request(MTPphone_DiscardCall(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_inputPhoneCall(
|
MTP_inputPhoneCall(
|
||||||
MTP_long(_id),
|
MTP_long(_id),
|
||||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "base/bytes.h"
|
#include "base/bytes.h"
|
||||||
#include "mtproto/sender.h"
|
#include "mtproto/sender.h"
|
||||||
#include "mtproto/auth_key.h"
|
#include "mtproto/mtproto_auth_key.h"
|
||||||
|
|
||||||
namespace Media {
|
namespace Media {
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
|
@ -31,7 +31,7 @@ struct DhConfig {
|
||||||
bytes::vector p;
|
bytes::vector p;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Call : public base::has_weak_ptr, private MTP::Sender {
|
class Call : public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
class Delegate {
|
class Delegate {
|
||||||
public:
|
public:
|
||||||
|
@ -183,6 +183,7 @@ private:
|
||||||
|
|
||||||
not_null<Delegate*> _delegate;
|
not_null<Delegate*> _delegate;
|
||||||
not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
|
MTP::Sender _api;
|
||||||
Type _type = Type::Outgoing;
|
Type _type = Type::Outgoing;
|
||||||
State _state = State::Starting;
|
State _state = State::Starting;
|
||||||
FinishType _finishAfterRequestingCall = FinishType::None;
|
FinishType _finishAfterRequestingCall = FinishType::None;
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "calls/calls_instance.h"
|
#include "calls/calls_instance.h"
|
||||||
|
|
||||||
#include "mtproto/connection.h"
|
#include "mtproto/mtproto_dh_utils.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
@ -32,7 +32,9 @@ constexpr auto kServerConfigUpdateTimeoutMs = 24 * 3600 * crl::time(1000);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Instance::Instance(not_null<Main::Session*> session) : _session(session) {
|
Instance::Instance(not_null<Main::Session*> session)
|
||||||
|
: _session(session)
|
||||||
|
, _api(_session->api().instance()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::startOutgoingCall(not_null<UserData*> user) {
|
void Instance::startOutgoingCall(not_null<UserData*> user) {
|
||||||
|
@ -139,7 +141,7 @@ void Instance::refreshDhConfig() {
|
||||||
Expects(_currentCall != nullptr);
|
Expects(_currentCall != nullptr);
|
||||||
|
|
||||||
const auto weak = base::make_weak(_currentCall);
|
const auto weak = base::make_weak(_currentCall);
|
||||||
request(MTPmessages_GetDhConfig(
|
_api.request(MTPmessages_GetDhConfig(
|
||||||
MTP_int(_dhConfig.version),
|
MTP_int(_dhConfig.version),
|
||||||
MTP_int(MTP::ModExpFirst::kRandomPowerSize)
|
MTP_int(MTP::ModExpFirst::kRandomPowerSize)
|
||||||
)).done([=](const MTPmessages_DhConfig &result) {
|
)).done([=](const MTPmessages_DhConfig &result) {
|
||||||
|
@ -203,13 +205,14 @@ void Instance::refreshServerConfig() {
|
||||||
if (_lastServerConfigUpdateTime && (crl::now() - _lastServerConfigUpdateTime) < kServerConfigUpdateTimeoutMs) {
|
if (_lastServerConfigUpdateTime && (crl::now() - _lastServerConfigUpdateTime) < kServerConfigUpdateTimeoutMs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_serverConfigRequestId = request(MTPphone_GetCallConfig()).done([this](const MTPDataJSON &result) {
|
_serverConfigRequestId = _api.request(MTPphone_GetCallConfig(
|
||||||
|
)).done([=](const MTPDataJSON &result) {
|
||||||
_serverConfigRequestId = 0;
|
_serverConfigRequestId = 0;
|
||||||
_lastServerConfigUpdateTime = crl::now();
|
_lastServerConfigUpdateTime = crl::now();
|
||||||
|
|
||||||
const auto &json = result.c_dataJSON().vdata().v;
|
const auto &json = result.c_dataJSON().vdata().v;
|
||||||
UpdateConfig(std::string(json.data(), json.size()));
|
UpdateConfig(std::string(json.data(), json.size()));
|
||||||
}).fail([this](const RPCError &error) {
|
}).fail([=](const RPCError &error) {
|
||||||
_serverConfigRequestId = 0;
|
_serverConfigRequestId = 0;
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -246,7 +249,7 @@ void Instance::handleCallUpdate(const MTPPhoneCall &call) {
|
||||||
LOG(("API Error: Self found in phoneCallRequested."));
|
LOG(("API Error: Self found in phoneCallRequested."));
|
||||||
}
|
}
|
||||||
if (alreadyInCall() || !user || user->isSelf()) {
|
if (alreadyInCall() || !user || user->isSelf()) {
|
||||||
request(MTPphone_DiscardCall(
|
_api.request(MTPphone_DiscardCall(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_inputPhoneCall(phoneCall.vid(), phoneCall.vaccess_hash()),
|
MTP_inputPhoneCall(phoneCall.vid(), phoneCall.vaccess_hash()),
|
||||||
MTP_int(0),
|
MTP_int(0),
|
||||||
|
|
|
@ -25,8 +25,7 @@ namespace Calls {
|
||||||
class Panel;
|
class Panel;
|
||||||
|
|
||||||
class Instance
|
class Instance
|
||||||
: private MTP::Sender
|
: private Call::Delegate
|
||||||
, private Call::Delegate
|
|
||||||
, private base::Subscriber
|
, private base::Subscriber
|
||||||
, public base::has_weak_ptr {
|
, public base::has_weak_ptr {
|
||||||
public:
|
public:
|
||||||
|
@ -74,6 +73,7 @@ private:
|
||||||
void handleCallUpdate(const MTPPhoneCall &call);
|
void handleCallUpdate(const MTPPhoneCall &call);
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
DhConfig _dhConfig;
|
DhConfig _dhConfig;
|
||||||
|
|
||||||
|
|
|
@ -427,7 +427,7 @@ object_ptr<TabbedSelector::InnerFooter> EmojiListWidget::createFooter() {
|
||||||
Expects(_footer == nullptr);
|
Expects(_footer == nullptr);
|
||||||
auto result = object_ptr<Footer>(this);
|
auto result = object_ptr<Footer>(this);
|
||||||
_footer = result;
|
_footer = result;
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
|
|
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "data/data_peer_values.h"
|
#include "data/data_peer_values.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_user.h"
|
#include "data/data_user.h"
|
||||||
#include "styles/style_chat_helpers.h"
|
#include "data/data_file_origin.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
|
@ -22,10 +22,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
#include "history/view/history_view_cursor_state.h"
|
#include "history/view/history_view_cursor_state.h"
|
||||||
#include "facades.h"
|
#include "facades.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
#include "styles/style_chat_helpers.h"
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
@ -130,6 +132,7 @@ GifsListWidget::GifsListWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::SessionController*> controller)
|
not_null<Window::SessionController*> controller)
|
||||||
: Inner(parent, controller)
|
: Inner(parent, controller)
|
||||||
|
, _api(controller->session().api().instance())
|
||||||
, _section(Section::Gifs)
|
, _section(Section::Gifs)
|
||||||
, _updateInlineItems([=] { updateInlineItems(); })
|
, _updateInlineItems([=] { updateInlineItems(); })
|
||||||
, _previewTimer([=] { showPreview(); }) {
|
, _previewTimer([=] { showPreview(); }) {
|
||||||
|
@ -178,7 +181,7 @@ object_ptr<TabbedSelector::InnerFooter> GifsListWidget::createFooter() {
|
||||||
|
|
||||||
auto result = object_ptr<Footer>(this);
|
auto result = object_ptr<Footer>(this);
|
||||||
_footer = result;
|
_footer = result;
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GifsListWidget::visibleTopBottomUpdated(
|
void GifsListWidget::visibleTopBottomUpdated(
|
||||||
|
@ -217,7 +220,7 @@ GifsListWidget::~GifsListWidget() {
|
||||||
void GifsListWidget::cancelGifsSearch() {
|
void GifsListWidget::cancelGifsSearch() {
|
||||||
_footer->setLoading(false);
|
_footer->setLoading(false);
|
||||||
if (_inlineRequestId) {
|
if (_inlineRequestId) {
|
||||||
request(_inlineRequestId).cancel();
|
_api.request(_inlineRequestId).cancel();
|
||||||
_inlineRequestId = 0;
|
_inlineRequestId = 0;
|
||||||
}
|
}
|
||||||
_inlineRequestTimer.stop();
|
_inlineRequestTimer.stop();
|
||||||
|
@ -840,7 +843,7 @@ void GifsListWidget::searchForGifs(const QString &query) {
|
||||||
if (_inlineQuery != query) {
|
if (_inlineQuery != query) {
|
||||||
_footer->setLoading(false);
|
_footer->setLoading(false);
|
||||||
if (_inlineRequestId) {
|
if (_inlineRequestId) {
|
||||||
request(_inlineRequestId).cancel();
|
_api.request(_inlineRequestId).cancel();
|
||||||
_inlineRequestId = 0;
|
_inlineRequestId = 0;
|
||||||
}
|
}
|
||||||
if (_inlineCache.find(query) != _inlineCache.cend()) {
|
if (_inlineCache.find(query) != _inlineCache.cend()) {
|
||||||
|
@ -855,7 +858,7 @@ void GifsListWidget::searchForGifs(const QString &query) {
|
||||||
|
|
||||||
if (!_searchBot && !_searchBotRequestId) {
|
if (!_searchBot && !_searchBotRequestId) {
|
||||||
auto username = str_const_toString(kSearchBotUsername);
|
auto username = str_const_toString(kSearchBotUsername);
|
||||||
_searchBotRequestId = request(MTPcontacts_ResolveUsername(
|
_searchBotRequestId = _api.request(MTPcontacts_ResolveUsername(
|
||||||
MTP_string(username)
|
MTP_string(username)
|
||||||
)).done([=](const MTPcontacts_ResolvedPeer &result) {
|
)).done([=](const MTPcontacts_ResolvedPeer &result) {
|
||||||
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
Expects(result.type() == mtpc_contacts_resolvedPeer);
|
||||||
|
@ -905,7 +908,7 @@ void GifsListWidget::sendInlineRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_footer->setLoading(true);
|
_footer->setLoading(true);
|
||||||
_inlineRequestId = request(MTPmessages_GetInlineBotResults(
|
_inlineRequestId = _api.request(MTPmessages_GetInlineBotResults(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
_searchBot->inputUser,
|
_searchBot->inputUser,
|
||||||
_inlineQueryPeer->input,
|
_inlineQueryPeer->input,
|
||||||
|
|
|
@ -34,8 +34,7 @@ namespace ChatHelpers {
|
||||||
class GifsListWidget
|
class GifsListWidget
|
||||||
: public TabbedSelector::Inner
|
: public TabbedSelector::Inner
|
||||||
, public InlineBots::Layout::Context
|
, public InlineBots::Layout::Context
|
||||||
, private base::Subscriber
|
, private base::Subscriber {
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
using InlineChosen = TabbedSelector::InlineChosen;
|
using InlineChosen = TabbedSelector::InlineChosen;
|
||||||
|
|
||||||
|
@ -119,6 +118,8 @@ private:
|
||||||
void updateInlineItems();
|
void updateInlineItems();
|
||||||
void showPreview();
|
void showPreview();
|
||||||
|
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
Section _section = Section::Gifs;
|
Section _section = Section::Gifs;
|
||||||
crl::time _lastScrolled = 0;
|
crl::time _lastScrolled = 0;
|
||||||
base::Timer _updateInlineItems;
|
base::Timer _updateInlineItems;
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "boxes/stickers_box.h"
|
#include "boxes/stickers_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -891,7 +892,7 @@ std::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
|
||||||
if (result.empty()) {
|
if (result.empty()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_document.h"
|
#include "data/data_document.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/effects/ripple_animation.h"
|
#include "ui/effects/ripple_animation.h"
|
||||||
|
@ -828,6 +829,7 @@ StickersListWidget::StickersListWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::SessionController*> controller)
|
not_null<Window::SessionController*> controller)
|
||||||
: Inner(parent, controller)
|
: Inner(parent, controller)
|
||||||
|
, _api(controller->session().api().instance())
|
||||||
, _section(Section::Stickers)
|
, _section(Section::Stickers)
|
||||||
, _megagroupSetAbout(st::columnMinimalWidthThird - st::emojiScroll.width - st::emojiPanHeaderLeft)
|
, _megagroupSetAbout(st::columnMinimalWidthThird - st::emojiScroll.width - st::emojiPanHeaderLeft)
|
||||||
, _addText(tr::lng_stickers_featured_add(tr::now).toUpper())
|
, _addText(tr::lng_stickers_featured_add(tr::now).toUpper())
|
||||||
|
@ -878,7 +880,7 @@ object_ptr<TabbedSelector::InnerFooter> StickersListWidget::createFooter() {
|
||||||
|
|
||||||
auto result = object_ptr<Footer>(this);
|
auto result = object_ptr<Footer>(this);
|
||||||
_footer = result;
|
_footer = result;
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListWidget::visibleTopBottomUpdated(
|
void StickersListWidget::visibleTopBottomUpdated(
|
||||||
|
@ -1069,7 +1071,7 @@ void StickersListWidget::sendSearchRequest() {
|
||||||
|
|
||||||
_footer->setLoading(true);
|
_footer->setLoading(true);
|
||||||
const auto hash = int32(0);
|
const auto hash = int32(0);
|
||||||
_searchRequestId = request(MTPmessages_SearchStickerSets(
|
_searchRequestId = _api.request(MTPmessages_SearchStickerSets(
|
||||||
MTP_flags(0),
|
MTP_flags(0),
|
||||||
MTP_string(_searchQuery),
|
MTP_string(_searchQuery),
|
||||||
MTP_int(hash)
|
MTP_int(hash)
|
||||||
|
@ -1092,7 +1094,7 @@ void StickersListWidget::searchForSets(const QString &query) {
|
||||||
if (_searchQuery != cleaned) {
|
if (_searchQuery != cleaned) {
|
||||||
_footer->setLoading(false);
|
_footer->setLoading(false);
|
||||||
if (const auto requestId = base::take(_searchRequestId)) {
|
if (const auto requestId = base::take(_searchRequestId)) {
|
||||||
request(requestId).cancel();
|
_api.request(requestId).cancel();
|
||||||
}
|
}
|
||||||
if (_searchCache.find(cleaned) != _searchCache.cend()) {
|
if (_searchCache.find(cleaned) != _searchCache.cend()) {
|
||||||
_searchRequestTimer.cancel();
|
_searchRequestTimer.cancel();
|
||||||
|
@ -1108,7 +1110,7 @@ void StickersListWidget::searchForSets(const QString &query) {
|
||||||
void StickersListWidget::cancelSetsSearch() {
|
void StickersListWidget::cancelSetsSearch() {
|
||||||
_footer->setLoading(false);
|
_footer->setLoading(false);
|
||||||
if (const auto requestId = base::take(_searchRequestId)) {
|
if (const auto requestId = base::take(_searchRequestId)) {
|
||||||
request(requestId).cancel();
|
_api.request(requestId).cancel();
|
||||||
}
|
}
|
||||||
_searchRequestTimer.cancel();
|
_searchRequestTimer.cancel();
|
||||||
_searchQuery = _searchNextQuery = QString();
|
_searchQuery = _searchNextQuery = QString();
|
||||||
|
@ -2468,7 +2470,7 @@ void StickersListWidget::refreshMegagroupStickers(GroupStickersPlace place) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_megagroupSetIdRequested = set.vid().v;
|
_megagroupSetIdRequested = set.vid().v;
|
||||||
request(MTPmessages_GetStickerSet(
|
_api.request(MTPmessages_GetStickerSet(
|
||||||
_megagroupSet->mgInfo->stickerSet
|
_megagroupSet->mgInfo->stickerSet
|
||||||
)).done([=](const MTPmessages_StickerSet &result) {
|
)).done([=](const MTPmessages_StickerSet &result) {
|
||||||
if (const auto set = Stickers::FeedSetFull(result)) {
|
if (const auto set = Stickers::FeedSetFull(result)) {
|
||||||
|
@ -2810,7 +2812,7 @@ void StickersListWidget::installSet(uint64 setId) {
|
||||||
const auto input = Stickers::inputSetId(*it);
|
const auto input = Stickers::inputSetId(*it);
|
||||||
if ((it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)
|
if ((it->flags & MTPDstickerSet_ClientFlag::f_not_loaded)
|
||||||
|| it->stickers.empty()) {
|
|| it->stickers.empty()) {
|
||||||
request(MTPmessages_GetStickerSet(
|
_api.request(MTPmessages_GetStickerSet(
|
||||||
input
|
input
|
||||||
)).done([=](const MTPmessages_StickerSet &result) {
|
)).done([=](const MTPmessages_StickerSet &result) {
|
||||||
Stickers::FeedSetFull(result);
|
Stickers::FeedSetFull(result);
|
||||||
|
@ -2825,7 +2827,7 @@ void StickersListWidget::installSet(uint64 setId) {
|
||||||
void StickersListWidget::sendInstallRequest(
|
void StickersListWidget::sendInstallRequest(
|
||||||
uint64 setId,
|
uint64 setId,
|
||||||
const MTPInputStickerSet &input) {
|
const MTPInputStickerSet &input) {
|
||||||
request(MTPmessages_InstallStickerSet(
|
_api.request(MTPmessages_InstallStickerSet(
|
||||||
input,
|
input,
|
||||||
MTP_bool(false)
|
MTP_bool(false)
|
||||||
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
)).done([=](const MTPmessages_StickerSetInstallResult &result) {
|
||||||
|
@ -2876,9 +2878,9 @@ void StickersListWidget::removeSet(uint64 setId) {
|
||||||
auto it = sets.find(_removingSetId);
|
auto it = sets.find(_removingSetId);
|
||||||
if (it != sets.cend()) {
|
if (it != sets.cend()) {
|
||||||
if (it->id && it->access) {
|
if (it->id && it->access) {
|
||||||
request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))).send();
|
_api.request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetID(MTP_long(it->id), MTP_long(it->access)))).send();
|
||||||
} else if (!it->shortName.isEmpty()) {
|
} else if (!it->shortName.isEmpty()) {
|
||||||
request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetShortName(MTP_string(it->shortName)))).send();
|
_api.request(MTPmessages_UninstallStickerSet(MTP_inputStickerSetShortName(MTP_string(it->shortName)))).send();
|
||||||
}
|
}
|
||||||
auto writeRecent = false;
|
auto writeRecent = false;
|
||||||
auto &recent = Stickers::GetRecentPack();
|
auto &recent = Stickers::GetRecentPack();
|
||||||
|
|
|
@ -38,8 +38,7 @@ struct StickerIcon;
|
||||||
|
|
||||||
class StickersListWidget
|
class StickersListWidget
|
||||||
: public TabbedSelector::Inner
|
: public TabbedSelector::Inner
|
||||||
, private base::Subscriber
|
, private base::Subscriber {
|
||||||
, private MTP::Sender {
|
|
||||||
public:
|
public:
|
||||||
StickersListWidget(
|
StickersListWidget(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
|
@ -300,6 +299,7 @@ private:
|
||||||
|
|
||||||
void showPreview();
|
void showPreview();
|
||||||
|
|
||||||
|
MTP::Sender _api;
|
||||||
ChannelData *_megagroupSet = nullptr;
|
ChannelData *_megagroupSet = nullptr;
|
||||||
uint64 _megagroupSetIdRequested = 0;
|
uint64 _megagroupSetIdRequested = 0;
|
||||||
std::vector<Set> _mySets;
|
std::vector<Set> _mySets;
|
||||||
|
|
|
@ -20,7 +20,7 @@ object_ptr<Window::SectionWidget> TabbedMemento::createWidget(
|
||||||
const QRect &geometry) {
|
const QRect &geometry) {
|
||||||
auto result = object_ptr<TabbedSection>(parent, controller);
|
auto result = object_ptr<TabbedSection>(parent, controller);
|
||||||
result->setGeometry(geometry);
|
result->setGeometry(geometry);
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedSection::TabbedSection(
|
TabbedSection::TabbedSection(
|
||||||
|
|
|
@ -14,7 +14,7 @@ from generate_tl import generate
|
||||||
|
|
||||||
generate({
|
generate({
|
||||||
'namespaces': {
|
'namespaces': {
|
||||||
'creator': 'MTP::internal',
|
'creator': 'MTP::details',
|
||||||
},
|
},
|
||||||
'prefixes': {
|
'prefixes': {
|
||||||
'type': 'MTP',
|
'type': 'MTP',
|
||||||
|
@ -28,7 +28,6 @@ generate({
|
||||||
'buffer': 'mtpBuffer',
|
'buffer': 'mtpBuffer',
|
||||||
},
|
},
|
||||||
'sections': [
|
'sections': [
|
||||||
'serialization',
|
|
||||||
'read-write',
|
'read-write',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -91,4 +90,8 @@ generate({
|
||||||
},
|
},
|
||||||
'builtinInclude': 'mtproto/core_types.h',
|
'builtinInclude': 'mtproto/core_types.h',
|
||||||
|
|
||||||
|
'dumpToText': {
|
||||||
|
'include': 'mtproto/details/mtproto_dump_to_text.h',
|
||||||
|
},
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -93,6 +93,7 @@ Application::Application(not_null<Launcher*> launcher)
|
||||||
, _dcOptions(std::make_unique<MTP::DcOptions>())
|
, _dcOptions(std::make_unique<MTP::DcOptions>())
|
||||||
, _account(std::make_unique<Main::Account>(cDataFile()))
|
, _account(std::make_unique<Main::Account>(cDataFile()))
|
||||||
, _langpack(std::make_unique<Lang::Instance>())
|
, _langpack(std::make_unique<Lang::Instance>())
|
||||||
|
, _langCloudManager(std::make_unique<Lang::CloudManager>(langpack()))
|
||||||
, _emojiKeywords(std::make_unique<ChatHelpers::EmojiKeywords>())
|
, _emojiKeywords(std::make_unique<ChatHelpers::EmojiKeywords>())
|
||||||
, _audio(std::make_unique<Media::Audio::Instance>())
|
, _audio(std::make_unique<Media::Audio::Instance>())
|
||||||
, _logo(Window::LoadLogo())
|
, _logo(Window::LoadLogo())
|
||||||
|
@ -114,9 +115,6 @@ Application::Application(not_null<Launcher*> launcher)
|
||||||
) | rpl::filter([=](MTP::Instance *instance) {
|
) | rpl::filter([=](MTP::Instance *instance) {
|
||||||
return instance != nullptr;
|
return instance != nullptr;
|
||||||
}) | rpl::start_with_next([=](not_null<MTP::Instance*> mtp) {
|
}) | rpl::start_with_next([=](not_null<MTP::Instance*> mtp) {
|
||||||
_langCloudManager = std::make_unique<Lang::CloudManager>(
|
|
||||||
langpack(),
|
|
||||||
mtp);
|
|
||||||
if (!UpdaterDisabled()) {
|
if (!UpdaterDisabled()) {
|
||||||
UpdateChecker().setMtproto(mtp.get());
|
UpdateChecker().setMtproto(mtp.get());
|
||||||
}
|
}
|
||||||
|
@ -134,11 +132,6 @@ Application::~Application() {
|
||||||
// Some MTP requests can be cancelled from data clearing.
|
// Some MTP requests can be cancelled from data clearing.
|
||||||
unlockTerms();
|
unlockTerms();
|
||||||
activeAccount().destroySession();
|
activeAccount().destroySession();
|
||||||
|
|
||||||
// The langpack manager should be destroyed before MTProto instance,
|
|
||||||
// because it is MTP::Sender and it may have pending requests.
|
|
||||||
_langCloudManager.reset();
|
|
||||||
|
|
||||||
activeAccount().clearMtp();
|
activeAccount().clearMtp();
|
||||||
|
|
||||||
Shortcuts::Finish();
|
Shortcuts::Finish();
|
||||||
|
@ -146,7 +139,6 @@ Application::~Application() {
|
||||||
Ui::Emoji::Clear();
|
Ui::Emoji::Clear();
|
||||||
Media::Clip::Finish();
|
Media::Clip::Finish();
|
||||||
|
|
||||||
stopWebLoadManager();
|
|
||||||
App::deinitMedia();
|
App::deinitMedia();
|
||||||
|
|
||||||
Window::Theme::Uninitialize();
|
Window::Theme::Uninitialize();
|
||||||
|
@ -191,9 +183,9 @@ void Application::run() {
|
||||||
style::ShortAnimationPlaying(
|
style::ShortAnimationPlaying(
|
||||||
) | rpl::start_with_next([=](bool playing) {
|
) | rpl::start_with_next([=](bool playing) {
|
||||||
if (playing) {
|
if (playing) {
|
||||||
MTP::internal::pause();
|
MTP::details::pause();
|
||||||
} else {
|
} else {
|
||||||
MTP::internal::unpause();
|
MTP::details::unpause();
|
||||||
}
|
}
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
|
||||||
|
@ -370,12 +362,12 @@ void Application::saveSettingsDelayed(crl::time delay) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setCurrentProxy(
|
void Application::setCurrentProxy(
|
||||||
const ProxyData &proxy,
|
const MTP::ProxyData &proxy,
|
||||||
ProxyData::Settings settings) {
|
MTP::ProxyData::Settings settings) {
|
||||||
const auto current = [&] {
|
const auto current = [&] {
|
||||||
return (Global::ProxySettings() == ProxyData::Settings::Enabled)
|
return (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled)
|
||||||
? Global::SelectedProxy()
|
? Global::SelectedProxy()
|
||||||
: ProxyData();
|
: MTP::ProxyData();
|
||||||
};
|
};
|
||||||
const auto was = current();
|
const auto was = current();
|
||||||
Global::SetSelectedProxy(proxy);
|
Global::SetSelectedProxy(proxy);
|
||||||
|
@ -391,12 +383,12 @@ auto Application::proxyChanges() const -> rpl::producer<ProxyChange> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::badMtprotoConfigurationError() {
|
void Application::badMtprotoConfigurationError() {
|
||||||
if (Global::ProxySettings() == ProxyData::Settings::Enabled
|
if (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled
|
||||||
&& !_badProxyDisableBox) {
|
&& !_badProxyDisableBox) {
|
||||||
const auto disableCallback = [=] {
|
const auto disableCallback = [=] {
|
||||||
setCurrentProxy(
|
setCurrentProxy(
|
||||||
Global::SelectedProxy(),
|
Global::SelectedProxy(),
|
||||||
ProxyData::Settings::System);
|
MTP::ProxyData::Settings::System);
|
||||||
};
|
};
|
||||||
_badProxyDisableBox = Ui::show(Box<InformBox>(
|
_badProxyDisableBox = Ui::show(Box<InformBox>(
|
||||||
Lang::Hard::ProxyConfigError(),
|
Lang::Hard::ProxyConfigError(),
|
||||||
|
@ -406,14 +398,18 @@ void Application::badMtprotoConfigurationError() {
|
||||||
|
|
||||||
void Application::startLocalStorage() {
|
void Application::startLocalStorage() {
|
||||||
Local::start();
|
Local::start();
|
||||||
subscribe(_dcOptions->changed(), [this](const MTP::DcOptions::Ids &ids) {
|
|
||||||
Local::writeSettings();
|
const auto writing = _lifetime.make_state<bool>(false);
|
||||||
if (const auto instance = activeAccount().mtp()) {
|
_dcOptions->changed(
|
||||||
for (const auto id : ids) {
|
) | rpl::filter([=] {
|
||||||
instance->restart(id);
|
return !*writing;
|
||||||
}
|
}) | rpl::start_with_next([=] {
|
||||||
}
|
*writing = true;
|
||||||
});
|
Ui::PostponeCall(this, [=] {
|
||||||
|
Local::writeSettings();
|
||||||
|
});
|
||||||
|
}, _lifetime);
|
||||||
|
|
||||||
_saveSettingsTimer.setCallback([=] { Local::writeSettings(); });
|
_saveSettingsTimer.setCallback([=] { Local::writeSettings(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/core_settings.h"
|
#include "core/core_settings.h"
|
||||||
#include "mtproto/auth_key.h"
|
#include "mtproto/mtproto_auth_key.h"
|
||||||
|
#include "mtproto/mtproto_proxy_data.h"
|
||||||
#include "base/observer.h"
|
#include "base/observer.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
|
||||||
|
@ -131,12 +132,12 @@ public:
|
||||||
return _dcOptions.get();
|
return _dcOptions.get();
|
||||||
}
|
}
|
||||||
struct ProxyChange {
|
struct ProxyChange {
|
||||||
ProxyData was;
|
MTP::ProxyData was;
|
||||||
ProxyData now;
|
MTP::ProxyData now;
|
||||||
};
|
};
|
||||||
void setCurrentProxy(
|
void setCurrentProxy(
|
||||||
const ProxyData &proxy,
|
const MTP::ProxyData &proxy,
|
||||||
ProxyData::Settings settings);
|
MTP::ProxyData::Settings settings);
|
||||||
[[nodiscard]] rpl::producer<ProxyChange> proxyChanges() const;
|
[[nodiscard]] rpl::producer<ProxyChange> proxyChanges() const;
|
||||||
void badMtprotoConfigurationError();
|
void badMtprotoConfigurationError();
|
||||||
|
|
||||||
|
@ -265,7 +266,7 @@ private:
|
||||||
std::unique_ptr<Window::Controller> _window;
|
std::unique_ptr<Window::Controller> _window;
|
||||||
std::unique_ptr<Media::View::OverlayWidget> _mediaView;
|
std::unique_ptr<Media::View::OverlayWidget> _mediaView;
|
||||||
const std::unique_ptr<Lang::Instance> _langpack;
|
const std::unique_ptr<Lang::Instance> _langpack;
|
||||||
std::unique_ptr<Lang::CloudManager> _langCloudManager;
|
const std::unique_ptr<Lang::CloudManager> _langCloudManager;
|
||||||
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
|
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
|
||||||
std::unique_ptr<Lang::Translator> _translator;
|
std::unique_ptr<Lang::Translator> _translator;
|
||||||
base::Observable<void> _passcodedChanged;
|
base::Observable<void> _passcodedChanged;
|
||||||
|
|
|
@ -8,7 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/core_cloud_password.h"
|
#include "core/core_cloud_password.h"
|
||||||
|
|
||||||
#include "base/openssl_help.h"
|
#include "base/openssl_help.h"
|
||||||
#include "mtproto/connection.h"
|
#include "mtproto/mtproto_dh_utils.h"
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
|
@ -814,10 +814,10 @@ void LastCrashedWindow::onNetworkSettingsSaved(
|
||||||
QString password) {
|
QString password) {
|
||||||
Expects(host.isEmpty() || port != 0);
|
Expects(host.isEmpty() || port != 0);
|
||||||
|
|
||||||
auto proxy = ProxyData();
|
auto proxy = MTP::ProxyData();
|
||||||
proxy.type = host.isEmpty()
|
proxy.type = host.isEmpty()
|
||||||
? ProxyData::Type::None
|
? MTP::ProxyData::Type::None
|
||||||
: ProxyData::Type::Http;
|
: MTP::ProxyData::Type::Http;
|
||||||
proxy.host = host;
|
proxy.host = host;
|
||||||
proxy.port = port;
|
proxy.port = port;
|
||||||
proxy.user = username;
|
proxy.user = username;
|
||||||
|
@ -843,7 +843,7 @@ void LastCrashedWindow::proxyUpdated() {
|
||||||
activate();
|
activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<ProxyData> LastCrashedWindow::proxyChanges() const {
|
rpl::producer<MTP::ProxyData> LastCrashedWindow::proxyChanges() const {
|
||||||
return _proxyChanges.events();
|
return _proxyChanges.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include <QtNetwork/QHttpMultiPart>
|
#include <QtNetwork/QHttpMultiPart>
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
|
||||||
|
namespace MTP {
|
||||||
|
struct ProxyData;
|
||||||
|
} // namespace MTP
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class Launcher;
|
class Launcher;
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@ -96,7 +100,7 @@ public:
|
||||||
const QByteArray &crashdump,
|
const QByteArray &crashdump,
|
||||||
Fn<void()> launch);
|
Fn<void()> launch);
|
||||||
|
|
||||||
rpl::producer<ProxyData> proxyChanges() const;
|
rpl::producer<MTP::ProxyData> proxyChanges() const;
|
||||||
|
|
||||||
rpl::lifetime &lifetime() {
|
rpl::lifetime &lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
|
@ -199,7 +203,7 @@ private:
|
||||||
void setDownloadProgress(qint64 ready, qint64 total);
|
void setDownloadProgress(qint64 ready, qint64 total);
|
||||||
|
|
||||||
Fn<void()> _launch;
|
Fn<void()> _launch;
|
||||||
rpl::event_stream<ProxyData> _proxyChanges;
|
rpl::event_stream<MTP::ProxyData> _proxyChanges;
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -341,6 +341,7 @@ QString PlatformString() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StartCatching(not_null<Core::Launcher*> launcher) {
|
void StartCatching(not_null<Core::Launcher*> launcher) {
|
||||||
|
return; AssertIsDebug();
|
||||||
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
#ifndef DESKTOP_APP_DISABLE_CRASH_REPORTS
|
||||||
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
|
ProcessAnnotations["Binary"] = cExeName().toUtf8().constData();
|
||||||
ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData();
|
ProcessAnnotations["ApiId"] = QString::number(ApiId).toUtf8().constData();
|
||||||
|
|
|
@ -163,7 +163,9 @@ bool ApplySocksProxy(
|
||||||
auto params = url_parse_params(
|
auto params = url_parse_params(
|
||||||
match->captured(1),
|
match->captured(1),
|
||||||
qthelp::UrlParamNameTransform::ToLower);
|
qthelp::UrlParamNameTransform::ToLower);
|
||||||
ProxiesBoxController::ShowApplyConfirmation(ProxyData::Type::Socks5, params);
|
ProxiesBoxController::ShowApplyConfirmation(
|
||||||
|
MTP::ProxyData::Type::Socks5,
|
||||||
|
params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +176,9 @@ bool ApplyMtprotoProxy(
|
||||||
auto params = url_parse_params(
|
auto params = url_parse_params(
|
||||||
match->captured(1),
|
match->captured(1),
|
||||||
qthelp::UrlParamNameTransform::ToLower);
|
qthelp::UrlParamNameTransform::ToLower);
|
||||||
ProxiesBoxController::ShowApplyConfirmation(ProxyData::Type::Mtproto, params);
|
ProxiesBoxController::ShowApplyConfirmation(
|
||||||
|
MTP::ProxyData::Type::Mtproto,
|
||||||
|
params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ void Sandbox::singleInstanceChecked() {
|
||||||
_lastCrashDump,
|
_lastCrashDump,
|
||||||
[=] { launchApplication(); });
|
[=] { launchApplication(); });
|
||||||
window->proxyChanges(
|
window->proxyChanges(
|
||||||
) | rpl::start_with_next([=](ProxyData &&proxy) {
|
) | rpl::start_with_next([=](MTP::ProxyData &&proxy) {
|
||||||
_sandboxProxy = std::move(proxy);
|
_sandboxProxy = std::move(proxy);
|
||||||
refreshGlobalProxy();
|
refreshGlobalProxy();
|
||||||
}, window->lifetime());
|
}, window->lifetime());
|
||||||
|
@ -443,15 +443,15 @@ void Sandbox::refreshGlobalProxy() {
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
const auto proxy = !Global::started()
|
const auto proxy = !Global::started()
|
||||||
? _sandboxProxy
|
? _sandboxProxy
|
||||||
: (Global::ProxySettings() == ProxyData::Settings::Enabled)
|
: (Global::ProxySettings() == MTP::ProxyData::Settings::Enabled)
|
||||||
? Global::SelectedProxy()
|
? Global::SelectedProxy()
|
||||||
: ProxyData();
|
: MTP::ProxyData();
|
||||||
if (proxy.type == ProxyData::Type::Socks5
|
if (proxy.type == MTP::ProxyData::Type::Socks5
|
||||||
|| proxy.type == ProxyData::Type::Http) {
|
|| proxy.type == MTP::ProxyData::Type::Http) {
|
||||||
QNetworkProxy::setApplicationProxy(
|
QNetworkProxy::setApplicationProxy(
|
||||||
ToNetworkProxy(ToDirectIpProxy(proxy)));
|
MTP::ToNetworkProxy(MTP::ToDirectIpProxy(proxy)));
|
||||||
} else if (!Global::started()
|
} else if (!Global::started()
|
||||||
|| Global::ProxySettings() == ProxyData::Settings::System) {
|
|| Global::ProxySettings() == MTP::ProxyData::Settings::System) {
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
} else {
|
} else {
|
||||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||||
|
@ -555,7 +555,7 @@ rpl::producer<> Sandbox::widgetUpdateRequests() const {
|
||||||
return _widgetUpdateRequests.events();
|
return _widgetUpdateRequests.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProxyData Sandbox::sandboxProxy() const {
|
MTP::ProxyData Sandbox::sandboxProxy() const {
|
||||||
return _sandboxProxy;
|
return _sandboxProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "mtproto/mtproto_proxy_data.h"
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtNetwork/QLocalServer>
|
#include <QtNetwork/QLocalServer>
|
||||||
#include <QtNetwork/QLocalSocket>
|
#include <QtNetwork/QLocalSocket>
|
||||||
|
@ -50,7 +52,7 @@ public:
|
||||||
|
|
||||||
rpl::producer<> widgetUpdateRequests() const;
|
rpl::producer<> widgetUpdateRequests() const;
|
||||||
|
|
||||||
ProxyData sandboxProxy() const;
|
MTP::ProxyData sandboxProxy() const;
|
||||||
|
|
||||||
static Sandbox &Instance() {
|
static Sandbox &Instance() {
|
||||||
Expects(QCoreApplication::instance() != nullptr);
|
Expects(QCoreApplication::instance() != nullptr);
|
||||||
|
@ -119,7 +121,7 @@ private:
|
||||||
std::unique_ptr<UpdateChecker> _updateChecker;
|
std::unique_ptr<UpdateChecker> _updateChecker;
|
||||||
|
|
||||||
QByteArray _lastCrashDump;
|
QByteArray _lastCrashDump;
|
||||||
ProxyData _sandboxProxy;
|
MTP::ProxyData _sandboxProxy;
|
||||||
|
|
||||||
rpl::event_stream<> _widgetUpdateRequests;
|
rpl::event_stream<> _widgetUpdateRequests;
|
||||||
|
|
||||||
|
|
|
@ -58,134 +58,6 @@ static_assert(sizeof(MTPdouble) == 8, "Basic types size check failed");
|
||||||
|
|
||||||
static_assert(sizeof(int) >= 4, "Basic types size check failed");
|
static_assert(sizeof(int) >= 4, "Basic types size check failed");
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
std::atomic<int> GlobalAtomicRequestId = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] bool IsHexMtprotoPassword(const QString &password) {
|
|
||||||
const auto size = password.size();
|
|
||||||
if (size < 32 || size % 2 == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const auto bad = [](QChar ch) {
|
|
||||||
const auto code = ch.unicode();
|
|
||||||
return (code < 'a' || code > 'f')
|
|
||||||
&& (code < 'A' || code > 'F')
|
|
||||||
&& (code < '0' || code > '9');
|
|
||||||
};
|
|
||||||
const auto i = std::find_if(password.begin(), password.end(), bad);
|
|
||||||
return (i == password.end());
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] ProxyData::Status HexMtprotoPasswordStatus(
|
|
||||||
const QString &password) {
|
|
||||||
const auto size = password.size() / 2;
|
|
||||||
const auto valid = (size == 16)
|
|
||||||
|| (size == 17 && (password[0] == 'd') && (password[1] == 'd'))
|
|
||||||
|| (size >= 21 && (password[0] == 'e') && (password[1] == 'e'));
|
|
||||||
if (valid) {
|
|
||||||
return ProxyData::Status::Valid;
|
|
||||||
} else if (size < 16) {
|
|
||||||
return ProxyData::Status::Invalid;
|
|
||||||
}
|
|
||||||
return ProxyData::Status::Unsupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] bytes::vector SecretFromHexMtprotoPassword(
|
|
||||||
const QString &password) {
|
|
||||||
Expects(password.size() % 2 == 0);
|
|
||||||
|
|
||||||
const auto size = password.size() / 2;
|
|
||||||
const auto fromHex = [](QChar ch) -> int {
|
|
||||||
const auto code = int(ch.unicode());
|
|
||||||
if (code >= '0' && code <= '9') {
|
|
||||||
return (code - '0');
|
|
||||||
} else if (code >= 'A' && code <= 'F') {
|
|
||||||
return 10 + (code - 'A');
|
|
||||||
} else if (ch >= 'a' && ch <= 'f') {
|
|
||||||
return 10 + (code - 'a');
|
|
||||||
}
|
|
||||||
Unexpected("Code in ProxyData fromHex.");
|
|
||||||
};
|
|
||||||
auto result = bytes::vector(size);
|
|
||||||
for (auto i = 0; i != size; ++i) {
|
|
||||||
const auto high = fromHex(password[2 * i]);
|
|
||||||
const auto low = fromHex(password[2 * i + 1]);
|
|
||||||
if (high < 0 || low < 0) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
result[i] = static_cast<bytes::type>(high * 16 + low);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] QStringRef Base64UrlInner(const QString &password) {
|
|
||||||
Expects(password.size() > 2);
|
|
||||||
|
|
||||||
// Skip one or two '=' at the end of the string.
|
|
||||||
return password.midRef(0, [&] {
|
|
||||||
auto result = password.size();
|
|
||||||
for (auto i = 0; i != 2; ++i) {
|
|
||||||
const auto prev = result - 1;
|
|
||||||
if (password[prev] != '=') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
result = prev;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}());
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] bool IsBase64UrlMtprotoPassword(const QString &password) {
|
|
||||||
const auto size = password.size();
|
|
||||||
if (size < 22 || size % 4 == 1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const auto bad = [](QChar ch) {
|
|
||||||
const auto code = ch.unicode();
|
|
||||||
return (code < 'a' || code > 'z')
|
|
||||||
&& (code < 'A' || code > 'Z')
|
|
||||||
&& (code < '0' || code > '9')
|
|
||||||
&& (code != '_')
|
|
||||||
&& (code != '-');
|
|
||||||
};
|
|
||||||
const auto inner = Base64UrlInner(password);
|
|
||||||
const auto begin = inner.data();
|
|
||||||
const auto end = begin + inner.size();
|
|
||||||
return (std::find_if(begin, end, bad) == end);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] ProxyData::Status Base64UrlMtprotoPasswordStatus(
|
|
||||||
const QString &password) {
|
|
||||||
const auto inner = Base64UrlInner(password);
|
|
||||||
const auto size = (inner.size() * 3) / 4;
|
|
||||||
const auto valid = (size == 16)
|
|
||||||
|| (size == 17
|
|
||||||
&& (password[0] == '3')
|
|
||||||
&& ((password[1] >= 'Q' && password[1] <= 'Z')
|
|
||||||
|| (password[1] >= 'a' && password[1] <= 'f')))
|
|
||||||
|| (size >= 21
|
|
||||||
&& (password[0] == '7')
|
|
||||||
&& (password[1] >= 'g')
|
|
||||||
&& (password[1] <= 'v'));
|
|
||||||
if (size < 16) {
|
|
||||||
return ProxyData::Status::Invalid;
|
|
||||||
} else if (valid) {
|
|
||||||
return ProxyData::Status::Valid;
|
|
||||||
}
|
|
||||||
return ProxyData::Status::Unsupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] bytes::vector SecretFromBase64UrlMtprotoPassword(
|
|
||||||
const QString &password) {
|
|
||||||
const auto result = QByteArray::fromBase64(
|
|
||||||
password.toLatin1(),
|
|
||||||
QByteArray::Base64UrlEncoding);
|
|
||||||
return bytes::make_vector(bytes::make_span(result));
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// Precise timing functions / rand init
|
// Precise timing functions / rand init
|
||||||
|
|
||||||
struct CRYPTO_dynlock_value {
|
struct CRYPTO_dynlock_value {
|
||||||
|
@ -248,105 +120,6 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProxyData::valid() const {
|
|
||||||
return status() == Status::Valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProxyData::Status ProxyData::status() const {
|
|
||||||
if (type == Type::None || host.isEmpty() || !port) {
|
|
||||||
return Status::Invalid;
|
|
||||||
} else if (type == Type::Mtproto) {
|
|
||||||
return MtprotoPasswordStatus(password);
|
|
||||||
}
|
|
||||||
return Status::Valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyData::supportsCalls() const {
|
|
||||||
return (type == Type::Socks5);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyData::tryCustomResolve() const {
|
|
||||||
return (type == Type::Socks5 || type == Type::Mtproto)
|
|
||||||
&& !qthelp::is_ipv6(host)
|
|
||||||
&& !QRegularExpression(
|
|
||||||
qsl("^\\d+\\.\\d+\\.\\d+\\.\\d+$")
|
|
||||||
).match(host).hasMatch();
|
|
||||||
}
|
|
||||||
|
|
||||||
bytes::vector ProxyData::secretFromMtprotoPassword() const {
|
|
||||||
Expects(type == Type::Mtproto);
|
|
||||||
|
|
||||||
if (IsHexMtprotoPassword(password)) {
|
|
||||||
return SecretFromHexMtprotoPassword(password);
|
|
||||||
} else if (IsBase64UrlMtprotoPassword(password)) {
|
|
||||||
return SecretFromBase64UrlMtprotoPassword(password);
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
ProxyData::operator bool() const {
|
|
||||||
return valid();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyData::operator==(const ProxyData &other) const {
|
|
||||||
if (!valid()) {
|
|
||||||
return !other.valid();
|
|
||||||
}
|
|
||||||
return (type == other.type)
|
|
||||||
&& (host == other.host)
|
|
||||||
&& (port == other.port)
|
|
||||||
&& (user == other.user)
|
|
||||||
&& (password == other.password);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyData::operator!=(const ProxyData &other) const {
|
|
||||||
return !(*this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ProxyData::ValidMtprotoPassword(const QString &password) {
|
|
||||||
return MtprotoPasswordStatus(password) == Status::Valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProxyData::Status ProxyData::MtprotoPasswordStatus(const QString &password) {
|
|
||||||
if (IsHexMtprotoPassword(password)) {
|
|
||||||
return HexMtprotoPasswordStatus(password);
|
|
||||||
} else if (IsBase64UrlMtprotoPassword(password)) {
|
|
||||||
return Base64UrlMtprotoPasswordStatus(password);
|
|
||||||
}
|
|
||||||
return Status::Invalid;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProxyData ToDirectIpProxy(const ProxyData &proxy, int ipIndex) {
|
|
||||||
if (!proxy.tryCustomResolve()
|
|
||||||
|| ipIndex < 0
|
|
||||||
|| ipIndex >= proxy.resolvedIPs.size()) {
|
|
||||||
return proxy;
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
proxy.type,
|
|
||||||
proxy.resolvedIPs[ipIndex],
|
|
||||||
proxy.port,
|
|
||||||
proxy.user,
|
|
||||||
proxy.password
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkProxy ToNetworkProxy(const ProxyData &proxy) {
|
|
||||||
if (proxy.type == ProxyData::Type::None) {
|
|
||||||
return QNetworkProxy::DefaultProxy;
|
|
||||||
} else if (proxy.type == ProxyData::Type::Mtproto) {
|
|
||||||
return QNetworkProxy::NoProxy;
|
|
||||||
}
|
|
||||||
return QNetworkProxy(
|
|
||||||
(proxy.type == ProxyData::Type::Socks5
|
|
||||||
? QNetworkProxy::Socks5Proxy
|
|
||||||
: QNetworkProxy::HttpProxy),
|
|
||||||
proxy.host,
|
|
||||||
proxy.port,
|
|
||||||
proxy.user,
|
|
||||||
proxy.password);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ThirdParty {
|
namespace ThirdParty {
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
@ -427,14 +200,6 @@ namespace ThirdParty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetNextRequestId() {
|
|
||||||
const auto result = ++GlobalAtomicRequestId;
|
|
||||||
if (result == std::numeric_limits<int>::max() / 2) {
|
|
||||||
GlobalAtomicRequestId = 0;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 *hashSha1(const void *data, uint32 len, void *dest) {
|
int32 *hashSha1(const void *data, uint32 len, void *dest) {
|
||||||
return (int32*)SHA1((const uchar*)data, (size_t)len, (uchar*)dest);
|
return (int32*)SHA1((const uchar*)data, (size_t)len, (uchar*)dest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,12 +25,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
using set_of_unique_ptr = std::set<std::unique_ptr<T>, base::pointer_comparator<T>>;
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
using set_of_shared_ptr = std::set<std::shared_ptr<T>, base::pointer_comparator<T>>;
|
|
||||||
|
|
||||||
template <typename Value, typename From, typename Till>
|
template <typename Value, typename From, typename Till>
|
||||||
inline bool in_range(Value &&value, From &&from, Till &&till) {
|
inline bool in_range(Value &&value, From &&from, Till &&till) {
|
||||||
return (value >= from) && (value < till);
|
return (value >= from) && (value < till);
|
||||||
|
@ -88,8 +82,6 @@ inline QByteArray str_const_toByteArray(const str_const &str) {
|
||||||
return QByteArray::fromRawData(str.c_str(), str.size());
|
return QByteArray::fromRawData(str.c_str(), str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetNextRequestId();
|
|
||||||
|
|
||||||
inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
|
inline void mylocaltime(struct tm * _Tm, const time_t * _Time) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
localtime_s(_Tm, _Time);
|
localtime_s(_Tm, _Time);
|
||||||
|
@ -167,37 +159,6 @@ T rand_value() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReadLockerAttempt {
|
|
||||||
public:
|
|
||||||
ReadLockerAttempt(not_null<QReadWriteLock*> lock) : _lock(lock), _locked(_lock->tryLockForRead()) {
|
|
||||||
}
|
|
||||||
ReadLockerAttempt(const ReadLockerAttempt &other) = delete;
|
|
||||||
ReadLockerAttempt &operator=(const ReadLockerAttempt &other) = delete;
|
|
||||||
ReadLockerAttempt(ReadLockerAttempt &&other) : _lock(other._lock), _locked(base::take(other._locked)) {
|
|
||||||
}
|
|
||||||
ReadLockerAttempt &operator=(ReadLockerAttempt &&other) {
|
|
||||||
_lock = other._lock;
|
|
||||||
_locked = base::take(other._locked);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
~ReadLockerAttempt() {
|
|
||||||
if (_locked) {
|
|
||||||
_lock->unlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
operator bool() const {
|
|
||||||
return _locked;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
not_null<QReadWriteLock*> _lock;
|
|
||||||
bool _locked = false;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
static const QRegularExpression::PatternOptions reMultiline(QRegularExpression::DotMatchesEverythingOption | QRegularExpression::MultilineOption);
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T snap(const T &v, const T &_min, const T &_max) {
|
inline T snap(const T &v, const T &_min, const T &_max) {
|
||||||
return (v < _min) ? _min : ((v > _max) ? _max : v);
|
return (v < _min) ? _min : ((v > _max) ? _max : v);
|
||||||
|
@ -218,50 +179,6 @@ enum DBIWorkMode {
|
||||||
dbiwmWindowOnly = 2,
|
dbiwmWindowOnly = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProxyData {
|
|
||||||
enum class Settings {
|
|
||||||
System,
|
|
||||||
Enabled,
|
|
||||||
Disabled,
|
|
||||||
};
|
|
||||||
enum class Type {
|
|
||||||
None,
|
|
||||||
Socks5,
|
|
||||||
Http,
|
|
||||||
Mtproto,
|
|
||||||
};
|
|
||||||
enum class Status {
|
|
||||||
Valid,
|
|
||||||
Unsupported,
|
|
||||||
Invalid,
|
|
||||||
};
|
|
||||||
|
|
||||||
Type type = Type::None;
|
|
||||||
QString host;
|
|
||||||
uint32 port = 0;
|
|
||||||
QString user, password;
|
|
||||||
|
|
||||||
std::vector<QString> resolvedIPs;
|
|
||||||
crl::time resolvedExpireAt = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] bool valid() const;
|
|
||||||
[[nodiscard]] Status status() const;
|
|
||||||
[[nodiscard]] bool supportsCalls() const;
|
|
||||||
[[nodiscard]] bool tryCustomResolve() const;
|
|
||||||
[[nodiscard]] bytes::vector secretFromMtprotoPassword() const;
|
|
||||||
[[nodiscard]] explicit operator bool() const;
|
|
||||||
[[nodiscard]] bool operator==(const ProxyData &other) const;
|
|
||||||
[[nodiscard]] bool operator!=(const ProxyData &other) const;
|
|
||||||
|
|
||||||
[[nodiscard]] static bool ValidMtprotoPassword(const QString &password);
|
|
||||||
[[nodiscard]] static Status MtprotoPasswordStatus(
|
|
||||||
const QString &password);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
ProxyData ToDirectIpProxy(const ProxyData &proxy, int ipIndex = 0);
|
|
||||||
QNetworkProxy ToNetworkProxy(const ProxyData &proxy);
|
|
||||||
|
|
||||||
static const int MatrixRowShift = 40000;
|
static const int MatrixRowShift = 40000;
|
||||||
|
|
||||||
inline int rowscount(int fullCount, int countPerRow) {
|
inline int rowscount(int fullCount, int countPerRow) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define TDESKTOP_REQUESTED_ALPHA_VERSION (0ULL)
|
#define TDESKTOP_REQUESTED_ALPHA_VERSION (1009001007ULL)
|
||||||
|
|
||||||
#ifdef TDESKTOP_OFFICIAL_TARGET
|
#ifdef TDESKTOP_OFFICIAL_TARGET
|
||||||
#define TDESKTOP_ALPHA_VERSION TDESKTOP_REQUESTED_ALPHA_VERSION
|
#define TDESKTOP_ALPHA_VERSION TDESKTOP_REQUESTED_ALPHA_VERSION
|
||||||
|
@ -17,5 +17,5 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
constexpr auto AppVersion = 1009001;
|
constexpr auto AppVersion = 1009001;
|
||||||
constexpr auto AppVersionStr = "1.9.1";
|
constexpr auto AppVersionStr = "1.9.1";
|
||||||
constexpr auto AppBetaVersion = true;
|
constexpr auto AppBetaVersion = false;
|
||||||
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
|
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
|
||||||
|
|
|
@ -21,6 +21,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "media/streaming/media_streaming_loader_local.h"
|
#include "media/streaming/media_streaming_loader_local.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
#include "storage/streamed_file_downloader.h"
|
#include "storage/streamed_file_downloader.h"
|
||||||
|
#include "storage/file_download_mtproto.h"
|
||||||
|
#include "storage/file_download_web.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -815,7 +817,6 @@ void DocumentData::destroyLoader() const {
|
||||||
if (cancelled()) {
|
if (cancelled()) {
|
||||||
loader->cancel();
|
loader->cancel();
|
||||||
}
|
}
|
||||||
loader->stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DocumentData::loading() const {
|
bool DocumentData::loading() const {
|
||||||
|
|
|
@ -33,6 +33,12 @@ struct FileReferenceAccumulator {
|
||||||
}, [](const MTPDdocumentEmpty &data) {
|
}, [](const MTPDdocumentEmpty &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
void push(const MTPPage &data) {
|
||||||
|
data.match([&](const auto &data) {
|
||||||
|
push(data.vphotos());
|
||||||
|
push(data.vdocuments());
|
||||||
|
});
|
||||||
|
}
|
||||||
void push(const MTPWallPaper &data) {
|
void push(const MTPWallPaper &data) {
|
||||||
data.match([&](const MTPDwallPaper &data) {
|
data.match([&](const MTPDwallPaper &data) {
|
||||||
push(data.vdocument());
|
push(data.vdocument());
|
||||||
|
@ -57,6 +63,9 @@ struct FileReferenceAccumulator {
|
||||||
if (const auto photo = data.vphoto()) {
|
if (const auto photo = data.vphoto()) {
|
||||||
push(*photo);
|
push(*photo);
|
||||||
}
|
}
|
||||||
|
if (const auto page = data.vcached_page()) {
|
||||||
|
push(*page);
|
||||||
|
}
|
||||||
}, [](const auto &data) {
|
}, [](const auto &data) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_web_page.h"
|
#include "data/data_web_page.h"
|
||||||
#include "data/data_poll.h"
|
#include "data/data_poll.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
#include "data/data_file_origin.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "storage/file_upload.h"
|
#include "storage/file_upload.h"
|
||||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
#include "apiwrap.h"
|
||||||
|
|
||||||
namespace Api {
|
namespace Api {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -191,6 +192,10 @@ SearchController::CacheEntry::CacheEntry(const Query &query)
|
||||||
: std::nullopt) {
|
: std::nullopt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SearchController::SearchController(not_null<Main::Session*> session)
|
||||||
|
: _api(session->api().instance()) {
|
||||||
|
}
|
||||||
|
|
||||||
bool SearchController::hasInCache(const Query &query) const {
|
bool SearchController::hasInCache(const Query &query) const {
|
||||||
return query.query.isEmpty() || _cache.contains(query);
|
return query.query.isEmpty() || _cache.contains(query);
|
||||||
}
|
}
|
||||||
|
@ -361,7 +366,7 @@ void SearchController::requestMore(
|
||||||
if (!prepared) {
|
if (!prepared) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto requestId = request(
|
auto requestId = _api.request(
|
||||||
std::move(*prepared)
|
std::move(*prepared)
|
||||||
).done([=](const MTPmessages_Messages &result) {
|
).done([=](const MTPmessages_Messages &result) {
|
||||||
listData->requests.remove(key);
|
listData->requests.remove(key);
|
||||||
|
@ -377,11 +382,13 @@ void SearchController::requestMore(
|
||||||
parsed.fullCount);
|
parsed.fullCount);
|
||||||
}).send();
|
}).send();
|
||||||
listData->requests.emplace(key, [=] {
|
listData->requests.emplace(key, [=] {
|
||||||
request(requestId).cancel();
|
_api.request(requestId).cancel();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayedSearchController::DelayedSearchController() {
|
DelayedSearchController::DelayedSearchController(
|
||||||
|
not_null<Main::Session*> session)
|
||||||
|
: _controller(session) {
|
||||||
_timer.setCallback([this] { setQueryFast(_nextQuery); });
|
_timer.setCallback([this] { setQueryFast(_nextQuery); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/value_ordering.h"
|
#include "base/value_ordering.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
|
|
||||||
|
namespace Main {
|
||||||
|
class Session;
|
||||||
|
} // namespace Main
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
enum class LoadDirection : char;
|
enum class LoadDirection : char;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
@ -40,7 +44,7 @@ SearchResult ParseSearchResult(
|
||||||
Data::LoadDirection direction,
|
Data::LoadDirection direction,
|
||||||
const MTPmessages_Messages &data);
|
const MTPmessages_Messages &data);
|
||||||
|
|
||||||
class SearchController : private MTP::Sender {
|
class SearchController final {
|
||||||
public:
|
public:
|
||||||
using IdsList = Storage::SparseIdsList;
|
using IdsList = Storage::SparseIdsList;
|
||||||
struct Query {
|
struct Query {
|
||||||
|
@ -67,6 +71,7 @@ public:
|
||||||
std::optional<IdsList> migratedList;
|
std::optional<IdsList> migratedList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
explicit SearchController(not_null<Main::Session*> session);
|
||||||
void setQuery(const Query &query);
|
void setQuery(const Query &query);
|
||||||
bool hasInCache(const Query &query) const;
|
bool hasInCache(const Query &query) const;
|
||||||
|
|
||||||
|
@ -124,6 +129,7 @@ private:
|
||||||
const Query &query,
|
const Query &query,
|
||||||
Data *listData);
|
Data *listData);
|
||||||
|
|
||||||
|
MTP::Sender _api;
|
||||||
Cache _cache;
|
Cache _cache;
|
||||||
Cache::iterator _current = _cache.end();
|
Cache::iterator _current = _cache.end();
|
||||||
|
|
||||||
|
@ -131,7 +137,7 @@ private:
|
||||||
|
|
||||||
class DelayedSearchController {
|
class DelayedSearchController {
|
||||||
public:
|
public:
|
||||||
DelayedSearchController();
|
explicit DelayedSearchController(not_null<Main::Session*> session);
|
||||||
|
|
||||||
using Query = SearchController::Query;
|
using Query = SearchController::Query;
|
||||||
using SavedState = SearchController::SavedState;
|
using SavedState = SearchController::SavedState;
|
||||||
|
|
|
@ -2464,7 +2464,6 @@ void InnerWidget::loadPeerPhotos() {
|
||||||
|
|
||||||
auto yFrom = _visibleTop;
|
auto yFrom = _visibleTop;
|
||||||
auto yTo = _visibleTop + (_visibleBottom - _visibleTop) * (PreloadHeightsCount + 1);
|
auto yTo = _visibleTop + (_visibleBottom - _visibleTop) * (PreloadHeightsCount + 1);
|
||||||
session().downloader().clearPriorities();
|
|
||||||
if (_state == WidgetState::Default) {
|
if (_state == WidgetState::Default) {
|
||||||
auto otherStart = shownDialogs()->size() * st::dialogsRowHeight;
|
auto otherStart = shownDialogs()->size() * st::dialogsRowHeight;
|
||||||
if (yFrom < otherStart) {
|
if (yFrom < otherStart) {
|
||||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "base/flags.h"
|
#include "base/flags.h"
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
#include "api/api_single_message_search.h"
|
#include "api/api_single_message_search.h"
|
||||||
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
|
|
|
@ -209,6 +209,32 @@ Utf8String FillLeft(const Utf8String &data, int length, char filler) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RefreshFileReference(FileLocation &to, const FileLocation &from) {
|
||||||
|
if (to.dcId != from.dcId || to.data.type() != from.data.type()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (to.data.type() == mtpc_inputPhotoFileLocation) {
|
||||||
|
const auto &toData = to.data.c_inputPhotoFileLocation();
|
||||||
|
const auto &fromData = from.data.c_inputPhotoFileLocation();
|
||||||
|
if (toData.vid().v != fromData.vid().v
|
||||||
|
|| toData.vthumb_size().v != fromData.vthumb_size().v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
to = from;
|
||||||
|
return true;
|
||||||
|
} else if (to.data.type() == mtpc_inputDocumentFileLocation) {
|
||||||
|
const auto &toData = to.data.c_inputDocumentFileLocation();
|
||||||
|
const auto &fromData = from.data.c_inputDocumentFileLocation();
|
||||||
|
if (toData.vid().v != fromData.vid().v
|
||||||
|
|| toData.vthumb_size().v != fromData.vthumb_size().v) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
to = from;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Image ParseMaxImage(
|
Image ParseMaxImage(
|
||||||
const MTPDphoto &photo,
|
const MTPDphoto &photo,
|
||||||
const QString &suggestedPath) {
|
const QString &suggestedPath) {
|
||||||
|
|
|
@ -60,6 +60,8 @@ struct FileLocation {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool RefreshFileReference(FileLocation &to, const FileLocation &from);
|
||||||
|
|
||||||
struct File {
|
struct File {
|
||||||
enum class SkipReason {
|
enum class SkipReason {
|
||||||
None,
|
None,
|
||||||
|
@ -526,6 +528,12 @@ struct Message {
|
||||||
const Image &thumb() const;
|
const Image &thumb() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct FileOrigin {
|
||||||
|
int split = 0;
|
||||||
|
MTPInputPeer peer;
|
||||||
|
int32 messageId = 0;
|
||||||
|
};
|
||||||
|
|
||||||
Message ParseMessage(
|
Message ParseMessage(
|
||||||
ParseMediaContext &context,
|
ParseMediaContext &context,
|
||||||
const MTPMessage &data,
|
const MTPMessage &data,
|
||||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "export/data/export_data_types.h"
|
#include "export/data/export_data_types.h"
|
||||||
#include "export/output/export_output_result.h"
|
#include "export/output/export_output_result.h"
|
||||||
#include "export/output/export_output_file.h"
|
#include "export/output/export_output_file.h"
|
||||||
#include "mtproto/rpc_sender.h"
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
#include "base/value_ordering.h"
|
#include "base/value_ordering.h"
|
||||||
#include "base/bytes.h"
|
#include "base/bytes.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
@ -84,6 +84,10 @@ LocationKey ComputeLocationKey(const Data::FileLocation &value) {
|
||||||
result.type |= (8ULL << 24);
|
result.type |= (8ULL << 24);
|
||||||
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||||
result.id = data.vvolume_id().v;
|
result.id = data.vvolume_id().v;
|
||||||
|
}, [&](const MTPDinputPhotoLegacyFileLocation &data) {
|
||||||
|
result.type |= (9ULL << 24);
|
||||||
|
result.type |= (uint64(uint32(data.vlocal_id().v)) << 32);
|
||||||
|
result.id = data.vvolume_id().v;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -177,6 +181,7 @@ struct ApiWrap::FileProcess {
|
||||||
FnMut<void(const QString &relativePath)> done;
|
FnMut<void(const QString &relativePath)> done;
|
||||||
|
|
||||||
Data::FileLocation location;
|
Data::FileLocation location;
|
||||||
|
Data::FileOrigin origin;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
|
||||||
|
@ -396,6 +401,9 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int offset) {
|
||||||
} else if (result.type() == qstr("LOCATION_INVALID")
|
} else if (result.type() == qstr("LOCATION_INVALID")
|
||||||
|| result.type() == qstr("VERSION_INVALID")) {
|
|| result.type() == qstr("VERSION_INVALID")) {
|
||||||
filePartUnavailable();
|
filePartUnavailable();
|
||||||
|
} else if (result.code() == 400
|
||||||
|
&& result.type().startsWith(qstr("FILE_REFERENCE_"))) {
|
||||||
|
filePartRefreshReference(offset);
|
||||||
} else {
|
} else {
|
||||||
error(std::move(result));
|
error(std::move(result));
|
||||||
}
|
}
|
||||||
|
@ -692,6 +700,7 @@ void ApiWrap::requestOtherData(
|
||||||
_otherDataProcess->file.suggestedPath = suggestedPath;
|
_otherDataProcess->file.suggestedPath = suggestedPath;
|
||||||
loadFile(
|
loadFile(
|
||||||
_otherDataProcess->file,
|
_otherDataProcess->file,
|
||||||
|
Data::FileOrigin(),
|
||||||
[](FileProgress progress) { return true; },
|
[](FileProgress progress) { return true; },
|
||||||
[=](const QString &result) { otherDataDone(result); });
|
[=](const QString &result) { otherDataDone(result); });
|
||||||
}
|
}
|
||||||
|
@ -776,6 +785,7 @@ void ApiWrap::loadNextUserpic() {
|
||||||
; ++_userpicsProcess->fileIndex) {
|
; ++_userpicsProcess->fileIndex) {
|
||||||
const auto ready = processFileLoad(
|
const auto ready = processFileLoad(
|
||||||
list[_userpicsProcess->fileIndex].image.file,
|
list[_userpicsProcess->fileIndex].image.file,
|
||||||
|
Data::FileOrigin(),
|
||||||
[=](FileProgress value) { return loadUserpicProgress(value); },
|
[=](FileProgress value) { return loadUserpicProgress(value); },
|
||||||
[=](const QString &path) { loadUserpicDone(path); });
|
[=](const QString &path) { loadUserpicDone(path); });
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
|
@ -1378,6 +1388,24 @@ void ApiWrap::loadMessagesFiles(Data::MessagesSlice &&slice) {
|
||||||
loadNextMessageFile();
|
loadNextMessageFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Data::Message *ApiWrap::currentFileMessage() const {
|
||||||
|
Expects(_chatProcess != nullptr);
|
||||||
|
Expects(_chatProcess->slice.has_value());
|
||||||
|
|
||||||
|
return &_chatProcess->slice->list[_chatProcess->fileIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
Data::FileOrigin ApiWrap::currentFileMessageOrigin() const {
|
||||||
|
Expects(_chatProcess != nullptr);
|
||||||
|
Expects(_chatProcess->slice.has_value());
|
||||||
|
|
||||||
|
auto result = Data::FileOrigin();
|
||||||
|
result.messageId = currentFileMessage()->id;
|
||||||
|
result.peer = _chatProcess->info.input;
|
||||||
|
result.split = _chatProcess->info.splits[_chatProcess->localSplitIndex];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void ApiWrap::loadNextMessageFile() {
|
void ApiWrap::loadNextMessageFile() {
|
||||||
Expects(_chatProcess != nullptr);
|
Expects(_chatProcess != nullptr);
|
||||||
Expects(_chatProcess->slice.has_value());
|
Expects(_chatProcess->slice.has_value());
|
||||||
|
@ -1394,9 +1422,10 @@ void ApiWrap::loadNextMessageFile() {
|
||||||
};
|
};
|
||||||
const auto ready = processFileLoad(
|
const auto ready = processFileLoad(
|
||||||
list[_chatProcess->fileIndex].file(),
|
list[_chatProcess->fileIndex].file(),
|
||||||
|
currentFileMessageOrigin(),
|
||||||
fileProgress,
|
fileProgress,
|
||||||
[=](const QString &path) { loadMessageFileDone(path); },
|
[=](const QString &path) { loadMessageFileDone(path); },
|
||||||
&list[_chatProcess->fileIndex]);
|
currentFileMessage());
|
||||||
if (!ready) {
|
if (!ready) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1405,9 +1434,10 @@ void ApiWrap::loadNextMessageFile() {
|
||||||
};
|
};
|
||||||
const auto thumbReady = processFileLoad(
|
const auto thumbReady = processFileLoad(
|
||||||
list[_chatProcess->fileIndex].thumb().file,
|
list[_chatProcess->fileIndex].thumb().file,
|
||||||
|
currentFileMessageOrigin(),
|
||||||
thumbProgress,
|
thumbProgress,
|
||||||
[=](const QString &path) { loadMessageThumbDone(path); },
|
[=](const QString &path) { loadMessageThumbDone(path); },
|
||||||
&list[_chatProcess->fileIndex]);
|
currentFileMessage());
|
||||||
if (!thumbReady) {
|
if (!thumbReady) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1497,6 +1527,7 @@ void ApiWrap::finishMessages() {
|
||||||
|
|
||||||
bool ApiWrap::processFileLoad(
|
bool ApiWrap::processFileLoad(
|
||||||
Data::File &file,
|
Data::File &file,
|
||||||
|
const Data::FileOrigin &origin,
|
||||||
Fn<bool(FileProgress)> progress,
|
Fn<bool(FileProgress)> progress,
|
||||||
FnMut<void(QString)> done,
|
FnMut<void(QString)> done,
|
||||||
Data::Message *message) {
|
Data::Message *message) {
|
||||||
|
@ -1508,7 +1539,7 @@ bool ApiWrap::processFileLoad(
|
||||||
} else if (!file.location && file.content.isEmpty()) {
|
} else if (!file.location && file.content.isEmpty()) {
|
||||||
file.skipReason = SkipReason::Unavailable;
|
file.skipReason = SkipReason::Unavailable;
|
||||||
return true;
|
return true;
|
||||||
} else if (writePreloadedFile(file)) {
|
} else if (writePreloadedFile(file, origin)) {
|
||||||
return !file.relativePath.isEmpty();
|
return !file.relativePath.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1544,11 +1575,13 @@ bool ApiWrap::processFileLoad(
|
||||||
file.skipReason = SkipReason::FileSize;
|
file.skipReason = SkipReason::FileSize;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
loadFile(file, std::move(progress), std::move(done));
|
loadFile(file, origin, std::move(progress), std::move(done));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApiWrap::writePreloadedFile(Data::File &file) {
|
bool ApiWrap::writePreloadedFile(
|
||||||
|
Data::File &file,
|
||||||
|
const Data::FileOrigin &origin) {
|
||||||
Expects(_settings != nullptr);
|
Expects(_settings != nullptr);
|
||||||
|
|
||||||
using namespace Output;
|
using namespace Output;
|
||||||
|
@ -1557,7 +1590,7 @@ bool ApiWrap::writePreloadedFile(Data::File &file) {
|
||||||
file.relativePath = *path;
|
file.relativePath = *path;
|
||||||
return true;
|
return true;
|
||||||
} else if (!file.content.isEmpty()) {
|
} else if (!file.content.isEmpty()) {
|
||||||
const auto process = prepareFileProcess(file);
|
const auto process = prepareFileProcess(file, origin);
|
||||||
if (const auto result = process->file.writeBlock(file.content)) {
|
if (const auto result = process->file.writeBlock(file.content)) {
|
||||||
file.relativePath = process->relativePath;
|
file.relativePath = process->relativePath;
|
||||||
_fileCache->save(file.location, file.relativePath);
|
_fileCache->save(file.location, file.relativePath);
|
||||||
|
@ -1571,13 +1604,14 @@ bool ApiWrap::writePreloadedFile(Data::File &file) {
|
||||||
|
|
||||||
void ApiWrap::loadFile(
|
void ApiWrap::loadFile(
|
||||||
const Data::File &file,
|
const Data::File &file,
|
||||||
|
const Data::FileOrigin &origin,
|
||||||
Fn<bool(FileProgress)> progress,
|
Fn<bool(FileProgress)> progress,
|
||||||
FnMut<void(QString)> done) {
|
FnMut<void(QString)> done) {
|
||||||
Expects(_fileProcess == nullptr);
|
Expects(_fileProcess == nullptr);
|
||||||
Expects(file.location.dcId != 0
|
Expects(file.location.dcId != 0
|
||||||
|| file.location.data.type() == mtpc_inputTakeoutFileLocation);
|
|| file.location.data.type() == mtpc_inputTakeoutFileLocation);
|
||||||
|
|
||||||
_fileProcess = prepareFileProcess(file);
|
_fileProcess = prepareFileProcess(file, origin);
|
||||||
_fileProcess->progress = std::move(progress);
|
_fileProcess->progress = std::move(progress);
|
||||||
_fileProcess->done = std::move(done);
|
_fileProcess->done = std::move(done);
|
||||||
|
|
||||||
|
@ -1594,7 +1628,9 @@ void ApiWrap::loadFile(
|
||||||
loadFilePart();
|
loadFilePart();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ApiWrap::prepareFileProcess(const Data::File &file) const
|
auto ApiWrap::prepareFileProcess(
|
||||||
|
const Data::File &file,
|
||||||
|
const Data::FileOrigin &origin) const
|
||||||
-> std::unique_ptr<FileProcess> {
|
-> std::unique_ptr<FileProcess> {
|
||||||
Expects(_settings != nullptr);
|
Expects(_settings != nullptr);
|
||||||
|
|
||||||
|
@ -1607,6 +1643,7 @@ auto ApiWrap::prepareFileProcess(const Data::File &file) const
|
||||||
result->relativePath = relativePath;
|
result->relativePath = relativePath;
|
||||||
result->location = file.location;
|
result->location = file.location;
|
||||||
result->size = file.size;
|
result->size = file.size;
|
||||||
|
result->origin = origin;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1701,6 +1738,87 @@ void ApiWrap::filePartDone(int offset, const MTPupload_File &result) {
|
||||||
process->done(process->relativePath);
|
process->done(process->relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ApiWrap::filePartRefreshReference(int offset) {
|
||||||
|
Expects(_fileProcess != nullptr);
|
||||||
|
|
||||||
|
const auto &origin = _fileProcess->origin;
|
||||||
|
if (!origin.messageId) {
|
||||||
|
error("FILE_REFERENCE error for non-message file.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (origin.peer.type() == mtpc_inputPeerChannel
|
||||||
|
|| origin.peer.type() == mtpc_inputPeerChannelFromMessage) {
|
||||||
|
const auto channel = (origin.peer.type() == mtpc_inputPeerChannel)
|
||||||
|
? MTP_inputChannel(
|
||||||
|
origin.peer.c_inputPeerChannel().vchannel_id(),
|
||||||
|
origin.peer.c_inputPeerChannel().vaccess_hash())
|
||||||
|
: MTP_inputChannelFromMessage(
|
||||||
|
origin.peer.c_inputPeerChannelFromMessage().vpeer(),
|
||||||
|
origin.peer.c_inputPeerChannelFromMessage().vmsg_id(),
|
||||||
|
origin.peer.c_inputPeerChannelFromMessage().vchannel_id());
|
||||||
|
mainRequest(MTPchannels_GetMessages(
|
||||||
|
channel,
|
||||||
|
MTP_vector<MTPInputMessage>(
|
||||||
|
1,
|
||||||
|
MTP_inputMessageID(MTP_int(origin.messageId)))
|
||||||
|
)).fail([=](const RPCError &error) {
|
||||||
|
filePartUnavailable();
|
||||||
|
return true;
|
||||||
|
}).done([=](const MTPmessages_Messages &result) {
|
||||||
|
filePartExtractReference(offset, result);
|
||||||
|
}).send();
|
||||||
|
} else {
|
||||||
|
splitRequest(origin.split, MTPmessages_GetMessages(
|
||||||
|
MTP_vector<MTPInputMessage>(
|
||||||
|
1,
|
||||||
|
MTP_inputMessageID(MTP_int(origin.messageId)))
|
||||||
|
)).fail([=](const RPCError &error) {
|
||||||
|
filePartUnavailable();
|
||||||
|
return true;
|
||||||
|
}).done([=](const MTPmessages_Messages &result) {
|
||||||
|
filePartExtractReference(offset, result);
|
||||||
|
}).send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApiWrap::filePartExtractReference(
|
||||||
|
int offset,
|
||||||
|
const MTPmessages_Messages &result) {
|
||||||
|
Expects(_fileProcess != nullptr);
|
||||||
|
|
||||||
|
result.match([&](const MTPDmessages_messagesNotModified &data) {
|
||||||
|
error("Unexpected messagesNotModified received.");
|
||||||
|
}, [&](const auto &data) {
|
||||||
|
auto context = Data::ParseMediaContext();
|
||||||
|
const auto messages = Data::ParseMessagesSlice(
|
||||||
|
context,
|
||||||
|
data.vmessages(),
|
||||||
|
data.vusers(),
|
||||||
|
data.vchats(),
|
||||||
|
_chatProcess->info.relativePath);
|
||||||
|
for (const auto &message : messages.list) {
|
||||||
|
if (message.id == _fileProcess->origin.messageId) {
|
||||||
|
const auto refresh1 = Data::RefreshFileReference(
|
||||||
|
_fileProcess->location,
|
||||||
|
message.file().location);
|
||||||
|
const auto refresh2 = Data::RefreshFileReference(
|
||||||
|
_fileProcess->location,
|
||||||
|
message.thumb().file.location);
|
||||||
|
if (refresh1 || refresh2) {
|
||||||
|
fileRequest(
|
||||||
|
_fileProcess->location,
|
||||||
|
offset
|
||||||
|
).done([=](const MTPupload_File &result) {
|
||||||
|
filePartDone(offset, result);
|
||||||
|
}).send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filePartUnavailable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void ApiWrap::filePartUnavailable() {
|
void ApiWrap::filePartUnavailable() {
|
||||||
Expects(_fileProcess != nullptr);
|
Expects(_fileProcess != nullptr);
|
||||||
Expects(!_fileProcess->requests.empty());
|
Expects(!_fileProcess->requests.empty());
|
||||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mtproto/concurrent_sender.h"
|
#include "mtproto/mtproto_concurrent_sender.h"
|
||||||
|
|
||||||
namespace Export {
|
namespace Export {
|
||||||
namespace Data {
|
namespace Data {
|
||||||
|
@ -23,6 +23,7 @@ struct DialogsInfo;
|
||||||
struct DialogInfo;
|
struct DialogInfo;
|
||||||
struct MessagesSlice;
|
struct MessagesSlice;
|
||||||
struct Message;
|
struct Message;
|
||||||
|
struct FileOrigin;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
namespace Output {
|
namespace Output {
|
||||||
|
@ -159,21 +160,33 @@ private:
|
||||||
void finishMessagesSlice();
|
void finishMessagesSlice();
|
||||||
void finishMessages();
|
void finishMessages();
|
||||||
|
|
||||||
|
[[nodiscard]] Data::Message *currentFileMessage() const;
|
||||||
|
[[nodiscard]] Data::FileOrigin currentFileMessageOrigin() const;
|
||||||
|
|
||||||
bool processFileLoad(
|
bool processFileLoad(
|
||||||
Data::File &file,
|
Data::File &file,
|
||||||
|
const Data::FileOrigin &origin,
|
||||||
Fn<bool(FileProgress)> progress,
|
Fn<bool(FileProgress)> progress,
|
||||||
FnMut<void(QString)> done,
|
FnMut<void(QString)> done,
|
||||||
Data::Message *message = nullptr);
|
Data::Message *message = nullptr);
|
||||||
std::unique_ptr<FileProcess> prepareFileProcess(
|
std::unique_ptr<FileProcess> prepareFileProcess(
|
||||||
const Data::File &file) const;
|
const Data::File &file,
|
||||||
bool writePreloadedFile(Data::File &file);
|
const Data::FileOrigin &origin) const;
|
||||||
|
bool writePreloadedFile(
|
||||||
|
Data::File &file,
|
||||||
|
const Data::FileOrigin &origin);
|
||||||
void loadFile(
|
void loadFile(
|
||||||
const Data::File &file,
|
const Data::File &file,
|
||||||
|
const Data::FileOrigin &origin,
|
||||||
Fn<bool(FileProgress)> progress,
|
Fn<bool(FileProgress)> progress,
|
||||||
FnMut<void(QString)> done);
|
FnMut<void(QString)> done);
|
||||||
void loadFilePart();
|
void loadFilePart();
|
||||||
void filePartDone(int offset, const MTPupload_File &result);
|
void filePartDone(int offset, const MTPupload_File &result);
|
||||||
void filePartUnavailable();
|
void filePartUnavailable();
|
||||||
|
void filePartRefreshReference(int offset);
|
||||||
|
void filePartExtractReference(
|
||||||
|
int offset,
|
||||||
|
const MTPmessages_Messages &result);
|
||||||
|
|
||||||
template <typename Request>
|
template <typename Request>
|
||||||
class RequestBuilder;
|
class RequestBuilder;
|
||||||
|
|
|
@ -7,9 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <crl/crl_object_on_queue.h>
|
|
||||||
#include "base/variant.h"
|
#include "base/variant.h"
|
||||||
#include "mtproto/rpc_sender.h"
|
#include "mtproto/mtproto_rpc_sender.h"
|
||||||
|
|
||||||
|
#include <crl/crl_object_on_queue.h>
|
||||||
|
|
||||||
namespace Export {
|
namespace Export {
|
||||||
|
|
||||||
|
|
|
@ -373,9 +373,9 @@ struct Data {
|
||||||
bool NotificationsDemoIsShown = false;
|
bool NotificationsDemoIsShown = false;
|
||||||
|
|
||||||
bool TryIPv6 = !Platform::IsWindows();
|
bool TryIPv6 = !Platform::IsWindows();
|
||||||
std::vector<ProxyData> ProxiesList;
|
std::vector<MTP::ProxyData> ProxiesList;
|
||||||
ProxyData SelectedProxy;
|
MTP::ProxyData SelectedProxy;
|
||||||
ProxyData::Settings ProxySettings = ProxyData::Settings::System;
|
MTP::ProxyData::Settings ProxySettings = MTP::ProxyData::Settings::System;
|
||||||
bool UseProxyForCalls = false;
|
bool UseProxyForCalls = false;
|
||||||
base::Observable<void> ConnectionTypeChanged;
|
base::Observable<void> ConnectionTypeChanged;
|
||||||
|
|
||||||
|
@ -501,9 +501,9 @@ DefineVar(Global, Notify::ScreenCorner, NotificationsCorner);
|
||||||
DefineVar(Global, bool, NotificationsDemoIsShown);
|
DefineVar(Global, bool, NotificationsDemoIsShown);
|
||||||
|
|
||||||
DefineVar(Global, bool, TryIPv6);
|
DefineVar(Global, bool, TryIPv6);
|
||||||
DefineVar(Global, std::vector<ProxyData>, ProxiesList);
|
DefineVar(Global, std::vector<MTP::ProxyData>, ProxiesList);
|
||||||
DefineVar(Global, ProxyData, SelectedProxy);
|
DefineVar(Global, MTP::ProxyData, SelectedProxy);
|
||||||
DefineVar(Global, ProxyData::Settings, ProxySettings);
|
DefineVar(Global, MTP::ProxyData::Settings, ProxySettings);
|
||||||
DefineVar(Global, bool, UseProxyForCalls);
|
DefineVar(Global, bool, UseProxyForCalls);
|
||||||
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/type_traits.h"
|
#include "base/type_traits.h"
|
||||||
#include "base/observer.h"
|
#include "base/observer.h"
|
||||||
#include "base/call_delayed.h"
|
#include "base/call_delayed.h"
|
||||||
#include "ui/effects/animation_value.h"
|
#include "mtproto/mtproto_proxy_data.h"
|
||||||
|
|
||||||
class History;
|
class History;
|
||||||
|
|
||||||
|
@ -224,9 +224,9 @@ DeclareVar(Notify::ScreenCorner, NotificationsCorner);
|
||||||
DeclareVar(bool, NotificationsDemoIsShown);
|
DeclareVar(bool, NotificationsDemoIsShown);
|
||||||
|
|
||||||
DeclareVar(bool, TryIPv6);
|
DeclareVar(bool, TryIPv6);
|
||||||
DeclareVar(std::vector<ProxyData>, ProxiesList);
|
DeclareVar(std::vector<MTP::ProxyData>, ProxiesList);
|
||||||
DeclareVar(ProxyData, SelectedProxy);
|
DeclareVar(MTP::ProxyData, SelectedProxy);
|
||||||
DeclareVar(ProxyData::Settings, ProxySettings);
|
DeclareVar(MTP::ProxyData::Settings, ProxySettings);
|
||||||
DeclareVar(bool, UseProxyForCalls);
|
DeclareVar(bool, UseProxyForCalls);
|
||||||
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ void PremultiplyLine(uchar *dst, const uchar *src, int intsCount) {
|
||||||
|
|
||||||
#ifndef TDESKTOP_OFFICIAL_TARGET
|
#ifndef TDESKTOP_OFFICIAL_TARGET
|
||||||
for (auto i = 0; i != intsCount; ++i) {
|
for (auto i = 0; i != intsCount; ++i) {
|
||||||
dst[i] = qPremultiply(src[i]);
|
udst[i] = qPremultiply(usrc[i]);
|
||||||
}
|
}
|
||||||
#elif QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
#elif QT_VERSION < QT_VERSION_CHECK(5, 12, 0)
|
||||||
static const auto layout = &qPixelLayouts[QImage::Format_ARGB32];
|
static const auto layout = &qPixelLayouts[QImage::Format_ARGB32];
|
||||||
|
|
|
@ -226,6 +226,7 @@ InnerWidget::InnerWidget(
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _history(channel->owner().history(channel))
|
, _history(channel->owner().history(channel))
|
||||||
|
, _api(_channel->session().api().instance())
|
||||||
, _scrollDateCheck([=] { scrollDateCheck(); })
|
, _scrollDateCheck([=] { scrollDateCheck(); })
|
||||||
, _emptyText(
|
, _emptyText(
|
||||||
st::historyAdminLogEmptyWidth
|
st::historyAdminLogEmptyWidth
|
||||||
|
@ -407,7 +408,7 @@ void InnerWidget::applySearch(const QString &query) {
|
||||||
|
|
||||||
void InnerWidget::requestAdmins() {
|
void InnerWidget::requestAdmins() {
|
||||||
auto participantsHash = 0;
|
auto participantsHash = 0;
|
||||||
request(MTPchannels_GetParticipants(
|
_api.request(MTPchannels_GetParticipants(
|
||||||
_channel->inputChannel,
|
_channel->inputChannel,
|
||||||
MTP_channelParticipantsAdmins(),
|
MTP_channelParticipantsAdmins(),
|
||||||
MTP_int(0),
|
MTP_int(0),
|
||||||
|
@ -463,8 +464,8 @@ void InnerWidget::showFilter(Fn<void(FilterValue &&filter)> callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::clearAndRequestLog() {
|
void InnerWidget::clearAndRequestLog() {
|
||||||
request(base::take(_preloadUpRequestId)).cancel();
|
_api.request(base::take(_preloadUpRequestId)).cancel();
|
||||||
request(base::take(_preloadDownRequestId)).cancel();
|
_api.request(base::take(_preloadDownRequestId)).cancel();
|
||||||
_filterChanged = true;
|
_filterChanged = true;
|
||||||
_upLoaded = false;
|
_upLoaded = false;
|
||||||
_downLoaded = true;
|
_downLoaded = true;
|
||||||
|
@ -635,7 +636,7 @@ void InnerWidget::preloadMore(Direction direction) {
|
||||||
auto maxId = (direction == Direction::Up) ? _minId : 0;
|
auto maxId = (direction == Direction::Up) ? _minId : 0;
|
||||||
auto minId = (direction == Direction::Up) ? 0 : _maxId;
|
auto minId = (direction == Direction::Up) ? 0 : _maxId;
|
||||||
auto perPage = _items.empty() ? kEventsFirstPage : kEventsPerPage;
|
auto perPage = _items.empty() ? kEventsFirstPage : kEventsPerPage;
|
||||||
requestId = request(MTPchannels_GetAdminLog(
|
requestId = _api.request(MTPchannels_GetAdminLog(
|
||||||
MTP_flags(flags),
|
MTP_flags(flags),
|
||||||
_channel->inputChannel,
|
_channel->inputChannel,
|
||||||
MTP_string(_searchQuery),
|
MTP_string(_searchQuery),
|
||||||
|
@ -1217,7 +1218,7 @@ void InnerWidget::suggestRestrictUser(not_null<UserData*> user) {
|
||||||
if (base::contains(_admins, user)) {
|
if (base::contains(_admins, user)) {
|
||||||
editRestrictions(true, MTP_chatBannedRights(MTP_flags(0), MTP_int(0)));
|
editRestrictions(true, MTP_chatBannedRights(MTP_flags(0), MTP_int(0)));
|
||||||
} else {
|
} else {
|
||||||
request(MTPchannels_GetParticipant(
|
_api.request(MTPchannels_GetParticipant(
|
||||||
_channel->inputChannel,
|
_channel->inputChannel,
|
||||||
user->inputUser
|
user->inputUser
|
||||||
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
)).done([=](const MTPchannels_ChannelParticipant &result) {
|
||||||
|
|
|
@ -44,7 +44,6 @@ class InnerWidget final
|
||||||
: public Ui::RpWidget
|
: public Ui::RpWidget
|
||||||
, public Ui::AbstractTooltipShower
|
, public Ui::AbstractTooltipShower
|
||||||
, public HistoryView::ElementDelegate
|
, public HistoryView::ElementDelegate
|
||||||
, private MTP::Sender
|
|
||||||
, private base::Subscriber {
|
, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
InnerWidget(
|
InnerWidget(
|
||||||
|
@ -216,9 +215,11 @@ private:
|
||||||
template <typename Method>
|
template <typename Method>
|
||||||
void enumerateDates(Method method);
|
void enumerateDates(Method method);
|
||||||
|
|
||||||
not_null<Window::SessionController*> _controller;
|
const not_null<Window::SessionController*> _controller;
|
||||||
not_null<ChannelData*> _channel;
|
const not_null<ChannelData*> _channel;
|
||||||
not_null<History*> _history;
|
const not_null<History*> _history;
|
||||||
|
MTP::Sender _api;
|
||||||
|
|
||||||
std::vector<OwnedItem> _items;
|
std::vector<OwnedItem> _items;
|
||||||
std::set<uint64> _eventIds;
|
std::set<uint64> _eventIds;
|
||||||
std::map<not_null<const HistoryItem*>, not_null<Element*>> _itemsByData;
|
std::map<not_null<const HistoryItem*>, not_null<Element*>> _itemsByData;
|
||||||
|
|
|
@ -97,7 +97,7 @@ object_ptr<Window::SectionWidget> SectionMemento::createWidget(
|
||||||
}
|
}
|
||||||
auto result = object_ptr<Widget>(parent, controller, _channel);
|
auto result = object_ptr<Widget>(parent, controller, _channel);
|
||||||
result->setInternalState(geometry, this);
|
result->setInternalState(geometry, this);
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedBar::FixedBar(
|
FixedBar::FixedBar(
|
||||||
|
@ -365,7 +365,7 @@ void Widget::setupShortcuts() {
|
||||||
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||||
auto result = std::make_unique<SectionMemento>(channel());
|
auto result = std::make_unique<SectionMemento>(channel());
|
||||||
saveState(result.get());
|
saveState(result.get());
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::saveState(not_null<SectionMemento*> memento) {
|
void Widget::saveState(not_null<SectionMemento*> memento) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ object_ptr<Window::SectionWidget> Memento::createWidget(
|
||||||
}
|
}
|
||||||
auto result = object_ptr<Widget>(parent, controller, _feed);
|
auto result = object_ptr<Widget>(parent, controller, _feed);
|
||||||
result->setInternalState(geometry, this);
|
result->setInternalState(geometry, this);
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::Widget(
|
Widget::Widget(
|
||||||
|
@ -456,7 +456,7 @@ ClickHandlerPtr Widget::listDateLink(not_null<Element*> view) {
|
||||||
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||||
auto result = std::make_unique<Memento>(_feed);
|
auto result = std::make_unique<Memento>(_feed);
|
||||||
saveState(result.get());
|
saveState(result.get());
|
||||||
return std::move(result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::saveState(not_null<Memento*> memento) {
|
void Widget::saveState(not_null<Memento*> memento) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue