Minor fixes.

This commit is contained in:
levlam 2023-07-01 16:22:01 +03:00
parent bcf9ff7d43
commit 2bf47d0809
26 changed files with 69 additions and 38 deletions

View File

@ -1247,7 +1247,7 @@ messageSponsorTypePublicChannel chat_id:int53 link:InternalLinkType = MessageSpo
//@description The sponsor is a private channel chat @title Title of the chat @invite_link Invite link for the channel
messageSponsorTypePrivateChannel title:string invite_link:string = MessageSponsorType;
//@description The sponsor is a website @url Url of the website @name Name of the website
//@description The sponsor is a website @url URL of the website @name Name of the website
messageSponsorTypeWebsite url:string name:string = MessageSponsorType;
@ -4886,7 +4886,7 @@ messageLinkInfo is_public:Bool chat_id:int53 message_thread_id:int53 message:mes
//@is_animation True, if the video has no sound
//@minithumbnail Video minithumbnail; may be null
//@thumbnail Video thumbnail in JPEG or MPEG4 format; may be null
//@preload_prefix_size Number of bytes from the video file beginning, which is enough to load to play the video for one second; 0 if unknown
//@preload_prefix_size Size of file prefix, which is supposed to be preloaded, in bytes
//@video File containing the video
storyVideo duration:double width:int32 height:int32 has_stickers:Bool is_animation:Bool minithumbnail:minithumbnail thumbnail:thumbnail preload_prefix_size:int32 video:file = StoryVideo;
@ -4955,7 +4955,7 @@ stories total_count:int32 stories:vector<story> = Stories;
storyInfo story_id:int32 date:int32 = StoryInfo;
//@description Describes active stories sent by the same sender
//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't from a current user's contact
//@list Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list
//@order A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order
//@story_sender_chat_id Identifier of the sender of the stories
//@max_read_story_id Identifier of the last read active story
@ -8221,7 +8221,9 @@ getLanguagePackInfo language_pack_id:string = LanguagePackInfo;
//@keys Language pack keys of the strings to be returned; leave empty to request all available strings
getLanguagePackStrings language_pack_id:string keys:vector<string> = LanguagePackStrings;
//@description Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization @language_pack_id Language pack identifier
//@description Fetches the latest versions of all strings from a language pack in the current localization target from the server.
//-This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization
//@language_pack_id Language pack identifier
synchronizeLanguagePack language_pack_id:string = Ok;
//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization @language_pack_id Identifier of a language pack to be added

View File

@ -315,7 +315,6 @@ class TlWriterCCommon final : public tl::TL_writer {
";\n"
"struct TdVectorVector" +
class_name + ";\n";
;
}
std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name, bool is_proxy,

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/DraftMessage.h"
#include "td/telegram/AccessRights.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessageEntity.h"

View File

@ -52,7 +52,6 @@
#include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h"
#include "td/telegram/net/DcId.h"
#include "td/telegram/OptionManager.h"
#include "td/telegram/OrderInfo.h"
#include "td/telegram/OrderInfo.hpp"
@ -60,7 +59,6 @@
#include "td/telegram/Photo.hpp"
#include "td/telegram/PhotoFormat.h"
#include "td/telegram/PhotoSize.h"
#include "td/telegram/PhotoSizeSource.h"
#include "td/telegram/PollId.h"
#include "td/telegram/PollId.hpp"
#include "td/telegram/PollManager.h"
@ -72,6 +70,7 @@
#include "td/telegram/StickersManager.hpp"
#include "td/telegram/StickerType.h"
#include "td/telegram/StoryFullId.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/telegram_api.h"

View File

@ -22,6 +22,7 @@
#include "td/telegram/secret_api.h"
#include "td/telegram/SecretInputMedia.h"
#include "td/telegram/StickerType.h"
#include "td/telegram/StoryFullId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/TopDialogCategory.h"

View File

@ -7,7 +7,6 @@
#pragma once
#include "td/telegram/MessageEntity.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/MessageInputReplyTo.h"
#include "td/telegram/ReplyMarkup.h"

View File

@ -7,8 +7,12 @@
#include "td/telegram/MessageInputReplyTo.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/Td.h"
#include "td/utils/logging.h"
namespace td {
MessageInputReplyTo::MessageInputReplyTo(const td_api::object_ptr<td_api::MessageReplyTo> &reply_to_ptr) {

View File

@ -9,6 +9,8 @@
#include "td/telegram/FullMessageId.h"
#include "td/telegram/ScheduledServerMessageId.h"
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/UserId.h"
#include "td/utils/logging.h"

View File

@ -9,6 +9,7 @@
#include "td/telegram/ContactsManager.h"
#include "td/utils/algorithm.h"
#include "td/utils/logging.h"
namespace td {

View File

@ -62,6 +62,7 @@
#include "td/telegram/SponsoredMessageManager.h"
#include "td/telegram/StickerPhotoSize.h"
#include "td/telegram/StickerType.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"

View File

@ -27,6 +27,7 @@
#include "td/telegram/SecretChatId.h"
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"

View File

@ -42,7 +42,6 @@
#include "td/utils/misc.h"
#include "td/utils/PathView.h"
#include "td/utils/Random.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/tl_helpers.h"
#include <algorithm>

View File

@ -9,7 +9,6 @@
#include "td/telegram/AnimationsManager.h"
#include "td/telegram/AudiosManager.h"
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/PhotoFormat.h"

View File

@ -9,6 +9,7 @@
#include "td/telegram/DialogId.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/PhotoSize.h"
#include "td/telegram/secret_api.h"
#include "td/telegram/SecretInputMedia.h"

View File

@ -411,19 +411,19 @@ PhotoSize get_web_document_photo_size(FileManager *file_manager, FileType file_t
Result<PhotoSize> get_input_photo_size(FileManager *file_manager, FileId file_id, int32 width, int32 height) {
if (width < 0 || width > 10000) {
return Status::Error(400, "Wrong photo width");
return Status::Error(400, "Width of the photo is too big");
}
if (height < 0 || height > 10000) {
return Status::Error(400, "Wrong photo height");
return Status::Error(400, "Height of the photo is too big");
}
if (width + height > 10000) {
return Status::Error(400, "Photo dimensions are too big");
return Status::Error(400, "Dimensions of the photo are too big");
}
auto file_view = file_manager->get_file_view(file_id);
auto file_size = file_view.size();
if (file_size < 0 || file_size >= 1000000000) {
return Status::Error(400, "Photo is too big");
return Status::Error(400, "Size of the photo is too big");
}
int32 type = 'i';

View File

@ -6,6 +6,7 @@
//
#pragma once
#include "td/telegram/ChannelId.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/FullMessageId.h"
#include "td/telegram/MessageEntity.h"

View File

@ -8,6 +8,7 @@
#include "td/telegram/MinChannel.hpp"
#include "td/telegram/PollManager.h"
#include "td/telegram/UserId.h"
#include "td/telegram/Version.h"
#include "td/utils/algorithm.h"

View File

@ -167,15 +167,21 @@ void PrivacyManager::on_get_user_privacy_settings(UserPrivacySetting user_privac
void PrivacyManager::on_set_user_privacy_settings(UserPrivacySetting user_privacy_setting,
Result<UserPrivacySettingRules> r_privacy_rules,
Promise<Unit> &&promise) {
G()->ignore_result_if_closing(r_privacy_rules);
if (G()->close_flag()) {
auto &info = get_info(user_privacy_setting);
CHECK(info.has_set_query_);
info.has_set_query_ = false;
auto promises = std::move(info.set_promises_);
fail_promises(promises, Global::request_aborted_error());
promise.set_error(Global::request_aborted_error());
return;
}
auto &info = get_info(user_privacy_setting);
CHECK(info.has_set_query_);
info.has_set_query_ = false;
if (r_privacy_rules.is_error()) {
promise.set_error(r_privacy_rules.move_as_error());
if (G()->close_flag()) {
return fail_promises(info.set_promises_, Global::request_aborted_error());
}
} else {
do_update_privacy(user_privacy_setting, r_privacy_rules.move_as_ok(), true);
promise.set_value(Unit());

View File

@ -6,17 +6,21 @@
//
#include "td/telegram/StoryContent.h"
#include "td/telegram/Dimensions.h"
#include "td/telegram/Document.h"
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Photo.h"
#include "td/telegram/PhotoSize.h"
#include "td/telegram/StickersManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/VideosManager.h"
#include "td/utils/common.h"
#include "td/utils/logging.h"
#include <cmath>

View File

@ -11,6 +11,7 @@
#include "td/utils/StringBuilder.h"
#include "td/utils/tl_helpers.h"
#include <limits>
#include <type_traits>
namespace td {

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/StoryManager.h"
#include "td/telegram/AccessRights.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/ConfigManager.h"
#include "td/telegram/ContactsManager.h"
@ -20,20 +21,25 @@
#include "td/telegram/OptionManager.h"
#include "td/telegram/ReportReason.h"
#include "td/telegram/StoryContent.h"
#include "td/telegram/StoryContentType.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UpdatesManager.h"
#include "td/telegram/UserId.h"
#include "td/telegram/WebPagesManager.h"
#include "tddb/td/db/binlog/BinlogEvent.h"
#include "tddb/td/db/binlog/BinlogHelper.h"
#include "td/db/binlog/BinlogEvent.h"
#include "td/db/binlog/BinlogHelper.h"
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Random.h"
#include "td/utils/Status.h"
#include "td/utils/tl_helpers.h"
#include <limits>
namespace td {
@ -471,7 +477,7 @@ class GetStoriesViewsQuery final : public Td::ResultHandler {
}
void on_error(Status status) final {
LOG(INFO) << "Failed to get views of " << story_ids_ << ": " << status;
LOG(INFO) << "Receive error for GetStoriesViewsQuery for " << story_ids_ << ": " << status;
}
};
@ -571,7 +577,6 @@ class StoryManager::SendStoryQuery final : public Td::ResultHandler {
void on_error(Status status) final {
LOG(INFO) << "Receive error for SendStoryQuery: " << status;
if (G()->close_flag() && G()->use_message_database()) {
// do not send error, story will be re-sent after restart
return;
@ -639,16 +644,15 @@ class StoryManager::EditStoryQuery final : public Td::ResultHandler {
void on_error(Status status) final {
LOG(INFO) << "Receive error for EditStoryQuery: " << status;
if (!td_->auth_manager_->is_bot() && status.message() == "STORY_NOT_MODIFIED") {
return td_->story_manager_->on_story_edited(file_id_, std::move(pending_story_), Status::OK());
}
if (G()->close_flag() && G()->use_message_database()) {
// do not send error, story will be edited after restart
return;
}
if (!td_->auth_manager_->is_bot() && status.message() == "STORY_NOT_MODIFIED") {
return td_->story_manager_->on_story_edited(file_id_, std::move(pending_story_), Status::OK());
}
if (begins_with(status.message(), "FILE_PART_") && ends_with(status.message(), "_MISSING")) {
td_->story_manager_->on_send_story_file_part_missing(std::move(pending_story_),
to_integer<int32>(status.message().substr(10)));
@ -855,7 +859,7 @@ StoryManager::ActiveStories *StoryManager::get_active_stories_editable(DialogId
void StoryManager::load_active_stories(const td_api::object_ptr<td_api::StoryList> &story_list_ptr,
Promise<Unit> &&promise) {
if (story_list_ptr == nullptr) {
return promise.set_error(Status::Error(400, "Story list must not be empty"));
return promise.set_error(Status::Error(400, "Story list must be non-empty"));
}
bool is_hidden = story_list_ptr->get_id() == td_api::storyListHidden::ID;
auto &story_list = story_lists_[is_hidden];
@ -1443,7 +1447,7 @@ void StoryManager::get_story_viewers(StoryId story_id, const td_api::messageView
return promise.set_error(Status::Error(400, "Parameter limit must be positive"));
}
if (can_get_story_viewers(story_full_id, story).is_error() || story->interaction_info_.get_view_count() == 0) {
return promise.set_value(td_api::object_ptr<td_api::messageViewers>());
return promise.set_value(td_api::make_object<td_api::messageViewers>());
}
int32 offset_date = 0;
@ -1491,7 +1495,7 @@ void StoryManager::on_get_story_viewers(
StoryFullId story_full_id{owner_dialog_id, story_id};
Story *story = get_story_editable(story_full_id);
if (story == nullptr) {
return promise.set_value(td_api::object_ptr<td_api::messageViewers>());
return promise.set_value(td_api::make_object<td_api::messageViewers>());
}
td_->contacts_manager_->on_get_users(std::move(view_list->users_), "on_get_story_viewers");
@ -1538,7 +1542,7 @@ bool StoryManager::have_story(StoryFullId story_full_id) const {
}
bool StoryManager::have_story_force(StoryFullId story_full_id) const {
// TODO try load story from the database
// TODO try to load story from the database
return have_story(story_full_id);
}

View File

@ -18,7 +18,6 @@
#include "td/telegram/StoryInteractionInfo.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/telegram/UserPrivacySettingRule.h"
#include "td/actor/actor.h"
@ -26,11 +25,15 @@
#include "td/actor/Timeout.h"
#include "td/utils/common.h"
#include "td/utils/FlatHashMap.h"
#include "td/utils/FlatHashSet.h"
#include "td/utils/Promise.h"
#include "td/utils/Status.h"
#include "td/utils/WaitFreeHashMap.h"
#include "td/utils/WaitFreeHashSet.h"
#include <memory>
#include <set>
#include <utility>
namespace td {

View File

@ -54,6 +54,7 @@
#include "td/telegram/StickerSetId.h"
#include "td/telegram/StickersManager.h"
#include "td/telegram/StickerType.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/td_api.h"
@ -1803,13 +1804,13 @@ void UpdatesManager::process_get_difference_updates(
}
void UpdatesManager::on_get_difference(tl_object_ptr<telegram_api::updates_Difference> &&difference_ptr) {
VLOG(get_difference) << "----- END GET DIFFERENCE-----";
running_get_difference_ = false;
if (G()->close_flag()) {
return;
}
VLOG(get_difference) << "----- END GET DIFFERENCE-----";
running_get_difference_ = false;
LOG(DEBUG) << "Result of get difference: " << to_string(difference_ptr);
CHECK(difference_ptr != nullptr);

View File

@ -9,7 +9,6 @@
#include "td/telegram/AnimationsManager.h"
#include "td/telegram/AudiosManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/Dimensions.h"
#include "td/telegram/Document.h"
@ -28,6 +27,7 @@
#include "td/telegram/secret_api.h"
#include "td/telegram/StickersManager.h"
#include "td/telegram/StoryFullId.h"
#include "td/telegram/StoryId.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"

View File

@ -14,6 +14,7 @@
#include "td/telegram/StoryFullId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/telegram/WebPageId.h"
#include "td/actor/actor.h"

View File

@ -141,7 +141,7 @@ static bool is_emoji_element(Slice str) {
bool is_emoji(Slice str) {
size_t i = str.substr(0, MAX_EMOJI_LENGTH + 4).find('\xE2');
if (i == td::Slice::npos) {
if (i == Slice::npos) {
return is_emoji_element(str);
}