Add ContactsManager::on_get_channel_participant.
This commit is contained in:
parent
3941144700
commit
6f51690275
@ -14953,9 +14953,23 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
|
|||||||
LOG(DEBUG) << "Get info about " << participant_dialog_id << " membership in the " << channel_id << " with random_id "
|
LOG(DEBUG) << "Get info about " << participant_dialog_id << " membership in the " << channel_id << " with random_id "
|
||||||
<< random_id;
|
<< random_id;
|
||||||
|
|
||||||
auto on_result_promise = PromiseCreator::lambda(
|
auto on_result_promise = PromiseCreator::lambda([actor_id = actor_id(this), random_id, promise = std::move(promise)](
|
||||||
[this, random_id, promise = std::move(promise)](Result<DialogParticipant> r_dialog_participant) mutable {
|
Result<DialogParticipant> r_dialog_participant) mutable {
|
||||||
// ResultHandlers are cleared before managers, so it is safe to capture this
|
send_closure(actor_id, &ContactsManager::on_get_channel_participant, random_id, std::move(r_dialog_participant),
|
||||||
|
std::move(promise));
|
||||||
|
});
|
||||||
|
|
||||||
|
td_->create_handler<GetChannelParticipantQuery>(std::move(on_result_promise))
|
||||||
|
->send(channel_id, participant_dialog_id, std::move(input_peer));
|
||||||
|
return DialogParticipant();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContactsManager::on_get_channel_participant(int64 random_id, Result<DialogParticipant> r_dialog_participant,
|
||||||
|
Promise<Unit> &&promise) {
|
||||||
|
if (G()->close_flag()) {
|
||||||
|
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||||
|
}
|
||||||
|
|
||||||
LOG(INFO) << "Receive a member of a channel with random_id " << random_id;
|
LOG(INFO) << "Receive a member of a channel with random_id " << random_id;
|
||||||
|
|
||||||
auto it = received_channel_participant_.find(random_id);
|
auto it = received_channel_participant_.find(random_id);
|
||||||
@ -14968,11 +14982,6 @@ DialogParticipant ContactsManager::get_channel_participant(ChannelId channel_id,
|
|||||||
it->second = r_dialog_participant.move_as_ok();
|
it->second = r_dialog_participant.move_as_ok();
|
||||||
promise.set_value(Unit());
|
promise.set_value(Unit());
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
td_->create_handler<GetChannelParticipantQuery>(std::move(on_result_promise))
|
|
||||||
->send(channel_id, participant_dialog_id, std::move(input_peer));
|
|
||||||
return DialogParticipant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsManager::get_channel_participants(ChannelId channel_id,
|
void ContactsManager::get_channel_participants(ChannelId channel_id,
|
||||||
|
@ -1493,6 +1493,9 @@ class ContactsManager : public Actor {
|
|||||||
|
|
||||||
void delete_chat_participant(ChatId chat_id, UserId user_id, bool revoke_messages, Promise<Unit> &&promise);
|
void delete_chat_participant(ChatId chat_id, UserId user_id, bool revoke_messages, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void on_get_channel_participant(int64 random_id, Result<DialogParticipant> r_dialog_participant,
|
||||||
|
Promise<Unit> &&promise);
|
||||||
|
|
||||||
void search_chat_participants(ChatId chat_id, const string &query, int32 limit, DialogParticipantsFilter filter,
|
void search_chat_participants(ChatId chat_id, const string &query, int32 limit, DialogParticipantsFilter filter,
|
||||||
Promise<DialogParticipants> &&promise);
|
Promise<DialogParticipants> &&promise);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user