mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 10:11:41 -05:00
Show bad proxy configuration error.
This commit is contained in:
parent
5e7642b42a
commit
37bf9ffcff
6 changed files with 34 additions and 0 deletions
|
@ -26,5 +26,9 @@ inline QString ClearPathFailed() {
|
||||||
return qsl("Clear failed :(");
|
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 Hard
|
||||||
} // namespace Lang
|
} // namespace Lang
|
||||||
|
|
|
@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "lang/lang_file_parser.h"
|
#include "lang/lang_file_parser.h"
|
||||||
#include "lang/lang_translator.h"
|
#include "lang/lang_translator.h"
|
||||||
#include "lang/lang_cloud_manager.h"
|
#include "lang/lang_cloud_manager.h"
|
||||||
|
#include "lang/lang_hardcoded.h"
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "storage/file_upload.h"
|
#include "storage/file_upload.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
|
@ -44,6 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/qthelp_url.h"
|
#include "base/qthelp_url.h"
|
||||||
#include "boxes/connection_box.h"
|
#include "boxes/connection_box.h"
|
||||||
#include "boxes/confirm_phone_box.h"
|
#include "boxes/confirm_phone_box.h"
|
||||||
|
#include "boxes/confirm_box.h"
|
||||||
#include "boxes/share_box.h"
|
#include "boxes/share_box.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -305,6 +307,14 @@ void Messenger::setCurrentProxy(
|
||||||
Global::RefConnectionTypeChanged().notify();
|
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) {
|
void Messenger::setMtpMainDcId(MTP::DcId mainDcId) {
|
||||||
Expects(!_mtproto);
|
Expects(!_mtproto);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ class MainWidget;
|
||||||
class FileUploader;
|
class FileUploader;
|
||||||
class Translator;
|
class Translator;
|
||||||
class MediaView;
|
class MediaView;
|
||||||
|
class BoxContent;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class Launcher;
|
class Launcher;
|
||||||
|
@ -99,6 +100,7 @@ public:
|
||||||
return _dcOptions.get();
|
return _dcOptions.get();
|
||||||
}
|
}
|
||||||
void setCurrentProxy(const ProxyData &proxy, bool enabled);
|
void setCurrentProxy(const ProxyData &proxy, bool enabled);
|
||||||
|
void badMtprotoConfigurationError();
|
||||||
|
|
||||||
// Set from legacy storage.
|
// Set from legacy storage.
|
||||||
void setMtpMainDcId(MTP::DcId mainDcId);
|
void setMtpMainDcId(MTP::DcId mainDcId);
|
||||||
|
@ -240,6 +242,7 @@ private:
|
||||||
std::unique_ptr<AuthSession> _authSession;
|
std::unique_ptr<AuthSession> _authSession;
|
||||||
base::Observable<void> _authSessionChanged;
|
base::Observable<void> _authSessionChanged;
|
||||||
base::Observable<void> _passcodedChanged;
|
base::Observable<void> _passcodedChanged;
|
||||||
|
QPointer<BoxContent> _badProxyDisableBox;
|
||||||
|
|
||||||
std::unique_ptr<Media::Audio::Instance> _audio;
|
std::unique_ptr<Media::Audio::Instance> _audio;
|
||||||
QImage _logo;
|
QImage _logo;
|
||||||
|
|
|
@ -2983,6 +2983,11 @@ void ConnectionPrivate::onError(
|
||||||
qint32 errorCode) {
|
qint32 errorCode) {
|
||||||
if (errorCode == -429) {
|
if (errorCode == -429) {
|
||||||
LOG(("Protocol Error: -429 flood code returned!"));
|
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);
|
removeTestConnection(connection);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ public:
|
||||||
void requestConfigIfOld();
|
void requestConfigIfOld();
|
||||||
void requestCDNConfig();
|
void requestCDNConfig();
|
||||||
void setUserPhone(const QString &phone);
|
void setUserPhone(const QString &phone);
|
||||||
|
void badConfigurationError();
|
||||||
|
|
||||||
void restart();
|
void restart();
|
||||||
void restart(ShiftedDcId shiftedDcId);
|
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() {
|
void Instance::Private::requestConfigIfOld() {
|
||||||
const auto timeout = Global::BlockedMode()
|
const auto timeout = Global::BlockedMode()
|
||||||
? kConfigBecomesOldForBlockedIn
|
? kConfigBecomesOldForBlockedIn
|
||||||
|
@ -1484,6 +1491,10 @@ void Instance::setUserPhone(const QString &phone) {
|
||||||
_private->setUserPhone(phone);
|
_private->setUserPhone(phone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Instance::badConfigurationError() {
|
||||||
|
_private->badConfigurationError();
|
||||||
|
}
|
||||||
|
|
||||||
void Instance::requestConfigIfOld() {
|
void Instance::requestConfigIfOld() {
|
||||||
_private->requestConfigIfOld();
|
_private->requestConfigIfOld();
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ public:
|
||||||
void requestConfigIfOld();
|
void requestConfigIfOld();
|
||||||
void requestCDNConfig();
|
void requestCDNConfig();
|
||||||
void setUserPhone(const QString &phone);
|
void setUserPhone(const QString &phone);
|
||||||
|
void badConfigurationError();
|
||||||
|
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue