Add messageSendOptions.update_order_of_installed_sticker_sets.
This commit is contained in:
parent
284dc4428b
commit
16ba2ebfb8
@ -2147,8 +2147,9 @@ messageSchedulingStateSendWhenOnline = MessageSchedulingState;
|
||||
//@disable_notification Pass true to disable notification for the message
|
||||
//@from_background Pass true if the message is sent from the background
|
||||
//@protect_content Pass true if the content of the message must be protected from forwarding and saving; for bots only
|
||||
//@update_order_of_installed_sticker_sets Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum
|
||||
//@scheduling_state Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled
|
||||
messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool scheduling_state:MessageSchedulingState = MessageSendOptions;
|
||||
messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState = MessageSendOptions;
|
||||
|
||||
//@description Options to be used when a message content is copied without reference to the original sender. Service messages and messageInvoice can't be copied
|
||||
//@send_copy True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local
|
||||
|
@ -4762,6 +4762,7 @@ void MessagesManager::Message::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_explicit_sender);
|
||||
STORE_FLAG(has_reactions);
|
||||
STORE_FLAG(has_available_reactions_generation);
|
||||
STORE_FLAG(update_stickersets_order);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -5003,6 +5004,7 @@ void MessagesManager::Message::parse(ParserT &parser) {
|
||||
PARSE_FLAG(has_explicit_sender);
|
||||
PARSE_FLAG(has_reactions);
|
||||
PARSE_FLAG(has_available_reactions_generation);
|
||||
PARSE_FLAG(update_stickersets_order);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
|
||||
@ -25006,6 +25008,7 @@ unique_ptr<MessagesManager::Message> MessagesManager::create_message_to_send(
|
||||
m->is_channel_post = is_channel_post;
|
||||
m->is_outgoing = is_scheduled || dialog_id != DialogId(my_id);
|
||||
m->from_background = options.from_background;
|
||||
m->update_stickersets_order = options.update_stickersets_order;
|
||||
m->noforwards = options.protect_content;
|
||||
m->view_count = is_channel_post && !is_scheduled ? 1 : 0;
|
||||
m->forward_count = 0;
|
||||
@ -25564,7 +25567,7 @@ Result<td_api::object_ptr<td_api::message>> MessagesManager::send_message(
|
||||
TRY_STATUS(can_send_message(dialog_id));
|
||||
TRY_RESULT(message_reply_markup, get_dialog_reply_markup(dialog_id, std::move(reply_markup)));
|
||||
TRY_RESULT(message_content, process_input_message_content(dialog_id, std::move(input_message_content)));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options)));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options), true));
|
||||
TRY_STATUS(can_use_message_send_options(message_send_options, message_content));
|
||||
TRY_STATUS(can_use_top_thread_message_id(d, top_thread_message_id, reply_to_message_id));
|
||||
|
||||
@ -25685,11 +25688,15 @@ Result<MessageCopyOptions> MessagesManager::process_message_copy_options(
|
||||
}
|
||||
|
||||
Result<MessagesManager::MessageSendOptions> MessagesManager::process_message_send_options(
|
||||
DialogId dialog_id, tl_object_ptr<td_api::messageSendOptions> &&options) const {
|
||||
DialogId dialog_id, tl_object_ptr<td_api::messageSendOptions> &&options,
|
||||
bool allow_update_stickersets_order) const {
|
||||
MessageSendOptions result;
|
||||
if (options != nullptr) {
|
||||
result.disable_notification = options->disable_notification_;
|
||||
result.from_background = options->from_background_;
|
||||
if (allow_update_stickersets_order) {
|
||||
result.update_stickersets_order = options->update_order_of_installed_sticker_sets_;
|
||||
}
|
||||
result.protect_content = options->protect_content_;
|
||||
TRY_RESULT_ASSIGN(result.schedule_date, get_message_schedule_date(std::move(options->scheduling_state_)));
|
||||
}
|
||||
@ -25794,7 +25801,7 @@ Result<td_api::object_ptr<td_api::messages>> MessagesManager::send_message_group
|
||||
}
|
||||
|
||||
TRY_STATUS(can_send_message(dialog_id));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options)));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options), true));
|
||||
|
||||
vector<std::pair<unique_ptr<MessageContent>, int32>> message_contents;
|
||||
std::unordered_set<MessageContentType, MessageContentTypeHash> message_content_types;
|
||||
@ -26674,7 +26681,7 @@ Result<MessageId> MessagesManager::send_inline_query_result_message(DialogId dia
|
||||
}
|
||||
|
||||
TRY_STATUS(can_send_message(dialog_id));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options)));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(dialog_id, std::move(options), false));
|
||||
bool to_secret = false;
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
@ -27933,6 +27940,9 @@ int32 MessagesManager::get_message_flags(const Message *m) {
|
||||
if (m->noforwards) {
|
||||
flags |= SEND_MESSAGE_FLAG_NOFORWARDS;
|
||||
}
|
||||
if (m->update_stickersets_order) {
|
||||
flags |= SEND_MESSAGE_FLAG_UPDATE_STICKER_SETS_ORDER;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
@ -28458,7 +28468,7 @@ Result<MessagesManager::ForwardedMessages> MessagesManager::get_forwarded_messag
|
||||
}
|
||||
|
||||
TRY_STATUS(can_send_message(to_dialog_id));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(to_dialog_id, std::move(options)));
|
||||
TRY_RESULT(message_send_options, process_message_send_options(to_dialog_id, std::move(options), false));
|
||||
|
||||
{
|
||||
MessageId last_message_id;
|
||||
@ -28859,7 +28869,8 @@ Result<vector<MessageId>> MessagesManager::resend_messages(DialogId dialog_id, v
|
||||
|
||||
auto need_another_sender =
|
||||
message->send_error_code == 400 && message->send_error_message == CSlice("SEND_AS_PEER_INVALID");
|
||||
MessageSendOptions options(message->disable_notification, message->from_background, message->noforwards,
|
||||
MessageSendOptions options(message->disable_notification, message->from_background,
|
||||
message->update_stickersets_order, message->noforwards,
|
||||
get_message_schedule_date(message.get()));
|
||||
Message *m = get_message_to_send(
|
||||
d, message->top_thread_message_id,
|
||||
@ -29066,6 +29077,7 @@ Result<MessageId> MessagesManager::add_local_message(
|
||||
m->is_outgoing = dialog_id != DialogId(my_id) && sender_user_id == my_id;
|
||||
m->disable_notification = disable_notification;
|
||||
m->from_background = false;
|
||||
m->update_stickersets_order = false;
|
||||
m->view_count = 0;
|
||||
m->forward_count = 0;
|
||||
m->content = std::move(message_content.content);
|
||||
|
@ -1151,6 +1151,7 @@ class MessagesManager final : public Actor {
|
||||
bool has_explicit_sender = false; // for send_message
|
||||
bool is_copy = false; // for send_message
|
||||
bool from_background = false; // for send_message
|
||||
bool update_stickersets_order = false; // for send_message
|
||||
bool disable_web_page_preview = false; // for send_message
|
||||
bool clear_draft = false; // for send_message
|
||||
bool in_game_share = false; // for send_message
|
||||
@ -1721,13 +1722,16 @@ class MessagesManager final : public Actor {
|
||||
struct MessageSendOptions {
|
||||
bool disable_notification = false;
|
||||
bool from_background = false;
|
||||
bool update_stickersets_order = false;
|
||||
bool protect_content = false;
|
||||
int32 schedule_date = 0;
|
||||
|
||||
MessageSendOptions() = default;
|
||||
MessageSendOptions(bool disable_notification, bool from_background, bool protect_content, int32 schedule_date)
|
||||
MessageSendOptions(bool disable_notification, bool from_background, bool update_stickersets_order,
|
||||
bool protect_content, int32 schedule_date)
|
||||
: disable_notification(disable_notification)
|
||||
, from_background(from_background)
|
||||
, update_stickersets_order(update_stickersets_order)
|
||||
, protect_content(protect_content)
|
||||
, schedule_date(schedule_date) {
|
||||
}
|
||||
@ -1881,7 +1885,8 @@ class MessagesManager final : public Actor {
|
||||
tl_object_ptr<td_api::messageCopyOptions> &&options) const;
|
||||
|
||||
Result<MessageSendOptions> process_message_send_options(DialogId dialog_id,
|
||||
tl_object_ptr<td_api::messageSendOptions> &&options) const;
|
||||
tl_object_ptr<td_api::messageSendOptions> &&options,
|
||||
bool allow_update_stickersets_order) const;
|
||||
|
||||
static Status can_use_message_send_options(const MessageSendOptions &options,
|
||||
const unique_ptr<MessageContent> &content, int32 ttl);
|
||||
|
@ -1808,7 +1808,7 @@ class CliClient final : public Actor {
|
||||
bool disable_notification = false, bool from_background = false, int64 reply_to_message_id = 0) {
|
||||
auto id = send_request(td_api::make_object<td_api::sendMessage>(
|
||||
chat_id, as_message_thread_id(message_thread_id_), reply_to_message_id,
|
||||
td_api::make_object<td_api::messageSendOptions>(disable_notification, from_background, true,
|
||||
td_api::make_object<td_api::messageSendOptions>(disable_notification, from_background, true, true,
|
||||
as_message_scheduling_state(schedule_date_)),
|
||||
nullptr, std::move(input_message_content)));
|
||||
if (id != 0) {
|
||||
@ -1817,7 +1817,7 @@ class CliClient final : public Actor {
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::messageSendOptions> default_message_send_options() const {
|
||||
return td_api::make_object<td_api::messageSendOptions>(false, false, false,
|
||||
return td_api::make_object<td_api::messageSendOptions>(false, false, false, true,
|
||||
as_message_scheduling_state(schedule_date_));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user