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

Debug feature added for overriding dc options.

Now you can type "endpoints" in Settings and choose a file with
a complete set of dc_options that will be used instead of built-in
or received through mtproto config till the end of current session.
This commit is contained in:
John Preston
2017-03-01 20:22:37 +03:00
parent 5f5770dd46
commit bc76f5ee1e
3 changed files with 108 additions and 2 deletions

View File

@@ -35,6 +35,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "boxes/confirmbox.h"
#include "lang.h"
#include "messenger.h"
#include "mtproto/mtp_instance.h"
#include "mtproto/dc_options.h"
#include "core/file_utilities.h"
#include "window/themes/window_theme.h"
#include "window/themes/window_theme_editor.h"
@@ -110,6 +112,15 @@ void fillCodes() {
Ui::hideLayer();
}));
});
Codes.insert(qsl("endpoints"), []() {
FileDialog::GetOpenPath("Open DC endpoints", "DC Endpoints (*.tdesktop-endpoints)", [](const FileDialog::OpenResult &result) {
if (!result.paths.isEmpty()) {
if (!Messenger::Instance().mtp()->dcOptions()->loadFromFile(result.paths.front())) {
Ui::show(Box<InformBox>("Could not load endpoints :( Errors in 'log.txt'."));
}
}
});
});
}
void codesFeedString(const QString &text) {