diff options
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r-- | protocols/Telegram/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/Telegram/src/server.cpp | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 45839832a5..3c1661d3f9 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -247,6 +247,7 @@ class CTelegramProto : public PROTO<CTelegramProto> void ProcessBasicGroup(TD::updateBasicGroup *pObj); void ProcessBasicGroupInfo(TD::updateBasicGroupFullInfo *pObj); void ProcessChat(TD::updateNewChat *pObj); + void ProcessChatAction(TD::updateChatAction *pObj); void ProcessChatLastMessage(TD::updateChatLastMessage *pObj); void ProcessChatNotification(TD::updateChatNotificationSettings *pObj); void ProcessChatPosition(TD::updateChatPosition *pObj); diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 75e4fa0cdc..89b8787f07 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -201,6 +201,10 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response) ProcessBasicGroupInfo((TD::updateBasicGroupFullInfo *)response.object.get());
break;
+ case TD::updateChatAction::ID:
+ ProcessChatAction((TD::updateChatAction *)response.object.get());
+ break;
+
case TD::updateChatFolders::ID:
ProcessGroups((TD::updateChatFolders *)response.object.get());
break;
@@ -490,6 +494,26 @@ void CTelegramProto::ProcessChat(TD::updateNewChat *pObj) else debugLogA("Unknown user id %lld, ignoring", userId);
}
+void CTelegramProto::ProcessChatAction(TD::updateChatAction *pObj)
+{
+ auto *pChat = FindChat(pObj->chat_id_);
+ if (pChat == nullptr) {
+ debugLogA("Unknown chat, skipping");
+ return;
+ }
+
+ if (pChat->hContact == INVALID_CONTACT_ID) {
+ debugLogA("Last message for a temporary contact, skipping");
+ return;
+ }
+
+ switch (pObj->action_->get_id()) {
+ case TD::chatActionTyping::ID:
+ CallService(MS_PROTO_CONTACTISTYPING, pChat->hContact, 1);
+ break;
+ }
+}
+
void CTelegramProto::ProcessChatLastMessage(TD::updateChatLastMessage *pObj)
{
auto *pUser = FindChat(pObj->chat_id_);
|