Skip to content

Commit

Permalink
Minor improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Mar 6, 2023
1 parent 36701d3 commit d4646d4
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 18 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*.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
*.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
*.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
Expand Down
6 changes: 3 additions & 3 deletions td/generate/scheme/td_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -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
//@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",
//-"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",
Expand All @@ -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
//@chat_id Identifier of the chat to which the message belongs
//@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",
//-"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",
Expand Down Expand Up @@ -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
//@sticker_format Format 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
//@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;
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/AttachMenuManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ FileSourceId AttachMenuManager::get_web_app_file_source_id(UserId user_id, const
if (!source_id.is_valid()) {
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;
}

Expand Down
9 changes: 5 additions & 4 deletions td/telegram/AutosaveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

namespace td {

class GetAutosaveSettingsQuery final : public Td::ResultHandler {
class GetAutoSaveSettingsQuery final : public Td::ResultHandler {
Promise<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> promise_;

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)) {
}

Expand Down Expand Up @@ -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) {
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(
Result<telegram_api::object_ptr<telegram_api::account_autoSaveSettings>> r_settings) {
G()->ignore_result_if_closing(r_settings);

CHECK(settings_.are_being_reloaded_);
settings_.are_being_reloaded_ = false;
SCOPE_EXIT {
Expand All @@ -363,7 +365,6 @@ void AutosaveManager::on_get_autosave_settings(
reload_autosave_settings();
}
};
G()->ignore_result_if_closing(r_settings);
if (r_settings.is_error()) {
return fail_promises(load_settings_queries_, r_settings.move_as_error());
}
Expand Down
1 change: 1 addition & 0 deletions td/telegram/EmojiGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/EmojiGroup.h"

#include "td/telegram/StickersManager.h"

#include "td/utils/algorithm.h"
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/FileReferenceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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) {
Expand Down
5 changes: 3 additions & 2 deletions td/telegram/StickersManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
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);
}
reset_to_empty(default_dialog_photo_custom_emoji_ids_load_queries_[for_user]);
return;
}
CHECK(constructor_id == telegram_api::emojiList::ID);
Expand Down
1 change: 0 additions & 1 deletion td/telegram/WebApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

namespace td {

class ContactsManager;
class Td;

class WebApp {
Expand Down
2 changes: 1 addition & 1 deletion tddb/td/db/binlog/BinlogEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Status BinlogEvent::validate() const {
return Status::Error("Too small 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()) {
return Status::Error(PSLICE() << "Size of event changed: " << tag("was", size_) << tag("now", size));
}
Expand Down
2 changes: 1 addition & 1 deletion tdutils/td/utils/port/FileFd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Result<FileFd> FileFd::open(CSlice filepath, int32 flags, int32 mode) {
}
#endif

while (1) {
while (true) {
int native_fd =
detail::skip_eintr([&] { return ::open(filepath.c_str(), native_flags, static_cast<mode_t>(mode)); });
if (native_fd < 0) {
Expand Down
6 changes: 4 additions & 2 deletions tdutils/td/utils/port/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

#include "td/utils/port/config.h"

#if TD_PORT_WINDOWS
#include "td/utils/port/Clocks.h"
#endif

#if TD_PORT_POSIX
#if _POSIX_C_SOURCE >= 199309L
#include <time.h>
#else
#include <unistd.h>
#endif
#else
#include "td/utils/port/Clocks.h"
#endif

namespace td {
Expand Down
2 changes: 1 addition & 1 deletion test/link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ static void parse_internal_link(const td::string &url, td::td_api::object_ptr<td
continue;
}
if (r_link.error().message() == "Deep link is unavailable for the link type") {
// some links are http-only
// some links are HTTP-only
continue;
}
if (r_link.error().message() == "WALLPAPER_INVALID") {
Expand Down

0 comments on commit d4646d4

Please sign in to comment.