Move get_chat_ids_object and get_chats_object to DialogManager.

This commit is contained in:
levlam 2024-01-04 16:13:20 +03:00
parent ebda6f1364
commit 32898dbe88
31 changed files with 117 additions and 116 deletions

View File

@ -12,7 +12,6 @@
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
#include "td/telegram/logevent/LogEvent.h" #include "td/telegram/logevent/LogEvent.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
@ -184,7 +183,7 @@ td_api::object_ptr<td_api::autosaveSettingsException>
AutosaveManager::DialogAutosaveSettings::get_autosave_settings_exception_object(const Td *td, AutosaveManager::DialogAutosaveSettings::get_autosave_settings_exception_object(const Td *td,
DialogId dialog_id) const { DialogId dialog_id) const {
return td_api::make_object<td_api::autosaveSettingsException>( return td_api::make_object<td_api::autosaveSettingsException>(
td->messages_manager_->get_chat_id_object(dialog_id, "autosaveSettingsException"), td->dialog_manager_->get_chat_id_object(dialog_id, "autosaveSettingsException"),
get_scope_autosave_settings_object()); get_scope_autosave_settings_object());
} }
@ -424,7 +423,7 @@ void AutosaveManager::on_get_autosave_settings(
current_settings = std::move(new_settings); current_settings = std::move(new_settings);
send_update_autosave_settings( send_update_autosave_settings(
td_api::make_object<td_api::autosaveSettingsScopeChat>( td_api::make_object<td_api::autosaveSettingsScopeChat>(
td_->messages_manager_->get_chat_id_object(dialog_id, "autosaveSettingsScopeChat")), td_->dialog_manager_->get_chat_id_object(dialog_id, "autosaveSettingsScopeChat")),
current_settings); current_settings);
} }
exception_dialog_ids.erase(dialog_id); exception_dialog_ids.erase(dialog_id);
@ -433,7 +432,7 @@ void AutosaveManager::on_get_autosave_settings(
settings_.exceptions_.erase(dialog_id); settings_.exceptions_.erase(dialog_id);
send_update_autosave_settings( send_update_autosave_settings(
td_api::make_object<td_api::autosaveSettingsScopeChat>( td_api::make_object<td_api::autosaveSettingsScopeChat>(
td_->messages_manager_->get_chat_id_object(dialog_id, "autosaveSettingsScopeChat 2")), td_->dialog_manager_->get_chat_id_object(dialog_id, "autosaveSettingsScopeChat 2")),
DialogAutosaveSettings()); DialogAutosaveSettings());
} }

View File

@ -95,7 +95,7 @@ static td_api::object_ptr<td_api::chatBoostSlots> get_chat_boost_slots_object(
cooldown_until_date = 0; cooldown_until_date = 0;
} }
slots.push_back(td_api::make_object<td_api::chatBoostSlot>( slots.push_back(td_api::make_object<td_api::chatBoostSlot>(
my_boost->slot_, td->messages_manager_->get_chat_id_object(dialog_id, "GetMyBoostsQuery"), start_date, my_boost->slot_, td->dialog_manager_->get_chat_id_object(dialog_id, "GetMyBoostsQuery"), start_date,
expiration_date, cooldown_until_date)); expiration_date, cooldown_until_date));
} }
return td_api::make_object<td_api::chatBoostSlots>(std::move(slots)); return td_api::make_object<td_api::chatBoostSlots>(std::move(slots));
@ -448,7 +448,7 @@ td_api::object_ptr<td_api::chatBoostLinkInfo> BoostManager::get_chat_boost_link_
DialogId dialog_id = DialogId dialog_id =
is_public ? td_->messages_manager_->resolve_dialog_username(info.username) : DialogId(info.channel_id); is_public ? td_->messages_manager_->resolve_dialog_username(info.username) : DialogId(info.channel_id);
return td_api::make_object<td_api::chatBoostLinkInfo>( return td_api::make_object<td_api::chatBoostLinkInfo>(
is_public, td_->messages_manager_->get_chat_id_object(dialog_id, "chatBoostLinkInfo")); is_public, td_->dialog_manager_->get_chat_id_object(dialog_id, "chatBoostLinkInfo"));
} }
void BoostManager::get_dialog_boosts(DialogId dialog_id, bool only_gift_codes, const string &offset, int32 limit, void BoostManager::get_dialog_boosts(DialogId dialog_id, bool only_gift_codes, const string &offset, int32 limit,
@ -496,7 +496,7 @@ void BoostManager::on_update_dialog_boost(DialogId dialog_id, telegram_api::obje
send_closure( send_closure(
G()->td(), &Td::send_update, G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatBoost>( td_api::make_object<td_api::updateChatBoost>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateChatBoost"), std::move(chat_boost_object))); td_->dialog_manager_->get_chat_id_object(dialog_id, "updateChatBoost"), std::move(chat_boost_object)));
} }
} // namespace td } // namespace td

View File

@ -195,7 +195,7 @@ void CallbackQueriesManager::on_new_query(int32 flags, int64 callback_query_id,
G()->td(), &Td::send_update, G()->td(), &Td::send_update,
td_api::make_object<td_api::updateNewCallbackQuery>( td_api::make_object<td_api::updateNewCallbackQuery>(
callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewCallbackQuery"), callback_query_id, td_->contacts_manager_->get_user_id_object(sender_user_id, "updateNewCallbackQuery"),
td_->messages_manager_->get_chat_id_object(dialog_id, "updateNewCallbackQuery"), message_id.get(), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateNewCallbackQuery"), message_id.get(),
chat_instance, std::move(payload))); chat_instance, std::move(payload)));
} }

View File

