Add DialogFilter::remove_dialog_id.

This commit is contained in:
levlam 2023-03-21 23:20:33 +03:00
parent c5c06a8523
commit 739bc08a31
3 changed files with 9 additions and 3 deletions

View File

@ -115,6 +115,12 @@ void DialogFilter::remove_secret_chat_dialog_ids() {
remove_secret_chats(excluded_dialog_ids);
}
void DialogFilter::remove_dialog_id(DialogId dialog_id) {
InputDialogId::remove(pinned_dialog_ids, dialog_id);
InputDialogId::remove(included_dialog_ids, dialog_id);
InputDialogId::remove(excluded_dialog_ids, dialog_id);
}
bool DialogFilter::is_empty(bool for_server) const {
if (include_contacts || include_non_contacts || include_bots || include_groups || include_channels) {
return false;

View File

@ -56,6 +56,8 @@ class DialogFilter {
void remove_secret_chat_dialog_ids();
void remove_dialog_id(DialogId dialog_id);
bool is_empty(bool for_server) const;
Status check_limits() const;

View File

@ -17088,9 +17088,7 @@ void MessagesManager::delete_dialogs_from_filter(const DialogFilter *dialog_filt
const char *source) {
auto new_dialog_filter = td::make_unique<DialogFilter>(*dialog_filter);
for (auto dialog_id : dialog_ids) {
InputDialogId::remove(new_dialog_filter->pinned_dialog_ids, dialog_id);
InputDialogId::remove(new_dialog_filter->included_dialog_ids, dialog_id);
InputDialogId::remove(new_dialog_filter->excluded_dialog_ids, dialog_id);
new_dialog_filter->remove_dialog_id(dialog_id);
}
if (*new_dialog_filter != *dialog_filter) {