summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-02-28 11:57:59 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-02-28 11:57:59 +0300
commite831ce4dfe7a6cb5f87f7eb862d5bbf21f4b4159 (patch)
treef5b20eab7605abff37b61f3c58fd7a232b3ca39c /protocols/Telegram/src/server.cpp
parentb13f7a520f9d6a792333ef9cd2dc0e786a57ca2e (diff)
fixes #3356 (Telegram: статус при переподключении)
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index 4517c8cca3..8b708a1e81 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -27,16 +27,16 @@ void __cdecl CTelegramProto::ServerThread(void *)
m_bTerminated = m_bAuthorized = false;
m_szFullPhone.Format("%d%S", (int)m_iCountry, (wchar_t *)m_szOwnPhone);
- m_pClientMmanager = std::make_unique<td::ClientManager>();
- m_iClientId = m_pClientMmanager->create_client_id();
+ m_pClientManager = std::make_unique<td::ClientManager>();
+ m_iClientId = m_pClientManager->create_client_id();
SendQuery(new TD::getOption("version"));
while (!m_bTerminated) {
- ProcessResponse(m_pClientMmanager->receive(1));
+ ProcessResponse(m_pClientManager->receive(1));
}
- m_pClientMmanager = std::move(nullptr);
+ m_pClientManager = std::move(nullptr);
}
void CTelegramProto::LogOut()
@@ -53,6 +53,8 @@ void CTelegramProto::LogOut()
m_impl.m_keepAlive.Stop();
setAllContactStatuses(ID_STATUS_OFFLINE, false);
+ for (auto &it : m_arUsers)
+ it->m_si = nullptr;
}
void CTelegramProto::OnLoggedIn()
@@ -209,7 +211,7 @@ int CTelegramProto::SendTextMessage(int64_t chatId, const char *pszMessage)
void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
{
- if (!m_pClientMmanager)
+ if (!m_pClientManager)
return;
int queryId = ++m_iQueryId;
@@ -217,7 +219,7 @@ void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
auto szDescr = to_string(*pFunc);
debugLogA("Sending query %d:\n%s", queryId, szDescr.c_str());
- m_pClientMmanager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
+ m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
if (pHandler)
m_arRequests.insert(new TG_REQUEST(queryId, pHandler));
@@ -225,7 +227,7 @@ void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER pHandler)
void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandler, void *pUserInfo)
{
- if (!m_pClientMmanager)
+ if (!m_pClientManager)
return;
int queryId = ++m_iQueryId;
@@ -233,7 +235,7 @@ void CTelegramProto::SendQuery(TD::Function *pFunc, TG_QUERY_HANDLER_FULL pHandl
auto szDescr = to_string(*pFunc);
debugLogA("Sending full query %d:\n%s", queryId, szDescr.c_str());
- m_pClientMmanager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
+ m_pClientManager->send(m_iClientId, queryId, TD::object_ptr<TD::Function>(pFunc));
if (pHandler)
m_arRequests.insert(new TG_REQUEST_FULL(queryId, pHandler, pUserInfo));