@ -7411,7 +7411,7 @@ vector<td_api::object_ptr<td_api::chatNearby>> ContactsManager::get_chats_nearby
const vector<DialogNearby> &dialogs_nearby) const { const vector<DialogNearby> &dialogs_nearby) const {
return transform(dialogs_nearby, [td = td_](const DialogNearby &dialog_nearby) { return transform(dialogs_nearby, [td = td_](const DialogNearby &dialog_nearby) {
return td_api::make_object<td_api::chatNearby>( return td_api::make_object<td_api::chatNearby>(
td->messages_manager_->get_chat_id_object(dialog_nearby.dialog_id, "chatNearby"), dialog_nearby.distance); td->dialog_manager_->get_chat_id_object(dialog_nearby.dialog_id, "chatNearby"), dialog_nearby.distance);
}); });
} }
@ -8990,7 +8990,7 @@ void ContactsManager::send_update_add_chat_members_privacy_forbidden(DialogId di
td_->dialog_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, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateAddChatMembersPrivacyForbidden>( td_api::make_object<td_api::updateAddChatMembersPrivacyForbidden>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateAddChatMembersPrivacyForbidden"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateAddChatMembersPrivacyForbidden"),
get_user_ids_object(user_ids, source))); get_user_ids_object(user_ids, source)));
} }
@ -9972,8 +9972,8 @@ void ContactsManager::get_channel_recommendations(DialogId dialog_id, bool retur
if (are_suitable_recommended_dialogs(it->second)) { if (are_suitable_recommended_dialogs(it->second)) {
auto next_reload_time = it->second.next_reload_time_; auto next_reload_time = it->second.next_reload_time_;
if (chats_promise) { if (chats_promise) {
chats_promise.set_value(td_->messages_manager_->get_chats_object( chats_promise.set_value(td_->dialog_manager_->get_chats_object(it->second.total_count_, it->second.dialog_ids_,
it->second.total_count_, it->second.dialog_ids_, "get_channel_recommendations")); "get_channel_recommendations"));
} }
if (count_promise) { if (count_promise) {
count_promise.set_value(td_api::make_object<td_api::count>(it->second.total_count_)); count_promise.set_value(td_api::make_object<td_api::count>(it->second.total_count_));
@ -10060,8 +10060,8 @@ void ContactsManager::finish_load_channel_recommendations_queries(ChannelId chan
get_channel_recommendations_queries_.erase(it); get_channel_recommendations_queries_.erase(it);
for (auto &promise : promises) { for (auto &promise : promises) {
if (promise) { if (promise) {
promise.set_value(td_->messages_manager_->get_chats_object(total_count, dialog_ids, promise.set_value(td_->dialog_manager_->get_chats_object(total_count, dialog_ids,
"finish_load_channel_recommendations_queries")); "finish_load_channel_recommendations_queries"));
} }
} }
} }
@ -17568,7 +17568,7 @@ void ContactsManager::send_update_chat_member(DialogId dialog_id, UserId agent_u
td_->dialog_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, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateChatMember>( td_api::make_object<td_api::updateChatMember>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateChatMember"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateChatMember"),
get_user_id_object(agent_user_id, "send_update_chat_member"), date, get_user_id_object(agent_user_id, "send_update_chat_member"), date,
invite_link.get_chat_invite_link_object(this), via_dialog_filter_invite_link, invite_link.get_chat_invite_link_object(this), via_dialog_filter_invite_link,
get_chat_member_object(old_dialog_participant, "send_update_chat_member old"), get_chat_member_object(old_dialog_participant, "send_update_chat_member old"),
@ -17722,10 +17722,10 @@ void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId
send_closure(G()->td(), &Td::send_update, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateNewChatJoinRequest>( td_api::make_object<td_api::updateNewChatJoinRequest>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateNewChatJoinRequest"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateNewChatJoinRequest"),
td_api::make_object<td_api::chatJoinRequest>( td_api::make_object<td_api::chatJoinRequest>(
get_user_id_object(user_id, "on_update_chat_invite_requester"), date, about), get_user_id_object(user_id, "on_update_chat_invite_requester"), date, about),
td_->messages_manager_->get_chat_id_object(user_dialog_id, "updateNewChatJoinRequest 2"), td_->dialog_manager_->get_chat_id_object(user_dialog_id, "updateNewChatJoinRequest 2"),
invite_link.get_chat_invite_link_object(this))); invite_link.get_chat_invite_link_object(this)));
} }
@ -20702,7 +20702,7 @@ tl_object_ptr<td_api::chatInviteLinkInfo> ContactsManager::get_chat_invite_link_
} }
return td_api::make_object<td_api::chatInviteLinkInfo>( return td_api::make_object<td_api::chatInviteLinkInfo>(
td_->messages_manager_->get_chat_id_object(dialog_id, "chatInviteLinkInfo"), accessible_for, std::move(chat_type), td_->dialog_manager_->get_chat_id_object(dialog_id, "chatInviteLinkInfo"), accessible_for, std::move(chat_type),
title, get_chat_photo_info_object(td_->file_manager_.get(), photo), accent_color_id_object, description, title, get_chat_photo_info_object(td_->file_manager_.get(), photo), accent_color_id_object, description,
participant_count, std::move(member_user_ids), creates_join_request, is_public, is_verified, is_scam, is_fake); participant_count, std::move(member_user_ids), creates_join_request, is_public, is_verified, is_scam, is_fake);
} }

View File

