Skip to content

Commit

Permalink
Support updateAutosaveSettings in getCurrentState.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed Feb 5, 2023
1 parent f6616f6 commit 43e5f2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions td/telegram/AutosaveManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,4 +354,20 @@ void AutosaveManager::send_update_autosave_settings(td_api::object_ptr<td_api::A
send_closure(G()->td(), &Td::send_update, get_update_autosave_settings(std::move(scope), settings));
}

void AutosaveManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
if (!settings_.are_inited_) {
return;
}
updates.push_back(get_update_autosave_settings(td_api::make_object<td_api::autosaveSettingsScopePrivateChats>(),
settings_.user_settings_));
updates.push_back(get_update_autosave_settings(td_api::make_object<td_api::autosaveSettingsScopeGroupChats>(),
settings_.chat_settings_));
updates.push_back(get_update_autosave_settings(td_api::make_object<td_api::autosaveSettingsScopeChannelChats>(),
settings_.broadcast_settings_));
for (const auto &exception : settings_.exceptions_) {
updates.push_back(get_update_autosave_settings(
td_api::make_object<td_api::autosaveSettingsScopeChat>(exception.first.get()), exception.second));
}
}

} // namespace td
2 changes: 2 additions & 0 deletions td/telegram/AutosaveManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class AutosaveManager final : public Actor {

void clear_autosave_settings_excpetions(Promise<Unit> &&promise);

void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;

private:
struct DialogAutosaveSettings {
bool are_inited_ = false;
Expand Down
2 changes: 2 additions & 0 deletions td/telegram/Td.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4299,6 +4299,8 @@ void Td::on_request(uint64 id, const td_api::getCurrentState &request) {

config_manager_.get_actor_unsafe()->get_current_state(updates);

autosave_manager_->get_current_state(updates);

// TODO updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update;
// TODO updateCall call:call = Update;
// TODO updateGroupCall call:groupCall = Update;
Expand Down

0 comments on commit 43e5f2a

Please sign in to comment.