Minor improvements.

This commit is contained in:
levlam 2023-03-06 16:59:18 +03:00
parent 36701d3acd
commit d4646d4cd9
12 changed files with 21 additions and 18 deletions

1
.gitattributes vendored
View File

@ -10,7 +10,6 @@
*.sh text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=lf *.sh text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=lf
*.php text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.php text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.ps1 text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf *.ps1 text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent eol=crlf
*.yml text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.cmake text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.cmake text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.md text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.md text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent
*.in text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent *.in text whitespace=blank-at-eol,space-before-tab,blank-at-eof,tab-in-indent

View File

@ -6145,7 +6145,7 @@ getMessageLinkInfo url:string = MessageLinkInfo;
//@description Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved //@description Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved
//@text Text to translate //@text Text to translate
//@to_language_code ISO language code of the language to which the message is translated. Must be one of //@to_language_code Language code of the language to which the message is translated. Must be one of
//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", //-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et",
//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", //-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko",
//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", //-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr",
@ -6155,7 +6155,7 @@ translateText text:formattedText to_language_code:string = FormattedText;
//@description Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved //@description Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved
//@chat_id Identifier of the chat to which the message belongs //@chat_id Identifier of the chat to which the message belongs
//@message_id Identifier of the message //@message_id Identifier of the message
//@to_language_code ISO language code of the language to which the message is translated. Must be one of //@to_language_code Language code of the language to which the message is translated. Must be one of
//-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", //-"af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et",
//-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", //-"fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko",
//-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", //-"ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr",
@ -8070,7 +8070,7 @@ checkStickerSetName name:string = CheckStickerSetNameResult;
//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_<bot username>"* (*<bot_username>* is case insensitive) for bots; 1-64 characters //@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_<bot username>"* (*<bot_username>* is case insensitive) for bots; 1-64 characters
//@sticker_format Format of the stickers in the set //@sticker_format Format of the stickers in the set
//@sticker_type Type of the stickers in the set //@sticker_type Type of the stickers in the set
//@needs_repainting True, if stickers in the sticker set must be repainted; for custom emoji sticker sets only //@needs_repainting Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only
//@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown //@stickers List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown
//@source Source of the sticker set; may be empty if unknown //@source Source of the sticker set; may be empty if unknown
createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector<inputSticker> source:string = StickerSet; createNewStickerSet user_id:int53 title:string name:string sticker_format:StickerFormat sticker_type:StickerType needs_repainting:Bool stickers:vector<inputSticker> source:string = StickerSet;

View File

@ -1161,7 +1161,7 @@ FileSourceId AttachMenuManager::get_web_app_file_source_id(UserId user_id, const
if (!source_id.is_valid()) { if (!source_id.is_valid()) {
source_id = td_->file_reference_manager_->create_web_app_file_source(user_id, short_name); source_id = td_->file_reference_manager_->create_web_app_file_source(user_id, short_name);
} }
VLOG(file_references) << "Return " << source_id << " for web app " << user_id << '/' << short_name; VLOG(file_references) << "Return " << source_id << " for Web App " << user_id << '/' << short_name;
return source_id; return source_id;
} }

View File

