Add struct NotificationInfo.

This commit is contained in:
levlam 2023-03-16 22:38:29 +03:00
parent 96981eed53
commit b01ee666e9
2 changed files with 357 additions and 245 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1283,6 +1283,18 @@ class MessagesManager final : public Actor {
unique_ptr<Message> scheduled_messages_;
};
struct NotificationInfo {
NotificationGroupInfo message_notification_group;
NotificationGroupInfo mention_notification_group;
NotificationId new_secret_chat_notification_id; // secret chats only
MessageId pinned_message_notification_message_id;
vector<std::pair<DialogId, MessageId>> pending_new_message_notifications;
vector<std::pair<DialogId, MessageId>> pending_new_mention_notifications;
FlatHashMap<NotificationId, MessageId, NotificationIdHash> notification_id_to_message_id;
};
struct Dialog {
DialogId dialog_id;
MessageId last_new_message_id; // identifier of the last known server message received from update, there should be
@ -1330,6 +1342,8 @@ class MessagesManager final : public Actor {
uint32 history_generation = 0;
uint32 open_count = 0;
unique_ptr<NotificationInfo> notification_info;
FolderId folder_id;
vector<DialogListId> dialog_list_ids; // TODO replace with mask
@ -1356,11 +1370,6 @@ class MessagesManager final : public Actor {
MessageId being_updated_last_database_message_id;
MessageId being_deleted_message_id;
NotificationGroupInfo message_notification_group;
NotificationGroupInfo mention_notification_group;
NotificationId new_secret_chat_notification_id; // secret chats only
MessageId pinned_message_notification_message_id;
bool has_contact_registered_message = false;
bool is_last_message_deleted_locally = false;
@ -1424,11 +1433,6 @@ class MessagesManager final : public Actor {
WaitFreeHashSet<MessageId, MessageIdHash> deleted_message_ids;
vector<std::pair<DialogId, MessageId>> pending_new_message_notifications;
vector<std::pair<DialogId, MessageId>> pending_new_mention_notifications;
FlatHashMap<NotificationId, MessageId, NotificationIdHash> notification_id_to_message_id;
string client_data;
unique_ptr<Message> messages;
@ -3112,6 +3116,8 @@ class MessagesManager final : public Actor {
static DialogScheduledMessages *add_dialog_scheduled_messages(Dialog *d);
static NotificationInfo *add_dialog_notification_info(Dialog *d);
static int64 get_dialog_order(MessageId message_id, int32 message_date);
bool is_dialog_sponsored(const Dialog *d) const;