@ -251,8 +251,8 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
return nullptr; return nullptr;
} }
return td_api::make_object<td_api::chatEventLinkedChatChanged>( return td_api::make_object<td_api::chatEventLinkedChatChanged>(
td->messages_manager_->get_chat_id_object(old_linked_dialog_id, "chatEventLinkedChatChanged"), td->dialog_manager_->get_chat_id_object(old_linked_dialog_id, "chatEventLinkedChatChanged"),
td->messages_manager_->get_chat_id_object(new_linked_dialog_id, "chatEventLinkedChatChanged 2")); td->dialog_manager_->get_chat_id_object(new_linked_dialog_id, "chatEventLinkedChatChanged 2"));
} }
case telegram_api::channelAdminLogEventActionChangeLocation::ID: { case telegram_api::channelAdminLogEventActionChangeLocation::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeLocation>(action_ptr); auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeLocation>(action_ptr);

View File

@ -8,7 +8,6 @@
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/LinkManager.h" #include "td/telegram/LinkManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
@ -33,7 +32,7 @@ DialogFilterInviteLink::DialogFilterInviteLink(
td_api::object_ptr<td_api::chatFolderInviteLink> DialogFilterInviteLink::get_chat_folder_invite_link_object( td_api::object_ptr<td_api::chatFolderInviteLink> DialogFilterInviteLink::get_chat_folder_invite_link_object(
const Td *td) const { const Td *td) const {
return td_api::make_object<td_api::chatFolderInviteLink>( return td_api::make_object<td_api::chatFolderInviteLink>(
invite_link_, title_, td->messages_manager_->get_chat_ids_object(dialog_ids_, "chatFolderInviteLink")); invite_link_, title_, td->dialog_manager_->get_chat_ids_object(dialog_ids_, "chatFolderInviteLink"));
} }
bool DialogFilterInviteLink::is_valid_invite_link(Slice invite_link) { bool DialogFilterInviteLink::is_valid_invite_link(Slice invite_link) {

View File

@ -400,7 +400,7 @@ class GetChatlistUpdatesQuery final : public Td::ResultHandler {
td_->contacts_manager_->on_get_users(std::move(ptr->users_), "GetChatlistUpdatesQuery"); td_->contacts_manager_->on_get_users(std::move(ptr->users_), "GetChatlistUpdatesQuery");
td_->contacts_manager_->on_get_chats(std::move(ptr->chats_), "GetChatlistUpdatesQuery"); td_->contacts_manager_->on_get_chats(std::move(ptr->chats_), "GetChatlistUpdatesQuery");
auto missing_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(ptr->missing_peers_), true); auto missing_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(ptr->missing_peers_), true);
promise_.set_value(td_->messages_manager_->get_chats_object(-1, missing_dialog_ids, "GetChatlistUpdatesQuery")); promise_.set_value(td_->dialog_manager_->get_chats_object(-1, missing_dialog_ids, "GetChatlistUpdatesQuery"));
} }
void on_error(Status status) final { void on_error(Status status) final {
@ -1711,7 +1711,7 @@ void DialogFilterManager::on_get_leave_dialog_filter_suggestions(
auto dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(peers)); auto dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(peers));
td::remove_if(dialog_ids, [&](DialogId dialog_id) { return !dialog_filter->is_dialog_included(dialog_id); }); td::remove_if(dialog_ids, [&](DialogId dialog_id) { return !dialog_filter->is_dialog_included(dialog_id); });
promise.set_value(td_->messages_manager_->get_chats_object(-1, dialog_ids, "on_get_leave_dialog_filter_suggestions")); promise.set_value(td_->dialog_manager_->get_chats_object(-1, dialog_ids, "on_get_leave_dialog_filter_suggestions"));
} }
void DialogFilterManager::reorder_dialog_filters(vector<DialogFilterId> dialog_filter_ids, void DialogFilterManager::reorder_dialog_filters(vector<DialogFilterId> dialog_filter_ids,
@ -1884,8 +1884,8 @@ void DialogFilterManager::do_get_dialogs_for_dialog_filter_invite_link(
return promise.set_error(Status::Error(400, "Chat folder not found")); return promise.set_error(Status::Error(400, "Chat folder not found"));
} }
promise.set_value(td_->messages_manager_->get_chats_object(-1, dialog_filter->get_dialogs_for_invite_link(td_), promise.set_value(td_->dialog_manager_->get_chats_object(-1, dialog_filter->get_dialogs_for_invite_link(td_),
"do_get_dialogs_for_dialog_filter_invite_link")); "do_get_dialogs_for_dialog_filter_invite_link"));
} }
void DialogFilterManager::create_dialog_filter_invite_link( void DialogFilterManager::create_dialog_filter_invite_link(
@ -2025,8 +2025,8 @@ void DialogFilterManager::on_get_chatlist_invite(
auto missing_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(missing_peers), true); auto missing_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(missing_peers), true);
auto already_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(already_peers)); auto already_dialog_ids = td_->messages_manager_->get_peers_dialog_ids(std::move(already_peers));
promise.set_value(td_api::make_object<td_api::chatFolderInviteLinkInfo>( promise.set_value(td_api::make_object<td_api::chatFolderInviteLinkInfo>(
std::move(info), td_->messages_manager_->get_chat_ids_object(missing_dialog_ids, "chatFolderInviteLinkInfo 1"), std::move(info), td_->dialog_manager_->get_chat_ids_object(missing_dialog_ids, "chatFolderInviteLinkInfo 1"),
td_->messages_manager_->get_chat_ids_object(already_dialog_ids, "chatFolderInviteLinkInfo 1"))); td_->dialog_manager_->get_chat_ids_object(already_dialog_ids, "chatFolderInviteLinkInfo 1")));
} }
void DialogFilterManager::add_dialog_filter_by_invite_link(const string &invite_link, vector<DialogId> dialog_ids, void DialogFilterManager::add_dialog_filter_by_invite_link(const string &invite_link, vector<DialogId> dialog_ids,

View File

@ -15,6 +15,9 @@
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/UserId.h" #include "td/telegram/UserId.h"
#include "td/utils/algorithm.h"
#include "td/utils/misc.h"
namespace td { namespace td {
DialogManager::DialogManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) { DialogManager::DialogManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
@ -165,7 +168,7 @@ bool DialogManager::have_dialog_force(DialogId dialog_id, const char *source) co
void DialogManager::force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access, void DialogManager::force_create_dialog(DialogId dialog_id, const char *source, bool expect_no_access,
bool force_update_dialog_pos) { bool force_update_dialog_pos) {
return td_->messages_manager_->force_create_dialog(dialog_id, source, expect_no_access, force_update_dialog_pos); 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 { bool DialogManager::have_dialog_info(DialogId dialog_id) const {
@ -267,6 +270,27 @@ void DialogManager::reload_dialog_info_full(DialogId dialog_id, const char *sour
} }
} }
int64 DialogManager::get_chat_id_object(DialogId dialog_id, const char *source) const {
return td_->messages_manager_->get_chat_id_object(dialog_id, source);
}
vector<int64> DialogManager::get_chat_ids_object(const vector<DialogId> &dialog_ids, const char *source) const {
return transform(dialog_ids, [this, source](DialogId dialog_id) { return get_chat_id_object(dialog_id, source); });
}
td_api::object_ptr<td_api::chats> DialogManager::get_chats_object(int32 total_count, const vector<DialogId> &dialog_ids,
const char *source) const {
if (total_count == -1) {
total_count = narrow_cast<int32>(dialog_ids.size());
}
return td_api::make_object<td_api::chats>(total_count, get_chat_ids_object(dialog_ids, source));
}
td_api::object_ptr<td_api::chats> DialogManager::get_chats_object(const std::pair<int32, vector<DialogId>> &dialog_ids,
const char *source) const {
return get_chats_object(dialog_ids.first, dialog_ids.second, source);
}
td_api::object_ptr<td_api::ChatType> DialogManager::get_chat_type_object(DialogId dialog_id) const { td_api::object_ptr<td_api::ChatType> DialogManager::get_chat_type_object(DialogId dialog_id) const {
switch (dialog_id.get_type()) { switch (dialog_id.get_type()) {
case DialogType::User: case DialogType::User:

View File

@ -64,6 +64,16 @@ class DialogManager final : public Actor {
void reload_dialog_info_full(DialogId dialog_id, const char *source); void reload_dialog_info_full(DialogId dialog_id, const char *source);
int64 get_chat_id_object(DialogId dialog_id, const char *source) const;
vector<int64> get_chat_ids_object(const vector<DialogId> &dialog_ids, const char *source) const;
td_api::object_ptr<td_api::chats> get_chats_object(int32 total_count, const vector<DialogId> &dialog_ids,
const char *source) const;
td_api::object_ptr<td_api::chats> get_chats_object(const std::pair<int32, vector<DialogId>> &dialog_ids,
const char *source) const;
td_api::object_ptr<td_api::ChatType> get_chat_type_object(DialogId dialog_id) const; td_api::object_ptr<td_api::ChatType> get_chat_type_object(DialogId dialog_id) const;
NotificationSettingsScope get_dialog_notification_setting_scope(DialogId dialog_id) const; NotificationSettingsScope get_dialog_notification_setting_scope(DialogId dialog_id) const;

View File

@ -1167,7 +1167,7 @@ void ForumTopicManager::set_topic_info(DialogId dialog_id, Topic *topic, unique_
td_api::object_ptr<td_api::updateForumTopicInfo> ForumTopicManager::get_update_forum_topic_info( td_api::object_ptr<td_api::updateForumTopicInfo> ForumTopicManager::get_update_forum_topic_info(
DialogId dialog_id, const ForumTopicInfo *topic_info) const { DialogId dialog_id, const ForumTopicInfo *topic_info) const {
return td_api::make_object<td_api::updateForumTopicInfo>( return td_api::make_object<td_api::updateForumTopicInfo>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateForumTopicInfo"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateForumTopicInfo"),
topic_info->get_forum_topic_info_object(td_)); topic_info->get_forum_topic_info_object(td_));
} }

View File

@ -12,7 +12,6 @@
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h" #include "td/telegram/misc.h"
#include "td/telegram/OptionManager.h" #include "td/telegram/OptionManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
@ -132,12 +131,12 @@ td_api::object_ptr<td_api::premiumGiveawayParameters> GiveawayParameters::get_pr
for (auto channel_id : additional_channel_ids_) { for (auto channel_id : additional_channel_ids_) {
DialogId dialog_id(channel_id); DialogId dialog_id(channel_id);
td->dialog_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")); chat_ids.push_back(td->dialog_manager_->get_chat_id_object(dialog_id, "premiumGiveawayParameters"));
} }
DialogId dialog_id(boosted_channel_id_); DialogId dialog_id(boosted_channel_id_);
td->dialog_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>( return td_api::make_object<td_api::premiumGiveawayParameters>(
td->messages_manager_->get_chat_id_object(dialog_id, "premiumGiveawayParameters"), std::move(chat_ids), date_, td->dialog_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_); only_new_subscribers_, winners_are_visible_, vector<string>(country_codes_), prize_description_);
} }

View File

@ -10,6 +10,7 @@
#include "td/telegram/ContactsManager.h" #include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h" #include "td/telegram/Dependencies.h"
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/DialogManager.h"
#include "td/telegram/InlineQueriesManager.h" #include "td/telegram/InlineQueriesManager.h"
#include "td/telegram/MessageId.h" #include "td/telegram/MessageId.h"
#include "td/telegram/MessagesManager.h" #include "td/telegram/MessagesManager.h"
@ -199,7 +200,7 @@ td_api::object_ptr<td_api::storyArea> MediaArea::get_story_area_object(
} }
case Type::Message: case Type::Message:
type = td_api::make_object<td_api::storyAreaTypeMessage>( type = td_api::make_object<td_api::storyAreaTypeMessage>(
td->messages_manager_->get_chat_id_object(message_full_id_.get_dialog_id(), "storyAreaTypeMessage"), td->dialog_manager_->get_chat_id_object(message_full_id_.get_dialog_id(), "storyAreaTypeMessage"),
message_full_id_.get_message_id().get()); message_full_id_.get_message_id().get());
break; break;
default: default:

View File

@ -55,7 +55,6 @@
#include "td/telegram/MessageId.h" #include "td/telegram/MessageId.h"
#include "td/telegram/MessageSearchFilter.h" #include "td/telegram/MessageSearchFilter.h"
#include "td/telegram/MessageSender.h" #include "td/telegram/MessageSender.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h" #include "td/telegram/misc.h"
#include "td/telegram/OptionManager.h" #include "td/telegram/OptionManager.h"
#include "td/telegram/OrderInfo.h" #include "td/telegram/OrderInfo.h"
@ -6939,7 +6938,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
} else { } else {
auto invoice_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id; auto invoice_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
return make_tl_object<td_api::messagePaymentSuccessful>( return make_tl_object<td_api::messagePaymentSuccessful>(
td->messages_manager_->get_chat_id_object(invoice_dialog_id, "messagePaymentSuccessful"), td->dialog_manager_->get_chat_id_object(invoice_dialog_id, "messagePaymentSuccessful"),
m->invoice_message_id.get(), m->currency, m->total_amount, m->is_recurring, m->is_first_recurring, m->invoice_message_id.get(), m->currency, m->total_amount, m->is_recurring, m->is_first_recurring,
m->invoice_payload); m->invoice_payload);
} }
@ -7074,7 +7073,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
if (td->auth_manager_->is_bot()) { if (td->auth_manager_->is_bot()) {
chat_id = m->shared_dialog_ids[0].get(); chat_id = m->shared_dialog_ids[0].get();
} else { } else {
chat_id = td->messages_manager_->get_chat_id_object(m->shared_dialog_ids[0], "messageChatShared"); chat_id = td->dialog_manager_->get_chat_id_object(m->shared_dialog_ids[0], "messageChatShared");
} }
return make_tl_object<td_api::messageChatShared>(chat_id, m->button_id); return make_tl_object<td_api::messageChatShared>(chat_id, m->button_id);
} }
@ -7091,7 +7090,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
case MessageContentType::Story: { case MessageContentType::Story: {
const auto *m = static_cast<const MessageStory *>(content); const auto *m = static_cast<const MessageStory *>(content);
return td_api::make_object<td_api::messageStory>( return td_api::make_object<td_api::messageStory>(
td->messages_manager_->get_chat_id_object(m->story_full_id.get_dialog_id(), "messageStory"), td->dialog_manager_->get_chat_id_object(m->story_full_id.get_dialog_id(), "messageStory"),
m->story_full_id.get_story_id().get(), m->via_mention); m->story_full_id.get_story_id().get(), m->via_mention);
} }
case MessageContentType::WriteAccessAllowedByRequest: case MessageContentType::WriteAccessAllowedByRequest:
@ -7122,7 +7121,7 @@ tl_object_ptr<td_api::MessageContent> get_message_content_object(const MessageCo
case MessageContentType::GiveawayWinners: { case MessageContentType::GiveawayWinners: {
const auto *m = static_cast<const MessageGiveawayWinners *>(content); const auto *m = static_cast<const MessageGiveawayWinners *>(content);
return td_api::make_object<td_api::messagePremiumGiveawayWinners>( return td_api::make_object<td_api::messagePremiumGiveawayWinners>(
td->messages_manager_->get_chat_id_object(DialogId(m->boosted_channel_id), "messagePremiumGiveawayWinners"), td->dialog_manager_->get_chat_id_object(DialogId(m->boosted_channel_id), "messagePremiumGiveawayWinners"),
m->giveaway_message_id.get(), m->additional_dialog_count, m->winners_selection_date, m->only_new_subscribers, m->giveaway_message_id.get(), m->additional_dialog_count, m->winners_selection_date, m->only_new_subscribers,
m->was_refunded, m->month_count, m->prize_description, m->winner_count, m->was_refunded, m->month_count, m->prize_description, m->winner_count,
td->contacts_manager_->get_user_ids_object(m->winner_user_ids, "messagePremiumGiveawayWinners"), td->contacts_manager_->get_user_ids_object(m->winner_user_ids, "messagePremiumGiveawayWinners"),

View File

@ -12,7 +12,6 @@
#include "td/telegram/DialogId.h" #include "td/telegram/DialogId.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/InputDialogId.h" #include "td/telegram/InputDialogId.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/misc.h" #include "td/telegram/misc.h"
#include "td/telegram/ServerMessageId.h" #include "td/telegram/ServerMessageId.h"
#include "td/telegram/StoryId.h" #include "td/telegram/StoryId.h"
@ -143,7 +142,7 @@ telegram_api::object_ptr<telegram_api::InputReplyTo> MessageInputReplyTo::get_in
td_api::object_ptr<td_api::InputMessageReplyTo> MessageInputReplyTo::get_input_message_reply_to_object(Td *td) const { td_api::object_ptr<td_api::InputMessageReplyTo> MessageInputReplyTo::get_input_message_reply_to_object(Td *td) const {
if (story_full_id_.is_valid()) { if (story_full_id_.is_valid()) {
return td_api::make_object<td_api::inputMessageReplyToStory>( return td_api::make_object<td_api::inputMessageReplyToStory>(
td->messages_manager_->get_chat_id_object(story_full_id_.get_dialog_id(), "inputMessageReplyToStory"), td->dialog_manager_->get_chat_id_object(story_full_id_.get_dialog_id(), "inputMessageReplyToStory"),
story_full_id_.get_story_id().get()); story_full_id_.get_story_id().get());
} }
if (!message_id_.is_valid() && !message_id_.is_valid_scheduled()) { if (!message_id_.is_valid() && !message_id_.is_valid_scheduled()) {
@ -154,7 +153,7 @@ td_api::object_ptr<td_api::InputMessageReplyTo> MessageInputReplyTo::get_input_m
quote = td_api::make_object<td_api::inputTextQuote>(get_formatted_text_object(quote_, true, -1), quote_position_); quote = td_api::make_object<td_api::inputTextQuote>(get_formatted_text_object(quote_, true, -1), quote_position_);
} }
return td_api::make_object<td_api::inputMessageReplyToMessage>( return td_api::make_object<td_api::inputMessageReplyToMessage>(
td->messages_manager_->get_chat_id_object(dialog_id_, "inputMessageReplyToMessage"), message_id_.get(), td->dialog_manager_->get_chat_id_object(dialog_id_, "inputMessageReplyToMessage"), message_id_.get(),
std::move(quote)); std::move(quote));
} }

View File

@ -11,7 +11,6 @@
#include "td/telegram/Dependencies.h" #include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/Global.h" #include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/ServerMessageId.h" #include "td/telegram/ServerMessageId.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
@ -86,12 +85,12 @@ td_api::object_ptr<td_api::MessageOrigin> MessageOrigin::get_message_origin_obje
} }
if (message_id_.is_valid()) { if (message_id_.is_valid()) {
return td_api::make_object<td_api::messageOriginChannel>( return td_api::make_object<td_api::messageOriginChannel>(
td->messages_manager_->get_chat_id_object(sender_dialog_id_, "messageOriginChannel"), message_id_.get(), td->dialog_manager_->get_chat_id_object(sender_dialog_id_, "messageOriginChannel"), message_id_.get(),
author_signature_); author_signature_);
} }
if (sender_dialog_id_.is_valid()) { if (sender_dialog_id_.is_valid()) {
return td_api::make_object<td_api::messageOriginChat>( return td_api::make_object<td_api::messageOriginChat>(
td->messages_manager_->get_chat_id_object(sender_dialog_id_, "messageOriginChat"), td->dialog_manager_->get_chat_id_object(sender_dialog_id_, "messageOriginChat"),
sender_name_.empty() ? author_signature_ : sender_name_); sender_name_.empty() ? author_signature_ : sender_name_);
} }
return td_api::make_object<td_api::messageOriginUser>( return td_api::make_object<td_api::messageOriginUser>(

View File

@ -22,7 +22,7 @@ td_api::object_ptr<td_api::MessageSender> get_message_sender_object_const(Td *td
const char *source) { const char *source) {
if (dialog_id.is_valid() && td->messages_manager_->have_dialog(dialog_id)) { if (dialog_id.is_valid() && td->messages_manager_->have_dialog(dialog_id)) {
return td_api::make_object<td_api::messageSenderChat>( return td_api::make_object<td_api::messageSenderChat>(
td->messages_manager_->get_chat_id_object(dialog_id, "get_message_sender_object_const")); td->dialog_manager_->get_chat_id_object(dialog_id, "get_message_sender_object_const"));
} }
if (!user_id.is_valid()) { if (!user_id.is_valid()) {
// can happen only if the server sends a message with wrong sender // can happen only if the server sends a message with wrong sender
@ -78,7 +78,7 @@ td_api::object_ptr<td_api::MessageSender> get_min_message_sender_object(Td *td,
} }
if (td->messages_manager_->have_dialog(dialog_id)) { if (td->messages_manager_->have_dialog(dialog_id)) {
return td_api::make_object<td_api::messageSenderChat>( return td_api::make_object<td_api::messageSenderChat>(
td->messages_manager_->get_chat_id_object(dialog_id, "get_min_message_sender_object")); td->dialog_manager_->get_chat_id_object(dialog_id, "get_min_message_sender_object"));
} }
} }
LOG(ERROR) << "Can't return unknown " << dialog_id << " from " << source; LOG(ERROR) << "Can't return unknown " << dialog_id << " from " << source;

View File

@ -17066,7 +17066,8 @@ void MessagesManager::get_dialogs_from_list_impl(int64 task_id) {
if (!task_promise) { if (!task_promise) {
dialog_ids.clear(); dialog_ids.clear();
} }
return task_promise.set_value(get_chats_object(total_count, dialog_ids, "get_dialogs_from_list_impl")); return task_promise.set_value(
td_->dialog_manager_->get_chats_object(total_count, dialog_ids, "get_dialogs_from_list_impl"));
} }
// nor the limit, nor the end of the list were reached; wait for the promise // nor the limit, nor the end of the list were reached; wait for the promise
} }
@ -20553,10 +20554,6 @@ int64 MessagesManager::get_chat_id_object(DialogId dialog_id, const char *source
return dialog_id.get(); return dialog_id.get();
} }
vector<int64> MessagesManager::get_chat_ids_object(const vector<DialogId> &dialog_ids, const char *source) const {
return transform(dialog_ids, [this, source](DialogId dialog_id) { return get_chat_id_object(dialog_id, source); });
}
td_api::object_ptr<td_api::ChatActionBar> MessagesManager::get_chat_action_bar_object(const Dialog *d) const { td_api::object_ptr<td_api::ChatActionBar> MessagesManager::get_chat_action_bar_object(const Dialog *d) const {
CHECK(d != nullptr); CHECK(d != nullptr);
auto dialog_type = d->dialog_id.get_type(); auto dialog_type = d->dialog_id.get_type();
@ -20679,19 +20676,6 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(DialogId dialo
return get_chat_object(d); return get_chat_object(d);
} }
tl_object_ptr<td_api::chats> MessagesManager::get_chats_object(int32 total_count, const vector<DialogId> &dialog_ids,
const char *source) const {
if (total_count == -1) {
total_count = narrow_cast<int32>(dialog_ids.size());
}
return td_api::make_object<td_api::chats>(total_count, get_chat_ids_object(dialog_ids, source));
}
tl_object_ptr<td_api::chats> MessagesManager::get_chats_object(const std::pair<int32, vector<DialogId>> &dialog_ids,
const char *source) const {
return get_chats_object(dialog_ids.first, dialog_ids.second, source);
}
std::pair<bool, int32> MessagesManager::get_dialog_mute_until(DialogId dialog_id, const Dialog *d) const { std::pair<bool, int32> MessagesManager::get_dialog_mute_until(DialogId dialog_id, const Dialog *d) const {
CHECK(!td_->auth_manager_->is_bot()); CHECK(!td_->auth_manager_->is_bot());
if (d == nullptr || !d->notification_settings.is_synchronized) { if (d == nullptr || !d->notification_settings.is_synchronized) {

View File

@ -733,16 +733,8 @@ class MessagesManager final : public Actor {
int64 get_chat_id_object(DialogId dialog_id, const char *source) const; int64 get_chat_id_object(DialogId dialog_id, const char *source) const;
vector<int64> get_chat_ids_object(const vector<DialogId> &dialog_ids, const char *source) const;
td_api::object_ptr<td_api::chat> get_chat_object(DialogId dialog_id); td_api::object_ptr<td_api::chat> get_chat_object(DialogId dialog_id);
tl_object_ptr<td_api::chats> get_chats_object(int32 total_count, const vector<DialogId> &dialog_ids,
const char *source) const;
tl_object_ptr<td_api::chats> get_chats_object(const std::pair<int32, vector<DialogId>> &dialog_ids,
const char *source) const;
tl_object_ptr<td_api::messages> get_dialog_history(DialogId dialog_id, MessageId from_message_id, int32 offset, tl_object_ptr<td_api::messages> get_dialog_history(DialogId dialog_id, MessageId from_message_id, int32 offset,
int32 limit, int left_tries, bool only_local, int32 limit, int left_tries, bool only_local,
Promise<Unit> &&promise); Promise<Unit> &&promise);

View File

@ -357,7 +357,7 @@ td_api::object_ptr<td_api::updateActiveNotifications> NotificationManager::get_u
std::reverse(notifications.begin(), notifications.end()); std::reverse(notifications.begin(), notifications.end());
groups.push_back(td_api::make_object<td_api::notificationGroup>( groups.push_back(td_api::make_object<td_api::notificationGroup>(
group.first.group_id.get(), get_notification_group_type_object(group.second.type), group.first.group_id.get(), get_notification_group_type_object(group.second.type),
td_->messages_manager_->get_chat_id_object(group.first.dialog_id, "updateActiveNotifications"), td_->dialog_manager_->get_chat_id_object(group.first.dialog_id, "updateActiveNotifications"),
group.second.total_count, std::move(notifications))); group.second.total_count, std::move(notifications)));
} }
} }
@ -733,7 +733,7 @@ void NotificationManager::add_notifications_to_group_begin(NotificationGroups::i
if (!added_notifications.empty()) { if (!added_notifications.empty()) {
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>( add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup"), 0, 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup"), 0, 0,
group.total_count, std::move(added_notifications), vector<int32>())); group.total_count, std::move(added_notifications), vector<int32>()));
} }
} }
@ -1461,9 +1461,9 @@ bool NotificationManager::do_flush_pending_notifications(NotificationGroupKey &g
if (!added_notifications.empty()) { if (!added_notifications.empty()) {
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>( add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 2"), td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 2"),
td_->messages_manager_->get_chat_id_object(pending_notifications[0].settings_dialog_id, td_->dialog_manager_->get_chat_id_object(pending_notifications[0].settings_dialog_id,
"updateNotificationGroup 3"), "updateNotificationGroup 3"),
pending_notifications[0].ringtone_id, group.total_count, std::move(added_notifications), pending_notifications[0].ringtone_id, group.total_count, std::move(added_notifications),
std::move(removed_notification_ids))); std::move(removed_notification_ids)));
} else { } else {
@ -1489,9 +1489,9 @@ td_api::object_ptr<td_api::updateNotificationGroup> NotificationManager::get_rem
} }
return td_api::make_object<td_api::updateNotificationGroup>( return td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 4"), td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 4"),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 10"), 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 10"), 0, group.total_count,
group.total_count, vector<td_api::object_ptr<td_api::notification>>(), std::move(removed_notification_ids)); vector<td_api::object_ptr<td_api::notification>>(), std::move(removed_notification_ids));
} }
void NotificationManager::send_remove_group_update(const NotificationGroupKey &group_key, void NotificationManager::send_remove_group_update(const NotificationGroupKey &group_key,
@ -1521,7 +1521,7 @@ void NotificationManager::send_add_group_update(const NotificationGroupKey &grou
if (!added_notifications.empty()) { if (!added_notifications.empty()) {
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>( add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 5"), 0, 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 5"), 0, 0,
group.total_count, std::move(added_notifications), vector<int32>())); group.total_count, std::move(added_notifications), vector<int32>()));
} }
} }
@ -1777,7 +1777,7 @@ void NotificationManager::on_notifications_removed(
// send update about empty invisible group anyway // send update about empty invisible group anyway
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>( add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 6"), 0, 0, 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 6"), 0, 0, 0,
vector<td_api::object_ptr<td_api::notification>>(), vector<int32>())); vector<td_api::object_ptr<td_api::notification>>(), vector<int32>()));
} else { } else {
VLOG(notifications) << "There is no need to send updateNotificationGroup about " << group_key.group_id; VLOG(notifications) << "There is no need to send updateNotificationGroup about " << group_key.group_id;
@ -1787,7 +1787,7 @@ void NotificationManager::on_notifications_removed(
// group is still visible // group is still visible
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>( add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 7"), 0, 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 7"), 0, 0,
group.total_count, std::move(added_notifications), std::move(removed_notification_ids))); group.total_count, std::move(added_notifications), std::move(removed_notification_ids)));
} else { } else {
// group needs to be removed // group needs to be removed
@ -2602,8 +2602,8 @@ void NotificationManager::on_notification_group_size_max_changed() {
if (!is_destroyed_) { if (!is_destroyed_) {
auto update = td_api::make_object<td_api::updateNotificationGroup>( auto update = td_api::make_object<td_api::updateNotificationGroup>(
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.group_id.get(), get_notification_group_type_object(group.type),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 8"), td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 8"),
td_->messages_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 9"), 0, td_->dialog_manager_->get_chat_id_object(group_key.dialog_id, "updateNotificationGroup 9"), 0,
group.total_count, std::move(added_notifications), std::move(removed_notification_ids)); group.total_count, std::move(added_notifications), std::move(removed_notification_ids));
VLOG(notifications) << "Send " << as_notification_update(update.get()); VLOG(notifications) << "Send " << as_notification_update(update.get());
send_closure(G()->td(), &Td::send_update, std::move(update)); send_closure(G()->td(), &Td::send_update, std::move(update));

View File

@ -331,7 +331,7 @@ class GetStoryNotifySettingsExceptionsQuery final : public Td::ResultHandler {
for (auto &dialog_id : dialog_ids) { for (auto &dialog_id : dialog_ids) {
td_->dialog_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 chat_ids = td_->dialog_manager_->get_chats_object(-1, dialog_ids, "GetStoryNotifySettingsExceptionsQuery");
auto promise = PromiseCreator::lambda([promise = std::move(promise_), chat_ids = std::move(chat_ids)]( auto promise = PromiseCreator::lambda([promise = std::move(promise_), chat_ids = std::move(chat_ids)](
Result<Unit>) mutable { promise.set_value(std::move(chat_ids)); }); Result<Unit>) mutable { promise.set_value(std::move(chat_ids)); });
td_->updates_manager_->on_get_updates(std::move(updates_ptr), std::move(promise)); td_->updates_manager_->on_get_updates(std::move(updates_ptr), std::move(promise));

View File

@ -470,8 +470,7 @@ class GetGiveawayInfoQuery final : public Td::ResultHandler {
DialogId dialog_id(channel_id); DialogId dialog_id(channel_id);
td_->dialog_manager_->force_create_dialog(dialog_id, "GetGiveawayInfoQuery"); td_->dialog_manager_->force_create_dialog(dialog_id, "GetGiveawayInfoQuery");
return td_api::make_object<td_api::premiumGiveawayParticipantStatusAdministrator>( return td_api::make_object<td_api::premiumGiveawayParticipantStatusAdministrator>(
td_->messages_manager_->get_chat_id_object(dialog_id, td_->dialog_manager_->get_chat_id_object(dialog_id, "premiumGiveawayParticipantStatusAdministrator"));
"premiumGiveawayParticipantStatusAdministrator"));
} }
} }
if (!info->disallowed_country_.empty()) { if (!info->disallowed_country_.empty()) {

View File

@ -315,7 +315,7 @@ td_api::object_ptr<td_api::messageReplyToMessage> RepliedMessageInfo::get_messag
} else { } else {
CHECK(dialog_id.is_valid()); CHECK(dialog_id.is_valid());
} }
auto chat_id = td->messages_manager_->get_chat_id_object(dialog_id, "messageReplyToMessage"); auto chat_id = td->dialog_manager_->get_chat_id_object(dialog_id, "messageReplyToMessage");
if (message_id_ == MessageId()) { if (message_id_ == MessageId()) {
chat_id = 0; chat_id = 0;
} }

View File

@ -13,7 +13,6 @@
#include "td/telegram/LinkManager.h" #include "td/telegram/LinkManager.h"
#include "td/telegram/MessageContent.h" #include "td/telegram/MessageContent.h"
#include "td/telegram/MessageEntity.h" #include "td/telegram/MessageEntity.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/net/NetQueryCreator.h" #include "td/telegram/net/NetQueryCreator.h"
#include "td/telegram/OptionManager.h" #include "td/telegram/OptionManager.h"
#include "td/telegram/Photo.h" #include "td/telegram/Photo.h"
@ -253,7 +252,7 @@ td_api::object_ptr<td_api::messageSponsor> SponsoredMessageManager::get_message_
<< sponsored_message.server_message_id.get()); << sponsored_message.server_message_id.get());
} }
type = td_api::make_object<td_api::messageSponsorTypePublicChannel>( type = td_api::make_object<td_api::messageSponsorTypePublicChannel>(
td_->messages_manager_->get_chat_id_object(sponsored_message.sponsor_dialog_id, "sponsoredMessage"), td_->dialog_manager_->get_chat_id_object(sponsored_message.sponsor_dialog_id, "sponsoredMessage"),
std::move(link)); std::move(link));
if (sponsored_message.show_dialog_photo) { if (sponsored_message.show_dialog_photo) {
photo = get_chat_photo_info_object(td_->file_manager_.get(), photo = get_chat_photo_info_object(td_->file_manager_.get(),

View File

@ -6934,7 +6934,7 @@ void StickersManager::send_update_animated_emoji_clicked(MessageFullId message_f
send_closure(G()->td(), &Td::send_update, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateAnimatedEmojiMessageClicked>( td_api::make_object<td_api::updateAnimatedEmojiMessageClicked>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateAnimatedEmojiMessageClicked"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateAnimatedEmojiMessageClicked"),
message_full_id.get_message_id().get(), get_sticker_object(sticker_id, false, true))); message_full_id.get_message_id().get(), get_sticker_object(sticker_id, false, true)));
} }

