summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
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) {