2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

MTP global state moved to MTP::Instance class.

Now there will be ability to start multiple mtproto instances.
This commit is contained in:
John Preston
2017-02-24 20:15:41 +03:00
parent c3b3819d9f
commit dd933cf61c
23 changed files with 1868 additions and 1341 deletions

View File

@@ -24,6 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace MTP {
class DcOptions;
class Instance;
} // namespace MTP
class AuthSession;
@@ -55,6 +56,16 @@ public:
MTP::DcOptions *dcOptions() {
return _dcOptions.get();
}
void setMtpMainDcId(MTP::DcId mainDcId);
void setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData);
QByteArray serializeMtpAuthorization() const;
void setMtpAuthorization(const QByteArray &serialized);
void startMtp();
MTP::Instance *mtp() {
return _mtproto.get();
}
AuthSession *authSession() {
return _authSession.get();
}
@@ -114,13 +125,16 @@ private:
QMap<int32, TimeMs> killDownloadSessionTimes;
SingleTimer killDownloadSessionsTimer;
TimeMs _lastActionTime = 0;
// Some fields are just moved from the declaration.
struct Private;
const std::unique_ptr<Private> _private;
std::unique_ptr<MainWindow> _window;
FileUploader *_uploader = nullptr;
Translator *_translator = nullptr;
std::unique_ptr<MTP::DcOptions> _dcOptions;
std::unique_ptr<MTP::Instance> _mtproto;
std::unique_ptr<AuthSession> _authSession;
};