summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-24 17:05:50 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-24 17:05:50 +0300
commit214a9afdb87700c80af08790b7cb967153cb932d (patch)
treed3a1a3be2f841ebaea09195e7eb0a4dc9c62de5e /protocols/Telegram/src/server.cpp
parent94759bc4f0b907778691293e3e50814d3a4071b1 (diff)
Telegram: more correct connection state detection
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index a42736c049..85afbae93d 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -168,6 +168,10 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
ProcessDeleteMessage((TD::updateDeleteMessages*)response.object.get());
break;
+ case TD::updateConnectionState::ID:
+ ProcessConnectionState((TD::updateConnectionState *)response.object.get());
+ break;
+
case TD::updateFile::ID:
ProcessFile((TD::updateFile *)response.object.get());
break;
@@ -418,6 +422,32 @@ void CTelegramProto::ProcessChatPosition(TD::updateChatPosition *pObj)
}
}
+void CTelegramProto::ProcessConnectionState(TD::updateConnectionState *pObj)
+{
+ switch (pObj->state_->get_id()) {
+ case TD::connectionStateConnecting::ID:
+ debugLogA("Connection state: connecting");
+ break;
+
+ case TD::connectionStateConnectingToProxy::ID:
+ debugLogA("Connection state: connecting to proxy");
+ break;
+
+ case TD::connectionStateWaitingForNetwork::ID:
+ debugLogA("Connection state: waiting for network");
+ break;
+
+ case TD::connectionStateUpdating::ID:
+ debugLogA("Connection state: updating");
+ break;
+
+ case TD::connectionStateReady::ID:
+ debugLogA("Connection state: connected");
+ OnLoggedIn();
+ break;
+ }
+}
+
void CTelegramProto::ProcessDeleteMessage(TD::updateDeleteMessages *pObj)
{
if (!pObj->is_permanent_)