Check voice_messages_forbidden for private chats before sending messages.

This commit is contained in:
levlam 2022-07-17 17:15:48 +03:00
parent 45f68d9e06
commit 1f2e8d7c57
1 changed files with 8 additions and 0 deletions

View File

@ -2734,11 +2734,19 @@ Status can_send_message_content(DialogId dialog_id, const MessageContent *conten
if (!permissions.can_send_media()) {
return Status::Error(400, "Not enough rights to send video notes to the chat");
}
if (dialog_type == DialogType::User &&
td->contacts_manager_->get_user_voice_messages_forbidden(dialog_id.get_user_id())) {
return Status::Error(400, "User restricted receiving of voice messages");
}
break;
case MessageContentType::VoiceNote:
if (!permissions.can_send_media()) {
return Status::Error(400, "Not enough rights to send voice notes to the chat");
}
if (dialog_type == DialogType::User &&
td->contacts_manager_->get_user_voice_messages_forbidden(dialog_id.get_user_id())) {
return Status::Error(400, "User restricted receiving of video messages");
}
break;
case MessageContentType::None:
case MessageContentType::ChatCreate: