Add Chat.has_scheduled_messages flag.
GitOrigin-RevId: 6d7f211647c738d5912476232e8842c245d1f884
This commit is contained in:
parent
2a335089f9
commit
5b1d363918
@ -640,6 +640,7 @@ chatListArchive = ChatList;
|
||||
//@is_pinned True, if the chat is pinned
|
||||
//@is_marked_as_unread True, if the chat is marked as unread
|
||||
//@is_sponsored True, if the chat is sponsored by the user's MTProxy server
|
||||
//@has_scheduled_messages True, if the chat has scheduled messages
|
||||
//@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages
|
||||
//@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users
|
||||
//@can_be_reported True, if the chat can be reported to Telegram moderators through reportChat
|
||||
@ -654,7 +655,7 @@ chatListArchive = ChatList;
|
||||
//@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 client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used
|
||||
chat id:int53 type:ChatType chat_list:ChatList title:string photo:chatPhoto permissions:chatPermissions last_message:message order:int64 is_pinned:Bool is_marked_as_unread:Bool is_sponsored: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 action_bar:ChatActionBar pinned_message_id:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
chat id:int53 type:ChatType chat_list:ChatList title:string photo:chatPhoto permissions:chatPermissions last_message:message order:int64 is_pinned:Bool is_marked_as_unread:Bool is_sponsored: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 action_bar:ChatActionBar pinned_message_id:int53 reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat;
|
||||
|
||||
//@description Represents a list of chats @chat_ids List of chat identifiers
|
||||
chats chat_ids:vector<int53> = Chats;
|
||||
@ -2741,6 +2742,9 @@ updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update;
|
||||
//@description A chat's is_sponsored field has changed @chat_id Chat identifier @is_sponsored New value of is_sponsored @order New value of chat order
|
||||
updateChatIsSponsored chat_id:int53 is_sponsored:Bool order:int64 = Update;
|
||||
|
||||
//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages
|
||||
updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update;
|
||||
|
||||
//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value
|
||||
updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update;
|
||||
|
||||
|
Binary file not shown.
@ -8137,6 +8137,8 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_folder_id(DialogId(user_id), folder_id);
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
|
||||
DialogId(user_id), (user_full->flags_ & USER_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
|
||||
|
||||
UserFull *user = add_user_full(user_id);
|
||||
user->expires_at = Time::now() + USER_FULL_EXPIRE_TIME;
|
||||
@ -8355,6 +8357,8 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_folder_id(DialogId(chat_id), folder_id);
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
|
||||
DialogId(chat_id), (chat_full->flags_ & CHAT_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
|
||||
|
||||
ChatFull *chat = add_chat_full(chat_id);
|
||||
on_update_chat_full_invite_link(chat, std::move(chat_full->exported_invite_));
|
||||
@ -8495,6 +8499,8 @@ void ContactsManager::on_get_chat_full(tl_object_ptr<telegram_api::ChatFull> &&c
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_folder_id(DialogId(channel_id), folder_id);
|
||||
}
|
||||
td_->messages_manager_->on_update_dialog_has_scheduled_messages(
|
||||
DialogId(channel_id), (channel_full->flags_ & CHANNEL_FULL_FLAG_HAS_SCHEDULED_MESSAGES) != 0);
|
||||
|
||||
if (participant_count >= 190) {
|
||||
int32 online_member_count = 0;
|
||||
|
@ -882,6 +882,7 @@ class ContactsManager : public Actor {
|
||||
static constexpr int32 USER_FULL_FLAG_HAS_PINNED_MESSAGE = 1 << 6;
|
||||
static constexpr int32 USER_FULL_FLAG_CAN_PIN_MESSAGE = 1 << 7;
|
||||
static constexpr int32 USER_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
||||
static constexpr int32 USER_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 12;
|
||||
|
||||
static constexpr int32 CHAT_FLAG_USER_IS_CREATOR = 1 << 0;
|
||||
static constexpr int32 CHAT_FLAG_USER_WAS_KICKED = 1 << 1;
|
||||
@ -892,6 +893,7 @@ class ContactsManager : public Actor {
|
||||
static constexpr int32 CHAT_FLAG_WAS_MIGRATED = 1 << 6;
|
||||
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_PINNED_MESSAGE = 1 << 6;
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 8;
|
||||
static constexpr int32 CHAT_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
|
||||
|
||||
static constexpr int32 CHANNEL_FLAG_USER_IS_CREATOR = 1 << 0;
|
||||
@ -933,6 +935,7 @@ class ContactsManager : public Actor {
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_CAN_SET_LOCATION = 1 << 16;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SLOW_MODE_DELAY = 1 << 17;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SLOW_MODE_NEXT_SEND_DATE = 1 << 18;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 19;
|
||||
|
||||
static constexpr int32 CHAT_INVITE_FLAG_IS_CHANNEL = 1 << 0;
|
||||
static constexpr int32 CHAT_INVITE_FLAG_IS_BROADCAST = 1 << 1;
|
||||
|
@ -4170,6 +4170,7 @@ void MessagesManager::Dialog::store(StorerT &storer) const {
|
||||
STORE_FLAG(can_block_user);
|
||||
STORE_FLAG(can_share_phone_number);
|
||||
STORE_FLAG(can_report_location);
|
||||
STORE_FLAG(has_scheduled_messages);
|
||||
END_STORE_FLAGS();
|
||||
}
|
||||
|
||||
@ -4328,6 +4329,7 @@ void MessagesManager::Dialog::parse(ParserT &parser) {
|
||||
PARSE_FLAG(can_block_user);
|
||||
PARSE_FLAG(can_share_phone_number);
|
||||
PARSE_FLAG(can_report_location);
|
||||
PARSE_FLAG(has_scheduled_messages);
|
||||
END_PARSE_FLAGS();
|
||||
} else {
|
||||
is_folder_id_inited = false;
|
||||
@ -14540,10 +14542,10 @@ td_api::object_ptr<td_api::chat> MessagesManager::get_chat_object(const Dialog *
|
||||
get_chat_photo_object(td_->file_manager_.get(), get_dialog_photo(d->dialog_id)),
|
||||
get_dialog_permissions(d->dialog_id).get_chat_permissions_object(),
|
||||
get_message_object(d->dialog_id, get_message(d, d->last_message_id)), get_dialog_public_order(d),
|
||||
d->pinned_order != DEFAULT_ORDER, d->is_marked_as_unread, d->order == SPONSORED_DIALOG_ORDER, can_delete_for_self,
|
||||
can_delete_for_all_users, can_report_dialog(d->dialog_id), d->notification_settings.silent_send_message,
|
||||
d->server_unread_count + d->local_unread_count, d->last_read_inbox_message_id.get(),
|
||||
d->last_read_outbox_message_id.get(), d->unread_mention_count,
|
||||
d->pinned_order != DEFAULT_ORDER, d->is_marked_as_unread, d->order == SPONSORED_DIALOG_ORDER,
|
||||
d->has_scheduled_messages, can_delete_for_self, can_delete_for_all_users, can_report_dialog(d->dialog_id),
|
||||
d->notification_settings.silent_send_message, d->server_unread_count + d->local_unread_count,
|
||||
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), get_chat_action_bar_object(d),
|
||||
d->pinned_message_id.get(), d->reply_markup_message_id.get(), get_draft_message_object(d->draft_message),
|
||||
d->client_data);
|
||||
@ -22155,6 +22157,35 @@ void MessagesManager::set_dialog_pinned_message_id(Dialog *d, MessageId pinned_m
|
||||
make_tl_object<td_api::updateChatPinnedMessage>(d->dialog_id.get(), pinned_message_id.get()));
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_has_scheduled_messages(DialogId dialog_id, bool has_scheduled_messages) {
|
||||
if (!dialog_id.is_valid()) {
|
||||
LOG(ERROR) << "Receive has_scheduled_messages in invalid " << dialog_id;
|
||||
return;
|
||||
}
|
||||
|
||||
auto d = get_dialog_force(dialog_id);
|
||||
if (d == nullptr) {
|
||||
// nothing to do
|
||||
return;
|
||||
}
|
||||
|
||||
if (d->has_scheduled_messages != has_scheduled_messages) {
|
||||
set_dialog_has_scheduled_messages(d, has_scheduled_messages);
|
||||
}
|
||||
}
|
||||
|
||||
void MessagesManager::set_dialog_has_scheduled_messages(Dialog *d, bool has_scheduled_messages) {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(d->has_scheduled_messages != has_scheduled_messages);
|
||||
d->has_scheduled_messages = has_scheduled_messages;
|
||||
on_dialog_updated(d->dialog_id, "set_dialog_has_scheduled_messages");
|
||||
|
||||
LOG(INFO) << "Set " << d->dialog_id << " has_scheduled_messages to " << has_scheduled_messages;
|
||||
LOG_CHECK(d->is_update_new_chat_sent) << "Wrong " << d->dialog_id << " in set_dialog_has_scheduled_messages";
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateChatHasScheduledMessages>(d->dialog_id.get(), has_scheduled_messages));
|
||||
}
|
||||
|
||||
void MessagesManager::on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id) {
|
||||
auto d = get_dialog_force(dialog_id);
|
||||
if (d == nullptr) {
|
||||
|
@ -285,6 +285,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
void on_update_dialog_pinned_message_id(DialogId dialog_id, MessageId pinned_message_id);
|
||||
|
||||
void on_update_dialog_has_scheduled_messages(DialogId dialog_id, bool has_scheduled_messages);
|
||||
|
||||
void on_update_dialog_folder_id(DialogId dialog_id, FolderId folder_id);
|
||||
|
||||
void on_update_service_notification(tl_object_ptr<telegram_api::updateServiceNotification> &&update,
|
||||
@ -1080,6 +1082,7 @@ class MessagesManager : public Actor {
|
||||
bool is_folder_id_inited = false;
|
||||
bool need_repair_server_unread_count = false;
|
||||
bool is_marked_as_unread = false;
|
||||
bool has_scheduled_messages = false;
|
||||
|
||||
bool increment_view_counter = false;
|
||||
|
||||
@ -1875,6 +1878,8 @@ class MessagesManager : public Actor {
|
||||
|
||||
void set_dialog_pinned_message_id(Dialog *d, MessageId pinned_message_id);
|
||||
|
||||
void set_dialog_has_scheduled_messages(Dialog *d, bool has_scheduled_messages);
|
||||
|
||||
void set_dialog_folder_id(Dialog *d, FolderId folder_id);
|
||||
|
||||
void toggle_dialog_is_pinned_on_server(DialogId dialog_id, bool is_pinned, uint64 logevent_id);
|
||||
|
Loading…
Reference in New Issue
Block a user