Add drop_notification_ids option.

GitOrigin-RevId: f246e68de2b01d0152b71e774da58de44740355d
This commit is contained in:
levlam 2019-04-21 00:07:02 +03:00
parent adaf85ae70
commit 7dddc07dfe
3 changed files with 12 additions and 2 deletions

View File

@ -227,6 +227,8 @@ void NotificationManager::init() {
current_notification_group_id_ =
NotificationGroupId(to_integer<int32>(G()->td_db()->get_binlog_pmc()->get("notification_group_id_current")));
VLOG(notifications) << "Loaded current " << current_notification_id_ << " and " << current_notification_group_id_;
on_notification_group_count_max_changed(false);
on_notification_group_size_max_changed();

View File

@ -6444,6 +6444,8 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
CLEAN_INPUT_STRING(request.name_);
int32 value_constructor_id = request.value_ == nullptr ? td_api::optionValueEmpty::ID : request.value_->get_id();
LOG(INFO) << "Set option " << request.name_;
auto set_integer_option = [&](Slice name, int32 min = 0, int32 max = std::numeric_limits<int32>::max()) {
if (request.name_ != name) {
return false;
@ -6524,6 +6526,12 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
if (!is_bot && set_boolean_option("disable_top_chats")) {
return;
}
if (request.name_ == "drop_notification_ids") {
G()->td_db()->get_binlog_pmc()->erase("notification_id_current");
G()->td_db()->get_binlog_pmc()->erase("notification_group_id_current");
send_closure(actor_id(this), &Td::send_result, id, make_tl_object<td_api::ok>());
return;
}
break;
case 'i':
if (set_boolean_option("ignore_inline_thumbnails")) {

View File

@ -811,6 +811,8 @@ class CliClient final : public Actor {
td_api::make_object<td_api::optionValueBoolean>(false)));
send_request(td_api::make_object<td_api::setOption>(
"use_pfs", td_api::make_object<td_api::optionValueBoolean>(std::time(nullptr) / 86400 % 2 == 0)));
send_request(td_api::make_object<td_api::setOption>("disable_contact_registered_notifications",
td_api::make_object<td_api::optionValueBoolean>(true)));
send_request(td_api::make_object<td_api::setNetworkType>(td_api::make_object<td_api::networkTypeWiFi>()));
send_request(td_api::make_object<td_api::getNetworkStatistics>());
@ -827,8 +829,6 @@ class CliClient final : public Actor {
bad_parameters->api_hash_ = api_hash_;
send_request(td_api::make_object<td_api::setTdlibParameters>(std::move(bad_parameters)));
}
send_request(td_api::make_object<td_api::setOption>("disable_contact_registered_notifications",
td_api::make_object<td_api::optionValueBoolean>(true)));
}
void init() {