Add get_update_unread_*_count_object functions.
GitOrigin-RevId: 9f5c53acaad72ad7288882691232f7e7c85d8127
This commit is contained in:
parent
6dbef6ef76
commit
b7a779db3b
@ -17415,8 +17415,7 @@ void MessagesManager::send_update_unread_message_count(DialogId dialog_id, bool
|
|||||||
have_postponed_unread_message_count_update_ = false;
|
have_postponed_unread_message_count_update_ = false;
|
||||||
LOG(INFO) << "Send updateUnreadMessageCount to " << unread_message_total_count_ << '/' << unread_unmuted_count
|
LOG(INFO) << "Send updateUnreadMessageCount to " << unread_message_total_count_ << '/' << unread_unmuted_count
|
||||||
<< " from " << source << " and " << dialog_id;
|
<< " from " << source << " and " << dialog_id;
|
||||||
send_closure(G()->td(), &Td::send_update,
|
send_closure(G()->td(), &Td::send_update, get_update_unread_message_count_object());
|
||||||
make_tl_object<td_api::updateUnreadMessageCount>(unread_message_total_count_, unread_unmuted_count));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17460,10 +17459,7 @@ void MessagesManager::send_update_unread_chat_count(DialogId dialog_id, bool for
|
|||||||
have_postponed_unread_chat_count_update_ = true;
|
have_postponed_unread_chat_count_update_ = true;
|
||||||
} else {
|
} else {
|
||||||
have_postponed_unread_chat_count_update_ = false;
|
have_postponed_unread_chat_count_update_ = false;
|
||||||
send_closure(
|
send_closure(G()->td(), &Td::send_update, get_update_unread_chat_count_object());
|
||||||
G()->td(), &Td::send_update,
|
|
||||||
make_tl_object<td_api::updateUnreadChatCount>(unread_dialog_total_count_, unread_unmuted_count,
|
|
||||||
unread_dialog_marked_count_, unread_unmuted_marked_count));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23101,20 +23097,34 @@ void MessagesManager::set_sponsored_dialog_id(DialogId dialog_id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateUnreadMessageCount> MessagesManager::get_update_unread_message_count_object() const {
|
||||||
|
CHECK(is_message_unread_count_inited_);
|
||||||
|
int32 unread_unmuted_count = unread_message_total_count_ - unread_message_muted_count_;
|
||||||
|
CHECK(unread_message_total_count_ >= 0);
|
||||||
|
CHECK(unread_unmuted_count >= 0);
|
||||||
|
return td_api::make_object<td_api::updateUnreadMessageCount>(unread_message_total_count_, unread_unmuted_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateUnreadChatCount> MessagesManager::get_update_unread_chat_count_object() const {
|
||||||
|
CHECK(is_dialog_unread_count_inited_);
|
||||||
|
int32 unread_unmuted_count = unread_dialog_total_count_ - unread_dialog_muted_count_;
|
||||||
|
int32 unread_unmuted_marked_count = unread_dialog_marked_count_ - unread_dialog_muted_marked_count_;
|
||||||
|
CHECK(unread_dialog_total_count_ >= 0);
|
||||||
|
CHECK(unread_unmuted_count >= 0);
|
||||||
|
CHECK(unread_dialog_marked_count_ >= 0);
|
||||||
|
CHECK(unread_unmuted_marked_count >= 0);
|
||||||
|
return td_api::make_object<td_api::updateUnreadChatCount>(unread_dialog_total_count_, unread_unmuted_count,
|
||||||
|
unread_dialog_marked_count_, unread_unmuted_marked_count);
|
||||||
|
}
|
||||||
|
|
||||||
void MessagesManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
void MessagesManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
|
||||||
if (!td_->auth_manager_->is_bot()) {
|
if (!td_->auth_manager_->is_bot()) {
|
||||||
if (G()->parameters().use_message_db) {
|
if (G()->parameters().use_message_db) {
|
||||||
if (is_message_unread_count_inited_) {
|
if (is_message_unread_count_inited_) {
|
||||||
int32 unread_unmuted_count = unread_message_total_count_ - unread_message_muted_count_;
|
updates.push_back(get_update_unread_message_count_object());
|
||||||
updates.push_back(
|
|
||||||
td_api::make_object<td_api::updateUnreadMessageCount>(unread_message_total_count_, unread_unmuted_count));
|
|
||||||
}
|
}
|
||||||
if (is_dialog_unread_count_inited_) {
|
if (is_dialog_unread_count_inited_) {
|
||||||
int32 unread_unmuted_count = unread_dialog_total_count_ - unread_dialog_muted_count_;
|
updates.push_back(get_update_unread_chat_count_object());
|
||||||
int32 unread_unmuted_marked_count = unread_dialog_marked_count_ - unread_dialog_muted_marked_count_;
|
|
||||||
updates.push_back(td_api::make_object<td_api::updateUnreadChatCount>(
|
|
||||||
unread_dialog_total_count_, unread_unmuted_count, unread_dialog_marked_count_,
|
|
||||||
unread_unmuted_marked_count));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1485,6 +1485,10 @@ class MessagesManager : public Actor {
|
|||||||
|
|
||||||
void recalc_unread_count();
|
void recalc_unread_count();
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateUnreadMessageCount> get_update_unread_message_count_object() const;
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::updateUnreadChatCount> get_update_unread_chat_count_object() const;
|
||||||
|
|
||||||
void set_dialog_last_read_inbox_message_id(Dialog *d, MessageId message_id, int32 server_unread_count,
|
void set_dialog_last_read_inbox_message_id(Dialog *d, MessageId message_id, int32 server_unread_count,
|
||||||
int32 local_unread_count, bool force_update, const char *source);
|
int32 local_unread_count, bool force_update, const char *source);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user