summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src/server.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-03-10 20:47:33 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-03-10 20:47:33 +0300
commitf37891335fc1f4f16f362dec4543487460997ea9 (patch)
tree76d85d3b54d4a5901f012621d8ad24c4cc0d1181 /protocols/Telegram/src/server.cpp
parent254e19a638bebc4bc468f0415eddf7e4ccff7e02 (diff)
Telegram: mute support
Diffstat (limited to 'protocols/Telegram/src/server.cpp')
-rw-r--r--protocols/Telegram/src/server.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp
index 7cada3e34c..483fe73d82 100644
--- a/protocols/Telegram/src/server.cpp
+++ b/protocols/Telegram/src/server.cpp
@@ -152,6 +152,10 @@ void CTelegramProto::ProcessResponse(td::ClientManager::Response response)
ProcessChatLastMessage((TD::updateChatLastMessage *)response.object.get());
break;
+ case TD::updateChatNotificationSettings::ID:
+ ProcessChatNotification((TD::updateChatNotificationSettings*)response.object.get());
+ break;
+
case TD::updateChatPosition::ID:
ProcessChatPosition((TD::updateChatPosition *)response.object.get());
break;
@@ -362,6 +366,19 @@ void CTelegramProto::ProcessChatLastMessage(TD::updateChatLastMessage *pObj)
}
}
+void CTelegramProto::ProcessChatNotification(TD::updateChatNotificationSettings *pObj)
+{
+ auto *pUser = FindChat(pObj->chat_id_);
+ if (pUser == nullptr || pUser->hContact == INVALID_CONTACT_ID)
+ return;
+
+ auto &pSettings = pObj->notification_settings_;
+ if (!pSettings->use_default_mute_for_ && pSettings->mute_for_ != 0)
+ Chat_Mute(pUser->hContact, CHATMODE_MUTE);
+ else
+ Chat_Mute(pUser->hContact, CHATMODE_NORMAL);
+}
+
void CTelegramProto::ProcessChatPosition(TD::updateChatPosition *pObj)
{
if (pObj->position_->get_id() != TD::chatPosition::ID) {