summaryrefslogtreecommitdiff
path: root/protocols
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
parent254e19a638bebc4bc468f0415eddf7e4ccff7e02 (diff)
Telegram: mute support
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Telegram/src/proto.h1
-rw-r--r--protocols/Telegram/src/server.cpp17
2 files changed, 18 insertions, 0 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h
index e975b8866a..6295784b9c 100644
--- a/protocols/Telegram/src/proto.h
+++ b/protocols/Telegram/src/proto.h
@@ -201,6 +201,7 @@ class CTelegramProto : public PROTO<CTelegramProto>
void ProcessBasicGroup(TD::updateBasicGroup *pObj);
void ProcessChat(TD::updateNewChat *pObj);
void ProcessChatLastMessage(TD::updateChatLastMessage *pObj);
+ void ProcessChatNotification(TD::updateChatNotificationSettings *pObj);
void ProcessChatPosition(TD::updateChatPosition *pObj);
void ProcessDeleteMessage(TD::updateDeleteMessages *pObj);
void ProcessFile(TD::updateFile *pObj);
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) {