Add is_supported_reply_message_content.
This commit is contained in:
parent
092144cf43
commit
b7f5949b98
@ -303,6 +303,8 @@ bool is_service_message_content(MessageContentType content_type) {
|
|||||||
case MessageContentType::Contact:
|
case MessageContentType::Contact:
|
||||||
case MessageContentType::Dice:
|
case MessageContentType::Dice:
|
||||||
case MessageContentType::Document:
|
case MessageContentType::Document:
|
||||||
|
case MessageContentType::ExpiredPhoto:
|
||||||
|
case MessageContentType::ExpiredVideo:
|
||||||
case MessageContentType::Game:
|
case MessageContentType::Game:
|
||||||
case MessageContentType::Giveaway:
|
case MessageContentType::Giveaway:
|
||||||
case MessageContentType::GiveawayWinners:
|
case MessageContentType::GiveawayWinners:
|
||||||
@ -319,8 +321,6 @@ bool is_service_message_content(MessageContentType content_type) {
|
|||||||
case MessageContentType::Video:
|
case MessageContentType::Video:
|
||||||
case MessageContentType::VideoNote:
|
case MessageContentType::VideoNote:
|
||||||
case MessageContentType::VoiceNote:
|
case MessageContentType::VoiceNote:
|
||||||
case MessageContentType::ExpiredPhoto:
|
|
||||||
case MessageContentType::ExpiredVideo:
|
|
||||||
return false;
|
return false;
|
||||||
case MessageContentType::ChatCreate:
|
case MessageContentType::ChatCreate:
|
||||||
case MessageContentType::ChatChangeTitle:
|
case MessageContentType::ChatChangeTitle:
|
||||||
@ -369,6 +369,40 @@ bool is_service_message_content(MessageContentType content_type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_supported_reply_message_content(MessageContentType content_type) {
|
||||||
|
// update documentation when the list changes
|
||||||
|
switch (content_type) {
|
||||||
|
case MessageContentType::Animation:
|
||||||
|
case MessageContentType::Audio:
|
||||||
|
case MessageContentType::Contact:
|
||||||
|
case MessageContentType::Dice:
|
||||||
|
case MessageContentType::Document:
|
||||||
|
case MessageContentType::Game:
|
||||||
|
case MessageContentType::Giveaway:
|
||||||
|
case MessageContentType::GiveawayWinners:
|
||||||
|
case MessageContentType::Invoice:
|
||||||
|
case MessageContentType::Location:
|
||||||
|
case MessageContentType::Photo:
|
||||||
|
case MessageContentType::Poll:
|
||||||
|
case MessageContentType::Sticker:
|
||||||
|
case MessageContentType::Story:
|
||||||
|
case MessageContentType::Text:
|
||||||
|
case MessageContentType::Unsupported:
|
||||||
|
case MessageContentType::Venue:
|
||||||
|
case MessageContentType::Video:
|
||||||
|
case MessageContentType::VideoNote:
|
||||||
|
case MessageContentType::VoiceNote:
|
||||||
|
return true;
|
||||||
|
case MessageContentType::ExpiredPhoto:
|
||||||
|
case MessageContentType::ExpiredVideo:
|
||||||
|
case MessageContentType::LiveLocation:
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool can_have_message_content_caption(MessageContentType content_type) {
|
bool can_have_message_content_caption(MessageContentType content_type) {
|
||||||
switch (content_type) {
|
switch (content_type) {
|
||||||
case MessageContentType::Animation:
|
case MessageContentType::Animation:
|
||||||
|
@ -90,6 +90,8 @@ bool is_secret_message_content(int32 ttl, MessageContentType content_type);
|
|||||||
|
|
||||||
bool is_service_message_content(MessageContentType content_type);
|
bool is_service_message_content(MessageContentType content_type);
|
||||||
|
|
||||||
|
bool is_supported_reply_message_content(MessageContentType content_type);
|
||||||
|
|
||||||
bool can_have_message_content_caption(MessageContentType content_type);
|
bool can_have_message_content_caption(MessageContentType content_type);
|
||||||
|
|
||||||
uint64 get_message_content_chain_id(MessageContentType content_type);
|
uint64 get_message_content_chain_id(MessageContentType content_type);
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/Dependencies.h"
|
#include "td/telegram/Dependencies.h"
|
||||||
#include "td/telegram/MessageContent.h"
|
#include "td/telegram/MessageContent.h"
|
||||||
#include "td/telegram/MessageContentType.h"
|
|
||||||
#include "td/telegram/MessageCopyOptions.h"
|
#include "td/telegram/MessageCopyOptions.h"
|
||||||
#include "td/telegram/MessageFullId.h"
|
#include "td/telegram/MessageFullId.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
@ -108,32 +107,7 @@ RepliedMessageInfo::RepliedMessageInfo(Td *td, tl_object_ptr<telegram_api::messa
|
|||||||
content_ = get_message_content(td, FormattedText(), std::move(reply_header->reply_media_), dialog_id,
|
content_ = get_message_content(td, FormattedText(), std::move(reply_header->reply_media_), dialog_id,
|
||||||
origin_date_, true, UserId(), nullptr, nullptr, "messageReplyHeader");
|
origin_date_, true, UserId(), nullptr, nullptr, "messageReplyHeader");
|
||||||
CHECK(content_ != nullptr);
|
CHECK(content_ != nullptr);
|
||||||
switch (content_->get_type()) {
|
if (!is_supported_reply_message_content(content_->get_type())) {
|
||||||
case MessageContentType::Animation:
|
|
||||||
case MessageContentType::Audio:
|
|
||||||
case MessageContentType::Contact:
|
|
||||||
case MessageContentType::Dice:
|
|
||||||
case MessageContentType::Document:
|
|
||||||
// case MessageContentType::ExpiredPhoto:
|
|
||||||
// case MessageContentType::ExpiredVideo:
|
|
||||||
case MessageContentType::Game:
|
|
||||||
case MessageContentType::Giveaway:
|
|
||||||
case MessageContentType::GiveawayWinners:
|
|
||||||
case MessageContentType::Invoice:
|
|
||||||
// case MessageContentType::LiveLocation:
|
|
||||||
case MessageContentType::Location:
|
|
||||||
case MessageContentType::Photo:
|
|
||||||
case MessageContentType::Poll:
|
|
||||||
case MessageContentType::Sticker:
|
|
||||||
case MessageContentType::Story:
|
|
||||||
case MessageContentType::Text:
|
|
||||||
case MessageContentType::Unsupported:
|
|
||||||
case MessageContentType::Venue:
|
|
||||||
case MessageContentType::Video:
|
|
||||||
case MessageContentType::VideoNote:
|
|
||||||
case MessageContentType::VoiceNote:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(ERROR) << "Receive reply with media of the type " << content_->get_type();
|
LOG(ERROR) << "Receive reply with media of the type " << content_->get_type();
|
||||||
content_ = nullptr;
|
content_ = nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user