diff --git a/td/telegram/SecretChatActor.cpp b/td/telegram/SecretChatActor.cpp index 863261d0c..bc6d56029 100644 --- a/td/telegram/SecretChatActor.cpp +++ b/td/telegram/SecretChatActor.cpp @@ -342,7 +342,7 @@ void SecretChatActor::send_message_impl(tl_object_ptrencrypted_message = create_encrypted_message(current_layer(), binlog_event->my_in_seq_no, binlog_event->my_out_seq_no, message) .move_as_ok(); - binlog_event->is_service = (flags & SendFlag::Push) == 0; + binlog_event->need_notify_user = (flags & SendFlag::Push) == 0; binlog_event->is_external = (flags & SendFlag::External) != 0; if (message->get_id() == secret_api::decryptedMessageService::ID) { binlog_event->is_rewritable = false; @@ -1460,12 +1460,11 @@ void SecretChatActor::inbound_loop(InboundMessageState *state, uint64 state_id) NetQueryPtr SecretChatActor::create_net_query(const logevent::OutboundSecretMessage &message) { NetQueryPtr query; - if (message.is_service) { + if (message.need_notify_user) { CHECK(message.file.empty()); query = create_net_query(QueryType::Message, telegram_api::messages_sendEncryptedService(get_input_chat(), message.random_id, message.encrypted_message.clone())); - query->total_timeout_limit = 1000000000; // inf. We will re-sent it immediately anyway } else if (message.file.empty()) { query = create_net_query( QueryType::Message, @@ -1476,6 +1475,9 @@ NetQueryPtr SecretChatActor::create_net_query(const logevent::OutboundSecretMess telegram_api::messages_sendEncryptedFile(get_input_chat(), message.random_id, message.encrypted_message.clone(), message.file.as_input_encrypted_file())); } + if (!message.is_rewritable) { + query->total_timeout_limit = 1000000000; // inf. We will re-sent it immediately anyway + } if (message.is_external && context_->get_config_option_boolean("use_quick_ack")) { query->quick_ack_promise_ = PromiseCreator::lambda([actor_id = actor_id(this), random_id = message.random_id]( @@ -1558,7 +1560,7 @@ Status SecretChatActor::outbound_rewrite_with_empty(uint64 state_id) { LOG(INFO) << tag("crc", crc64(state->message->encrypted_message.as_slice())); state->message->is_rewritable = false; state->message->is_external = false; - state->message->is_service = true; + state->message->need_notify_user = false; state->message->file = logevent::EncryptedInputFile::from_input_encrypted_file(nullptr); binlog_rewrite(context_->binlog(), state->message->logevent_id(), LogEvent::HandlerType::SecretChats, create_storer(*state->message)); diff --git a/td/telegram/logevent/SecretChatEvent.h b/td/telegram/logevent/SecretChatEvent.h index 28e79a1d2..7b365a7c5 100644 --- a/td/telegram/logevent/SecretChatEvent.h +++ b/td/telegram/logevent/SecretChatEvent.h @@ -321,8 +321,11 @@ class OutboundSecretMessage : public SecretChatLogEventBase action; @@ -331,7 +334,6 @@ class OutboundSecretMessage : public SecretChatLogEventBase(action); BEGIN_STORE_FLAGS(); STORE_FLAG(is_sent); - STORE_FLAG(is_service); + STORE_FLAG(need_notify_user); STORE_FLAG(has_action); STORE_FLAG(is_rewritable); STORE_FLAG(is_external); @@ -381,7 +383,7 @@ class OutboundSecretMessage : public SecretChatLogEventBase