summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-12-05 12:01:42 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-12-05 12:01:42 +0300
commit436b606226fea6dd7ca03fc36f55fab53ce3bfb7 (patch)
treec0018642746f91b63409f3d788a3c253d8c4d082
parent6ab8095788096969e9abea7be524b10d306d8132 (diff)
fixes #4015 (Telegram: применять ограничения чата сразу)
-rw-r--r--protocols/Telegram/src/proto.h1
-rw-r--r--protocols/Telegram/src/server.cpp22
2 files changed, 19 insertions, 4 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index 1ab2b23d08..14b617fe1f 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -248,6 +248,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
void ProcessBasicGroupInfo(TD::updateBasicGroupFullInfo *pObj);
void ProcessChat(TD::updateNewChat *pObj);
void ProcessChatAction(TD::updateChatAction *pObj);
+ void ProcessChatHasProtected(TD::updateChatHasProtectedContent *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 89b8787f07..5cc78c2439 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -205,10 +205,18 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
ProcessChatAction((TD::updateChatAction *)response.object.get());
break;
+ case TD::updateChatAvailableReactions::ID:
+ ProcessChatReactions((TD::updateChatAvailableReactions *)response.object.get());
+ break;
+
case TD::updateChatFolders::ID:
ProcessGroups((TD::updateChatFolders *)response.object.get());
break;
+ case TD::updateChatHasProtectedContent::ID:
+ ProcessChatHasProtected((TD::updateChatHasProtectedContent *)response.object.get());
+ break;
+
case TD::updateChatLastMessage::ID:
ProcessChatLastMessage((TD::updateChatLastMessage *)response.object.get());
break;
@@ -221,10 +229,6 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
ProcessChatPosition((TD::updateChatPosition *)response.object.get());
break;
- case TD::updateChatAvailableReactions::ID:
- ProcessChatReactions((TD::updateChatAvailableReactions *)response.object.get());
- break;
-
case TD::updateChatReadInbox::ID:
ProcessMarkRead((TD::updateChatReadInbox *)response.object.get());
break;
@@ -514,6 +518,16 @@ void CTelegramProto::ProcessChatAction(TD::updateChatAction *pObj)
}
}
+void CTelegramProto::ProcessChatHasProtected(TD::updateChatHasProtectedContent *pObj)
+{
+ if (auto *pChat = FindChat(pObj->chat_id_)) {
+ if (pObj->has_protected_content_)
+ setByte(pChat->hContact, "Protected", 1);
+ else
+ delSetting(pChat->hContact, "Protected");
+ }
+}
+
void CTelegramProto::ProcessChatLastMessage(TD::updateChatLastMessage *pObj)
{
auto *pUser = FindChat(pObj->chat_id_);