Try to create secret chat dialog when receive new message in it.
This commit is contained in:
parent
add28462a0
commit
8a7a3f403b
@ -13068,6 +13068,10 @@ void MessagesManager::on_get_secret_message(SecretChatId secret_chat_id, UserId
|
||||
message_info.ttl = message->ttl_;
|
||||
|
||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_get_secret_message");
|
||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||
d = get_dialog(message_info.dialog_id);
|
||||
}
|
||||
if (d == nullptr) {
|
||||
LOG(ERROR) << "Ignore secret message in unknown " << message_info.dialog_id;
|
||||
pending_secret_message->success_promise.set_error(Status::Error(500, "Chat not found"));
|
||||
@ -13158,6 +13162,10 @@ void MessagesManager::on_secret_chat_screenshot_taken(SecretChatId secret_chat_i
|
||||
message_info.content = create_screenshot_taken_message_content();
|
||||
|
||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_screenshot_taken");
|
||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||
d = get_dialog(message_info.dialog_id);
|
||||
}
|
||||
if (d == nullptr) {
|
||||
LOG(ERROR) << "Ignore secret message in unknown " << message_info.dialog_id;
|
||||
pending_secret_message->success_promise.set_error(Status::Error(500, "Chat not found"));
|
||||
@ -13192,6 +13200,10 @@ void MessagesManager::on_secret_chat_ttl_changed(SecretChatId secret_chat_id, Us
|
||||
message_info.content = create_chat_set_ttl_message_content(ttl);
|
||||
|
||||
Dialog *d = get_dialog_force(message_info.dialog_id, "on_secret_chat_ttl_changed");
|
||||
if (d == nullptr && have_dialog_info_force(message_info.dialog_id)) {
|
||||
force_create_dialog(message_info.dialog_id, "on_get_secret_message", true, true);
|
||||
d = get_dialog(message_info.dialog_id);
|
||||
}
|
||||
if (d == nullptr) {
|
||||
LOG(ERROR) << "Ignore secret message in unknown " << message_info.dialog_id;
|
||||
pending_secret_message->success_promise.set_error(Status::Error(500, "Chat not found"));
|
||||
|
@ -352,44 +352,44 @@ unique_ptr<SecretChatActor::Context> SecretChatsManager::make_secret_chat_contex
|
||||
void on_inbound_message(UserId user_id, MessageId message_id, int32 date,
|
||||
tl_object_ptr<telegram_api::encryptedFile> file,
|
||||
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_get_secret_message, secret_chat_id_, user_id,
|
||||
message_id, date, std::move(file), std::move(message), std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_get_secret_message, secret_chat_id_, user_id,
|
||||
message_id, date, std::move(file), std::move(message), std::move(promise));
|
||||
}
|
||||
|
||||
void on_send_message_error(int64 random_id, Status error, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_send_secret_message_error, random_id, std::move(error),
|
||||
std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_secret_message_error, random_id,
|
||||
std::move(error), std::move(promise));
|
||||
}
|
||||
|
||||
void on_send_message_ack(int64 random_id) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);
|
||||
}
|
||||
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
|
||||
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_send_secret_message_success, random_id, message_id,
|
||||
date, std::move(file), std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_secret_message_success, random_id,
|
||||
message_id, date, std::move(file), std::move(promise));
|
||||
}
|
||||
void on_delete_messages(std::vector<int64> random_ids, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::delete_secret_messages, secret_chat_id_,
|
||||
std::move(random_ids), std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::delete_secret_messages, secret_chat_id_,
|
||||
std::move(random_ids), std::move(promise));
|
||||
}
|
||||
void on_flush_history(bool remove_from_dialog_list, MessageId message_id, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::delete_secret_chat_history, secret_chat_id_,
|
||||
remove_from_dialog_list, message_id, std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::delete_secret_chat_history, secret_chat_id_,
|
||||
remove_from_dialog_list, message_id, std::move(promise));
|
||||
}
|
||||
void on_read_message(int64 random_id, Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::open_secret_message, secret_chat_id_, random_id,
|
||||
std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::open_secret_message, secret_chat_id_, random_id,
|
||||
std::move(promise));
|
||||
}
|
||||
void on_screenshot_taken(UserId user_id, MessageId message_id, int32 date, int64 random_id,
|
||||
Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_secret_chat_screenshot_taken, secret_chat_id_, user_id,
|
||||
message_id, date, random_id, std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_secret_chat_screenshot_taken, secret_chat_id_,
|
||||
user_id, message_id, date, random_id, std::move(promise));
|
||||
}
|
||||
void on_set_ttl(UserId user_id, MessageId message_id, int32 date, int32 ttl, int64 random_id,
|
||||
Promise<> promise) override {
|
||||
send_closure(G()->messages_manager(), &MessagesManager::on_secret_chat_ttl_changed, secret_chat_id_, user_id,
|
||||
message_id, date, ttl, random_id, std::move(promise));
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::on_secret_chat_ttl_changed, secret_chat_id_,
|
||||
user_id, message_id, date, ttl, random_id, std::move(promise));
|
||||
}
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user