2018-01-14 16:02:25 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
|
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
|
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "data/data_types.h"
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
|
2018-01-17 16:21:01 +00:00
|
|
|
class Session;
|
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
struct Group {
|
|
|
|
HistoryItemsList items;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class Groups {
|
|
|
|
public:
|
2018-01-17 16:21:01 +00:00
|
|
|
Groups(not_null<Session*> data);
|
|
|
|
|
2021-01-29 10:38:07 +00:00
|
|
|
[[nodiscard]] bool isGrouped(not_null<const HistoryItem*> item) const;
|
2018-01-14 16:02:25 +00:00
|
|
|
void registerMessage(not_null<HistoryItem*> item);
|
2018-01-21 09:05:30 +00:00
|
|
|
void unregisterMessage(not_null<const HistoryItem*> item);
|
2019-04-01 10:58:51 +00:00
|
|
|
void refreshMessage(
|
|
|
|
not_null<HistoryItem*> item,
|
2019-04-02 10:38:53 +00:00
|
|
|
bool justRefreshViews = false);
|
2018-01-14 16:02:25 +00:00
|
|
|
|
2021-01-29 10:38:07 +00:00
|
|
|
[[nodiscard]] const Group *find(not_null<const HistoryItem*> item) const;
|
2018-01-14 16:02:25 +00:00
|
|
|
|
2021-01-18 15:04:03 +00:00
|
|
|
not_null<HistoryItem*> findItemToEdit(not_null<HistoryItem*> item) const;
|
|
|
|
|
2018-01-14 16:02:25 +00:00
|
|
|
private:
|
2018-01-17 16:21:01 +00:00
|
|
|
HistoryItemsList::const_iterator findPositionForItem(
|
|
|
|
const HistoryItemsList &group,
|
|
|
|
not_null<HistoryItem*> item);
|
|
|
|
void refreshViews(const HistoryItemsList &items);
|
|
|
|
|
|
|
|
not_null<Session*> _data;
|
|
|
|
std::map<MessageGroupId, Group> _groups;
|
2018-01-14 16:02:25 +00:00
|
|
|
std::map<MessageGroupId, MessageGroupId> _alias;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Data
|