@ -19,11 +19,11 @@
namespace td { namespace td {
class GetAutosaveSettingsQuery final : public Td::ResultHandler { class GetAutoSaveSettingsQuery final : public Td::ResultHandler {
Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> promise_; Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> promise_;
public: public:
explicit GetAutosaveSettingsQuery(Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> &&promise) explicit GetAutoSaveSettingsQuery(Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> &&promise)
: promise_(std::move(promise)) { : promise_(std::move(promise)) {
} }
@ -350,11 +350,13 @@ void AutosaveManager::reload_autosave_settings() {
[actor_id = actor_id(this)](Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) { [actor_id = actor_id(this)](Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) {
send_closure(actor_id, &AutosaveManager::on_get_autosave_settings, std::move(r_settings)); send_closure(actor_id, &AutosaveManager::on_get_autosave_settings, std::move(r_settings));
}); });
td_->create_handler<GetAutosaveSettingsQuery>(std::move(query_promise))->send(); td_->create_handler<GetAutoSaveSettingsQuery>(std::move(query_promise))->send();
} }
void AutosaveManager::on_get_autosave_settings( void AutosaveManager::on_get_autosave_settings(
Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) { Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) {
G()->ignore_result_if_closing(r_settings);
CHECK(settings_.are_being_reloaded_); CHECK(settings_.are_being_reloaded_);
settings_.are_being_reloaded_ = false; settings_.are_being_reloaded_ = false;
SCOPE_EXIT { SCOPE_EXIT {
@ -363,7 +365,6 @@ void AutosaveManager::on_get_autosave_settings(
reload_autosave_settings(); reload_autosave_settings();
} }
}; };
G()->ignore_result_if_closing(r_settings);
if (r_settings.is_error()) { if (r_settings.is_error()) {
return fail_promises(load_settings_queries_, r_settings.move_as_error()); return fail_promises(load_settings_queries_, r_settings.move_as_error());
} }

View File

@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// //
#include "td/telegram/EmojiGroup.h" #include "td/telegram/EmojiGroup.h"
#include "td/telegram/StickersManager.h" #include "td/telegram/StickersManager.h"
#include "td/utils/algorithm.h" #include "td/utils/algorithm.h"

View File

@ -158,7 +158,7 @@ FileSourceId FileReferenceManager::create_attach_menu_bot_file_source(UserId use
FileSourceId FileReferenceManager::create_web_app_file_source(UserId user_id, const string &short_name) { FileSourceId FileReferenceManager::create_web_app_file_source(UserId user_id, const string &short_name) {
FileSourceWebApp source{user_id, short_name}; FileSourceWebApp source{user_id, short_name};
return add_file_source_id(source, PSLICE() << "web app " << user_id << '/' << short_name); return add_file_source_id(source, PSLICE() << "Web App " << user_id << '/' << short_name);
} }
FileReferenceManager::Node &FileReferenceManager::add_node(NodeId node_id) { FileReferenceManager::Node &FileReferenceManager::add_node(NodeId node_id) {

View File

@ -6792,10 +6792,11 @@ void StickersManager::on_get_default_dialog_photo_custom_emoji_ids(
if (!are_default_dialog_photo_custom_emoji_ids_loaded_[for_user]) { if (!are_default_dialog_photo_custom_emoji_ids_loaded_[for_user]) {
on_get_default_dialog_photo_custom_emoji_ids_success(for_user, {}, 0); on_get_default_dialog_photo_custom_emoji_ids_success(for_user, {}, 0);
} }
for (auto &promise : default_dialog_photo_custom_emoji_ids_load_queries_[for_user]) { auto promises = std::move(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
reset_to_empty(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
for (auto &promise : promises) {
CHECK(!promise); CHECK(!promise);
} }
reset_to_empty(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
return; return;
} }
CHECK(constructor_id == telegram_api::emojiList::ID); CHECK(constructor_id == telegram_api::emojiList::ID);

View File

@ -18,7 +18,6 @@
namespace td { namespace td {
class ContactsManager;
class Td; class Td;
class WebApp { class WebApp {

View File

@ -38,7 +38,7 @@ Status BinlogEvent::validate() const {
return Status::Error("Too small event"); return Status::Error("Too small event");
} }
TlParser parser(as_slice(raw_event_)); TlParser parser(as_slice(raw_event_));
uint32 size = static_cast<uint32>(parser.fetch_int()); auto size = static_cast<uint32>(parser.fetch_int());
if (size_ != size || size_ != raw_event_.size()) { if (size_ != size || size_ != raw_event_.size()) {
return Status::Error(PSLICE() << "Size of event changed: " << tag("was", size_) << tag("now", size)); return Status::Error(PSLICE() << "Size of event changed: " << tag("was", size_) << tag("now", size));
} }

View File

@ -157,7 +157,7 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
} }
#endif #endif
while (1) { while (true) {
int native_fd = int native_fd =
detail::skip_eintr([&] { return ::open(filepath.c_str(), native_flags, static_cast<mode_t>(mode)); }); detail::skip_eintr([&] { return ::open(filepath.c_str(), native_flags, static_cast<mode_t>(mode)); });
if (native_fd < 0) { if (native_fd < 0) {

View File

@ -8,14 +8,16 @@
#include "td/utils/port/config.h" #include "td/utils/port/config.h"
#if TD_PORT_WINDOWS
#include "td/utils/port/Clocks.h"
#endif
#if TD_PORT_POSIX #if TD_PORT_POSIX
#if _POSIX_C_SOURCE >= 199309L #if _POSIX_C_SOURCE >= 199309L
#include <time.h> #include <time.h>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
#else
#include "td/utils/port/Clocks.h"
#endif #endif
namespace td { namespace td {

View File

@ -112,7 +112,7 @@ static void parse_internal_link(const td::string &url, td::td_api::object_ptr<td
continue; continue;
} }
if (r_link.error().message() == "Deep link is unavailable for the link type") { if (r_link.error().message() == "Deep link is unavailable for the link type") {
// some links are http-only // some links are HTTP-only
continue; continue;
} }
if (r_link.error().message() == "WALLPAPER_INVALID") { if (r_link.error().message() == "WALLPAPER_INVALID") {