View File

@ -8,7 +8,6 @@
#include "td/telegram/Dependencies.h" #include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/utils/logging.h" #include "td/utils/logging.h"
@ -51,7 +50,7 @@ td_api::object_ptr<td_api::storyRepostInfo> StoryForwardInfo::get_story_repost_i
auto origin = [&]() -> td_api::object_ptr<td_api::StoryOrigin> { auto origin = [&]() -> td_api::object_ptr<td_api::StoryOrigin> {
if (dialog_id_.is_valid() && story_id_.is_valid()) { if (dialog_id_.is_valid() && story_id_.is_valid()) {
return td_api::make_object<td_api::storyOriginPublicStory>( return td_api::make_object<td_api::storyOriginPublicStory>(
td->messages_manager_->get_chat_id_object(dialog_id_, "storyOriginPublicStory"), story_id_.get()); td->dialog_manager_->get_chat_id_object(dialog_id_, "storyOriginPublicStory"), story_id_.get());
} }
return td_api::make_object<td_api::storyOriginHiddenUser>(sender_name_); return td_api::make_object<td_api::storyOriginHiddenUser>(sender_name_);
}(); }();

View File

@ -3208,7 +3208,7 @@ td_api::object_ptr<td_api::story> StoryManager::get_story_object(StoryFullId sto
story->is_update_sent_ = true; story->is_update_sent_ = true;
return td_api::make_object<td_api::story>( return td_api::make_object<td_api::story>(
story_id.get(), td_->messages_manager_->get_chat_id_object(owner_dialog_id, "get_story_object"), story->date_, story_id.get(), td_->dialog_manager_->get_chat_id_object(owner_dialog_id, "get_story_object"), story->date_,
is_being_sent, is_being_edited, is_edited, story->is_pinned_, is_visible_only_for_self, can_be_deleted, is_being_sent, is_being_edited, is_edited, story->is_pinned_, is_visible_only_for_self, can_be_deleted,
can_be_edited, can_be_forwarded, can_be_replied, can_toggle_is_pinned, can_get_statistics, can_get_interactions, can_be_edited, can_be_forwarded, can_be_replied, can_toggle_is_pinned, can_get_statistics, can_get_interactions,
has_expired_viewers, std::move(repost_info), std::move(interaction_info), has_expired_viewers, std::move(repost_info), std::move(interaction_info),
@ -3261,7 +3261,7 @@ td_api::object_ptr<td_api::chatActiveStories> StoryManager::get_chat_active_stor
} }
} }
return td_api::make_object<td_api::chatActiveStories>( return td_api::make_object<td_api::chatActiveStories>(
td_->messages_manager_->get_chat_id_object(owner_dialog_id, "updateChatActiveStories"), td_->dialog_manager_->get_chat_id_object(owner_dialog_id, "updateChatActiveStories"),
story_list_id.get_story_list_object(), order, max_read_story_id.get(), std::move(stories)); story_list_id.get_story_list_object(), order, max_read_story_id.get(), std::move(stories));
} }
@ -3630,7 +3630,7 @@ void StoryManager::on_delete_story(StoryFullId story_full_id) {
send_closure( send_closure(
G()->td(), &Td::send_update, G()->td(), &Td::send_update,
td_api::make_object<td_api::updateStoryDeleted>( td_api::make_object<td_api::updateStoryDeleted>(
td_->messages_manager_->get_chat_id_object(owner_dialog_id, "updateStoryDeleted"), story_id.get())); td_->dialog_manager_->get_chat_id_object(owner_dialog_id, "updateStoryDeleted"), story_id.get()));
} }
delete_story_files(story); delete_story_files(story);
unregister_story_global_id(story); unregister_story_global_id(story);

