summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-06-07 20:17:14 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-06-07 20:17:14 +0300
commite2f89ec27ee79ef51c271f40d3fdaf42496d066a (patch)
tree17d3243e61a11bdb715cede9f325eb1066953cc7
parent9f9f8d20f6b1db33d9bb14154f27a51c53cd9c22 (diff)
fixes #3417 (Telegram: при удалении учётной записи сессия не удаляется)
-rw-r--r--protocols/Telegram/src/auth.cpp13
-rw-r--r--protocols/Telegram/src/proto.cpp6
-rw-r--r--protocols/Telegram/src/proto.h1
-rw-r--r--protocols/Telegram/src/server.cpp3
4 files changed, 13 insertions, 10 deletions
diff --git a/protocols/Telegram/src/auth.cpp b/protocols/Telegram/src/auth.cpp
index ed82c99d04..53aa8d5c82 100644
--- a/protocols/Telegram/src/auth.cpp
+++ b/protocols/Telegram/src/auth.cpp
@@ -99,12 +99,12 @@ void CTelegramProto::ProcessAuth(TD::updateAuthorizationState *pObj)
break;
case TD::authorizationStateWaitTdlibParameters::ID:
- if (!m_bUnregister) {
- MFileVersion v;
- char text[100];
- Miranda_GetFileVersion(&v);
- mir_snprintf(text, "%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
-
+ MFileVersion v;
+ Miranda_GetFileVersion(&v);
+
+ char text[100];
+ mir_snprintf(text, "%d.%d.%d.%d", v[0], v[1], v[2], v[3]);
+ {
CMStringW wszPath(GetProtoFolder());
auto *request = new TD::setTdlibParameters();
@@ -119,7 +119,6 @@ void CTelegramProto::ProcessAuth(TD::updateAuthorizationState *pObj)
request->enable_storage_optimizer_ = true;
SendQuery(request, &CTelegramProto::OnUpdateAuth);
}
- else LogOut();
break;
case TD::authorizationStateWaitPhoneNumber::ID:
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index c0e92ecc40..1354be1c33 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -182,8 +182,10 @@ void CTelegramProto::OnBuildProtoMenu()
void CTelegramProto::OnErase()
{
- m_bUnregister = true;
- ServerThread(0);
+ if (getByte(DBKEY_AUTHORIZED)) {
+ m_bUnregister = true;
+ ServerThread(0);
+ }
DeleteDirectoryTreeW(GetProtoFolder(), false);
}
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 0e397eca0d..b0d57893d2 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -4,6 +4,7 @@
#define DBKEY_ID "id"
#define DBKEY_COMPAT "Compatibility"
+#define DBKEY_AUTHORIZED "Authorized"
#define DBKEY_AVATAR_HASH "AvatarHash"
#define DBKEY_AVATAR_TYPE "AvatarType"
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index c8eba7f5ae..d40b6dc82f 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -1,4 +1,4 @@
-/*
+-/*
Copyright (C) 2012-23 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
@@ -74,6 +74,7 @@ void CTelegramProto::OnLoggedIn()
}
else {
m_impl.m_keepAlive.Start(1000);
+ setByte(DBKEY_AUTHORIZED, 1);
SendQuery(new TD::getChats(td::tl::unique_ptr<TD::chatListMain>(), 1000));
}