mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-29 19:03:03 +00:00
Show bad proxy configuration error.
This commit is contained in:
parent
5e7642b42a
commit
37bf9ffcff
@ -26,5 +26,9 @@ inline QString ClearPathFailed() {
|
||||
return qsl("Clear failed :(");
|
||||
}
|
||||
|
||||
inline QString ProxyConfigError() {
|
||||
return qsl("The proxy you are using is not configured correctly and will be disabled. Please find another one.");
|
||||
}
|
||||
|
||||
} // namespace Hard
|
||||
} // namespace Lang
|
||||
|
@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "lang/lang_file_parser.h"
|
||||
#include "lang/lang_translator.h"
|
||||
#include "lang/lang_cloud_manager.h"
|
||||
#include "lang/lang_hardcoded.h"
|
||||
#include "observer_peer.h"
|
||||
#include "storage/file_upload.h"
|
||||
#include "mainwidget.h"
|
||||
@ -44,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/qthelp_url.h"
|
||||
#include "boxes/connection_box.h"
|
||||
#include "boxes/confirm_phone_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/share_box.h"
|
||||
|
||||
namespace {
|
||||
@ -305,6 +307,14 @@ void Messenger::setCurrentProxy(
|
||||
Global::RefConnectionTypeChanged().notify();
|
||||
}
|
||||
|
||||
void Messenger::badMtprotoConfigurationError() {
|
||||
if (Global::UseProxy() && !_badProxyDisableBox) {
|
||||
_badProxyDisableBox = Ui::show(Box<InformBox>(
|
||||
Lang::Hard::ProxyConfigError(),
|
||||
[=] { setCurrentProxy(Global::SelectedProxy(), false); }));
|
||||
}
|
||||
}
|
||||
|
||||
void Messenger::setMtpMainDcId(MTP::DcId mainDcId) {
|
||||
Expects(!_mtproto);
|
||||
|
||||
|
@ -17,6 +17,7 @@ class MainWidget;
|
||||
class FileUploader;
|
||||
class Translator;
|
||||
class MediaView;
|
||||
class BoxContent;
|
||||
|
||||
namespace Core {
|
||||
class Launcher;
|
||||
@ -99,6 +100,7 @@ public:
|
||||
return _dcOptions.get();
|
||||
}
|
||||
void setCurrentProxy(const ProxyData &proxy, bool enabled);
|
||||
void badMtprotoConfigurationError();
|
||||
|
||||
// Set from legacy storage.
|
||||
void setMtpMainDcId(MTP::DcId mainDcId);
|
||||
@ -240,6 +242,7 @@ private:
|
||||
std::unique_ptr<AuthSession> _authSession;
|
||||
base::Observable<void> _authSessionChanged;
|
||||
base::Observable<void> _passcodedChanged;
|
||||
QPointer<BoxContent> _badProxyDisableBox;
|
||||
|
||||
std::unique_ptr<Media::Audio::Instance> _audio;
|
||||
QImage _logo;
|
||||
|
@ -2983,6 +2983,11 @@ void ConnectionPrivate::onError(
|
||||
qint32 errorCode) {
|
||||
if (errorCode == -429) {
|
||||
LOG(("Protocol Error: -429 flood code returned!"));
|
||||
} else if (errorCode == -444) {
|
||||
LOG(("Protocol Error: -444 bad dc_id code returned!"));
|
||||
InvokeQueued(_instance, [instance = _instance] {
|
||||
instance->badConfigurationError();
|
||||
});
|
||||
}
|
||||
removeTestConnection(connection);
|
||||
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
void requestConfigIfOld();
|
||||
void requestCDNConfig();
|
||||
void setUserPhone(const QString &phone);
|
||||
void badConfigurationError();
|
||||
|
||||
void restart();
|
||||
void restart(ShiftedDcId shiftedDcId);
|
||||
@ -398,6 +399,12 @@ void Instance::Private::setUserPhone(const QString &phone) {
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::Private::badConfigurationError() {
|
||||
if (_mode == Mode::Normal) {
|
||||
Messenger::Instance().badMtprotoConfigurationError();
|
||||
}
|
||||
}
|
||||
|
||||
void Instance::Private::requestConfigIfOld() {
|
||||
const auto timeout = Global::BlockedMode()
|
||||
? kConfigBecomesOldForBlockedIn
|
||||
@ -1484,6 +1491,10 @@ void Instance::setUserPhone(const QString &phone) {
|
||||
_private->setUserPhone(phone);
|
||||
}
|
||||
|
||||
void Instance::badConfigurationError() {
|
||||
_private->badConfigurationError();
|
||||
}
|
||||
|
||||
void Instance::requestConfigIfOld() {
|
||||
_private->requestConfigIfOld();
|
||||
}
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
void requestConfigIfOld();
|
||||
void requestCDNConfig();
|
||||
void setUserPhone(const QString &phone);
|
||||
void badConfigurationError();
|
||||
|
||||
~Instance();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user