summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Telegram/src/auth.cpp4
-rw-r--r--protocols/Telegram/src/proto.h1
-rw-r--r--protocols/Telegram/src/server.cpp30
3 files changed, 31 insertions, 4 deletions
diff --git a/protocols/Telegram/src/auth.cpp b/protocols/Telegram/src/auth.cpp
index 92962f5d79..8a64b2a015 100644
--- a/protocols/Telegram/src/auth.cpp
+++ b/protocols/Telegram/src/auth.cpp
@@ -137,10 +137,6 @@ void CTelegramProto::ProcessAuth(TD::updateAuthorizationState *pObj)
CallFunctionSync(EnterEmailCode, this);
break;
- case TD::authorizationStateReady::ID:
- OnLoggedIn();
- break;
-
case TD::authorizationStateClosed::ID:
debugLogA("Connection terminated, exiting");
LogOut();
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 1234bb3ed3..42bf428802 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -208,6 +208,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
void ProcessChatLastMessage(TD::updateChatLastMessage *pObj);
void ProcessChatNotification(TD::updateChatNotificationSettings *pObj);
void ProcessChatPosition(TD::updateChatPosition *pObj);
+ void ProcessConnectionState(TD::updateConnectionState *pObj);
void ProcessDeleteMessage(TD::updateDeleteMessages *pObj);
void ProcessFile(TD::updateFile *pObj);
void ProcessGroups(TD::updateChatFilters *pObj);
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_)