More start_up and bots fixes.

GitOrigin-RevId: 1f72829332cea0b863cb7813b490782f0ed39db3
This commit is contained in:
levlam 2019-03-05 07:35:17 +03:00
parent 285b590058
commit b9d73b5c47
5 changed files with 16 additions and 3 deletions

View File

@ -22,6 +22,7 @@
#include "td/telegram/PasswordManager.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"
#include "td/telegram/TopDialogManager.h"
#include "td/telegram/UniqueId.h"
#include "td/telegram/UpdatesManager.h"
@ -562,6 +563,7 @@ void AuthManager::on_authorization(tl_object_ptr<telegram_api::auth_authorizatio
G()->shared_config().set_option_integer("session_count", auth->tmp_sessions_);
}
td->notification_manager_->init();
send_closure(td->top_dialog_manager_, &TopDialogManager::do_start_up);
td->updates_manager_->get_difference("on_authorization");
td->on_online_updated(false, true);
td->schedule_get_terms_of_service(0);

View File

@ -8998,7 +8998,7 @@ void MessagesManager::init() {
channels_notification_settings_.disable_pinned_message_notifications = false;
channels_notification_settings_.disable_mention_notifications = false;
channels_notification_settings_.is_synchronized = false;
if (!td_->auth_manager_->is_bot()) {
if (td_->auth_manager_->is_authorized() && !td_->auth_manager_->is_bot()) {
send_get_scope_notification_settings_query(NotificationSettingsScope::Channel, Promise<>());
}
}

View File

@ -635,7 +635,7 @@ void PollManager::on_update_poll_timeout(PollId poll_id) {
}
void PollManager::on_get_poll_results_failed(PollId poll_id) {
if (!get_poll_is_closed(poll_id)) {
if (!get_poll_is_closed(poll_id) && !td_->auth_manager_->is_bot()) {
auto timeout = get_polling_timeout();
LOG(INFO) << "Schedule updating of " << poll_id << " in " << timeout;
update_poll_timeout_.add_timeout_in(poll_id.get(), timeout);

View File

@ -464,7 +464,16 @@ void TopDialogManager::do_save_top_dialogs() {
}
void TopDialogManager::start_up() {
is_active_ = G()->parameters().use_chat_info_db && !G()->td().get_actor_unsafe()->auth_manager_->is_bot();
do_start_up();
}
void TopDialogManager::do_start_up() {
auto auth_manager = G()->td().get_actor_unsafe()->auth_manager_.get();
if (auth_manager == nullptr || !auth_manager->is_authorized()) {
return;
}
is_active_ = G()->parameters().use_chat_info_db && !auth_manager->is_bot();
is_enabled_ = !G()->shared_config().get_option_boolean("disable_top_chats");
update_rating_e_decay();

View File

@ -49,6 +49,8 @@ class TopDialogManager : public NetQueryCallback {
explicit TopDialogManager(ActorShared<> parent) : parent_(std::move(parent)) {
}
void do_start_up();
void on_dialog_used(TopDialogCategory category, DialogId dialog_id, int32 date);
void remove_dialog(TopDialogCategory category, DialogId dialog_id, tl_object_ptr<telegram_api::InputPeer> input_peer);