diff --git a/td/mtproto/RawConnection.h b/td/mtproto/RawConnection.h index 5736c1daa..3c989c412 100644 --- a/td/mtproto/RawConnection.h +++ b/td/mtproto/RawConnection.h @@ -124,7 +124,7 @@ class RawConnection { Status do_flush(const AuthKey &auth_key, Callback &callback) TD_WARN_UNUSED_RESULT { if (has_error_) { - return Status::Error("Connection already failed"); + return Status::Error("Connection has already failed"); } // read/write diff --git a/td/mtproto/SessionConnection.cpp b/td/mtproto/SessionConnection.cpp index d21bcb1dc..c53e8107f 100644 --- a/td/mtproto/SessionConnection.cpp +++ b/td/mtproto/SessionConnection.cpp @@ -156,10 +156,10 @@ namespace mtproto { * 2: message not received (msg_id in stored range) * 3: message not receiver (msg_id is too high) * 4: message received. No extra ack will be sent - * +8: message already acknowledged - * +16: message not requiring acknolegement - * +32: RPC query contained in message being processed or processing already complete - * +64: content-related response to message already generated + * +8: message is already acknowledged + * +16: message don't requires acknowledgement + * +32: RPC query contained in message being processed or the processing has already been completed + * +64: content-related response to message has already been generated * +128: other party knows for a fact that message is already received * * 13. Voluntary Communication of Status of Messages diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index fd2f7fe59..75a631a04 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -3184,7 +3184,7 @@ void ContactsManager::load_contacts(Promise &&promise) { reload_contacts(true); } } else { - LOG(INFO) << "Load contacts request was already sent"; + LOG(INFO) << "Load contacts request has already been sent"; } } @@ -3227,7 +3227,7 @@ std::pair, vector> ContactsManager::import_contacts( LOG(INFO) << "Asked to import " << contacts.size() << " contacts with random_id = " << random_id; if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = imported_contacts_.find(random_id); CHECK(it != imported_contacts_.end()); auto result = std::move(it->second); @@ -3322,7 +3322,7 @@ void ContactsManager::load_imported_contacts(Promise &&promise) { send_closure_later(G()->contacts_manager(), &ContactsManager::on_load_imported_contacts_from_database, string()); } } else { - LOG(INFO) << "Load imported contacts request was already sent"; + LOG(INFO) << "Load imported contacts request has already been sent"; } } @@ -3382,7 +3382,7 @@ std::pair, vector> ContactsManager::change_imported_contac LOG(INFO) << "Asked to change imported contacts to a list of " << contacts.size() << " contacts with random_id = " << random_id; if (random_id != 0) { - // request was already sent before + // request has already been sent before CHECK(are_imported_contacts_changing_); are_imported_contacts_changing_ = false; @@ -8280,7 +8280,7 @@ bool ContactsManager::get_channel_full(ChannelId channel_id, Promise &&pro send_get_channel_full_query(channel_id, std::move(input_channel), std::move(promise)); return false; } else { - // request was already sent in get_channel_full + // request has already been sent in get_channel_full // send_get_channel_full_query(channel_id, std::move(input_channel), Auto()); } } @@ -8488,7 +8488,7 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id, bool force, Promise &&promise) { LOG(INFO) << "Trying to get " << user_id << " as member of " << channel_id; if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = received_channel_participant_.find(random_id); CHECK(it != received_channel_participant_.end()); auto result = std::move(it->second); @@ -8548,7 +8548,7 @@ std::pair> ContactsManager::get_channel_partici ChannelId channel_id, const tl_object_ptr &filter, int32 offset, int32 limit, int64 &random_id, bool force, Promise &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = received_channel_participants_.find(random_id); CHECK(it != received_channel_participants_.end()); auto result = std::move(it->second); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5acdf8371..4e4f9c80e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -6059,9 +6059,9 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptrfile_manager_->upload(file_id, nullptr, 0, 0); - LOG(INFO) << "Message with a media is already deleted"; + LOG(INFO) << "Message with a media has already been deleted"; return; } @@ -6231,9 +6231,9 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id, Message *m = get_message(full_message_id); if (m == nullptr) { - // message is already deleted by the user or sent to inaccessible channel, do not need to send it + // message has already been deleted by the user or sent to inaccessible channel, do not need to send it // thumbnail file upload should be already cancelled in cancel_send_message_query - LOG(ERROR) << "Message with a media is already deleted"; + LOG(ERROR) << "Message with a media has already been deleted"; return; } @@ -6360,7 +6360,7 @@ void MessagesManager::after_get_difference() { } for (auto &it : update_message_ids_) { - // this is impossible for ordinary chats because updates coming during getDifference are already applied + // this is impossible for ordinary chats because updates coming during getDifference have already been applied auto dialog_id = it.first.get_dialog_id(); switch (dialog_id.get_type()) { case DialogType::Channel: @@ -7422,7 +7422,7 @@ void MessagesManager::delete_dialog_history(DialogId dialog_id, bool remove_from delete_all_dialog_messages(d, remove_from_dialog_list, true); if (last_new_message_id.is_valid() && last_new_message_id == d->max_unavailable_message_id) { - // history was already cleared, nothing to do + // history has already been cleared, nothing to do promise.set_value(Unit()); return; } @@ -7997,7 +7997,7 @@ void MessagesManager::read_history_inbox(DialogId dialog_id, MessageId max_messa } if (d->is_last_read_inbox_message_id_inited && max_message_id.get() <= d->last_read_inbox_message_id.get()) { LOG(INFO) << "Receive read inbox update in " << dialog_id << " up to " << max_message_id << " from " << source - << ", but all messages are already read up to " << d->last_read_inbox_message_id; + << ", but all messages have already been read up to " << d->last_read_inbox_message_id; return; } @@ -8075,8 +8075,8 @@ void MessagesManager::read_history_outbox(DialogId dialog_id, MessageId max_mess return; } if (max_message_id.get() <= d->last_read_outbox_message_id.get()) { - LOG(INFO) << "Receive read outbox update up to " << max_message_id << ", but all messages are already read up to " - << d->last_read_outbox_message_id; + LOG(INFO) << "Receive read outbox update up to " << max_message_id + << ", but all messages have already been read up to " << d->last_read_outbox_message_id; return; } @@ -9419,7 +9419,7 @@ std::pair> MessagesManager::creat auto content_id = message->content->get_id(); if (content_id == MessageExpiredPhoto::ID || content_id == MessageExpiredVideo::ID) { - CHECK(message->ttl == 0); // ttl is ignored/set to 0 if the message is already expired + CHECK(message->ttl == 0); // ttl is ignored/set to 0 if the message has already been expired if (message->reply_markup != nullptr) { if (message->reply_markup->type != ReplyMarkup::Type::InlineKeyboard) { message->had_reply_markup = true; @@ -9499,7 +9499,7 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f delete_message(d, old_message_id, false, &need_update_dialog_pos, "add sent message"); if (old_message == nullptr) { // message has already been deleted by the user or sent to inaccessible channel - // don't need to send update to the user, because the message is already deleted + // don't need to send update to the user, because the message has already been deleted LOG(INFO) << "Delete already deleted sent " << new_message->message_id << " from server"; delete_messages_from_server(dialog_id, {new_message->message_id}, true, 0, Auto()); return FullMessageId(); @@ -9769,14 +9769,14 @@ void MessagesManager::on_update_sent_text_message(int64 random_id, auto it = being_sent_messages_.find(random_id); if (it == being_sent_messages_.end()) { - // result of sending message already received through getDifference + // result of sending message has already been received through getDifference return; } auto dialog_id = it->second.get_dialog_id(); auto m = get_message_force(it->second); if (m == nullptr) { - // message was already deleted + // message has already been deleted return; } @@ -9837,7 +9837,7 @@ void MessagesManager::on_update_message_web_page(FullMessageId full_message_id, CHECK(content_type == MessageText::ID); auto content = static_cast(message->content.get()); if (!content->web_page_id.is_valid()) { - // webpage was already received as empty + // webpage has already been received as empty LOG_IF(ERROR, have_web_page) << "Receive earlier not received web page"; return; } @@ -10581,7 +10581,7 @@ void MessagesManager::load_dialog_list(Promise &&promise) { auto &multipromise = load_dialog_list_multipromise_; multipromise.add_promise(std::move(promise)); if (multipromise.promise_count() != 1) { - // queries are already sent, just wait for the result + // queries have already been sent, just wait for the result return; } @@ -11648,7 +11648,7 @@ DialogId MessagesManager::create_new_group_chat(const vector &user_ids, LOG(INFO) << "Trying to create group chat \"" << title << "\" with members " << format::as_array(user_ids); if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = created_dialogs_.find(random_id); CHECK(it != created_dialogs_.end()); auto dialog_id = it->second; @@ -11701,7 +11701,7 @@ DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_m << "\" and description \"" << description << "\""; if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = created_dialogs_.find(random_id); CHECK(it != created_dialogs_.end()); auto dialog_id = it->second; @@ -12611,7 +12611,7 @@ std::pair> MessagesManager::search_dialog_messages( int32 limit, const tl_object_ptr &filter, int64 &random_id, bool use_db, Promise &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = found_dialog_messages_.find(random_id); if (it != found_dialog_messages_.end()) { auto result = std::move(it->second); @@ -12746,7 +12746,7 @@ std::pair> MessagesManager::search_call_messages(Me bool only_missed, int64 &random_id, bool use_db, Promise &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = found_call_messages_.find(random_id); if (it != found_call_messages_.end()) { auto result = std::move(it->second); @@ -12822,7 +12822,7 @@ std::pair> MessagesManager::search_dialog_recent_locati int64 &random_id, Promise &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = found_dialog_recent_location_messages_.find(random_id); CHECK(it != found_dialog_recent_location_messages_.end()); auto result = std::move(it->second); @@ -13061,7 +13061,7 @@ std::pair> MessagesManager::offline_search_messages DialogId dialog_id, const string &query, int64 from_search_id, int32 limit, const tl_object_ptr &filter, int64 &random_id, Promise<> &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = found_fts_messages_.find(random_id); CHECK(it != found_fts_messages_.end()); auto result = std::move(it->second); @@ -13169,7 +13169,7 @@ std::pair> MessagesManager::search_messages(const s MessageId offset_message_id, int32 limit, int64 &random_id, Promise &&promise) { if (random_id != 0) { - // request was already sent before + // request has already been sent before auto it = found_messages_.find(random_id); CHECK(it != found_messages_.end()); auto result = std::move(it->second); @@ -15885,7 +15885,7 @@ void MessagesManager::on_secret_message_media_uploaded(DialogId dialog_id, Messa } */ // TODO use file_id, thumbnail_file_id, invalidate partial remote location for file_id in case of failed upload - // even message is already deleted + // even message has already been deleted on_media_message_ready_to_send( dialog_id, m->message_id, PromiseCreator::lambda([this, dialog_id, secret_input_media = std::move(secret_input_media), file_id, @@ -15914,8 +15914,8 @@ void MessagesManager::on_upload_message_media_success(DialogId dialog_id, Messag Message *m = get_message(d, message_id); if (m == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send error to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send error to the user, because the message has already been deleted // and there is nothing to be deleted from the server LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << FullMessageId{dialog_id, message_id}; @@ -15948,8 +15948,8 @@ void MessagesManager::on_upload_message_media_file_part_missing(DialogId dialog_ Message *m = get_message(d, message_id); if (m == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send error to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send error to the user, because the message has already been deleted // and there is nothing to be deleted from the server LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << FullMessageId{dialog_id, message_id}; @@ -15973,8 +15973,8 @@ void MessagesManager::on_upload_message_media_fail(DialogId dialog_id, MessageId Message *m = get_message(d, message_id); if (m == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send error to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send error to the user, because the message has already been deleted // and there is nothing to be deleted from the server LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << FullMessageId{dialog_id, message_id}; @@ -18125,8 +18125,8 @@ FullMessageId MessagesManager::on_send_message_success(int64 random_id, MessageI bool need_update_dialog_pos = false; unique_ptr sent_message = delete_message(d, old_message_id, false, &need_update_dialog_pos, source); if (sent_message == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send update to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send update to the user, because the message has already been deleted LOG(INFO) << "Delete already deleted sent " << new_message_id << " from server"; delete_messages_from_server(dialog_id, {new_message_id}, true, 0, Auto()); return {}; @@ -18306,8 +18306,8 @@ void MessagesManager::on_send_message_file_part_missing(int64 random_id, int bad Message *m = get_message(full_message_id); if (m == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send error to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send error to the user, because the message has already been deleted // and there is nothing to be deleted from the server LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << full_message_id; return; @@ -18378,8 +18378,8 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) { Message *m = get_message(full_message_id); if (m == nullptr) { - // message already deleted by the user or sent to inaccessible channel - // don't need to send error to the user, because the message is already deleted + // message has already been deleted by the user or sent to inaccessible channel + // don't need to send error to the user, because the message has already been deleted // and there is nothing to be deleted from the server LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << full_message_id; return; @@ -18401,7 +18401,7 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) { LOG(ERROR) << "Receive error 420: " << error_message; break; case 429: - // nothing special, error description was already changed + // nothing special, error description has already been changed LOG_IF(ERROR, !begins_with(error_message, "Too Many Requests: retry after ")) << "Wrong error message: " << error_message; break; @@ -18538,7 +18538,7 @@ void MessagesManager::fail_send_message(FullMessageId full_message_id, int error unique_ptr message = delete_message(d, old_message_id, false, &need_update_dialog_pos, "fail send message"); if (message == nullptr) { // message has already been deleted by the user or sent to inaccessible channel - // don't need to send update to the user, because the message is already deleted + // don't need to send update to the user, because the message has already been deleted // and there is nothing to be deleted from the server return; } @@ -18682,7 +18682,7 @@ void MessagesManager::on_create_new_dialog_success(int64 random_id, tl_object_pt if (d != nullptr && d->last_new_message_id.is_valid()) { // dialog have been already created and at least one non-temporary message was added, // i.e. we are not interested in the creation of dialog by searchMessages - // then messages already added, so just set promise + // then messages have already been added, so just set promise return promise.set_value(Unit()); } @@ -19217,7 +19217,7 @@ void MessagesManager::set_dialog_photo(DialogId dialog_id, const tl_object_ptrcreate_handler(std::move(promise)) ->send(FileId(), dialog_id, std::move(input_chat_photo)); @@ -21111,7 +21111,7 @@ MessagesManager::Message *MessagesManager::add_message_to_dialog(Dialog *d, uniq if ((*v)->message_id.get() < message_id.get()) { v = &(*v)->right; } else if ((*v)->message_id == message_id) { - LOG(INFO) << "Adding already existed " << message_id << " in " << dialog_id; + LOG(INFO) << "Adding already existing " << message_id << " in " << dialog_id; if (*need_update) { *need_update = false; if (!G()->parameters().use_message_db) { diff --git a/td/tl/tl_jni_object.cpp b/td/tl/tl_jni_object.cpp index 1ba4f6e3d..5074017b9 100644 --- a/td/tl/tl_jni_object.cpp +++ b/td/tl/tl_jni_object.cpp @@ -145,7 +145,7 @@ static void utf16_to_utf8(const jchar *p, jsize len, char *res) { *res++ = static_cast(0x80 | ((cur >> 6) & 0x3f)); *res++ = static_cast(0x80 | (cur & 0x3f)); } else { - // correctness already checked + // correctness is already checked unsigned int next = p[++i]; unsigned int val = ((cur - 0xD800) << 10) + next - 0xDC00 + 0x10000; diff --git a/tdutils/td/utils/JsonBuilder.h b/tdutils/td/utils/JsonBuilder.h index 848b4969f..623c85c6f 100644 --- a/tdutils/td/utils/JsonBuilder.h +++ b/tdutils/td/utils/JsonBuilder.h @@ -125,14 +125,14 @@ class JsonChar { auto c = val.c_; if (c < 0x10000) { if (0xD7FF < c && c < 0xE000) { - // UTF-8 correctness already checked + // UTF-8 correctness has already been checked UNREACHABLE(); } return sb << JsonOneChar(c); } else if (c <= 0x10ffff) { return sb << JsonOneChar(0xD7C0 + (c >> 10)) << JsonOneChar(0xDC00 + (c & 0x3FF)); } else { - // UTF-8 correctness already checked + // UTF-8 correctness has already been checked UNREACHABLE(); } }