Add DialogId::get_dialog_ids.
This commit is contained in:
parent
17e120d7ec
commit
881e74accb
@ -8,6 +8,7 @@
|
||||
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/algorithm.h"
|
||||
#include "td/utils/logging.h"
|
||||
|
||||
#include <limits>
|
||||
@ -176,4 +177,8 @@ DialogId DialogId::get_message_dialog_id(const tl_object_ptr<telegram_api::Messa
|
||||
return get_message_dialog_id(message_ptr.get());
|
||||
}
|
||||
|
||||
vector<DialogId> DialogId::get_dialog_ids(const vector<int64> &chat_ids) {
|
||||
return transform(chat_ids, [](int64 chat_id) { return DialogId(chat_id); });
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -70,6 +70,8 @@ class DialogId {
|
||||
|
||||
static DialogId get_message_dialog_id(const tl_object_ptr<telegram_api::Message> &message_ptr);
|
||||
|
||||
static vector<DialogId> get_dialog_ids(const vector<int64> &chat_ids);
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const {
|
||||
storer.store_long(id);
|
||||
|
@ -4789,25 +4789,9 @@ void Td::on_request(uint64 id, td_api::optimizeStorage &request) {
|
||||
|
||||
file_types.push_back(get_file_type(*file_type));
|
||||
}
|
||||
std::vector<DialogId> owner_dialog_ids;
|
||||
for (auto chat_id : request.chat_ids_) {
|
||||
DialogId dialog_id(chat_id);
|
||||
if (!dialog_id.is_valid() && dialog_id != DialogId()) {
|
||||
return send_error_raw(id, 400, "Wrong chat identifier");
|
||||
}
|
||||
owner_dialog_ids.push_back(dialog_id);
|
||||
}
|
||||
std::vector<DialogId> exclude_owner_dialog_ids;
|
||||
for (auto chat_id : request.exclude_chat_ids_) {
|
||||
DialogId dialog_id(chat_id);
|
||||
if (!dialog_id.is_valid() && dialog_id != DialogId()) {
|
||||
return send_error_raw(id, 400, "Wrong chat identifier");
|
||||
}
|
||||
exclude_owner_dialog_ids.push_back(dialog_id);
|
||||
}
|
||||
FileGcParameters parameters(request.size_, request.ttl_, request.count_, request.immunity_delay_,
|
||||
std::move(file_types), std::move(owner_dialog_ids), std::move(exclude_owner_dialog_ids),
|
||||
request.chat_limit_);
|
||||
std::move(file_types), DialogId::get_dialog_ids(request.chat_ids_),
|
||||
DialogId::get_dialog_ids(request.exclude_chat_ids_), request.chat_limit_);
|
||||
|
||||
CREATE_REQUEST_PROMISE();
|
||||
auto query_promise = PromiseCreator::lambda([promise = std::move(promise)](Result<FileStats> result) mutable {
|
||||
@ -6242,9 +6226,8 @@ void Td::on_request(uint64 id, const td_api::toggleChatDefaultDisableNotificatio
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::setPinnedChats &request) {
|
||||
CHECK_IS_USER();
|
||||
answer_ok_query(id, messages_manager_->set_pinned_dialogs(
|
||||
DialogListId(request.chat_list_),
|
||||
transform(request.chat_ids_, [](int64 chat_id) { return DialogId(chat_id); })));
|
||||
answer_ok_query(id, messages_manager_->set_pinned_dialogs(DialogListId(request.chat_list_),
|
||||
DialogId::get_dialog_ids(request.chat_ids_)));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getAttachmentMenuBot &request) {
|
||||
|
Loading…
Reference in New Issue
Block a user