From 16c56fd6e23135895b73082c11a5ae6a321cc9f9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 2 Jan 2023 15:41:19 +0300 Subject: =?UTF-8?q?fixes=20#3288=20(Telegram:=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D0=B7=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B5=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D1=81=D0=B5=D1=81=D1=81=D0=B8=D0=B8=20=D0=BF=D1=80=D0=B8=20?= =?UTF-8?q?=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=83=D1=87?= =?UTF-8?q?=D1=91=D1=82=D0=BA=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/server.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'protocols/Telegram/src/server.cpp') diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 8dede07c4c..8792000d59 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -17,18 +17,25 @@ along with this program. If not, see . #include "stdafx.h" +void CMTProto::OnEndSession(td::ClientManager::Response&) +{ + m_bTerminated = true; +} + void __cdecl CMTProto::ServerThread(void *) { - m_bRunning = true; m_bTerminated = m_bAuthorized = false; + m_pClientMmanager = std::make_unique(); + m_iClientId = m_pClientMmanager->create_client_id(); + SendQuery(new TD::getOption("version")); while (!m_bTerminated) { ProcessResponse(m_pClientMmanager->receive(1)); } - m_bRunning = false; + m_pClientMmanager = std::move(nullptr); } void CMTProto::LogOut() @@ -55,7 +62,11 @@ void CMTProto::OnLoggedIn() ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, m_iDesiredStatus); m_iStatus = m_iDesiredStatus; - SendQuery(new TD::getChats(td::tl::unique_ptr(), 1000)); + if (m_bUnregister) { + SendQuery(new TD::terminateSession()); + SendQuery(new TD::logOut(), &CMTProto::OnEndSession); + } + else SendQuery(new TD::getChats(td::tl::unique_ptr(), 1000)); } /////////////////////////////////////////////////////////////////////////////// @@ -254,7 +265,6 @@ void CMTProto::ProcessGroups(TD::updateChatFilters *pObj) Clist_GroupRename(oldGroup, wszFullGroup); setWString(szSetting, wszNewValue); } - } } -- cgit v1.2.3