diff options
| -rw-r--r-- | td/generate/scheme/td_api.tl | 2 | ||||
| -rw-r--r-- | td/telegram/MessagesManager.cpp | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 982511c30..e9591a66f 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -6086,7 +6086,7 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool rep //@can_be_forwarded True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options //@can_be_paid True, if the message can be paid using inputInvoiceMessage //@can_be_pinned True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage -//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage +//@can_be_replied True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage. Ephemeral messages can be replied only by other ephemeral messages //@can_be_replied_in_another_chat True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage //@can_be_saved True, if content of the message can be saved locally //@can_be_shared_in_story True, if the message can be shared in a story using inputStoryAreaTypeMessage diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index bdec793d6..79ab4ab3c 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -8110,6 +8110,9 @@ bool MessagesManager::can_forward_message(DialogId from_dialog_id, const Message if (m->message_id.is_scheduled()) { return false; } + if (!is_copy && !m->message_id.is_server()) { + return false; + } switch (from_dialog_id.get_type()) { case DialogType::User: case DialogType::Chat: @@ -8136,6 +8139,9 @@ bool MessagesManager::can_forward_message(DialogId from_dialog_id, const Message bool MessagesManager::can_reply_to_message(const Dialog *d, MessageId message_id, const Message *m) const { CHECK(d != nullptr); auto dialog_id = d->dialog_id; + if (is_ephemeral_message(m)) { + return m->ephemeral_message_id != 0 && !m->is_outgoing; + } if (!td_->auth_manager_->is_bot() && m != nullptr && m->is_topic_message && d->is_forum) { auto forum_topic_id = ForumTopicId::from_top_thread_message_id(m->top_thread_message_id); if (!td_->forum_topic_manager_->can_send_message_to_forum_topic(dialog_id, forum_topic_id)) { @@ -15158,6 +15164,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa message_id = m->message_id; bool can_delete = can_delete_message(dialog_id, m); + bool is_ephemeral = is_ephemeral_message(m); bool is_scheduled = message_id.is_scheduled(); bool is_from_saved_messages = (dialog_id == td_->dialog_manager_->get_my_dialog_id()); bool can_delete_for_self = false; @@ -15183,6 +15190,10 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa can_delete_for_self = is_from_saved_messages; can_delete_for_all_users = !can_delete_for_self; } + if (is_ephemeral) { + can_delete_for_self = m->ephemeral_message_id == 0; + can_delete_for_all_users = !can_delete_for_self; + } auto is_bot = td_->auth_manager_->is_bot(); auto can_add_offer = can_add_message_offer(dialog_id, m); |
