Skip to content

Commit

Permalink
Prefer US spelling of "canceled".
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed May 31, 2021
1 parent 181e486 commit 9cecc11
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 56 deletions.
10 changes: 5 additions & 5 deletions td/generate/scheme/td_api.tl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ authenticationCodeTypeSms length:int32 = AuthenticationCodeType;
//@description An authentication code is delivered via a phone call to the specified phone number @length Length of the code
authenticationCodeTypeCall length:int32 = AuthenticationCodeType;

//@description An authentication code is delivered by an immediately cancelled call to the specified phone number. The number from which the call was made is the code @pattern Pattern of the phone number from which the call will be made
//@description An authentication code is delivered by an immediately canceled call to the specified phone number. The number from which the call was made is the code @pattern Pattern of the phone number from which the call will be made
authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType;


Expand Down Expand Up @@ -2028,7 +2028,7 @@ chatActionStartPlayingGame = ChatAction;
chatActionRecordingVideoNote = ChatAction;
//@description The user is uploading a video note @progress Upload progress, as a percentage
chatActionUploadingVideoNote progress:int32 = ChatAction;
//@description The user has cancelled the previous action
//@description The user has canceled the previous action
chatActionCancel = ChatAction;


Expand Down Expand Up @@ -2084,7 +2084,7 @@ stickerSets total_count:int32 sets:vector<stickerSetInfo> = StickerSets;
//@description The call wasn't discarded, or the reason is unknown
callDiscardReasonEmpty = CallDiscardReason;

//@description The call was ended before the conversation started. It was cancelled by the caller or missed by the other party
//@description The call was ended before the conversation started. It was canceled by the caller or missed by the other party
callDiscardReasonMissed = CallDiscardReason;

//@description The call was ended before the conversation started. It was declined by the other party
Expand Down Expand Up @@ -4536,9 +4536,9 @@ setPinnedChats chat_list:ChatList chat_ids:vector<int53> = Ok;
//@file_id Identifier of the file to download
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first
//@offset The starting position from which the file should be downloaded
//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit
//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically canceled; use 0 to download without a limit
//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after
//-the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent
//-the download has succeeded, has failed, has been canceled or a new downloadFile request with different offset/limit parameters was sent
downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File;

//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated
Expand Down
2 changes: 1 addition & 1 deletion td/mtproto/HandshakeActor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ HandshakeActor::HandshakeActor(unique_ptr<AuthKeyHandshake> handshake, unique_pt
}

void HandshakeActor::close() {
finish(Status::Error("Cancelled"));
finish(Status::Error("Canceled"));
stop();
}

Expand Down
2 changes: 1 addition & 1 deletion td/mtproto/HandshakeActor.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class HandshakeActor : public Actor {
finish(Status::OK());
}
void hangup() override {
finish(Status::Error(1, "Cancelled"));
finish(Status::Error(1, "Canceled"));
stop();
}
void timeout_expired() override {
Expand Down
2 changes: 1 addition & 1 deletion td/mtproto/Ping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connect
}

void hangup() override {
finish(Status::Error("Cancelled"));
finish(Status::Error("Canceled"));
stop();
}

Expand Down
2 changes: 1 addition & 1 deletion td/telegram/DialogAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ tl_object_ptr<td_api::ChatAction> DialogAction::get_chat_action_object() const {
}
}

