Add sending_id to messageSendOptions.
This commit is contained in:
parent
439dd7c2ca
commit
1f32ae3dfd
@ -1079,8 +1079,8 @@ unreadReaction type:ReactionType sender_id:MessageSender is_big:Bool = UnreadRea
|
||||
|
||||
//@class MessageSendingState @description Contains information about the sending state of the message
|
||||
|
||||
//@description The message is being sent now, but has not yet been delivered to the server
|
||||
messageSendingStatePending = MessageSendingState;
|
||||
//@description The message is being sent now, but has not yet been delivered to the server @sending_id Non-persistent message sending identifier, specified by the application
|
||||
messageSendingStatePending sending_id:int32 = MessageSendingState;
|
||||
|
||||
//@description The message failed to be sent
|
||||
//@error_code An error code; 0 if unknown
|
||||
@ -2679,7 +2679,8 @@ messageSchedulingStateSendWhenOnline = MessageSchedulingState;
|
||||
//@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 update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState = MessageSendOptions;
|
||||
//@sending_id Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates
|
||||
messageSendOptions disable_notification:Bool from_background:Bool protect_content:Bool update_order_of_installed_sticker_sets:Bool scheduling_state:MessageSchedulingState sending_id:int32 = 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
|
||||
|
@ -25701,7 +25701,7 @@ Result<int32> MessagesManager::get_message_schedule_date(
|
||||
tl_object_ptr<td_api::MessageSendingState> MessagesManager::get_message_sending_state_object(const Message *m) const {
|
||||
CHECK(m != nullptr);
|
||||
if (m->message_id.is_yet_unsent()) {
|
||||
return td_api::make_object<td_api::messageSendingStatePending>();
|
||||
return td_api::make_object<td_api::messageSendingStatePending>(m->sending_id);
|
||||
}
|
||||
if (m->is_failed_to_send) {
|
||||
auto can_retry = can_resend_message(m);
|
||||
@ -26032,6 +26032,7 @@ unique_ptr<MessagesManager::Message> MessagesManager::create_message_to_send(
|
||||
m->content = std::move(content);
|
||||
m->forward_info = std::move(forward_info);
|
||||
m->is_copy = is_copy || m->forward_info != nullptr;
|
||||
m->sending_id = options.sending_id;
|
||||
|
||||
if (td_->auth_manager_->is_bot() || options.disable_notification ||
|
||||
td_->option_manager_->get_option_boolean("ignore_default_disable_notification")) {
|
||||
@ -26720,6 +26721,8 @@ Result<MessagesManager::MessageSendOptions> MessagesManager::process_message_sen
|
||||
result.protect_content = false;
|
||||
}
|
||||
|
||||
result.sending_id = options->sending_id_;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -29895,7 +29898,7 @@ Result<vector<MessageId>> MessagesManager::resend_messages(DialogId dialog_id, v
|
||||
message->send_error_code == 400 && message->send_error_message == CSlice("SEND_AS_PEER_INVALID");
|
||||
MessageSendOptions options(message->disable_notification, message->from_background,
|
||||
message->update_stickersets_order, message->noforwards,
|
||||
get_message_schedule_date(message.get()));
|
||||
get_message_schedule_date(message.get()), message->sending_id);
|
||||
Message *m = get_message_to_send(
|
||||
d, message->top_thread_message_id,
|
||||
get_reply_to_message_id(d, message->top_thread_message_id, message->reply_to_message_id, false), options,
|
||||
|
@ -1138,6 +1138,7 @@ class MessagesManager final : public Actor {
|
||||
int32 date = 0;
|
||||
int32 edit_date = 0;
|
||||
int32 send_date = 0;
|
||||
int32 sending_id = 0;
|
||||
|
||||
int64 random_id = 0;
|
||||
|
||||
@ -1759,15 +1760,17 @@ class MessagesManager final : public Actor {
|
||||
bool update_stickersets_order = false;
|
||||
bool protect_content = false;
|
||||
int32 schedule_date = 0;
|
||||
int32 sending_id = 0;
|
||||
|
||||
MessageSendOptions() = default;
|
||||
MessageSendOptions(bool disable_notification, bool from_background, bool update_stickersets_order,
|
||||
bool protect_content, int32 schedule_date)
|
||||
bool protect_content, int32 schedule_date, int32 sending_id)
|
||||
: disable_notification(disable_notification)
|
||||
, from_background(from_background)
|
||||
, update_stickersets_order(update_stickersets_order)
|
||||
, protect_content(protect_content)
|
||||
, schedule_date(schedule_date) {
|
||||
, schedule_date(schedule_date)
|
||||
, sending_id(sending_id) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -1925,6 +1928,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
static Status can_use_message_send_options(const MessageSendOptions &options,
|
||||
const unique_ptr<MessageContent> &content, int32 ttl);
|
||||
|
||||
static Status can_use_message_send_options(const MessageSendOptions &options, const InputMessageContent &content);
|
||||
|
||||
Status can_use_top_thread_message_id(Dialog *d, MessageId top_thread_message_id, MessageId reply_to_message_id);
|
||||
@ -2014,7 +2018,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Result<td_api::object_ptr<td_api::message>> forward_message(DialogId to_dialog_id, MessageId top_thread_message_id,
|
||||
DialogId from_dialog_id, MessageId message_id,
|
||||
tl_object_ptr<td_api::messageSendOptions> &&options,
|
||||
td_api::object_ptr<td_api::messageSendOptions> &&options,
|
||||
bool in_game_share,
|
||||
MessageCopyOptions &©_options) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
@ -2054,7 +2058,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Result<ForwardedMessages> get_forwarded_messages(DialogId to_dialog_id, MessageId top_thread_message_id,
|
||||
DialogId from_dialog_id, const vector<MessageId> &message_ids,
|
||||
tl_object_ptr<td_api::messageSendOptions> &&options,
|
||||
td_api::object_ptr<td_api::messageSendOptions> &&options,
|
||||
bool in_game_share, vector<MessageCopyOptions> &©_options);
|
||||
|
||||
void do_send_media(DialogId dialog_id, Message *m, FileId file_id, FileId thumbnail_file_id,
|
||||
|
@ -1862,7 +1862,8 @@ class CliClient final : public Actor {
|
||||
auto id = send_request(td_api::make_object<td_api::sendMessage>(
|
||||
chat_id, message_thread_id_, reply_to_message_id,
|
||||
td_api::make_object<td_api::messageSendOptions>(disable_notification, from_background, true, true,
|
||||
as_message_scheduling_state(schedule_date_)),
|
||||
as_message_scheduling_state(schedule_date_),
|
||||
Random::fast(1, 1000)),
|
||||
nullptr, std::move(input_message_content)));
|
||||
if (id != 0) {
|
||||
query_id_to_send_message_info_[id].start_time = Time::now();
|
||||
@ -1870,8 +1871,8 @@ 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, true,
|
||||
as_message_scheduling_state(schedule_date_));
|
||||
return td_api::make_object<td_api::messageSendOptions>(
|
||||
false, false, false, true, as_message_scheduling_state(schedule_date_), Random::fast(1, 1000));
|
||||
}
|
||||
|
||||
void send_get_background_url(td_api::object_ptr<td_api::BackgroundType> &&background_type) {
|
||||
|
Loading…
Reference in New Issue
Block a user