Minor fixes.

This commit is contained in:
levlam 2024-02-07 17:50:57 +03:00
parent 2ca4672a98
commit afb8524392
16 changed files with 28 additions and 17 deletions

View File

@ -6973,7 +6973,7 @@ requestQrCodeAuthentication other_user_ids:vector<int53> = Ok;
//@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration //@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration
//@first_name The first name of the user; 1-64 characters //@first_name The first name of the user; 1-64 characters
//@last_name The last name of the user; 0-64 characters //@last_name The last name of the user; 0-64 characters
//@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contacts list //@disable_notification Pass true to disable notification about the current user joining Telegram for other users that added them to contact list
registerUser first_name:string last_name:string disable_notification:Bool = Ok; registerUser first_name:string last_name:string disable_notification:Bool = Ok;
//@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. //@description Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending.

View File

@ -20,6 +20,7 @@
#include "td/utils/buffer.h" #include "td/utils/buffer.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/tl_helpers.h"
namespace td { namespace td {
@ -171,10 +172,10 @@ class DraftMessageContentVideoNote final : public DraftMessageContent {
return DraftMessageContentType::VideoNote; return DraftMessageContentType::VideoNote;
} }
td_api::object_ptr<td_api::InputMessageContent> get_input_message_content_object() const final { td_api::object_ptr<td_api::InputMessageContent> get_draft_input_message_content_object() const final {
return td_api::make_object<td_api::inputMessageVideoNote>(td_api::make_object<td_api::inputFileLocal>(path_), return td_api::make_object<td_api::inputMessageVideoNote>(td_api::make_object<td_api::inputFileLocal>(path_),
nullptr, duration_, length_, nullptr, duration_, length_,
ttl_.get_message_self_desctruct_type_object()); ttl_.get_message_self_destruct_type_object());
} }
template <class StorerT> template <class StorerT>
@ -247,10 +248,10 @@ class DraftMessageContentVoiceNote final : public DraftMessageContent {
return DraftMessageContentType::VoiceNote; return DraftMessageContentType::VoiceNote;
} }
td_api::object_ptr<td_api::InputMessageContent> get_input_message_content_object() const final { td_api::object_ptr<td_api::InputMessageContent> get_draft_input_message_content_object() const final {
return td_api::make_object<td_api::inputMessageVoiceNote>(td_api::make_object<td_api::inputFileLocal>(path_), return td_api::make_object<td_api::inputMessageVoiceNote>(td_api::make_object<td_api::inputFileLocal>(path_),
duration_, waveform_, nullptr, duration_, waveform_, nullptr,
ttl_.get_message_self_desctruct_type_object()); ttl_.get_message_self_destruct_type_object());
} }
template <class StorerT> template <class StorerT>
@ -396,7 +397,7 @@ void DraftMessage::add_dependencies(Dependencies &dependencies) const {
td_api::object_ptr<td_api::draftMessage> DraftMessage::get_draft_message_object(Td *td) const { td_api::object_ptr<td_api::draftMessage> DraftMessage::get_draft_message_object(Td *td) const {
td_api::object_ptr<td_api::InputMessageContent> input_message_content; td_api::object_ptr<td_api::InputMessageContent> input_message_content;
if (local_content_ != nullptr) { if (local_content_ != nullptr) {
input_message_content = local_content_->get_input_message_content_object(); input_message_content = local_content_->get_draft_input_message_content_object();
} else { } else {
input_message_content = input_message_text_.get_input_message_text_object(); input_message_content = input_message_text_.get_input_message_text_object();
} }

View File

@ -36,7 +36,7 @@ class DraftMessageContent {
virtual DraftMessageContentType get_type() const = 0; virtual DraftMessageContentType get_type() const = 0;
virtual td_api::object_ptr<td_api::InputMessageContent> get_input_message_content_object() const = 0; virtual td_api::object_ptr<td_api::InputMessageContent> get_draft_input_message_content_object() const = 0;
virtual ~DraftMessageContent() = default; virtual ~DraftMessageContent() = default;
}; };

View File

@ -41,7 +41,7 @@ void DraftMessage::store(StorerT &storer) const {
template <class ParserT> template <class ParserT>
void DraftMessage::parse(ParserT &parser) { void DraftMessage::parse(ParserT &parser) {
bool has_legacy_reply_to_message_id; bool has_legacy_reply_to_message_id;
bool has_input_message_text = true; bool has_input_message_text;
bool has_message_input_reply_to = false; bool has_message_input_reply_to = false;
bool has_local_content = false; bool has_local_content = false;
if (parser.version() >= static_cast<int32>(Version::SupportRepliesInOtherChats)) { if (parser.version() >= static_cast<int32>(Version::SupportRepliesInOtherChats)) {
@ -53,6 +53,7 @@ void DraftMessage::parse(ParserT &parser) {
END_PARSE_FLAGS(); END_PARSE_FLAGS();
} else { } else {
has_legacy_reply_to_message_id = true; has_legacy_reply_to_message_id = true;
has_input_message_text = true;
} }
td::parse(date_, parser); td::parse(date_, parser);
if (has_legacy_reply_to_message_id) { if (has_legacy_reply_to_message_id) {

View File

@ -58,7 +58,7 @@ Result<MessageSelfDestructType> MessageSelfDestructType::get_message_self_destru
} }
} }
td_api::object_ptr<td_api::MessageSelfDestructType> MessageSelfDestructType::get_message_self_desctruct_type_object() td_api::object_ptr<td_api::MessageSelfDestructType> MessageSelfDestructType::get_message_self_destruct_type_object()
const { const {
if (is_immediate()) { if (is_immediate()) {
return td_api::make_object<td_api::messageSelfDestructTypeImmediately>(); return td_api::make_object<td_api::messageSelfDestructTypeImmediately>();

View File

@ -10,6 +10,7 @@
#include "td/telegram/td_api.h" #include "td/telegram/td_api.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/Status.h"
#include "td/utils/StringBuilder.h" #include "td/utils/StringBuilder.h"
#include "td/utils/tl_helpers.h" #include "td/utils/tl_helpers.h"
@ -47,7 +48,7 @@ class MessageSelfDestructType {
static Result<MessageSelfDestructType> get_message_self_destruct_type( static Result<MessageSelfDestructType> get_message_self_destruct_type(
td_api::object_ptr<td_api::MessageSelfDestructType> &&self_destruct_type); td_api::object_ptr<td_api::MessageSelfDestructType> &&self_destruct_type);
td_api::object_ptr<td_api::MessageSelfDestructType> get_message_self_desctruct_type_object() const; td_api::object_ptr<td_api::MessageSelfDestructType> get_message_self_destruct_type_object() const;
int32 get_input_ttl() const; int32 get_input_ttl() const;

View File

@ -22672,7 +22672,7 @@ tl_object_ptr<td_api::message> MessagesManager::get_message_object(DialogId dial
auto has_timestamped_media = reply_to == nullptr || m->max_own_media_timestamp >= 0; auto has_timestamped_media = reply_to == nullptr || m->max_own_media_timestamp >= 0;
auto reply_markup = get_reply_markup_object(td_->contacts_manager_.get(), m->reply_markup); auto reply_markup = get_reply_markup_object(td_->contacts_manager_.get(), m->reply_markup);
auto content = get_message_message_content_object(dialog_id, m); auto content = get_message_message_content_object(dialog_id, m);
auto self_destruct_type = m->ttl.get_message_self_desctruct_type_object(); auto self_destruct_type = m->ttl.get_message_self_destruct_type_object();
return td_api::make_object<td_api::message>( return td_api::make_object<td_api::message>(
m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_message_object"), m->message_id.get(), std::move(sender), get_chat_id_object(dialog_id, "get_message_object"),

View File

@ -23,6 +23,7 @@
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/db/SqliteKeyValue.h"
#include "td/db/SqliteKeyValueAsync.h" #include "td/db/SqliteKeyValueAsync.h"
#include "td/utils/algorithm.h" #include "td/utils/algorithm.h"
@ -30,7 +31,9 @@
#include "td/utils/FlatHashSet.h" #include "td/utils/FlatHashSet.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/ScopeGuard.h" #include "td/utils/ScopeGuard.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"
#include "td/utils/tl_helpers.h"
#include <algorithm> #include <algorithm>
#include <type_traits> #include <type_traits>

View File

@ -18,6 +18,7 @@
#include "td/actor/actor.h" #include "td/actor/actor.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/Promise.h" #include "td/utils/Promise.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"
#include "td/utils/StringBuilder.h" #include "td/utils/StringBuilder.h"

View File

@ -12,6 +12,7 @@
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
#include "td/telegram/MessageFullId.h"
#include "td/telegram/MessagesManager.h" #include "td/telegram/MessagesManager.h"
#include "td/telegram/OptionManager.h" #include "td/telegram/OptionManager.h"
#include "td/telegram/ServerMessageId.h" #include "td/telegram/ServerMessageId.h"
@ -20,11 +21,12 @@
#include "td/utils/algorithm.h" #include "td/utils/algorithm.h"
#include "td/utils/buffer.h" #include "td/utils/buffer.h"
#include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashSet.h"
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/misc.h"
#include <limits> #include <algorithm>
namespace td { namespace td {

View File

@ -6,16 +6,21 @@
// //
#pragma once #pragma once
#include "td/telegram/DialogId.h"
#include "td/telegram/MessageId.h" #include "td/telegram/MessageId.h"
#include "td/telegram/MessagesInfo.h" #include "td/telegram/MessagesInfo.h"
#include "td/telegram/SavedMessagesTopicId.h" #include "td/telegram/SavedMessagesTopicId.h"
#include "td/telegram/td_api.h" #include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/actor/actor.h" #include "td/actor/actor.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/Promise.h" #include "td/utils/Promise.h"
#include "td/utils/Status.h"
#include <limits>
#include <set> #include <set>
namespace td { namespace td {

View File

@ -11,7 +11,6 @@
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/HashTableUtils.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"
#include "td/utils/StringBuilder.h" #include "td/utils/StringBuilder.h"

View File

@ -7,7 +7,6 @@
#include "td/telegram/StoryViewer.h" #include "td/telegram/StoryViewer.h"
#include "td/telegram/BlockListId.h" #include "td/telegram/BlockListId.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/MessageSender.h" #include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h" #include "td/telegram/MessagesManager.h"
#include "td/telegram/StoryManager.h" #include "td/telegram/StoryManager.h"

View File

@ -23,7 +23,6 @@
#include "td/mtproto/RSA.h" #include "td/mtproto/RSA.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/misc.h" #include "td/utils/misc.h"
#include "td/utils/port/sleep.h" #include "td/utils/port/sleep.h"

View File

@ -6,6 +6,7 @@
// //
#include "td/utils/tl_parsers.h" #include "td/utils/tl_parsers.h"
#include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/misc.h" #include "td/utils/misc.h"
#include "td/utils/utf8.h" #include "td/utils/utf8.h"

View File

@ -8,7 +8,6 @@
#include "td/utils/buffer.h" #include "td/utils/buffer.h"
#include "td/utils/common.h" #include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/Slice.h" #include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h" #include "td/utils/SliceBuilder.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"