Add chat.pending_join_request_count.
This commit is contained in:
parent
a4aa509308
commit
e49ae700b6
@ -948,10 +948,11 @@ voiceChat group_call_id:int32 has_participants:Bool default_participant_id:Messa
|
||||
//@theme_name If non-empty, name of a theme, set for the chat
|
||||
//@action_bar Describes actions which must be possible to do through a chat action bar; may be null
|
||||
//@voice_chat Contains information about voice chat of the chat
|
||||
//@pending_join_request_count Number of pending join requests, waiting administrator's approval
|
||||
//@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||
//@draft_message A draft of a message in the chat; may be null
|
||||
//@client_data Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar voice_chat:voiceChat reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector<chatPosition> is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings message_ttl_setting:int32 theme_name:string action_bar:ChatActionBar voice_chat:voiceChat pending_join_request_count:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
|
||||
//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers
|
||||
chats total_count:int32 chat_ids:vector<int53> = Chats;
|
||||
@ -3704,6 +3705,9 @@ updateChatActionBar chat_id:int53 action_bar:ChatActionBar = Update;
|
||||
//@description The chat theme was changed @chat_id Chat identifier @theme_name The new name of the chat theme; may be empty if theme was reset to default
|
||||
updateChatTheme chat_id:int53 theme_name:string = Update;
|
||||
|
||||
//@description The number of chat pending join requests was changed @chat_id Chat identifier @pending_join_request_count The new number of pending join requests
|
||||
updateChatPendingJoinRequestCount chat_id:int53 pending_join_request_count:int32 = Update;
|
||||
|
||||
//@description The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user
|
||||
//@chat_id Chat identifier @reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
|
||||
updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update;
|
||||
|
@ -10454,6 +10454,8 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
|
||||
td_->messages_manager_->on_update_dialog_theme_name(DialogId(chat_id), std::move(chat->theme_emoticon_));
|
||||
|
||||
td_->messages_manager_->on_update_dialog_pending_join_request_count(DialogId(chat_id), chat->requests_pending_);
|
||||
|
||||
auto bot_commands = get_bot_commands(std::move(chat->bot_info_), &chat_full->participants);
|
||||
if (chat_full->bot_commands != bot_commands) {
|
||||
chat_full->bot_commands = std::move(bot_commands);
|
||||
@ -10497,6 +10499,9 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
|
||||
td_->messages_manager_->on_update_dialog_theme_name(DialogId(channel_id), std::move(channel->theme_emoticon_));
|
||||
|
||||
td_->messages_manager_->on_update_dialog_pending_join_request_count(DialogId(channel_id),
|
||||
channel->requests_pending_);
|
||||
|
||||
{
|
||||
MessageTtlSetting message_ttl_setting;
|
||||
if ((channel->flags_ & CHANNEL_FULL_FLAG_HAS_MESSAGE_TTL) != 0) {
|
||||
|
@ -1028,6 +1028,7 @@ class ContactsManager final : public Actor {
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_ACTIVE_GROUP_CALL = 1 << 12;
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 14;
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_PENDING_REQUEST_COUNT = 1 << 17;
|
||||
|
||||
static constexpr int32 CHANNEL_FLAG_USER_IS_CREATOR = 1 << 0;
|
||||
static constexpr int32 CHANNEL_FLAG_USER_HAS_LEFT = 1 << 2;
|
||||
@ -1078,6 +1079,7 @@ class ContactsManager final : public Actor {
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_IS_BLOCKED = 1 << 22;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_EXPORTED_INVITE = 1 << 23;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 24;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PENDING_REQUEST_COUNT = 1 << 28;
|
||||
|
||||
static constexpr int32 CHAT_INVITE_FLAG_IS_CHANNEL = 1 << 0;
|
||||
static constexpr int32 CHAT_INVITE_FLAG_IS_BROADCAST = 1 << 1;
|
||||
|
@ -5250,7 +5250,8 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
bool has_default_join_group_call_as_dialog_id = default_join_group_call_as_dialog_id.is_valid();
|
||||
bool store_has_bots = dialog_type == DialogType::Chat || dialog_type == DialogType::Channel;
|
||||
bool has_theme_name = !theme_name.empty();
|
||||
bool has_flags3 = false;
|
||||
bool has_flags3 = true;
|
||||
bool has_pending_join_request_count = pending_join_request_count != 0;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(has_draft_message);
|
||||
STORE_FLAG(has_last_database_message);
|
||||
@ -5320,6 +5321,11 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
STORE_FLAG(has_flags3);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
if (has_flags3) {
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(has_pending_join_request_count);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
store(last_new_message_id, storer);
|
||||
store(server_unread_count, storer);
|
||||
@ -5414,6 +5420,9 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
if (has_theme_name) {
|
||||
store(theme_name, storer);
|
||||
}
|
||||
if (has_pending_join_request_count) {
|
||||
store(pending_join_request_count, storer);
|
||||
}
|
||||
}
|
||||
|
||||
// do not forget to resolve dialog dependencies including dependencies of last_message
|
||||
@ -5448,6 +5457,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
bool has_default_join_group_call_as_dialog_id = false;
|
||||
bool has_theme_name = false;
|
||||
bool has_flags3 = false;
|
||||
bool has_pending_join_request_count = false;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(has_draft_message);
|
||||
PARSE_FLAG(has_last_database_message);
|
||||
@ -5541,6 +5551,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
}
|
||||
if (has_flags3) {
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(has_pending_join_request_count);
|
||||
END_PARSE_FLAGS();
|
||||
}
|
||||
|
||||
@ -5670,6 +5681,9 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
if (has_theme_name) {
|
||||
parse(theme_name, parser);
|
||||
}
|
||||
if (has_pending_join_request_count) {
|
||||
parse(pending_join_request_count, parser);
|
||||
}
|
||||
}
|
||||
|
||||
template <class StorerT>
|
||||
@ -20141,7 +20155,8 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
||||
d->last_read_inbox_message_id.get(), d->last_read_outbox_message_id.get(), d->unread_mention_count,
|
||||
get_chat_notification_settings_object(&d->notification_settings),
|
||||
d->message_ttl_setting.get_message_ttl_setting_object(), get_dialog_theme_name(d), get_chat_action_bar_object(d),
|
||||
get_voice_chat_object(d), d->reply_markup_message_id.get(), std::move(draft_message), d->client_data);
|
||||
get_voice_chat_object(d), d->pending_join_request_count, d->reply_markup_message_id.get(),
|
||||
std::move(draft_message), d->client_data);
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::chat> MessagesManager::get_chat_object(DialogId dialog_id) const {
|
||||
@ -28834,6 +28849,20 @@ void MessagesManager::send_update_chat_theme(const Dialog *d) {
|
||||
send_update_secret_chats_with_user_theme(d);
|
||||
}
|
||||
|
||||
void MessagesManager::send_update_chat_pending_join_request_count(const Dialog *d) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK(d != nullptr);
|
||||
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id
|
||||
<< " in send_update_chat_pending_join_request_count";
|
||||
on_dialog_updated(d->dialog_id, "send_update_chat_pending_join_request_count");
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateChatPendingJoinRequestCount>(d->dialog_id.get(),
|
||||
d->pending_join_request_count));
|
||||
}
|
||||
|
||||
void MessagesManager::send_update_chat_voice_chat(const Dialog *d) {
|
||||
CHECK(d != nullptr);
|
||||
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in send_update_chat_voice_chat";
|
||||
@ -29848,14 +29877,41 @@ void MessagesManager::set_dialog_theme_name(Dialog *d, string theme_name) {
|
||||
}
|
||||
d->theme_name = std::move(theme_name);
|
||||
d->is_theme_name_inited = true;
|
||||
on_dialog_updated(d->dialog_id, "set_dialog_theme_name");
|
||||
|
||||
if (is_changed) {
|
||||
LOG(INFO) << "Set " << d->dialog_id << " theme to \"" << theme_name << '"';
|
||||
send_update_chat_theme(d);
|
||||
} else {
|
||||
on_dialog_updated(d->dialog_id, "set_dialog_theme_name");
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_pending_join_request_count(DialogId dialog_id,
|
||||
int32 pending_join_request_count) {
|
||||
if (!dialog_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive pending join request count in invalid " << dialog_id;
|
||||
return;
|
||||
}
|
||||
|
||||
auto d = get_dialog_force(dialog_id, "on_update_dialog_pending_join_request_count");
|
||||
if (d == nullptr) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
set_dialog_pending_join_request_count(d, pending_join_request_count);
|
||||
}
|
||||
|
||||
void MessagesManager::set_dialog_pending_join_request_count(Dialog *d, int32 pending_join_request_count) {
|
||||
CHECK(d != nullptr);
|
||||
bool is_changed = d->pending_join_request_count != pending_join_request_count;
|
||||
if (!is_changed) {
|
||||
return;
|
||||
}
|
||||
d->pending_join_request_count = pending_join_request_count;
|
||||
send_update_chat_pending_join_request_count(d);
|
||||
}
|
||||
|
||||
void MessagesManager::repair_dialog_scheduled_messages(Dialog *d) {
|
||||
if (td_->auth_manager_->is_bot() || d->dialog_id.get_type() == DialogType::SecretChat) {
|
||||
return;
|
||||
|
@ -293,6 +293,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_update_dialog_theme_name(DialogId dialog_id, string theme_name);
|
||||
|
||||
void on_update_dialog_pending_join_request_count(DialogId dialog_id, int32 pending_join_request_count);
|
||||
|
||||
void on_update_dialog_has_scheduled_server_messages(DialogId dialog_id, bool has_scheduled_server_messages);
|
||||
|
||||
void on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id);
|
||||
@ -1178,6 +1180,7 @@ class MessagesManager final : public Actor {
|
||||
InputGroupCallId expected_active_group_call_id;
|
||||
DialogId default_join_group_call_as_dialog_id;
|
||||
string theme_name;
|
||||
int32 pending_join_request_count = 0;
|
||||
|
||||
FolderId folder_id;
|
||||
vector<DialogListId> dialog_list_ids; // TODO replace with mask
|
||||
@ -2337,6 +2340,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void send_update_chat_theme(const Dialog *d);
|
||||
|
||||
void send_update_chat_pending_join_request_count(const Dialog *d);
|
||||
|
||||
void send_update_chat_voice_chat(const Dialog *d);
|
||||
|
||||
void send_update_chat_message_ttl_setting(const Dialog *d);
|
||||
@ -2436,6 +2441,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void set_dialog_theme_name(Dialog *d, string theme_name);
|
||||
|
||||
void set_dialog_pending_join_request_count(Dialog *d, int32 pending_join_request_count);
|
||||
|
||||
void repair_dialog_scheduled_messages(Dialog *d);
|
||||
|
||||
void set_dialog_has_scheduled_server_messages(Dialog *d, bool has_scheduled_server_messages);
|
||||
|
@ -3212,11 +3212,14 @@ void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateTheme> update,
|
||||
td_->theme_manager_->on_update_theme(std::move(update->theme_), std::move(promise));
|
||||
}
|
||||
|
||||
// unsupported updates
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updatePendingJoinRequests> update, Promise<Unit> &&promise) {
|
||||
td_->messages_manager_->on_update_dialog_pending_join_request_count(DialogId(update->peer_),
|
||||
update->requests_pending_);
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
// unsupported updates
|
||||
|
||||
void UpdatesManager::on_update(tl_object_ptr<telegram_api::updateBotChatInviteRequester> update,
|
||||
Promise<Unit> &&promise) {
|
||||
}
|
||||
|
@ -490,10 +490,10 @@ class UpdatesManager final : public Actor {
|
||||
|
||||
void on_update(tl_object_ptr<telegram_api::updateTheme> update, Promise<Unit> &&promise);
|
||||
|
||||
// unsupported updates
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user