2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Add AUTH_KEY_DROP_ service notification support.

Also move logout code to Messenger.
This commit is contained in:
John Preston
2018-06-04 21:18:52 +03:00
parent 1d1bd5e1e7
commit a2d4b9260e
11 changed files with 120 additions and 67 deletions

View File

@@ -147,43 +147,6 @@ namespace App {
return false;
}
namespace {
bool loggedOut() {
if (Global::LocalPasscode()) {
Global::SetLocalPasscode(false);
Global::RefLocalPasscodeChanged().notify();
}
Media::Player::mixer()->stopAndClear();
if (auto w = wnd()) {
w->tempDirDelete(Local::ClearManagerAll);
w->setupIntro();
}
histories().clear();
Messenger::Instance().authSessionDestroy();
Local::reset();
Window::Theme::Background()->reset();
cSetOtherOnline(0);
clearStorageImages();
return true;
}
} // namespace
void logOut() {
if (auto mtproto = Messenger::Instance().mtp()) {
mtproto->logout(rpcDone([] {
return loggedOut();
}), rpcFail([] {
return loggedOut();
}));
} else {
// We log out because we've forgotten passcode.
// So we just start mtproto from scratch.
Messenger::Instance().startMtp();
loggedOut();
}
}
namespace {
// we should get a full restriction in "{fulltype}: {reason}" format and we
// need to find a "-all" tag in {fulltype}, otherwise ignore this restriction