View File

@ -811,7 +811,7 @@ class SearchPublicChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(-1, dialog_ids_, "SearchPublicChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(-1, dialog_ids_, "SearchPublicChatsRequest"));
} }
public: public:
@ -831,7 +831,7 @@ class SearchChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(dialog_ids_, "SearchChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(dialog_ids_, "SearchChatsRequest"));
} }
public: public:
@ -851,7 +851,7 @@ class SearchChatsOnServerRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(-1, dialog_ids_, "SearchChatsOnServerRequest")); send_result(td_->dialog_manager_->get_chats_object(-1, dialog_ids_, "SearchChatsOnServerRequest"));
} }
public: public:
@ -873,7 +873,7 @@ class GetGroupsInCommonRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(dialog_ids_, "GetGroupsInCommonRequest")); send_result(td_->dialog_manager_->get_chats_object(dialog_ids_, "GetGroupsInCommonRequest"));
} }
public: public:
@ -890,7 +890,7 @@ class GetSuitableDiscussionChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(-1, dialog_ids_, "GetSuitableDiscussionChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(-1, dialog_ids_, "GetSuitableDiscussionChatsRequest"));
} }
public: public:
@ -906,7 +906,7 @@ class GetInactiveSupergroupChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(-1, dialog_ids_, "GetInactiveSupergroupChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(-1, dialog_ids_, "GetInactiveSupergroupChatsRequest"));
} }
public: public:
@ -925,7 +925,7 @@ class SearchRecentlyFoundChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(dialog_ids_, "SearchRecentlyFoundChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(dialog_ids_, "SearchRecentlyFoundChatsRequest"));
} }
public: public:
@ -944,7 +944,7 @@ class GetRecentlyOpenedChatsRequest final : public RequestActor<> {
} }
void do_send_result() final { void do_send_result() final {
send_result(td_->messages_manager_->get_chats_object(dialog_ids_, "GetRecentlyOpenedChatsRequest")); send_result(td_->dialog_manager_->get_chats_object(dialog_ids_, "GetRecentlyOpenedChatsRequest"));
} }
public: public:
@ -1974,7 +1974,7 @@ class GetChatNotificationSettingsExceptionsRequest final : public RequestActor<>
void do_send_result() final { void do_send_result() final {
send_result( send_result(
td_->messages_manager_->get_chats_object(-1, dialog_ids_, "GetChatNotificationSettingsExceptionsRequest")); td_->dialog_manager_->get_chats_object(-1, dialog_ids_, "GetChatNotificationSettingsExceptionsRequest"));
} }
public: public:

