Various fixes.

This commit is contained in:
levlam 2024-03-31 18:30:18 +03:00
parent f577c1564e
commit 020415f736
11 changed files with 21 additions and 17 deletions

View File

@ -7765,7 +7765,7 @@ getChatSponsoredMessages chat_id:int53 = SponsoredMessages;
//@message_id Identifier of the sponsored message //@message_id Identifier of the sponsored message
clickChatSponsoredMessage chat_id:int53 message_id:int53 = Ok; clickChatSponsoredMessage chat_id:int53 message_id:int53 = Ok;
//@description Reports a sponsored message to to Telegram moderators //@description Reports a sponsored message to Telegram moderators
//@chat_id Chat identifier of the sponsored message //@chat_id Chat identifier of the sponsored message
//@message_id Identifier of the sponsored message //@message_id Identifier of the sponsored message
//@option_id Option identifier chosen by the user; leave empty for the initial request //@option_id Option identifier chosen by the user; leave empty for the initial request

View File

@ -8,8 +8,6 @@
#include "td/telegram/ConfigManager.h" #include "td/telegram/ConfigManager.h"
#include "td/utils/misc.h"
namespace td { namespace td {
void Birthdate::init(int32 day, int32 month, int32 year) { void Birthdate::init(int32 day, int32 month, int32 year) {
@ -60,7 +58,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const Birthdate &birthd
if (birthdate.is_empty()) { if (birthdate.is_empty()) {
return string_builder << "unknown birthdate"; return string_builder << "unknown birthdate";
} }
string_builder << "birtdate " << birthdate.get_day() << '.' << birthdate.get_month(); string_builder << "birthdate " << birthdate.get_day() << '.' << birthdate.get_month();
auto year = birthdate.get_year(); auto year = birthdate.get_year();
if (year != 0) { if (year != 0) {
string_builder << '.' << year; string_builder << '.' << year;

View File

@ -11,6 +11,7 @@
#include "td/telegram/ContactsManager.h" #include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/files/FileId.h" #include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileLocation.h"
#include "td/telegram/files/FileManager.h" #include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h" #include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
@ -28,9 +29,13 @@
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h" #include "td/telegram/UserId.h"
#include "td/utils/buffer.h"
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/Random.h" #include "td/utils/Random.h"
#include "td/utils/SliceBuilder.h"
#include <unordered_set>
namespace td { namespace td {
@ -585,7 +590,7 @@ void BusinessConnectionManager::on_get_business_connection(
auto updates = telegram_api::move_object_as<telegram_api::updates>(updates_ptr); auto updates = telegram_api::move_object_as<telegram_api::updates>(updates_ptr);
if (updates->updates_.size() != 1 || updates->updates_[0]->get_id() != telegram_api::updateBotBusinessConnect::ID) { if (updates->updates_.size() != 1 || updates->updates_[0]->get_id() != telegram_api::updateBotBusinessConnect::ID) {
if (updates->updates_.empty()) { if (updates->updates_.empty()) {
return fail_promises(promises, Status::Error(400, "Business connnection not found")); return fail_promises(promises, Status::Error(400, "Business connection not found"));
} }
LOG(ERROR) << "Receive " << to_string(updates); LOG(ERROR) << "Receive " << to_string(updates);
return fail_promises(promises, Status::Error(500, "Receive invalid business connection info")); return fail_promises(promises, Status::Error(500, "Receive invalid business connection info"));
@ -1031,6 +1036,7 @@ void BusinessConnectionManager::send_message_album(
void BusinessConnectionManager::on_upload_message_album_media(int64 request_id, size_t media_pos, void BusinessConnectionManager::on_upload_message_album_media(int64 request_id, size_t media_pos,
Result<UploadMediaResult> &&result) { Result<UploadMediaResult> &&result) {
G()->ignore_result_if_closing(result);
auto it = media_group_send_requests_.find(request_id); auto it = media_group_send_requests_.find(request_id);
CHECK(it != media_group_send_requests_.end()); CHECK(it != media_group_send_requests_.end());
auto &request = it->second; auto &request = it->second;
@ -1047,7 +1053,6 @@ void BusinessConnectionManager::on_upload_message_album_media(int64 request_id,
auto promise = std::move(request.promise_); auto promise = std::move(request.promise_);
media_group_send_requests_.erase(it); media_group_send_requests_.erase(it);
TRY_STATUS_PROMISE(promise, G()->close_status());
for (auto &r_upload_result : upload_results) { for (auto &r_upload_result : upload_results) {
if (r_upload_result.is_error()) { if (r_upload_result.is_error()) {
return promise.set_error(r_upload_result.move_as_error()); return promise.set_error(r_upload_result.move_as_error());

View File

@ -6,10 +6,14 @@
// //
#include "td/telegram/BusinessIntro.h" #include "td/telegram/BusinessIntro.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/Document.h" #include "td/telegram/Document.h"
#include "td/telegram/files/FileManager.h" #include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/misc.h" #include "td/telegram/misc.h"
#include "td/telegram/StickerFormat.h"
#include "td/telegram/StickersManager.h" #include "td/telegram/StickersManager.h"
#include "td/telegram/StickerType.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
namespace td { namespace td {

View File

@ -21,9 +21,9 @@ class BusinessIntro {
public: public:
BusinessIntro() = default; BusinessIntro() = default;
explicit BusinessIntro(Td *td, telegram_api::object_ptr<telegram_api::businessIntro> intro); BusinessIntro(Td *td, telegram_api::object_ptr<telegram_api::businessIntro> intro);
explicit BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessIntro> intro); BusinessIntro(Td *td, td_api::object_ptr<td_api::inputBusinessIntro> intro);
td_api::object_ptr<td_api::businessIntro> get_business_intro_object(Td *td) const; td_api::object_ptr<td_api::businessIntro> get_business_intro_object(Td *td) const;

View File

@ -134,7 +134,7 @@ class GetContactsBirthdaysQuery final : public Td::ResultHandler {
} }
auto ptr = result_ptr.move_as_ok(); auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for GetContactBirthdaysQuery: " << to_string(ptr); LOG(INFO) << "Receive result for GetContactsBirthdaysQuery: " << to_string(ptr);
td_->contacts_manager_->on_get_contact_birthdates(std::move(ptr)); td_->contacts_manager_->on_get_contact_birthdates(std::move(ptr));
} }
@ -5932,7 +5932,7 @@ void ContactsManager::on_get_contact_birthdates(
} }
contact_birthdates_.next_sync_time_ = Time::now() + Random::fast(86400 / 4, 86400 / 3); contact_birthdates_.next_sync_time_ = Time::now() + Random::fast(86400 / 4, 86400 / 3);
td_->contacts_manager_->on_get_users(std::move(birthdays->users_), "on_get_contact_birthdates"); on_get_users(std::move(birthdays->users_), "on_get_contact_birthdates");
vector<std::pair<UserId, Birthdate>> users; vector<std::pair<UserId, Birthdate>> users;
for (auto &contact : birthdays->contacts_) { for (auto &contact : birthdays->contacts_) {
UserId user_id(contact->contact_id_); UserId user_id(contact->contact_id_);

View File

@ -7,16 +7,11 @@
#include "td/telegram/SharedDialog.h" #include "td/telegram/SharedDialog.h"
#include "td/telegram/AuthManager.h" #include "td/telegram/AuthManager.h"
#include "td/telegram/ChannelId.h"
#include "td/telegram/ChatId.h"
#include "td/telegram/ContactsManager.h" #include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/UserId.h" #include "td/telegram/UserId.h"
#include "td/utils/logging.h"
namespace td { namespace td {
SharedDialog::SharedDialog(Td *td, telegram_api::object_ptr<telegram_api::RequestedPeer> &&requested_peer_ptr) { SharedDialog::SharedDialog(Td *td, telegram_api::object_ptr<telegram_api::RequestedPeer> &&requested_peer_ptr) {

View File

@ -22,7 +22,7 @@ class SharedDialog {
public: public:
SharedDialog() = default; SharedDialog() = default;
SharedDialog(DialogId dialog_id) : dialog_id_(dialog_id) { explicit SharedDialog(DialogId dialog_id) : dialog_id_(dialog_id) {
} }
SharedDialog(Td *td, telegram_api::object_ptr<telegram_api::RequestedPeer> &&requested_peer_ptr); SharedDialog(Td *td, telegram_api::object_ptr<telegram_api::RequestedPeer> &&requested_peer_ptr);

View File

@ -8252,10 +8252,10 @@ void Td::on_request(uint64 id, td_api::addStickerToSet &request) {
void Td::on_request(uint64 id, td_api::replaceStickerInSet &request) { void Td::on_request(uint64 id, td_api::replaceStickerInSet &request) {
CLEAN_INPUT_STRING(request.name_); CLEAN_INPUT_STRING(request.name_);
CREATE_OK_REQUEST_PROMISE();
if (request.old_sticker_ == nullptr) { if (request.old_sticker_ == nullptr) {
return send_error_raw(id, 400, "Old sticker must be non-empty"); return send_error_raw(id, 400, "Old sticker must be non-empty");
} }
CREATE_OK_REQUEST_PROMISE();
stickers_manager_->add_sticker_to_set(UserId(request.user_id_), std::move(request.name_), stickers_manager_->add_sticker_to_set(UserId(request.user_id_), std::move(request.name_),
std::move(request.new_sticker_), std::move(request.old_sticker_), std::move(request.new_sticker_), std::move(request.old_sticker_),
std::move(promise)); std::move(promise));

View File

@ -12,6 +12,7 @@
#include "td/telegram/AuthManager.h" #include "td/telegram/AuthManager.h"
#include "td/telegram/AutosaveManager.h" #include "td/telegram/AutosaveManager.h"
#include "td/telegram/BoostManager.h" #include "td/telegram/BoostManager.h"
#include "td/telegram/BusinessConnectionId.h"
#include "td/telegram/BusinessConnectionManager.h" #include "td/telegram/BusinessConnectionManager.h"
#include "td/telegram/CallbackQueriesManager.h" #include "td/telegram/CallbackQueriesManager.h"
#include "td/telegram/CallManager.h" #include "td/telegram/CallManager.h"

View File

@ -17,6 +17,7 @@
#include "td/utils/format.h" #include "td/utils/format.h"
#include "td/utils/Gzip.h" #include "td/utils/Gzip.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
#include "td/utils/Slice.h"
#include "td/utils/Storer.h" #include "td/utils/Storer.h"
namespace td { namespace td {