-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add td_api::getArchiveChatListSettings.
- Loading branch information
Showing
7 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 2014-2023 | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
#include "td/telegram/GlobalPrivacySettings.h" | ||
|
||
#include "td/telegram/Global.h" | ||
#include "td/telegram/net/NetQueryCreator.h" | ||
#include "td/telegram/Td.h" | ||
|
||
#include "td/utils/buffer.h" | ||
#include "td/utils/Status.h" | ||
|
||
namespace td { | ||
|
||
class GetGlobalPrivacySettingsQuery final : public Td::ResultHandler { | ||
Promise<td_api::object_ptr<td_api::archiveChatListSettings>> promise_; | ||
|
||
public: | ||
explicit GetGlobalPrivacySettingsQuery(Promise<td_api::object_ptr<td_api::archiveChatListSettings>> &&promise) | ||
: promise_(std::move(promise)) { | ||
} | ||
|
||
void send() { | ||
send_query(G()->net_query_creator().create(telegram_api::account_getGlobalPrivacySettings())); | ||
} | ||
|
||
void on_result(BufferSlice packet) final { | ||
auto result_ptr = fetch_result<telegram_api::account_getGlobalPrivacySettings>(packet); | ||
if (result_ptr.is_error()) { | ||
return on_error(result_ptr.move_as_error()); | ||
} | ||
|
||
auto settings = GlobalPrivacySettings(result_ptr.move_as_ok()); | ||
promise_.set_value(settings.get_archive_chat_list_settings_object()); | ||
} | ||
|
||
void on_error(Status status) final { | ||
promise_.set_error(std::move(status)); | ||
} | ||
}; | ||
|
||
GlobalPrivacySettings::GlobalPrivacySettings(telegram_api::object_ptr<telegram_api::globalPrivacySettings> &&settings) | ||
: archive_and_mute_new_noncontact_peers_(settings->archive_and_mute_new_noncontact_peers_) | ||
, keep_archived_unmuted_(settings->keep_archived_unmuted_) | ||
, keep_archived_folders_(settings->keep_archived_folders_) { | ||
} | ||
|
||
td_api::object_ptr<td_api::archiveChatListSettings> GlobalPrivacySettings::get_archive_chat_list_settings_object() | ||
const { | ||
return td_api::make_object<td_api::archiveChatListSettings>(archive_and_mute_new_noncontact_peers_, | ||
keep_archived_unmuted_, keep_archived_folders_); | ||
} | ||
|
||
void GlobalPrivacySettings::get_global_privacy_settings( | ||
Td *td, Promise<td_api::object_ptr<td_api::archiveChatListSettings>> &&promise) { | ||
td->create_handler<GetGlobalPrivacySettingsQuery>(std::move(promise))->send(); | ||
} | ||
|
||
} // namespace td |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 2014-2023 | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
#pragma once | ||
|
||
#include "td/telegram/td_api.h" | ||
#include "td/telegram/telegram_api.h" | ||
|
||
#include "td/utils/common.h" | ||
#include "td/utils/Promise.h" | ||
|
||
namespace td { | ||
|
||
class Td; | ||
|
||
class GlobalPrivacySettings { | ||
bool archive_and_mute_new_noncontact_peers_ = false; | ||
bool keep_archived_unmuted_ = false; | ||
bool keep_archived_folders_ = false; | ||
|
||
public: | ||
explicit GlobalPrivacySettings(telegram_api::object_ptr<telegram_api::globalPrivacySettings> &&settings); | ||
|
||
td_api::object_ptr<td_api::archiveChatListSettings> get_archive_chat_list_settings_object() const; | ||
|
||
static void get_global_privacy_settings(Td *td, | ||
Promise<td_api::object_ptr<td_api::archiveChatListSettings>> &&promise); | ||
}; | ||
|
||
} // namespace td |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters