- Send-restriction UI now has a single owner: ComposeControls' write restriction bar, matching Replies/Sublist modes. BottomControls' duplicate (overlapping, wrongly sized) bar is removed and the monoforum-admin "choose a message to reply" state is ported into the section's write restriction producer. - History load failures with CHANNEL_PRIVATE / CHANNEL_PUBLIC_GROUP_NA / USER_BANNED_IN_CHANNEL close the chat with the not-accessible toast (and handle expired invite peeks), like the legacy view, via a new Data::Session::historyAccessLost signal fired from ApiWrap::requestHistory. - SparseIdsList::Slice::merge inserts single ids instead of re-sorting the whole accumulated set, so the every-message full-history index updates in O(log n) instead of O(n log n). - Unread counting queries the index in place through the new SparseIdsList::countAfter instead of copying up to 10000 ids on every read-marking tick. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
71 lines
1.8 KiB
C++
71 lines
1.8 KiB
C++
/*
|
|
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
|