Add deleteChatBackground.restore_previous.
This commit is contained in:
parent
330088d9f8
commit
762c224c10
|
@ -7827,13 +7827,11 @@ setChatPermissions chat_id:int53 permissions:chatPermissions = Ok;
|
|||
//@only_for_self Pass true to set background only for self; pass false to set background for both chat users. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious
|
||||
setChatBackground chat_id:int53 background:InputBackground type:BackgroundType dark_theme_dimming:int32 only_for_self:Bool = Ok;
|
||||
|
||||
//@description Deletes background in a specific chat @chat_id Chat identifier
|
||||
deleteChatBackground chat_id:int53 = Ok;
|
||||
|
||||
//@description Restores background in a specific chat after it was changed by the other user. Supported only in private and secret chats with non-deleted users.
|
||||
//-Can be called only from messageChatSetBackground messages with the currently set background that was set for both sides by the other user if userFullInfo.set_chat_background == true
|
||||
//@description Deletes background in a specific chat
|
||||
//@chat_id Chat identifier
|
||||
revertChatBackground chat_id:int53 = Ok;
|
||||
//@restore_previous Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true.
|
||||
//-Supposed to be used from messageChatSetBackground messages with the currently set background that was set for both sides by the other user
|
||||
deleteChatBackground chat_id:int53 restore_previous:Bool = Ok;
|
||||
|
||||
//@description Changes the chat theme. Supported only in private and secret chats @chat_id Chat identifier @theme_name Name of the new chat theme; pass an empty string to return the default theme
|
||||
setChatTheme chat_id:int53 theme_name:string = Ok;
|
||||
|
|
|
@ -820,16 +820,10 @@ void BackgroundManager::set_dialog_background(DialogId dialog_id, const td_api::
|
|||
}
|
||||
}
|
||||
|
||||
void BackgroundManager::delete_dialog_background(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||
void BackgroundManager::delete_dialog_background(DialogId dialog_id, bool restore_previous, Promise<Unit> &&promise) {
|
||||
TRY_RESULT_PROMISE_ASSIGN(promise, dialog_id, get_background_dialog(dialog_id));
|
||||
send_set_dialog_background_query(dialog_id, nullptr, nullptr, MessageId(), false, std::move(promise));
|
||||
}
|
||||
|
||||
void BackgroundManager::revert_dialog_background(DialogId dialog_id, Promise<Unit> &&promise) {
|
||||
TRY_RESULT_PROMISE_ASSIGN(promise, dialog_id, get_background_dialog(dialog_id));
|
||||
|
||||
td_->create_handler<SetChatWallPaperQuery>(std::move(promise))
|
||||
->send(dialog_id, nullptr, nullptr, MessageId(), false, true);
|
||||
->send(dialog_id, nullptr, nullptr, MessageId(), false, restore_previous);
|
||||
}
|
||||
|
||||
void BackgroundManager::do_set_dialog_background(DialogId dialog_id, BackgroundId background_id, BackgroundType type,
|
||||
|
|
|
@ -52,9 +52,7 @@ class BackgroundManager final : public Actor {
|
|||
const td_api::BackgroundType *background_type, int32 dark_theme_dimming, bool for_both,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void delete_dialog_background(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
|
||||
void revert_dialog_background(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
void delete_dialog_background(DialogId dialog_id, bool restore_previous, Promise<Unit> &&promise);
|
||||
|
||||
td_api::object_ptr<td_api::background> get_background_object(BackgroundId background_id, bool for_dark_theme,
|
||||
const BackgroundType *type) const;
|
||||
|
|
|
@ -6537,13 +6537,8 @@ void Td::on_request(uint64 id, td_api::setChatBackground &request) {
|
|||
void Td::on_request(uint64 id, const td_api::deleteChatBackground &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
background_manager_->delete_dialog_background(DialogId(request.chat_id_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::revertChatBackground &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
background_manager_->revert_dialog_background(DialogId(request.chat_id_), std::move(promise));
|
||||
background_manager_->delete_dialog_background(DialogId(request.chat_id_), request.restore_previous_,
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::setChatTheme &request) {
|
||||
|
|
|
@ -1017,8 +1017,6 @@ class Td final : public Actor {
|
|||
|
||||
void on_request(uint64 id, const td_api::deleteChatBackground &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::revertChatBackground &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setChatTheme &request);
|
||||
|
||||
void on_request(uint64 id, td_api::setChatDraftMessage &request);
|
||||
|
|
|
@ -3127,14 +3127,10 @@ class CliClient final : public Actor {
|
|||
get_args(args, chat_id, input_background, background_type, dark_theme_dimming);
|
||||
send_request(td_api::make_object<td_api::setChatBackground>(chat_id, input_background, background_type,
|
||||
dark_theme_dimming, op == "scbgs"));
|
||||
} else if (op == "dcb") {
|
||||
} else if (op == "dcb" || op == "dcbr") {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
send_request(td_api::make_object<td_api::deleteChatBackground>(chat_id));
|
||||
} else if (op == "rcb") {
|
||||
ChatId chat_id;
|
||||
get_args(args, chat_id);
|
||||
send_request(td_api::make_object<td_api::revertChatBackground>(chat_id));
|
||||
send_request(td_api::make_object<td_api::deleteChatBackground>(chat_id, op == "dcbr"));
|
||||
} else if (op == "gcos") {
|
||||
send_request(td_api::make_object<td_api::getCountries>());
|
||||
} else if (op == "gcoc") {
|
||||
|
|
Loading…
Reference in New Issue