diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index bf02834b7..f529b0707 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2849,6 +2849,15 @@ int32 get_message_content_live_location_period(const MessageContent *content) { } } +bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content) { + switch (content->get_type()) { + case MessageContentType::Poll: + return td->poll_manager_->get_poll_is_anonymous(static_cast(content)->poll_id); + default: + return false; + } +} + bool get_message_content_poll_is_closed(const Td *td, const MessageContent *content) { switch (content->get_type()) { case MessageContentType::Poll: diff --git a/td/telegram/MessageContent.h b/td/telegram/MessageContent.h index c911cefbd..411c92527 100644 --- a/td/telegram/MessageContent.h +++ b/td/telegram/MessageContent.h @@ -147,6 +147,8 @@ UserId get_message_content_deleted_user_id(const MessageContent *content); int32 get_message_content_live_location_period(const MessageContent *content); +bool get_message_content_poll_is_anonymous(const Td *td, const MessageContent *content); + bool get_message_content_poll_is_closed(const Td *td, const MessageContent *content); bool has_message_content_web_page(const MessageContent *content); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index e83c91ecb..7008ea894 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -17280,6 +17280,7 @@ Status MessagesManager::can_get_message_viewers(DialogId dialog_id, const Messag if (td_->auth_manager_->is_bot()) { return Status::Error(400, "User is bot"); } + CHECK(m != nullptr); if (!m->is_outgoing) { return Status::Error(400, "Can't get viewers of incoming messages"); } @@ -17331,6 +17332,10 @@ Status MessagesManager::can_get_message_viewers(DialogId dialog_id, const Messag } CHECK(m->message_id.is_server()); + if (m->content->get_type() == MessageContentType::Poll && + get_message_content_poll_is_anonymous(td_, m->content.get())) { + } + return Status::OK(); }