Add updateChatMember.via_join_request.
This commit is contained in:
parent
ee57967e6b
commit
373a17e39e
@ -7352,10 +7352,11 @@ updatePollAnswer poll_id:int64 voter_id:MessageSender option_ids:vector<int32> =
|
|||||||
//@actor_user_id Identifier of the user, changing the rights
|
//@actor_user_id Identifier of the user, changing the rights
|
||||||
//@date Point in time (Unix timestamp) when the user rights were changed
|
//@date Point in time (Unix timestamp) when the user rights were changed
|
||||||
//@invite_link If user has joined the chat using an invite link, the invite link; may be null
|
//@invite_link If user has joined the chat using an invite link, the invite link; may be null
|
||||||
|
//@via_join_request True, if the user has joined the chat after sending a join request and being approved by an administrator
|
||||||
//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder
|
//@via_chat_folder_invite_link True, if the user has joined the chat using an invite link for a chat folder
|
||||||
//@old_chat_member Previous chat member
|
//@old_chat_member Previous chat member
|
||||||
//@new_chat_member New chat member
|
//@new_chat_member New chat member
|
||||||
updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update;
|
updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink via_join_request:Bool via_chat_folder_invite_link:Bool old_chat_member:chatMember new_chat_member:chatMember = Update;
|
||||||
|
|
||||||
//@description A user sent a join request to a chat; for bots only
|
//@description A user sent a join request to a chat; for bots only
|
||||||
//@chat_id Chat identifier
|
//@chat_id Chat identifier
|
||||||
|
@ -1348,7 +1348,7 @@ void DialogParticipantManager::on_reload_dialog_administrators(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DialogParticipantManager::send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date,
|
void DialogParticipantManager::send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date,
|
||||||
const DialogInviteLink &invite_link,
|
const DialogInviteLink &invite_link, bool via_join_request,
|
||||||
bool via_dialog_filter_invite_link,
|
bool via_dialog_filter_invite_link,
|
||||||
const DialogParticipant &old_dialog_participant,
|
const DialogParticipant &old_dialog_participant,
|
||||||
const DialogParticipant &new_dialog_participant) {
|
const DialogParticipant &new_dialog_participant) {
|
||||||
@ -1358,7 +1358,8 @@ void DialogParticipantManager::send_update_chat_member(DialogId dialog_id, UserI
|
|||||||
td_api::make_object<td_api::updateChatMember>(
|
td_api::make_object<td_api::updateChatMember>(
|
||||||
td_->dialog_manager_->get_chat_id_object(dialog_id, "updateChatMember"),
|
td_->dialog_manager_->get_chat_id_object(dialog_id, "updateChatMember"),
|
||||||
td_->user_manager_->get_user_id_object(agent_user_id, "updateChatMember"), date,
|
td_->user_manager_->get_user_id_object(agent_user_id, "updateChatMember"), date,
|
||||||
invite_link.get_chat_invite_link_object(td_->user_manager_.get()), via_dialog_filter_invite_link,
|
invite_link.get_chat_invite_link_object(td_->user_manager_.get()), via_join_request,
|
||||||
|
via_dialog_filter_invite_link,
|
||||||
td_->chat_manager_->get_chat_member_object(old_dialog_participant, "updateChatMember old"),
|
td_->chat_manager_->get_chat_member_object(old_dialog_participant, "updateChatMember old"),
|
||||||
td_->chat_manager_->get_chat_member_object(new_dialog_participant, "updateChatMember new")));
|
td_->chat_manager_->get_chat_member_object(new_dialog_participant, "updateChatMember new")));
|
||||||
}
|
}
|
||||||
@ -1386,12 +1387,12 @@ void DialogParticipantManager::on_update_bot_stopped(UserId user_id, int32 date,
|
|||||||
std::swap(old_dialog_participant.status_, new_dialog_participant.status_);
|
std::swap(old_dialog_participant.status_, new_dialog_participant.status_);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_update_chat_member(DialogId(user_id), user_id, date, DialogInviteLink(), false, old_dialog_participant,
|
send_update_chat_member(DialogId(user_id), user_id, date, DialogInviteLink(), false, false, old_dialog_participant,
|
||||||
new_dialog_participant);
|
new_dialog_participant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogParticipantManager::on_update_chat_participant(
|
void DialogParticipantManager::on_update_chat_participant(
|
||||||
ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link, bool via_join_request,
|
||||||
telegram_api::object_ptr<telegram_api::ChatParticipant> old_participant,
|
telegram_api::object_ptr<telegram_api::ChatParticipant> old_participant,
|
||||||
telegram_api::object_ptr<telegram_api::ChatParticipant> new_participant) {
|
telegram_api::object_ptr<telegram_api::ChatParticipant> new_participant) {
|
||||||
CHECK(td_->auth_manager_->is_bot());
|
CHECK(td_->auth_manager_->is_bot());
|
||||||
@ -1434,13 +1435,13 @@ void DialogParticipantManager::on_update_chat_participant(
|
|||||||
<< user_id << " at " << date << " from " << old_dialog_participant << " to " << new_dialog_participant;
|
<< user_id << " at " << date << " from " << old_dialog_participant << " to " << new_dialog_participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_update_chat_member(DialogId(chat_id), user_id, date, invite_link, false, old_dialog_participant,
|
send_update_chat_member(DialogId(chat_id), user_id, date, invite_link, via_join_request, false,
|
||||||
new_dialog_participant);
|
old_dialog_participant, new_dialog_participant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogParticipantManager::on_update_channel_participant(
|
void DialogParticipantManager::on_update_channel_participant(
|
||||||
ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link, bool via_dialog_filter_invite_link,
|
ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link, bool via_join_request,
|
||||||
telegram_api::object_ptr<telegram_api::ChannelParticipant> old_participant,
|
bool via_dialog_filter_invite_link, telegram_api::object_ptr<telegram_api::ChannelParticipant> old_participant,
|
||||||
telegram_api::object_ptr<telegram_api::ChannelParticipant> new_participant) {
|
telegram_api::object_ptr<telegram_api::ChannelParticipant> new_participant) {
|
||||||
CHECK(td_->auth_manager_->is_bot());
|
CHECK(td_->auth_manager_->is_bot());
|
||||||
if (!channel_id.is_valid() || !user_id.is_valid() || date <= 0 ||
|
if (!channel_id.is_valid() || !user_id.is_valid() || date <= 0 ||
|
||||||
@ -1496,8 +1497,8 @@ void DialogParticipantManager::on_update_channel_participant(
|
|||||||
<< new_dialog_participant;
|
<< new_dialog_participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_update_chat_member(DialogId(channel_id), user_id, date, invite_link, via_dialog_filter_invite_link,
|
send_update_chat_member(DialogId(channel_id), user_id, date, invite_link, via_join_request,
|
||||||
old_dialog_participant, new_dialog_participant);
|
via_dialog_filter_invite_link, old_dialog_participant, new_dialog_participant);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogParticipantManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about,
|
void DialogParticipantManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about,
|
||||||
|
@ -85,11 +85,12 @@ class DialogParticipantManager final : public Actor {
|
|||||||
void on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped, bool force = false);
|
void on_update_bot_stopped(UserId user_id, int32 date, bool is_stopped, bool force = false);
|
||||||
|
|
||||||
void on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
void on_update_chat_participant(ChatId chat_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
||||||
|
bool via_join_request,
|
||||||
telegram_api::object_ptr<telegram_api::ChatParticipant> old_participant,
|
telegram_api::object_ptr<telegram_api::ChatParticipant> old_participant,
|
||||||
telegram_api::object_ptr<telegram_api::ChatParticipant> new_participant);
|
telegram_api::object_ptr<telegram_api::ChatParticipant> new_participant);
|
||||||
|
|
||||||
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
||||||
bool via_dialog_filter_invite_link,
|
bool via_join_request, bool via_dialog_filter_invite_link,
|
||||||
telegram_api::object_ptr<telegram_api::ChannelParticipant> old_participant,
|
telegram_api::object_ptr<telegram_api::ChannelParticipant> old_participant,
|
||||||
telegram_api::object_ptr<telegram_api::ChannelParticipant> new_participant);
|
telegram_api::object_ptr<telegram_api::ChannelParticipant> new_participant);
|
||||||
|
|
||||||
@ -190,8 +191,8 @@ class DialogParticipantManager final : public Actor {
|
|||||||
Promise<td_api::object_ptr<td_api::chatAdministrators>> &&promise);
|
Promise<td_api::object_ptr<td_api::chatAdministrators>> &&promise);
|
||||||
|
|
||||||
void send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date,
|
void send_update_chat_member(DialogId dialog_id, UserId agent_user_id, int32 date,
|
||||||
const DialogInviteLink &invite_link, bool via_dialog_filter_invite_link,
|
const DialogInviteLink &invite_link, bool via_join_request,
|
||||||
const DialogParticipant &old_dialog_participant,
|
bool via_dialog_filter_invite_link, const DialogParticipant &old_dialog_participant,
|
||||||
const DialogParticipant &new_dialog_participant);
|
const DialogParticipant &new_dialog_participant);
|
||||||
|
|
||||||
void do_get_dialog_participant(DialogId dialog_id, DialogId participant_dialog_id,
|
void do_get_dialog_participant(DialogId dialog_id, DialogId participant_dialog_id,
|
||||||
|
@ -2992,18 +2992,22 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
|
|||||||
}
|
}
|
||||||
case telegram_api::updateChatParticipant::ID: {
|
case telegram_api::updateChatParticipant::ID: {
|
||||||
auto update = move_tl_object_as<telegram_api::updateChatParticipant>(update_ptr);
|
auto update = move_tl_object_as<telegram_api::updateChatParticipant>(update_ptr);
|
||||||
|
bool via_join_request =
|
||||||
|
update->invite_ != nullptr && update->invite_->get_id() == telegram_api::chatInvitePublicJoinRequests::ID;
|
||||||
td_->dialog_participant_manager_->on_update_chat_participant(
|
td_->dialog_participant_manager_->on_update_chat_participant(
|
||||||
ChatId(update->chat_id_), UserId(update->actor_id_), update->date_,
|
ChatId(update->chat_id_), UserId(update->actor_id_), update->date_,
|
||||||
DialogInviteLink(std::move(update->invite_), true, "updateChatParticipant"),
|
DialogInviteLink(std::move(update->invite_), true, "updateChatParticipant"), via_join_request,
|
||||||
std::move(update->prev_participant_), std::move(update->new_participant_));
|
std::move(update->prev_participant_), std::move(update->new_participant_));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::updateChannelParticipant::ID: {
|
case telegram_api::updateChannelParticipant::ID: {
|
||||||
auto update = move_tl_object_as<telegram_api::updateChannelParticipant>(update_ptr);
|
auto update = move_tl_object_as<telegram_api::updateChannelParticipant>(update_ptr);
|
||||||
|
bool via_join_request =
|
||||||
|
update->invite_ != nullptr && update->invite_->get_id() == telegram_api::chatInvitePublicJoinRequests::ID;
|
||||||
td_->dialog_participant_manager_->on_update_channel_participant(
|
td_->dialog_participant_manager_->on_update_channel_participant(
|
||||||
ChannelId(update->channel_id_), UserId(update->actor_id_), update->date_,
|
ChannelId(update->channel_id_), UserId(update->actor_id_), update->date_,
|
||||||
DialogInviteLink(std::move(update->invite_), true, "updateChannelParticipant"), update->via_chatlist_,
|
DialogInviteLink(std::move(update->invite_), true, "updateChannelParticipant"), via_join_request,
|
||||||
std::move(update->prev_participant_), std::move(update->new_participant_));
|
update->via_chatlist_, std::move(update->prev_participant_), std::move(update->new_participant_));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::updateBotChatInviteRequester::ID: {
|
case telegram_api::updateBotChatInviteRequester::ID: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user