Pass chat member status as DialogParticipantStatus.
This commit is contained in:
parent
76e1466abd
commit
922fd9b17b
@ -14890,9 +14890,7 @@ void ContactsManager::add_dialog_participants(DialogId dialog_id, const vector<U
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::set_dialog_participant_status(DialogId dialog_id, DialogId participant_dialog_id,
|
void ContactsManager::set_dialog_participant_status(DialogId dialog_id, DialogId participant_dialog_id,
|
||||||
const tl_object_ptr<td_api::ChatMemberStatus> &chat_member_status,
|
DialogParticipantStatus &&status, Promise<Unit> &&promise) {
|
||||||
Promise<Unit> &&promise) {
|
|
||||||
auto status = get_dialog_participant_status(chat_member_status);
|
|
||||||
if (!td_->messages_manager_->have_dialog_force(dialog_id, "set_dialog_participant_status")) {
|
if (!td_->messages_manager_->have_dialog_force(dialog_id, "set_dialog_participant_status")) {
|
||||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||||
}
|
}
|
||||||
|
@ -527,8 +527,7 @@ class ContactsManager final : public Actor {
|
|||||||
void add_dialog_participants(DialogId dialog_id, const vector<UserId> &user_ids, Promise<Unit> &&promise);
|
void add_dialog_participants(DialogId dialog_id, const vector<UserId> &user_ids, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void set_dialog_participant_status(DialogId dialog_id, DialogId participant_dialog_id,
|
void set_dialog_participant_status(DialogId dialog_id, DialogId participant_dialog_id,
|
||||||
const tl_object_ptr<td_api::ChatMemberStatus> &chat_member_status,
|
DialogParticipantStatus &&status, Promise<Unit> &&promise);
|
||||||
Promise<Unit> &&promise);
|
|
||||||
|
|
||||||
void ban_dialog_participant(DialogId dialog_id, DialogId participant_dialog_id, int32 banned_until_date,
|
void ban_dialog_participant(DialogId dialog_id, DialogId participant_dialog_id, int32 banned_until_date,
|
||||||
bool revoke_messages, Promise<Unit> &&promise);
|
bool revoke_messages, Promise<Unit> &&promise);
|
||||||
|
@ -6221,7 +6221,7 @@ void Td::on_request(uint64 id, const td_api::joinChat &request) {
|
|||||||
void Td::on_request(uint64 id, const td_api::leaveChat &request) {
|
void Td::on_request(uint64 id, const td_api::leaveChat &request) {
|
||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
DialogId dialog_id(request.chat_id_);
|
DialogId dialog_id(request.chat_id_);
|
||||||
td_api::object_ptr<td_api::ChatMemberStatus> new_status = td_api::make_object<td_api::chatMemberStatusLeft>();
|
auto new_status = DialogParticipantStatus::Left();
|
||||||
if (dialog_id.get_type() == DialogType::Channel && messages_manager_->have_dialog_force(dialog_id, "leaveChat")) {
|
if (dialog_id.get_type() == DialogType::Channel && messages_manager_->have_dialog_force(dialog_id, "leaveChat")) {
|
||||||
auto status = contacts_manager_->get_channel_status(dialog_id.get_channel_id());
|
auto status = contacts_manager_->get_channel_status(dialog_id.get_channel_id());
|
||||||
if (status.is_creator()) {
|
if (status.is_creator()) {
|
||||||
@ -6229,12 +6229,11 @@ void Td::on_request(uint64 id, const td_api::leaveChat &request) {
|
|||||||
return promise.set_value(Unit());
|
return promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
new_status =
|
new_status = DialogParticipantStatus::Creator(false, status.is_anonymous(), status.get_rank());
|
||||||
td_api::make_object<td_api::chatMemberStatusCreator>(status.get_rank(), status.is_anonymous(), false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contacts_manager_->set_dialog_participant_status(dialog_id, DialogId(contacts_manager_->get_my_id()), new_status,
|
contacts_manager_->set_dialog_participant_status(dialog_id, DialogId(contacts_manager_->get_my_id()),
|
||||||
std::move(promise));
|
std::move(new_status), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::addChatMember &request) {
|
void Td::on_request(uint64 id, const td_api::addChatMember &request) {
|
||||||
@ -6255,8 +6254,8 @@ void Td::on_request(uint64 id, const td_api::setChatMemberStatus &request) {
|
|||||||
CREATE_OK_REQUEST_PROMISE();
|
CREATE_OK_REQUEST_PROMISE();
|
||||||
TRY_RESULT_PROMISE(promise, participant_dialog_id,
|
TRY_RESULT_PROMISE(promise, participant_dialog_id,
|
||||||
get_message_sender_dialog_id(this, request.member_id_, false, false));
|
get_message_sender_dialog_id(this, request.member_id_, false, false));
|
||||||
contacts_manager_->set_dialog_participant_status(DialogId(request.chat_id_), participant_dialog_id, request.status_,
|
contacts_manager_->set_dialog_participant_status(DialogId(request.chat_id_), participant_dialog_id,
|
||||||
std::move(promise));
|
get_dialog_participant_status(request.status_), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Td::on_request(uint64 id, const td_api::banChatMember &request) {
|
void Td::on_request(uint64 id, const td_api::banChatMember &request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user