-
Notifications
You must be signed in to change notification settings - Fork 7.2k
Expand file tree
/
Copy pathdata_history_messages.h
More file actions
71 lines (58 loc) · 1.83 KB
/
Copy pathdata_history_messages.h
File metadata and controls
71 lines (58 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
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 "storage/storage_sparse_ids_list.h"
class History;
class SparseIdsSlice;
class SparseIdsMergedSlice;
namespace Data {
struct MessagesSlice;
struct MessagePosition;
class HistoryMessages final {
public:
void addNew(MsgId messageId);
void addExisting(MsgId messageId, MsgRange noSkipRange);
void addSlice(
std::vector<MsgId> &&messageIds,
MsgRange noSkipRange,
std::optional<int> count);
void removeOne(MsgId messageId);
void removeAll();
void invalidateBottom();
[[nodiscard]] Storage::SparseIdsListResult snapshot(
const Storage::SparseIdsListQuery &query) const;
[[nodiscard]] std::optional<int> countAfter(
MsgId tillId,
int limit,
Fn<bool(MsgId)> counts) const;
[[nodiscard]] auto sliceUpdated() const
-> rpl::producer<Storage::SparseIdsSliceUpdate>;
[[nodiscard]] rpl::producer<MsgId> oneRemoved() const;
[[nodiscard]] rpl::producer<> allRemoved() const;
[[nodiscard]] rpl::producer<> bottomInvalidated() const;
private:
Storage::SparseIdsList _chat;
rpl::event_stream<MsgId> _oneRemoved;
rpl::event_stream<> _allRemoved;
rpl::event_stream<> _bottomInvalidated;
};
[[nodiscard]] rpl::producer<SparseIdsSlice> HistoryViewer(
not_null<History*> history,
MsgId aroundId,
int limitBefore,
int limitAfter);
[[nodiscard]] rpl::producer<SparseIdsMergedSlice> HistoryMergedViewer(
not_null<History*> history,
/*Universal*/MsgId universalAroundId,
int limitBefore,
int limitAfter);
[[nodiscard]] rpl::producer<MessagesSlice> HistoryMessagesViewer(
not_null<History*> history,
MessagePosition aroundId,
int limitBefore,
int limitAfter);
} // namespace Data