Add DialogManager::force_create_dialog.

This commit is contained in:
levlam 2024-01-04 15:38:01 +03:00
parent 978be7206f
commit eb5a37e927
29 changed files with 74 additions and 63 deletions

View File

@ -417,7 +417,7 @@ void AutosaveManager::on_get_autosave_settings(
if (!dialog_id.is_valid()) {
continue;
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_get_autosave_settings");
td_->dialog_manager_->force_create_dialog(dialog_id, "on_get_autosave_settings");
DialogAutosaveSettings new_settings(exception->settings_.get());
auto &current_settings = settings_.exceptions_[dialog_id];
if (current_settings != new_settings) {

View File

@ -89,7 +89,7 @@ static td_api::object_ptr<td_api::chatBoostSlots> get_chat_boost_slots_object(
}
}
if (dialog_id.is_valid()) {
td->messages_manager_->force_create_dialog(dialog_id, "GetMyBoostsQuery", true);
td->dialog_manager_->force_create_dialog(dialog_id, "GetMyBoostsQuery", true);
} else {
start_date = 0;
cooldown_until_date = 0;
@ -492,7 +492,7 @@ void BoostManager::on_update_dialog_boost(DialogId dialog_id, telegram_api::obje
LOG(ERROR) << "Receive wrong updateBotChatBoost in " << dialog_id << ": " << to_string(boost);
return;
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_dialog_boost", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_dialog_boost", true);
send_closure(
G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatBoost>(

View File

@ -190,7 +190,7 @@ void CallbackQueriesManager::on_new_query(int32 flags, int64 callback_query_id,
return;
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_new_callback_query", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_new_callback_query", true);
send_closure(
G()->td(), &Td::send_update,
td_api::make_object<td_api::updateNewCallbackQuery>(

View File

@ -7659,7 +7659,7 @@ int32 ContactsManager::on_update_peer_located(vector<tl_object_ptr<telegram_api:
continue;
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_peer_located");
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_peer_located");
if (from_update) {
CHECK(dialog_type == DialogType::User);
@ -8987,7 +8987,7 @@ void ContactsManager::delete_dialog(DialogId dialog_id, Promise<Unit> &&promise)
void ContactsManager::send_update_add_chat_members_privacy_forbidden(DialogId dialog_id, vector<UserId> user_ids,
const char *source) {
td_->messages_manager_->force_create_dialog(dialog_id, "send_update_add_chat_members_privacy_forbidden");
td_->dialog_manager_->force_create_dialog(dialog_id, "send_update_add_chat_members_privacy_forbidden");
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateAddChatMembersPrivacyForbidden>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateAddChatMembersPrivacyForbidden"),
@ -10137,7 +10137,7 @@ void ContactsManager::on_get_channel_recommendations(
}
for (auto recommended_channel_id : channel_ids) {
auto recommended_dialog_id = DialogId(recommended_channel_id);
td_->messages_manager_->force_create_dialog(recommended_dialog_id, "on_get_channel_recommendations");
td_->dialog_manager_->force_create_dialog(recommended_dialog_id, "on_get_channel_recommendations");
if (is_suitable_recommended_channel(recommended_channel_id)) {
dialog_ids.push_back(recommended_dialog_id);
} else {
@ -10323,7 +10323,7 @@ void ContactsManager::on_get_created_public_channels(PublicDialogType type,
}
created_public_channels_[index].clear();
for (auto channel_id : channel_ids) {
td_->messages_manager_->force_create_dialog(DialogId(channel_id), "on_get_created_public_channels");
td_->dialog_manager_->force_create_dialog(DialogId(channel_id), "on_get_created_public_channels");
if (is_suitable_created_public_channel(type, get_channel(channel_id))) {
created_public_channels_[index].push_back(channel_id);
}
@ -10370,7 +10370,7 @@ vector<DialogId> ContactsManager::get_dialogs_for_discussion(Promise<Unit> &&pro
if (dialogs_for_discussion_inited_) {
promise.set_value(Unit());
return transform(dialogs_for_discussion_, [&](DialogId dialog_id) {
td_->messages_manager_->force_create_dialog(dialog_id, "get_dialogs_for_discussion");
td_->dialog_manager_->force_create_dialog(dialog_id, "get_dialogs_for_discussion");
return dialog_id;
});
}
@ -13303,8 +13303,7 @@ void ContactsManager::update_channel_full(ChannelFull *channel_full, ChannelId c
}
if (channel_full->need_send_update) {
if (channel_full->linked_channel_id.is_valid()) {
td_->messages_manager_->force_create_dialog(DialogId(channel_full->linked_channel_id), "update_channel_full",
true);
td_->dialog_manager_->force_create_dialog(DialogId(channel_full->linked_channel_id), "update_channel_full", true);
}
{
@ -15329,7 +15328,7 @@ tl_object_ptr<td_api::chatMember> ContactsManager::get_chat_member_object(const
if (dialog_id.get_type() == DialogType::User) {
participant_user_id = dialog_id.get_user_id();
} else {
td_->messages_manager_->force_create_dialog(dialog_id, source, true);
td_->dialog_manager_->force_create_dialog(dialog_id, source, true);
}
return td_api::make_object<td_api::chatMember>(
get_message_sender_object_const(td_, dialog_id, source),
@ -17566,7 +17565,7 @@ void ContactsManager::send_update_chat_member(DialogId dialog_id, UserId agent_u
const DialogParticipant &old_dialog_participant,
const DialogParticipant &new_dialog_participant) {
CHECK(td_->auth_manager_->is_bot());
td_->messages_manager_->force_create_dialog(dialog_id, "send_update_chat_member", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "send_update_chat_member", true);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatMember>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateChatMember"),
@ -17718,8 +17717,8 @@ void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId
return;
}
DialogId user_dialog_id(user_id);
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_chat_invite_requester", true);
td_->messages_manager_->force_create_dialog(user_dialog_id, "on_update_chat_invite_requester");
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_chat_invite_requester", true);
td_->dialog_manager_->force_create_dialog(user_dialog_id, "on_update_chat_invite_requester");
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateNewChatJoinRequest>(
@ -20692,7 +20691,7 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
}
if (dialog_id.is_valid()) {
td_->messages_manager_->force_create_dialog(dialog_id, "get_chat_invite_link_info_object");
td_->dialog_manager_->force_create_dialog(dialog_id, "get_chat_invite_link_info_object");
}
int32 accessible_for = 0;
if (dialog_id.is_valid() && !is_member) {

View File

@ -8,7 +8,6 @@
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/WebPagesManager.h"
@ -133,7 +132,7 @@ bool Dependencies::resolve_force(Td *td, const char *source, bool ignore_errors)
if (!ignore_errors) {
LOG(ERROR) << "Can't find " << dialog_id << " from " << source;
}
td->messages_manager_->force_create_dialog(dialog_id, source, true);
td->dialog_manager_->force_create_dialog(dialog_id, source, true);
success = false;
}
}

View File

@ -233,14 +233,14 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
case telegram_api::channelAdminLogEventActionChangeLinkedChat::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeLinkedChat>(action_ptr);
auto get_dialog_from_channel_id = [messages_manager = td->messages_manager_.get()](int64 channel_id_int) {
auto get_dialog_from_channel_id = [dialog_manager = td->dialog_manager_.get()](int64 channel_id_int) {
ChannelId channel_id(channel_id_int);
if (!channel_id.is_valid()) {
return DialogId();
}
DialogId dialog_id(channel_id);
messages_manager->force_create_dialog(dialog_id, "get_dialog_from_channel_id");
dialog_manager->force_create_dialog(dialog_id, "get_dialog_from_channel_id");
return dialog_id;
};

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/DialogFilterInviteLink.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/LinkManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h"
@ -23,7 +24,7 @@ DialogFilterInviteLink::DialogFilterInviteLink(
for (const auto &peer : exported_invite->peers_) {
DialogId dialog_id(peer);
if (dialog_id.is_valid()) {
td->messages_manager_->force_create_dialog(dialog_id, "DialogFilterInviteLink");
td->dialog_manager_->force_create_dialog(dialog_id, "DialogFilterInviteLink");
dialog_ids_.push_back(dialog_id);
}
}

View File

@ -945,7 +945,7 @@ void DialogFilterManager::load_dialog_filter(const DialogFilter *dialog_filter,
if (!td_->dialog_manager_->have_dialog_force(dialog_id, "load_dialog_filter")) {
if (dialog_id.get_type() == DialogType::SecretChat) {
if (td_->dialog_manager_->have_dialog_info_force(dialog_id, "load_dialog_filter")) {
td_->messages_manager_->force_create_dialog(dialog_id, "load_dialog_filter");
td_->dialog_manager_->force_create_dialog(dialog_id, "load_dialog_filter");
}
} else {
input_dialog_ids.push_back(input_dialog_id);

View File

@ -163,6 +163,11 @@ bool DialogManager::have_dialog_force(DialogId dialog_id, const char *source) co
return td_->messages_manager_->have_dialog_force(dialog_id, source);
}
void DialogManager::force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access,
bool force_update_dialog_pos) {
return td_->messages_manager_->force_create_dialog(dialog_id, source, expect_no_access, force_update_dialog_pos);
}
bool DialogManager::have_dialog_info(DialogId dialog_id) const {
switch (dialog_id.get_type()) {
case DialogType::User: {

View File

@ -53,6 +53,9 @@ class DialogManager final : public Actor {
bool have_dialog_force(DialogId dialog_id, const char *source) const;
void force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access = false,
bool force_update_dialog_pos = false);
bool have_dialog_info(DialogId dialog_id) const;
bool have_dialog_info_force(DialogId dialog_id, const char *source) const;

View File

@ -8,7 +8,6 @@
#include "td/telegram/DialogManager.h"
#include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/ServerMessageId.h"
#include "td/telegram/Td.h"
@ -31,7 +30,7 @@ ForumTopicInfo::ForumTopicInfo(Td *td, const tl_object_ptr<telegram_api::ForumTo
creator_dialog_id_ = DialogId(forum_topic->from_id_);
if (creator_dialog_id_.is_valid() && creator_dialog_id_.get_type() != DialogType::User &&
td->dialog_manager_->have_dialog_info_force(creator_dialog_id_, "ForumTopicInfo")) {
td->messages_manager_->force_create_dialog(creator_dialog_id_, "ForumTopicInfo", true);
td->dialog_manager_->force_create_dialog(creator_dialog_id_, "ForumTopicInfo", true);
}
is_outgoing_ = forum_topic->my_;
is_closed_ = forum_topic->closed_;

View File

@ -131,11 +131,11 @@ td_api::object_ptr<td_api::premiumGiveawayParameters> GiveawayParameters::get_pr
vector<int64> chat_ids;
for (auto channel_id : additional_channel_ids_) {
DialogId dialog_id(channel_id);
td->messages_manager_->force_create_dialog(dialog_id, "premiumGiveawayParameters", true);
td->dialog_manager_->force_create_dialog(dialog_id, "premiumGiveawayParameters", true);
chat_ids.push_back(td->messages_manager_->get_chat_id_object(dialog_id, "premiumGiveawayParameters"));
}
DialogId dialog_id(boosted_channel_id_);
td->messages_manager_->force_create_dialog(dialog_id, "premiumGiveawayParameters", true);
td->dialog_manager_->force_create_dialog(dialog_id, "premiumGiveawayParameters", true);
return td_api::make_object<td_api::premiumGiveawayParameters>(
td->messages_manager_->get_chat_id_object(dialog_id, "premiumGiveawayParameters"), std::move(chat_ids), date_,
only_new_subscribers_, winners_are_visible_, vector<string>(country_codes_), prize_description_);

View File

@ -1845,7 +1845,7 @@ void GroupCallManager::on_update_group_call_participants(
}
auto dialog_id = participant.dialog_id;
if (dialog_id.get_type() != DialogType::User && participant.joined_date != 0) {
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_group_call_participants 2", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_group_call_participants 2", true);
}
bool is_versioned = GroupCallParticipant::is_versioned_update(group_call_participant);
@ -2089,7 +2089,7 @@ void GroupCallManager::process_group_call_participants(
continue;
}
if (participant.dialog_id.get_type() != DialogType::User) {
td_->messages_manager_->force_create_dialog(participant.dialog_id, "process_group_call_participants", true);
td_->dialog_manager_->force_create_dialog(participant.dialog_id, "process_group_call_participants", true);
}
on_participant_speaking_in_group_call(input_group_call_id, participant);
@ -2121,7 +2121,7 @@ void GroupCallManager::process_group_call_participants(
continue;
}
if (participant.dialog_id.get_type() != DialogType::User) {
td_->messages_manager_->force_create_dialog(participant.dialog_id, "process_group_call_participants", true);
td_->dialog_manager_->force_create_dialog(participant.dialog_id, "process_group_call_participants", true);
}
if (is_load) {
@ -2684,7 +2684,7 @@ void GroupCallManager::join_group_call(GroupCallId group_call_id, DialogId as_di
true);
} else {
if (as_dialog_id.get_type() != DialogType::User) {
td_->messages_manager_->force_create_dialog(as_dialog_id, "join_group_call");
td_->dialog_manager_->force_create_dialog(as_dialog_id, "join_group_call");
}
}
if (group_call->is_inited && have_as_dialog_id) {
@ -4593,7 +4593,7 @@ void GroupCallManager::on_user_speaking_in_group_call(GroupCallId group_call_id,
for (size_t i = 0; i <= recent_speakers->users.size(); i++) {
if (i == recent_speakers->users.size() || recent_speakers->users[i].second <= date) {
if (dialog_id.get_type() != DialogType::User) {
td_->messages_manager_->force_create_dialog(dialog_id, "on_user_speaking_in_group_call", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_user_speaking_in_group_call", true);
}
recent_speakers->users.insert(recent_speakers->users.begin() + i, {dialog_id, date});
break;

View File

@ -5986,7 +5986,7 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
LOG(ERROR) << "Receive " << actual_story_id << " instead of " << story_id;
}
}
td->messages_manager_->force_create_dialog(dialog_id, "messageMediaStory", true);
td->dialog_manager_->force_create_dialog(dialog_id, "messageMediaStory", true);
return make_unique<MessageStory>(story_full_id, media->via_mention_);
}
case telegram_api::messageMediaGiveaway::ID: {
@ -5996,7 +5996,7 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
ChannelId channel_id(channel);
if (channel_id.is_valid()) {
channel_ids.push_back(channel_id);
td->messages_manager_->force_create_dialog(DialogId(channel_id), "messageMediaGiveaway", true);
td->dialog_manager_->force_create_dialog(DialogId(channel_id), "messageMediaGiveaway", true);
}
}
if (channel_ids.empty() || media->quantity_ <= 0 || media->months_ <= 0 || media->until_date_ < 0) {
@ -6022,7 +6022,7 @@ unique_ptr<MessageContent> get_message_content(Td *td, FormattedText message,
LOG(ERROR) << "Receive " << to_string(media);
break;
}
td->messages_manager_->force_create_dialog(DialogId(boosted_channel_id), "messageMediaGiveawayResults", true);
td->dialog_manager_->force_create_dialog(DialogId(boosted_channel_id), "messageMediaGiveawayResults", true);
vector<UserId> winner_user_ids;
for (auto winner : media->winners_) {
UserId winner_user_id(winner);
@ -6706,7 +6706,7 @@ unique_ptr<MessageContent> get_action_message_content(Td *td, tl_object_ptr<tele
break;
}
if (dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
td->dialog_manager_->force_create_dialog(dialog_id, "messageActionGiftCode", true);
}
}
return td::make_unique<MessageGiftCode>(dialog_id, action->months_, std::move(action->currency_), action->amount_,

View File

@ -40,7 +40,7 @@ MessageInputReplyTo::MessageInputReplyTo(Td *td,
auto story_id = StoryId(reply_to->story_id_);
if (user_id.is_valid() && story_id.is_valid()) {
DialogId dialog_id(user_id);
td->messages_manager_->force_create_dialog(dialog_id, "MessageInputReplyTo", true);
td->dialog_manager_->force_create_dialog(dialog_id, "MessageInputReplyTo", true);
story_full_id_ = {dialog_id, story_id};
}
break;
@ -57,7 +57,7 @@ MessageInputReplyTo::MessageInputReplyTo(Td *td,
if (!dialog_id.is_valid() || !td->dialog_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
return;
}
td->messages_manager_->force_create_dialog(dialog_id, "inputReplyToMessage");
td->dialog_manager_->force_create_dialog(dialog_id, "inputReplyToMessage");
}
message_id_ = message_id;
dialog_id_ = dialog_id;

View File

@ -9,6 +9,7 @@
#include "td/telegram/ChannelId.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/ServerMessageId.h"
@ -70,7 +71,7 @@ Result<MessageOrigin> MessageOrigin::get_message_origin(
LOG(ERROR) << "Receive forward from " << (td->contacts_manager_->have_min_channel(channel_id) ? "min" : "unknown")
<< ' ' << channel_id;
}
td->messages_manager_->force_create_dialog(sender_dialog_id, "get_message_origin", true);
td->dialog_manager_->force_create_dialog(sender_dialog_id, "get_message_origin", true);
CHECK(!sender_user_id.is_valid());
}

View File

@ -44,7 +44,7 @@ td_api::object_ptr<td_api::MessageSender> get_message_sender_object(Td *td, User
const char *source) {
if (dialog_id.is_valid() && !td->messages_manager_->have_dialog(dialog_id)) {
LOG(ERROR) << "Failed to find " << dialog_id << " from " << source;
td->messages_manager_->force_create_dialog(dialog_id, source);
td->dialog_manager_->force_create_dialog(dialog_id, source);
}
if (!user_id.is_valid() && td->auth_manager_->is_bot()) {
td->contacts_manager_->add_anonymous_bot_user();
@ -74,7 +74,7 @@ td_api::object_ptr<td_api::MessageSender> get_min_message_sender_object(Td *td,
(td->dialog_manager_->have_dialog_info(dialog_id) ||
(dialog_type == DialogType::Channel && td->contacts_manager_->have_min_channel(dialog_id.get_channel_id())))) {
LOG(INFO) << "Force creation of " << dialog_id;
td->messages_manager_->force_create_dialog(dialog_id, source, true);
td->dialog_manager_->force_create_dialog(dialog_id, source, true);
}
if (td->messages_manager_->have_dialog(dialog_id)) {
return td_api::make_object<td_api::messageSenderChat>(
@ -104,7 +104,7 @@ vector<DialogId> get_message_sender_dialog_ids(Td *td,
if (!td->dialog_manager_->have_dialog_info(dialog_id)) {
continue;
}
td->messages_manager_->force_create_dialog(dialog_id, "get_message_sender_dialog_ids");
td->dialog_manager_->force_create_dialog(dialog_id, "get_message_sender_dialog_ids");
if (!td->messages_manager_->have_dialog(dialog_id)) {
continue;
}

View File

@ -11,6 +11,7 @@
#include "td/telegram/ChatId.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DeviceTokenManager.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/Document.h"
#include "td/telegram/Document.hpp"
#include "td/telegram/DocumentsManager.h"
@ -921,7 +922,7 @@ void NotificationManager::add_notification(NotificationGroupId group_id, Notific
return;
}
if (notification_settings_dialog_id != dialog_id) {
td_->messages_manager_->force_create_dialog(notification_settings_dialog_id, "add_notification", true);
td_->dialog_manager_->force_create_dialog(notification_settings_dialog_id, "add_notification", true);
}
PendingNotification notification;
@ -2397,7 +2398,7 @@ void NotificationManager::add_call_notification(DialogId dialog_id, CallId call_
return;
}
td_->messages_manager_->force_create_dialog(dialog_id, "add_call_notification");
td_->dialog_manager_->force_create_dialog(dialog_id, "add_call_notification");
auto &active_notifications = active_call_notifications_[dialog_id];
if (active_notifications.size() >= MAX_CALL_NOTIFICATIONS) {

View File

@ -274,7 +274,7 @@ class GetNotifySettingsExceptionsQuery final : public Td::ResultHandler {
td_->contacts_manager_->on_get_users(std::move(users), "GetNotifySettingsExceptionsQuery");
td_->contacts_manager_->on_get_chats(std::move(chats), "GetNotifySettingsExceptionsQuery");
for (auto &dialog_id : dialog_ids) {
td_->messages_manager_->force_create_dialog(dialog_id, "GetNotifySettingsExceptionsQuery");
td_->dialog_manager_->force_create_dialog(dialog_id, "GetNotifySettingsExceptionsQuery");
}
td_->updates_manager_->on_get_updates(std::move(updates_ptr), std::move(promise_));
}
@ -329,7 +329,7 @@ class GetStoryNotifySettingsExceptionsQuery final : public Td::ResultHandler {
td_->contacts_manager_->on_get_users(std::move(users), "GetStoryNotifySettingsExceptionsQuery");
td_->contacts_manager_->on_get_chats(std::move(chats), "GetStoryNotifySettingsExceptionsQuery");
for (auto &dialog_id : dialog_ids) {
td_->messages_manager_->force_create_dialog(dialog_id, "GetStoryNotifySettingsExceptionsQuery");
td_->dialog_manager_->force_create_dialog(dialog_id, "GetStoryNotifySettingsExceptionsQuery");
}
auto chat_ids = td_->messages_manager_->get_chats_object(-1, dialog_ids, "GetStoryNotifySettingsExceptionsQuery");
auto promise = PromiseCreator::lambda([promise = std::move(promise_), chat_ids = std::move(chat_ids)](

View File

@ -339,7 +339,7 @@ class CheckGiftCodeQuery final : public Td::ResultHandler {
return on_error(Status::Error(500, "Receive invalid response"));
}
if (creator_dialog_id.get_type() != DialogType::User) {
td_->messages_manager_->force_create_dialog(creator_dialog_id, "CheckGiftCodeQuery", true);
td_->dialog_manager_->force_create_dialog(creator_dialog_id, "CheckGiftCodeQuery", true);
}
}
UserId user_id(result->to_id_);
@ -468,7 +468,7 @@ class GetGiveawayInfoQuery final : public Td::ResultHandler {
LOG(ERROR) << "Receive " << to_string(info);
} else {
DialogId dialog_id(channel_id);
td_->messages_manager_->force_create_dialog(dialog_id, "GetGiveawayInfoQuery");
td_->dialog_manager_->force_create_dialog(dialog_id, "GetGiveawayInfoQuery");
return td_api::make_object<td_api::premiumGiveawayParticipantStatusAdministrator>(
td_->messages_manager_->get_chat_id_object(dialog_id,
"premiumGiveawayParticipantStatusAdministrator"));

View File

@ -144,7 +144,7 @@ void RecentDialogList::on_load_dialogs(vector<string> &&found_dialogs) {
if (dialog_id.is_valid() && removed_dialog_ids_.count(dialog_id) == 0 &&
td_->dialog_manager_->have_dialog_info(dialog_id) &&
td_->dialog_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
td_->messages_manager_->force_create_dialog(dialog_id, "recent dialog");
td_->dialog_manager_->force_create_dialog(dialog_id, "recent dialog");
do_add_dialog(dialog_id);
}
}

View File

@ -397,7 +397,7 @@ void SponsoredMessageManager::on_get_dialog_sponsored_messages(
LOG(ERROR) << "Receive invalid channel post in " << to_string(sponsored_message);
server_message_id = ServerMessageId();
}
td_->messages_manager_->force_create_dialog(sponsor_dialog_id, "on_get_dialog_sponsored_messages");
td_->dialog_manager_->force_create_dialog(sponsor_dialog_id, "on_get_dialog_sponsored_messages");
} else if (sponsored_message->chat_invite_ != nullptr && !sponsored_message->chat_invite_hash_.empty()) {
auto invite_link = LinkManager::get_dialog_invite_link(sponsored_message->chat_invite_hash_, false);
if (invite_link.empty()) {

View File

@ -7,6 +7,7 @@
#include "td/telegram/StoryForwardInfo.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h"
@ -25,7 +26,7 @@ StoryForwardInfo::StoryForwardInfo(Td *td, telegram_api::object_ptr<telegram_api
dialog_id_ = {};
story_id_ = {};
} else {
td->messages_manager_->force_create_dialog(dialog_id_, "StoryForwardInfo", true);
td->dialog_manager_->force_create_dialog(dialog_id_, "StoryForwardInfo", true);
}
} else if ((fwd_header->flags_ & telegram_api::storyFwdHeader::FROM_NAME_MASK) != 0) {
if (fwd_header->story_id_ != 0) {

View File

@ -2396,7 +2396,7 @@ void StoryManager::reload_dialog_expiring_stories(DialogId dialog_id) {
if (!td_->dialog_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
return;
}
td_->messages_manager_->force_create_dialog(dialog_id, "reload_dialog_expiring_stories");
td_->dialog_manager_->force_create_dialog(dialog_id, "reload_dialog_expiring_stories");
load_dialog_expiring_stories(dialog_id, 0, "reload_dialog_expiring_stories");
}
@ -3336,7 +3336,7 @@ StoryId StoryManager::on_get_new_story(DialogId owner_dialog_id,
return StoryId();
}
td_->messages_manager_->force_create_dialog(owner_dialog_id, "on_get_new_story");
td_->dialog_manager_->force_create_dialog(owner_dialog_id, "on_get_new_story");
StoryId old_story_id;
auto updates_story_ids_it = update_story_ids_.find(story_full_id);
@ -3499,7 +3499,7 @@ StoryId StoryManager::on_get_new_story(DialogId owner_dialog_id,
Dependencies dependencies;
add_story_dependencies(dependencies, story);
for (auto dependent_dialog_id : dependencies.get_dialog_ids()) {
td_->messages_manager_->force_create_dialog(dependent_dialog_id, "on_get_new_story", true);
td_->dialog_manager_->force_create_dialog(dependent_dialog_id, "on_get_new_story", true);
}
on_story_changed(story_full_id, story, is_changed, need_save_to_database);
@ -3567,7 +3567,7 @@ StoryId StoryManager::on_get_story_info(DialogId owner_dialog_id, StoryInfo &&st
return StoryId();
}
td_->messages_manager_->force_create_dialog(owner_dialog_id, "on_get_skipped_story");
td_->dialog_manager_->force_create_dialog(owner_dialog_id, "on_get_skipped_story");
StoryFullId story_full_id{owner_dialog_id, story_id};
Story *story = get_story_editable(story_full_id);
@ -4636,7 +4636,7 @@ void StoryManager::on_get_dialogs_to_send_stories(vector<tl_object_ptr<telegram_
}
channels_to_send_stories_.clear();
for (auto channel_id : channel_ids) {
td_->messages_manager_->force_create_dialog(DialogId(channel_id), "on_get_dialogs_to_send_stories");
td_->dialog_manager_->force_create_dialog(DialogId(channel_id), "on_get_dialogs_to_send_stories");
if (td_->contacts_manager_->get_channel_status(channel_id).can_post_stories()) {
channels_to_send_stories_.push_back(channel_id);
}
@ -4725,7 +4725,7 @@ void StoryManager::send_story(DialogId dialog_id, td_api::object_ptr<td_api::Inp
caption.entities.clear();
}
td_->messages_manager_->force_create_dialog(dialog_id, "send_story");
td_->dialog_manager_->force_create_dialog(dialog_id, "send_story");
auto story = make_unique<Story>();
story->date_ = G()->unix_time();

View File

@ -7,6 +7,7 @@
#include "td/telegram/StoryViewer.h"
#include "td/telegram/BlockListId.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/StoryManager.h"
@ -89,7 +90,7 @@ StoryViewer::StoryViewer(Td *td, telegram_api::object_ptr<telegram_api::StoryRea
break;
}
if (actor_dialog_id.get_type() != DialogType::User) {
td->messages_manager_->force_create_dialog(actor_dialog_id, "StoryViewer", true);
td->dialog_manager_->force_create_dialog(actor_dialog_id, "StoryViewer", true);
}
type_ = Type::View;

View File

@ -1700,7 +1700,7 @@ class CreateNewSecretChatRequest final : public RequestActor<SecretChatId> {
secret_chat_id_, 0 /* no access_hash */, user_id_, SecretChatState::Unknown, true /* it is outbound chat */,
-1 /* unknown TTL */, 0 /* unknown creation date */, "" /* no key_hash */, 0, FolderId());
DialogId dialog_id(secret_chat_id_);
td_->messages_manager_->force_create_dialog(dialog_id, "create new secret chat", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "create new secret chat", true);
send_result(td_->messages_manager_->get_chat_object(dialog_id));
}
@ -1808,7 +1808,7 @@ class JoinChatByInviteLinkRequest final : public RequestActor<DialogId> {
void do_send_result() final {
CHECK(dialog_id_.is_valid());
td_->messages_manager_->force_create_dialog(dialog_id_, "join chat via an invite link");
td_->dialog_manager_->force_create_dialog(dialog_id_, "join chat via an invite link");
send_result(td_->messages_manager_->get_chat_object(dialog_id_));
}

View File

@ -3029,7 +3029,7 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
break;
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_bot_message_reaction", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_bot_message_reaction", true);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateMessageReaction>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateMessageReaction"),
@ -3058,7 +3058,7 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
message_reactions.push_back(td_api::make_object<td_api::messageReaction>(
reaction_type.get_reaction_type_object(), reaction_count->count_, false, nullptr, Auto()));
}
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_bot_message_reactions", true);
td_->dialog_manager_->force_create_dialog(dialog_id, "on_update_bot_message_reactions", true);
send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateMessageReactions>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateMessageReactions"),

View File

@ -147,7 +147,7 @@ void UserPrivacySettingRule::set_dialog_ids_from_server(Td *td, const vector<int
continue;
}
}
td->messages_manager_->force_create_dialog(dialog_id, "set_dialog_ids_from_server");
td->dialog_manager_->force_create_dialog(dialog_id, "set_dialog_ids_from_server");
dialog_ids_.push_back(dialog_id);
}
}

View File

@ -11,6 +11,7 @@
#include "td/telegram/AuthManager.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/Dimensions.h"
#include "td/telegram/Document.h"
#include "td/telegram/Document.hpp"
@ -586,7 +587,7 @@ WebPageId WebPagesManager::on_get_web_page(tl_object_ptr<telegram_api::WebPage>
LOG(ERROR) << "Receive " << actual_story_id << " instead of " << story_id;
}
}
td_->messages_manager_->force_create_dialog(dialog_id, "webPageAttributeStory");
td_->dialog_manager_->force_create_dialog(dialog_id, "webPageAttributeStory");
page->story_full_ids_.push_back(story_full_id);
break;
}