View File

@ -437,7 +437,7 @@ void TopDialogManager::on_load_dialogs(GetTopDialogsQuery &&query, vector<Dialog
} }
query.promise.set_value( query.promise.set_value(
td_->messages_manager_->get_chats_object(-1, std::move(result), "TopDialogManager::on_load_dialogs")); td_->dialog_manager_->get_chats_object(-1, std::move(result), "TopDialogManager::on_load_dialogs"));
} }
void TopDialogManager::do_get_top_peers() { void TopDialogManager::do_get_top_peers() {

View File

@ -3032,9 +3032,9 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
td_->dialog_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, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateMessageReaction>( td_api::make_object<td_api::updateMessageReaction>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateMessageReaction"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateMessageReaction"), message_id.get(),
message_id.get(), get_message_sender_object(td_, actor_dialog_id, "updateMessageReaction"), get_message_sender_object(td_, actor_dialog_id, "updateMessageReaction"), date,
date, ReactionType::get_reaction_types_object(old_reaction_types), ReactionType::get_reaction_types_object(old_reaction_types),
ReactionType::get_reaction_types_object(new_reaction_types))); ReactionType::get_reaction_types_object(new_reaction_types)));
break; break;
} }
@ -3061,7 +3061,7 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
td_->dialog_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, send_closure(G()->td(), &Td::send_update,
td_api::make_object<td_api::updateMessageReactions>( td_api::make_object<td_api::updateMessageReactions>(
td_->messages_manager_->get_chat_id_object(dialog_id, "updateMessageReactions"), td_->dialog_manager_->get_chat_id_object(dialog_id, "updateMessageReactions"),
message_id.get(), date, std::move(message_reactions))); message_id.get(), date, std::move(message_reactions)));
break; break;
} }

