Ensure that loaded from binlog server dialog filters are distinct.

GitOrigin-RevId: 89cdffd0d284dcd36c539dc1a4259b1bc445d4b8
This commit is contained in:
levlam 2020-05-29 09:35:52 +03:00
parent 45b90e2163
commit 4db8cdc9d9

View File

@ -11034,7 +11034,12 @@ void MessagesManager::init() {
DialogFiltersLogEvent log_event;
if (log_event_parse(log_event, dialog_filters).is_ok()) {
dialog_filters_updated_date_ = log_event.updated_date;
server_dialog_filters_ = std::move(log_event.server_dialog_filters_out);
std::unordered_set<DialogFilterId, DialogFilterIdHash> server_dialog_filter_ids;
for (auto &dialog_filter : log_event.server_dialog_filters_out) {
if (server_dialog_filter_ids.insert(dialog_filter->dialog_filter_id).second) {
server_dialog_filters_.push_back(std::move(dialog_filter));
}
}
for (auto &dialog_filter : log_event.dialog_filters_out) {
add_dialog_filter(std::move(dialog_filter), "binlog");
}