bool DialogAction::is_cancelled_by_message_of_type(MessageContentType message_content_type) const {
bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_content_type) const {
if (message_content_type == MessageContentType::None) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/DialogAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DialogAction {

td_api::object_ptr<td_api::ChatAction> get_chat_action_object() const;

bool is_cancelled_by_message_of_type(MessageContentType message_content_type) const;
bool is_canceled_by_message_of_type(MessageContentType message_content_type) const;

static DialogAction get_uploading_action(MessageContentType message_content_type, int32 progress);

Expand Down
4 changes: 2 additions & 2 deletions td/telegram/GroupCallManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2236,7 +2236,7 @@ int32 GroupCallManager::cancel_join_group_call_request(InputGroupCallId input_gr
if (!it->second->query_ref.empty()) {
cancel_query(it->second->query_ref);
}
it->second->promise.set_error(Status::Error(200, "Cancelled"));
it->second->promise.set_error(Status::Error(200, "Canceled"));
auto audio_source = it->second->audio_source;
pending_join_requests_.erase(it);
return audio_source;
Expand All @@ -2252,7 +2252,7 @@ int32 GroupCallManager::cancel_join_group_call_presentation_request(InputGroupCa
if (!it->second->query_ref.empty()) {
cancel_query(it->second->query_ref);
}
it->second->promise.set_error(Status::Error(200, "Cancelled"));
it->second->promise.set_error(Status::Error(200, "Canceled"));
auto audio_source = it->second->audio_source;
pending_join_presentation_requests_.erase(it);
return audio_source;
Expand Down
6 changes: 3 additions & 3 deletions td/telegram/InlineQueriesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class GetInlineBotResultsQuery : public Td::ResultHandler {
}

void on_error(uint64 id, Status status) override {
if (status.code() == NetQuery::Cancelled) {
status = Status::Error(406, "Request cancelled");
if (status.code() == NetQuery::Canceled) {
status = Status::Error(406, "Request canceled");
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
status = Status::Error(502, "The bot is not responding");
}
Expand Down Expand Up @@ -828,7 +828,7 @@ uint64 InlineQueriesManager::send_inline_query(UserId bot_user_id, DialogId dial
LOG(INFO) << "Drop inline query " << pending_inline_query_->query_hash;
on_get_inline_query_results(pending_inline_query_->dialog_id, pending_inline_query_->bot_user_id,
pending_inline_query_->query_hash, nullptr);
pending_inline_query_->promise.set_error(Status::Error(406, "Request cancelled"));
pending_inline_query_->promise.set_error(Status::Error(406, "Request canceled"));
}

pending_inline_query_ = make_unique<PendingInlineQuery>(PendingInlineQuery{
Expand Down
20 changes: 10 additions & 10 deletions td/telegram/MessagesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3854,7 +3854,7 @@ class SetTypingQuery : public Td::ResultHandler {
}

void on_error(uint64 id, Status status) override {
if (status.code() == NetQuery::Cancelled) {
if (status.code() == NetQuery::Canceled) {
return promise_.set_value(Unit());
}

Expand Down Expand Up @@ -7174,7 +7174,7 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th
}

if (!td_->contacts_manager_->is_user_bot(user_id) &&
!it->action.is_cancelled_by_message_of_type(message_content_type)) {
!it->action.is_canceled_by_message_of_type(message_content_type)) {
return;
}

Expand Down Expand Up @@ -8543,7 +8543,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api

auto it = being_uploaded_files_.find(file_id);
if (it == being_uploaded_files_.end()) {
// callback may be called just before the file upload was cancelled
// callback may be called just before the file upload was canceled
return;
}

Expand All @@ -8555,7 +8555,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
Message *m = get_message(full_message_id);
if (m == nullptr) {
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
// file upload should be already cancelled in cancel_send_message_query, it shouldn't happen
// file upload should be already canceled in cancel_send_message_query, it shouldn't happen
LOG(ERROR) << "Message with a media has already been deleted";
return;
}
Expand Down Expand Up @@ -8665,7 +8665,7 @@ void MessagesManager::on_upload_media_error(FileId file_id, Status status) {

auto it = being_uploaded_files_.find(file_id);
if (it == being_uploaded_files_.end()) {
// callback may be called just before the file upload was cancelled
// callback may be called just before the file upload was canceled
return;
}

Expand Down Expand Up @@ -8739,7 +8739,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,

auto it = being_uploaded_thumbnails_.find(thumbnail_file_id);
if (it == being_uploaded_thumbnails_.end()) {
// callback may be called just before the thumbnail upload was cancelled
// callback may be called just before the thumbnail upload was canceled
return;
}

Expand All @@ -8752,7 +8752,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,
Message *m = get_message(full_message_id);
if (m == nullptr) {
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
// thumbnail file upload should be already cancelled in cancel_send_message_query
// thumbnail file upload should be already canceled in cancel_send_message_query
LOG(ERROR) << "Message with a media has already been deleted";
return;
}
Expand Down Expand Up @@ -24782,7 +24782,7 @@ void MessagesManager::edit_message_media(FullMessageId full_message_id,
return promise.set_error(r_new_reply_markup.move_as_error());
}

cancel_edit_message_media(dialog_id, m, "Cancelled by new editMessageMedia request");
cancel_edit_message_media(dialog_id, m, "Canceled by new editMessageMedia request");

m->edited_content =
dup_message_content(td_, dialog_id, content.content.get(), MessageContentDupType::Send, MessageCopyOptions());
Expand Down Expand Up @@ -28580,7 +28580,7 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) {
if (it == being_sent_messages_.end()) {
// we can't receive fail more than once
// but message can be successfully sent before
if (error.code() != NetQuery::Cancelled) {
if (error.code() != NetQuery::Canceled) {
LOG(ERROR) << "Receive error " << error << " about successfully sent message with random_id = " << random_id;
}
return;
Expand All @@ -28598,7 +28598,7 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) {
LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << full_message_id;
return;
}
LOG_IF(ERROR, error.code() == NetQuery::Cancelled)
LOG_IF(ERROR, error.code() == NetQuery::Canceled)
<< "Receive error " << error << " about sent message with random_id = " << random_id;

auto dialog_id = full_message_id.get_dialog_id();
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/StorageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void StorageManager::timeout_expired() {
next_gc_at_ = 0;
run_gc({}, false, PromiseCreator::lambda([actor_id = actor_id(this)](Result<FileStats> r_stats) {
if (!r_stats.is_error() || r_stats.error().code() != 500) {
// do not save gc timestamp if request was cancelled
// do not save gc timestamp if request was canceled
send_closure(actor_id, &StorageManager::save_last_gc_timestamp);
}
send_closure(actor_id, &StorageManager::schedule_next_gc);
Expand Down
6 changes: 3 additions & 3 deletions td/telegram/Td.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class UpdateStatusQuery : public Td::ResultHandler {
}

void on_error(uint64 id, Status status) override {
if (status.code() != NetQuery::Cancelled && !G()->is_expected_error(status)) {
if (status.code() != NetQuery::Canceled && !G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for UpdateStatusQuery: " << status;
}
status.ignore();
Expand Down Expand Up @@ -6599,7 +6599,7 @@ void Td::on_request(uint64 id, const td_api::downloadFile &request) {
// we can't have two pending requests with different offset and limit, so cancel all previous requests
for (auto request_id : info->request_ids) {
send_closure(actor_id(this), &Td::send_error, request_id,
Status::Error(200, "Cancelled by another downloadFile request"));
Status::Error(200, "Canceled by another downloadFile request"));
}
info->request_ids.clear();
}
Expand Down Expand Up @@ -6639,7 +6639,7 @@ void Td::on_file_download_finished(FileId file_id) {
download_offset + downloaded_size - it->second.offset >= limit))) {
send_result(id, std::move(file_object));
} else {
send_error_impl(id, td_api::make_object<td_api::error>(400, "File download has failed or was cancelled"));
send_error_impl(id, td_api::make_object<td_api::error>(400, "File download has failed or was canceled"));
}
}
pending_file_downloads_.erase(it);
Expand Down
4 changes: 2 additions & 2 deletions td/telegram/files/FileGenerateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class MapDownloadGenerateActor : public FileGenerateActor {
}

void hangup_shared() override {
on_error(Status::Error(1, "Cancelled"));
on_error(Status::Error(1, "Canceled"));
}
};

Expand Down Expand Up @@ -308,7 +308,7 @@ class FileExternalGenerateActor : public FileGenerateActor {
static_cast<int64>(query_id_), generate_location_.original_path_, path_, generate_location_.conversion_));
}
void hangup() override {
check_status(Status::Error(1, "Cancelled"));
check_status(Status::Error(1, "Canceled"));
}

Status do_file_generate_write_part(int32 offset, const string &data) {
Expand Down
4 changes: 2 additions & 2 deletions td/telegram/files/FileLoadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void FileLoadManager::cancel(QueryId id) {
if (it == query_id_to_node_id_.end()) {
return;
}
on_error_impl(it->second, Status::Error(1, "Cancelled"));
on_error_impl(it->second, Status::Error(1, "Canceled"));
}
void FileLoadManager::update_local_file_location(QueryId id, const LocalFileLocation &local) {
if (stop_flag_) {
Expand Down Expand Up @@ -283,7 +283,7 @@ void FileLoadManager::on_error_impl(NodeId node_id, Status status) {

void FileLoadManager::hangup_shared() {
auto node_id = get_link_token();
on_error_impl(node_id, Status::Error(1, "Cancelled"));
on_error_impl(node_id, Status::Error(1, "Canceled"));
}

void FileLoadManager::loop() {
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/files/FileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void FileLoader::on_result(NetQueryPtr query) {
bool next = false;
auto status = [&] {
TRY_RESULT(should_restart, should_restart_part(part, query));
if (query->is_error() && query->error().code() == NetQuery::Error::Cancelled) {
if (query->is_error() && query->error().code() == NetQuery::Error::Canceled) {
should_restart = true;
}
if (should_restart) {
Expand Down
6 changes: 3 additions & 3 deletions td/telegram/files/FileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ void FileManager::download(FileId file_id, std::shared_ptr<DownloadCallback> cal
// this would be an error and should never happen, unless we cancel previous download query
// in that case we send an error to the callback
CHECK(new_priority == 0);
file_info->download_callback_->on_download_error(file_id, Status::Error(200, "Cancelled"));
file_info->download_callback_->on_download_error(file_id, Status::Error(200, "Canceled"));
}
file_info->download_priority_ = narrow_cast<int8>(new_priority);
file_info->download_callback_ = std::move(callback);
Expand Down Expand Up @@ -2367,7 +2367,7 @@ class FileManager::ForceUploadActor : public Actor {
if (callback_.empty()) {
return;
}
send_closure(std::move(callback_), &ForceUploadActor::on_upload_error, Status::Error("Cancelled"));
send_closure(std::move(callback_), &ForceUploadActor::on_upload_error, Status::Error("Canceled"));
}

private:
Expand Down Expand Up @@ -2445,7 +2445,7 @@ class FileManager::ForceUploadActor : public Actor {

void tear_down() override {
if (callback_) {
callback_->on_upload_error(file_id_, Status::Error("Cancelled"));
callback_->on_upload_error(file_id_, Status::Error("Canceled"));
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion td/telegram/net/ConnectionCreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
auto begin = client.queries.begin();
auto it = begin;
while (it != client.queries.end() && !client.ready_connections.empty()) {
if (!it->is_cancelled()) {
if (!it->is_canceled()) {
VLOG(connections) << "Send to promise " << tag("connection", client.ready_connections.back().first.get());
it->set_value(std::move(client.ready_connections.back().first));
client.ready_connections.pop_back();
Expand Down
3 changes: 1 addition & 2 deletions td/telegram/net/NetQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ int32 NetQuery::tl_magic(const BufferSlice &buffer_slice) {
}

void NetQuery::set_error(Status status, string source) {
if (status.code() == Error::Resend || status.code() == Error::Cancelled ||
status.code() == Error::ResendInvokeAfter) {
if (status.code() == Error::Resend || status.code() == Error::Canceled || status.code() == Error::ResendInvokeAfter) {
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
}

Expand Down
8 changes: 4 additions & 4 deletions td/telegram/net/NetQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
enum class Type : int8 { Common, Upload, Download, DownloadSmall };
enum class AuthFlag : int8 { Off, On };
enum class GzipFlag : int8 { Off, On };
enum Error : int32 { Resend = 202, Cancelled = 203, ResendInvokeAfter = 204 };
enum Error : int32 { Resend = 202, Canceled = 203, ResendInvokeAfter = 204 };

uint64 id() const {
return id_;
Expand Down Expand Up @@ -143,8 +143,8 @@ class NetQuery : public TsListNode<NetQueryDebug> {
set_error_impl(Status::Error<Error::Resend>());
}

void set_error_cancelled() {
set_error_impl(Status::Error<Error::Cancelled>());
void set_error_canceled() {
set_error_impl(Status::Error<Error::Canceled>());
}

void set_error_resend_invoke_after() {
Expand All @@ -154,7 +154,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
bool update_is_ready() {
if (state_ == State::Query) {
if (cancellation_token_.load(std::memory_order_relaxed) == 0 || cancel_slot_.was_signal()) {
set_error_cancelled();
set_error_canceled();
return true;
}
return false;
Expand Down
4 changes: 2 additions & 2 deletions td/telegram/net/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ class GenAuthKeyActor : public Actor {

void hangup() override {
if (connection_promise_) {
connection_promise_.set_error(Status::Error(1, "Cancelled"));
connection_promise_.set_error(Status::Error(1, "Canceled"));
}
if (handshake_promise_) {
handshake_promise_.set_error(Status::Error(1, "Cancelled"));
handshake_promise_.set_error(Status::Error(1, "Canceled"));
}
stop();
}
Expand Down
Loading

0 comments on commit 9cecc11

Please sign in to comment.