Add updateNewChatJoinRequest.
This commit is contained in:
parent
81bfbecb18
commit
39b5db357e
@ -3935,6 +3935,10 @@ updatePollAnswer poll_id:int64 user_id:int53 option_ids:vector<int32> = Update;
|
||||
//@old_chat_member Previous chat member @new_chat_member New chat member
|
||||
updateChatMember chat_id:int53 actor_user_id:int53 date:int32 invite_link:chatInviteLink old_chat_member:chatMember new_chat_member:chatMember = Update;
|
||||
|
||||
//@description A user sent a join request to a chat; for bots only @chat_id Chat identifier @user_id Identifier of the user, which sent the join request
|
||||
//@bio A short user bio @date Point in time (Unix timestamp) when the request was sent @invite_link The invite link, which was used to send join request; may be null
|
||||
updateNewChatJoinRequest chat_id:int53 user_id:int53 bio:string date:int32 invite_link:chatInviteLink = Update;
|
||||
|
||||
|
||||
//@description Contains a list of updates @updates List of updates
|
||||
updates updates:vector<Update> = Updates;
|
||||
|
@ -13625,14 +13625,10 @@ void ContactsManager::on_update_bot_stopped(UserId user_id, int32 date, bool is_
|
||||
LOG(ERROR) << "Receive updateBotStopped by non-bot";
|
||||
return;
|
||||
}
|
||||
if (!user_id.is_valid() || date <= 0) {
|
||||
if (date <= 0 || !have_user_force(user_id)) {
|
||||
LOG(ERROR) << "Receive invalid updateBotStopped by " << user_id << " at " << date;
|
||||
return;
|
||||
}
|
||||
if (!have_user_force(user_id)) {
|
||||
LOG(ERROR) << "Receive updateBotStopped by unknown " << user_id;
|
||||
return;
|
||||
}
|
||||
|
||||
DialogParticipant old_dialog_participant(DialogId(get_my_id()), user_id, date, DialogParticipantStatus::Banned(0));
|
||||
DialogParticipant new_dialog_participant(DialogId(get_my_id()), user_id, date, DialogParticipantStatus::Member());
|
||||
@ -13746,6 +13742,22 @@ void ContactsManager::on_update_channel_participant(ChannelId channel_id, UserId
|
||||
new_dialog_participant);
|
||||
}
|
||||
|
||||
void ContactsManager::on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about, int32 date,
|
||||
DialogInviteLink invite_link) {
|
||||
if (!td_->auth_manager_->is_bot() || date <= 0 || !have_user_force(user_id) ||
|
||||
!td_->messages_manager_->have_dialog_info_force(dialog_id)) {
|
||||
LOG(ERROR) << "Receive invalid updateBotChatInviteRequester by " << user_id << " in " << dialog_id << " at "
|
||||
<< date;
|
||||
return;
|
||||
}
|
||||
td_->messages_manager_->force_create_dialog(dialog_id, "on_update_chat_invite_requester", true);
|
||||
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateNewChatJoinRequest>(
|
||||
dialog_id.get(), get_user_id_object(user_id, "on_update_chat_invite_requester"), about, date,
|
||||
invite_link.get_chat_invite_link_object(this)));
|
||||
}
|
||||
|
||||
void ContactsManager::update_contacts_hints(const User *u, UserId user_id, bool from_database) {
|
||||
bool is_contact = is_user_contact(u, user_id, false);
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
|
@ -202,6 +202,8 @@ class ContactsManager final : public Actor {
|
||||
void on_update_channel_participant(ChannelId channel_id, UserId user_id, int32 date, DialogInviteLink invite_link,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> old_participant,
|
||||
tl_object_ptr<telegram_api::ChannelParticipant> new_participant);
|
||||
void on_update_chat_invite_requester(DialogId dialog_id, UserId user_id, string about, int32 date,
|
||||
DialogInviteLink invite_link);
|
||||
|
||||
int32 on_update_peer_located(vector<tl_object_ptr<telegram_api::PeerLocated>> &&peers, bool from_update);
|
||||
|
||||
|
@ -2119,6 +2119,14 @@ void UpdatesManager::process_qts_update(tl_object_ptr<telegram_api::Update> &&up
|
||||
add_qts(qts).set_value(Unit());
|
||||
break;
|
||||
}
|
||||
case telegram_api::updateBotChatInviteRequester::ID: {
|
||||
auto update = move_tl_object_as<telegram_api::updateBotChatInviteRequester>(update_ptr);
|
||||
td_->contacts_manager_->on_update_chat_invite_requester(DialogId(update->peer_), UserId(update->user_id_),
|
||||
std::move(update->about_), update->date_,
|
||||
DialogInviteLink(std::move(update->invite_)));
|
||||
add_qts(qts).set_value(Unit());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
@ -2774,6 +2782,7 @@ bool UpdatesManager::is_qts_update(const telegram_api::Update *update) {
|
||||
case telegram_api::updateBotStopped::ID:
|
||||
case telegram_api::updateChatParticipant::ID:
|
||||
case telegram_api::updateChannelParticipant::ID:
|
||||
case telegram_api::updateBotChatInviteRequester::ID:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -2792,6 +2801,8 @@ int32 UpdatesManager::get_update_qts(const telegram_api::Update *update) {
|
||||
return static_cast<const telegram_api::updateChatParticipant *>(update)->qts_;
|
||||
case telegram_api::updateChannelParticipant::ID:
|
||||
return static_cast<const telegram_api::updateChannelParticipant *>(update)->qts_;
|
||||
case telegram_api::updateBotChatInviteRequester::ID:
|
||||
return static_cast<const telegram_api::updateBotChatInviteRequester *>(update)->qts_;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -3207,6 +3218,12 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateChannelParticip
|
||||
add_pending_qts_update(std::move(update), qts, std::move(promise));
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update,
|
||||
Promise<Unit> &&promise) {
|
||||
auto qts = update->qts_;
|
||||
add_pending_qts_update(std::move(update), qts, std::move(promise));
|
||||
}
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateTheme> update, Promise<Unit> &&promise) {
|
||||
td_->theme_manager_->on_update_theme(std::move(update->theme_), std::move(promise));
|
||||
}
|
||||
@ -3219,8 +3236,4 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePendingJoinRequ
|
||||
|
||||
// unsupported updates
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update,
|
||||
Promise<Unit> &&promise) {
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -487,14 +487,13 @@ class UpdatesManager final : public Actor {
|
||||
void on_update(tl_object_ptr<telegram_api::updateBotStopped> update, Promise<Unit> &&promise);
|
||||
void on_update(tl_object_ptr<telegram_api::updateChatParticipant> update, Promise<Unit> &&promise);
|
||||
void on_update(tl_object_ptr<telegram_api::updateChannelParticipant> update, Promise<Unit> &&promise);
|
||||
void on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update, Promise<Unit> &&promise);
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateTheme> update, Promise<Unit> &&promise);
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updatePendingJoinRequests> update, Promise<Unit> &&promise);
|
||||
|
||||
// unsupported updates
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update, Promise<Unit> &&promise);
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
Loading…
Reference in New Issue
Block a user