Move reload_dialog_info to DialogManager.
This commit is contained in:
parent
9a90089879
commit
7b6ce8b822
@ -15509,19 +15509,6 @@ bool ContactsManager::is_dialog_info_received_from_server(DialogId dialog_id) co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise) {
|
|
||||||
switch (dialog_id.get_type()) {
|
|
||||||
case DialogType::User:
|
|
||||||
return reload_user(dialog_id.get_user_id(), std::move(promise), "reload_dialog_info");
|
|
||||||
case DialogType::Chat:
|
|
||||||
return reload_chat(dialog_id.get_chat_id(), std::move(promise), "reload_dialog_info");
|
|
||||||
case DialogType::Channel:
|
|
||||||
return reload_channel(dialog_id.get_channel_id(), std::move(promise), "reload_dialog_info");
|
|
||||||
default:
|
|
||||||
return promise.set_error(Status::Error("Invalid chat identifier to reload"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContactsManager::send_get_me_query(Td *td, Promise<Unit> &&promise) {
|
void ContactsManager::send_get_me_query(Td *td, Promise<Unit> &&promise) {
|
||||||
vector<tl_object_ptr<telegram_api::InputUser>> users;
|
vector<tl_object_ptr<telegram_api::InputUser>> users;
|
||||||
users.push_back(make_tl_object<telegram_api::inputUserSelf>());
|
users.push_back(make_tl_object<telegram_api::inputUserSelf>());
|
||||||
|
@ -563,8 +563,6 @@ class ContactsManager final : public Actor {
|
|||||||
|
|
||||||
bool is_dialog_info_received_from_server(DialogId dialog_id) const;
|
bool is_dialog_info_received_from_server(DialogId dialog_id) const;
|
||||||
|
|
||||||
void reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise);
|
|
||||||
|
|
||||||
static void send_get_me_query(Td *td, Promise<Unit> &&promise);
|
static void send_get_me_query(Td *td, Promise<Unit> &&promise);
|
||||||
UserId get_me(Promise<Unit> &&promise);
|
UserId get_me(Promise<Unit> &&promise);
|
||||||
bool get_user(UserId user_id, int left_tries, Promise<Unit> &&promise);
|
bool get_user(UserId user_id, int left_tries, Promise<Unit> &&promise);
|
||||||
|
@ -712,6 +712,20 @@ bool DialogManager::have_dialog_info_force(DialogId dialog_id, const char *sourc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogManager::reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||||
|
switch (dialog_id.get_type()) {
|
||||||
|
case DialogType::User:
|
||||||
|
return td_->contacts_manager_->reload_user(dialog_id.get_user_id(), std::move(promise), "reload_dialog_info");
|
||||||
|
case DialogType::Chat:
|
||||||
|
return td_->contacts_manager_->reload_chat(dialog_id.get_chat_id(), std::move(promise), "reload_dialog_info");
|
||||||
|
case DialogType::Channel:
|
||||||
|
return td_->contacts_manager_->reload_channel(dialog_id.get_channel_id(), std::move(promise),
|
||||||
|
"reload_dialog_info");
|
||||||
|
default:
|
||||||
|
return promise.set_error(Status::Error("Invalid chat identifier to reload"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DialogManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source) {
|
void DialogManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source) {
|
||||||
switch (dialog_id.get_type()) {
|
switch (dialog_id.get_type()) {
|
||||||
case DialogType::User:
|
case DialogType::User:
|
||||||
|
@ -82,6 +82,8 @@ class DialogManager final : public Actor {
|
|||||||
|
|
||||||
bool have_dialog_info_force(DialogId dialog_id, const char *source) const;
|
bool have_dialog_info_force(DialogId dialog_id, const char *source) const;
|
||||||
|
|
||||||
|
void reload_dialog_info(DialogId dialog_id, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source);
|
void get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source);
|
||||||
|
|
||||||
void reload_dialog_info_full(DialogId dialog_id, const char *source);
|
void reload_dialog_info_full(DialogId dialog_id, const char *source);
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "td/telegram/BackgroundManager.h"
|
#include "td/telegram/BackgroundManager.h"
|
||||||
#include "td/telegram/ConfigManager.h"
|
#include "td/telegram/ConfigManager.h"
|
||||||
#include "td/telegram/ContactsManager.h"
|
#include "td/telegram/ContactsManager.h"
|
||||||
|
#include "td/telegram/DialogManager.h"
|
||||||
#include "td/telegram/files/FileManager.h"
|
#include "td/telegram/files/FileManager.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/MessagesManager.h"
|
#include "td/telegram/MessagesManager.h"
|
||||||
@ -449,7 +450,7 @@ void FileReferenceManager::reload_photo(PhotoSizeSource source, Promise<Unit> pr
|
|||||||
case PhotoSizeSource::Type::DialogPhotoSmall:
|
case PhotoSizeSource::Type::DialogPhotoSmall:
|
||||||
case PhotoSizeSource::Type::DialogPhotoBigLegacy:
|
case PhotoSizeSource::Type::DialogPhotoBigLegacy:
|
||||||
case PhotoSizeSource::Type::DialogPhotoSmallLegacy:
|
case PhotoSizeSource::Type::DialogPhotoSmallLegacy:
|
||||||
send_closure(G()->contacts_manager(), &ContactsManager::reload_dialog_info, source.dialog_photo().dialog_id,
|
send_closure(G()->dialog_manager(), &DialogManager::reload_dialog_info, source.dialog_photo().dialog_id,
|
||||||
std::move(promise));
|
std::move(promise));
|
||||||
break;
|
break;
|
||||||
case PhotoSizeSource::Type::StickerSetThumbnail:
|
case PhotoSizeSource::Type::StickerSetThumbnail:
|
||||||
|
@ -3453,7 +3453,7 @@ class ForwardMessagesQuery final : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
// no on_get_dialog_error call, because two dialogs are involved
|
// no on_get_dialog_error call, because two dialogs are involved
|
||||||
if (status.code() == 400 && status.message() == CSlice("CHAT_FORWARDS_RESTRICTED")) {
|
if (status.code() == 400 && status.message() == CSlice("CHAT_FORWARDS_RESTRICTED")) {
|
||||||
td_->contacts_manager_->reload_dialog_info(from_dialog_id_, Promise<Unit>());
|
td_->dialog_manager_->reload_dialog_info(from_dialog_id_, Promise<Unit>());
|
||||||
}
|
}
|
||||||
if (status.code() == 400 && status.message() == CSlice("SEND_AS_PEER_INVALID")) {
|
if (status.code() == 400 && status.message() == CSlice("SEND_AS_PEER_INVALID")) {
|
||||||
td_->dialog_manager_->reload_dialog_info_full(to_dialog_id_, "SEND_AS_PEER_INVALID");
|
td_->dialog_manager_->reload_dialog_info_full(to_dialog_id_, "SEND_AS_PEER_INVALID");
|
||||||
|
Loading…
Reference in New Issue
Block a user