Do not include TopDialogManager in MessagesManager.

GitOrigin-RevId: 364ebfc86bc49d8b64a60a82a3383210531774c3
This commit is contained in:
levlam 2020-01-27 03:25:23 +03:00
parent 985e051bbe
commit e666d10c8d
3 changed files with 11 additions and 5 deletions

View File

@ -50,6 +50,7 @@
#include "td/telegram/StickersManager.h" #include "td/telegram/StickersManager.h"
#include "td/telegram/StickersManager.hpp" #include "td/telegram/StickersManager.hpp"
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TopDialogManager.h"
#include "td/telegram/UserId.h" #include "td/telegram/UserId.h"
#include "td/telegram/Venue.h" #include "td/telegram/Venue.h"
#include "td/telegram/Version.h" #include "td/telegram/Version.h"
@ -5184,4 +5185,8 @@ StickerSetId add_sticker_set(Td *td, tl_object_ptr<telegram_api::InputStickerSet
return td->stickers_manager_->add_sticker_set(std::move(input_sticker_set)); return td->stickers_manager_->add_sticker_set(std::move(input_sticker_set));
} }
void on_dialog_used(TopDialogCategory category, DialogId dialog_id, int32 date) {
send_closure(G()->top_dialog_manager(), &TopDialogManager::on_dialog_used, category, dialog_id, date);
}
} // namespace td } // namespace td

View File

@ -19,6 +19,7 @@
#include "td/telegram/StickerSetId.h" #include "td/telegram/StickerSetId.h"
#include "td/telegram/td_api.h" #include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h" #include "td/telegram/telegram_api.h"
#include "td/telegram/TopDialogCategory.h"
#include "td/telegram/UserId.h" #include "td/telegram/UserId.h"
#include "td/telegram/WebPageId.h" #include "td/telegram/WebPageId.h"
@ -265,4 +266,6 @@ void on_sent_message_content(Td *td, const MessageContent *content);
StickerSetId add_sticker_set(Td *td, tl_object_ptr<telegram_api::InputStickerSet> &&input_sticker_set); StickerSetId add_sticker_set(Td *td, tl_object_ptr<telegram_api::InputStickerSet> &&input_sticker_set);
void on_dialog_used(TopDialogCategory category, DialogId dialog_id, int32 date);
} // namespace td } // namespace td

View File

@ -46,7 +46,6 @@
#include "td/telegram/Td.h" #include "td/telegram/Td.h"
#include "td/telegram/TdDb.h" #include "td/telegram/TdDb.h"
#include "td/telegram/TopDialogCategory.h" #include "td/telegram/TopDialogCategory.h"
#include "td/telegram/TopDialogManager.h"
#include "td/telegram/UpdatesManager.h" #include "td/telegram/UpdatesManager.h"
#include "td/telegram/Version.h" #include "td/telegram/Version.h"
#include "td/telegram/WebPageId.h" #include "td/telegram/WebPageId.h"
@ -29055,8 +29054,7 @@ void MessagesManager::update_top_dialogs(DialogId dialog_id, const Message *m) {
bool is_forward = m->forward_info != nullptr || m->had_forward_info; bool is_forward = m->forward_info != nullptr || m->had_forward_info;
if (m->via_bot_user_id.is_valid() && !is_forward) { if (m->via_bot_user_id.is_valid() && !is_forward) {
// forwarded game messages can't be distinguished from sent via bot game messages, so increase rating anyway // forwarded game messages can't be distinguished from sent via bot game messages, so increase rating anyway
send_closure(G()->top_dialog_manager(), &TopDialogManager::on_dialog_used, TopDialogCategory::BotInline, on_dialog_used(TopDialogCategory::BotInline, DialogId(m->via_bot_user_id), m->date);
DialogId(m->via_bot_user_id), m->date);
} }
if (is_forward) { if (is_forward) {
@ -29064,7 +29062,7 @@ void MessagesManager::update_top_dialogs(DialogId dialog_id, const Message *m) {
if (last_forward_date < m->date) { if (last_forward_date < m->date) {
TopDialogCategory category = TopDialogCategory category =
dialog_type == DialogType::User ? TopDialogCategory::ForwardUsers : TopDialogCategory::ForwardChats; dialog_type == DialogType::User ? TopDialogCategory::ForwardUsers : TopDialogCategory::ForwardChats;
send_closure(G()->top_dialog_manager(), &TopDialogManager::on_dialog_used, category, dialog_id, m->date); on_dialog_used(category, dialog_id, m->date);
last_forward_date = m->date; last_forward_date = m->date;
} }
} }
@ -29103,7 +29101,7 @@ void MessagesManager::update_top_dialogs(DialogId dialog_id, const Message *m) {
UNREACHABLE(); UNREACHABLE();
} }
if (category != TopDialogCategory::Size) { if (category != TopDialogCategory::Size) {
send_closure(G()->top_dialog_manager(), &TopDialogManager::on_dialog_used, category, dialog_id, m->date); on_dialog_used(category, dialog_id, m->date);
} }
} }