View File

@ -11,7 +11,6 @@
#include "td/telegram/ContactsManager.h" #include "td/telegram/ContactsManager.h"
#include "td/telegram/Dependencies.h" #include "td/telegram/Dependencies.h"
#include "td/telegram/DialogManager.h" #include "td/telegram/DialogManager.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/utils/algorithm.h" #include "td/utils/algorithm.h"
@ -167,7 +166,7 @@ td_api::object_ptr<td_api::UserPrivacySettingRule> UserPrivacySettingRule::get_u
td->contacts_manager_->get_user_ids_object(user_ids_, "userPrivacySettingRuleAllowUsers")); td->contacts_manager_->get_user_ids_object(user_ids_, "userPrivacySettingRuleAllowUsers"));
case Type::AllowChatParticipants: case Type::AllowChatParticipants:
return make_tl_object<td_api::userPrivacySettingRuleAllowChatMembers>( return make_tl_object<td_api::userPrivacySettingRuleAllowChatMembers>(
td->messages_manager_->get_chat_ids_object(dialog_ids_, "UserPrivacySettingRule")); td->dialog_manager_->get_chat_ids_object(dialog_ids_, "UserPrivacySettingRule"));
case Type::RestrictContacts: case Type::RestrictContacts:
return make_tl_object<td_api::userPrivacySettingRuleRestrictContacts>(); return make_tl_object<td_api::userPrivacySettingRuleRestrictContacts>();
case Type::RestrictAll: case Type::RestrictAll:
@ -177,7 +176,7 @@ td_api::object_ptr<td_api::UserPrivacySettingRule> UserPrivacySettingRule::get_u
td->contacts_manager_->get_user_ids_object(user_ids_, "userPrivacySettingRuleRestrictUsers")); td->contacts_manager_->get_user_ids_object(user_ids_, "userPrivacySettingRuleRestrictUsers"));
case Type::RestrictChatParticipants: case Type::RestrictChatParticipants:
return make_tl_object<td_api::userPrivacySettingRuleRestrictChatMembers>( return make_tl_object<td_api::userPrivacySettingRuleRestrictChatMembers>(
td->messages_manager_->get_chat_ids_object(dialog_ids_, "UserPrivacySettingRule")); td->dialog_manager_->get_chat_ids_object(dialog_ids_, "UserPrivacySettingRule"));
default: default:
UNREACHABLE(); UNREACHABLE();
return nullptr; return nullptr;

View File

@ -1419,7 +1419,7 @@ tl_object_ptr<td_api::webPage> WebPagesManager::get_web_page_object(WebPageId we
web_page->document_.type == Document::Type::VoiceNote web_page->document_.type == Document::Type::VoiceNote
? td_->voice_notes_manager_->get_voice_note_object(web_page->document_.file_id) ? td_->voice_notes_manager_->get_voice_note_object(web_page->document_.file_id)
: nullptr, : nullptr,
td_->messages_manager_->get_chat_id_object(story_sender_dialog_id, "webPage"), story_id.get(), td_->dialog_manager_->get_chat_id_object(story_sender_dialog_id, "webPage"), story_id.get(),
instant_view_version); instant_view_version);
} }