2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Make HistoryView::Message a ClickHandlerHost.

This commit is contained in:
John Preston
2018-01-11 18:51:59 +03:00
parent 062b0b2165
commit 4740d44159
22 changed files with 185 additions and 189 deletions

View File

@@ -164,6 +164,13 @@ MessageIdsList Session::groupToIds(
return result;
}
MessageIdsList Session::itemOrItsGroup(not_null<HistoryItem*> item) const {
if (const auto group = item->getFullGroup()) {
return groupToIds(group);
}
return { 1, item->fullId() };
}
void Session::setPinnedDialog(const Dialogs::Key &key, bool pinned) {
setIsPinned(key, pinned);
}
@@ -292,4 +299,12 @@ Data::Feed *Session::feedLoaded(FeedId id) {
return (it == _feeds.end()) ? nullptr : it->second.get();
}
void Session::setMimeForwardIds(MessageIdsList &&list) {
_mimeForwardIds = std::move(list);
}
MessageIdsList Session::takeMimeForwardIds() {
return std::move(_mimeForwardIds);
}
} // namespace Data

View File

@@ -142,6 +142,7 @@ public:
HistoryItemsList idsToItems(const MessageIdsList &ids) const;
MessageIdsList itemsToIds(const HistoryItemsList &items) const;
MessageIdsList groupToIds(not_null<HistoryMessageGroup*> group) const;
MessageIdsList itemOrItsGroup(not_null<HistoryItem*> item) const;
int pinnedDialogsCount() const;
const std::deque<Dialogs::Key> &pinnedDialogsOrder() const;
@@ -155,6 +156,9 @@ public:
not_null<Data::Feed*> feed(FeedId id);
Data::Feed *feedLoaded(FeedId id);
void setMimeForwardIds(MessageIdsList &&list);
MessageIdsList takeMimeForwardIds();
private:
bool stickersUpdateNeeded(TimeMs lastUpdate, TimeMs now) const {
constexpr auto kStickersUpdateTimeout = TimeMs(3600'000);
@@ -196,6 +200,8 @@ private:
std::deque<Dialogs::Key> _pinnedDialogs;
base::flat_map<FeedId, std::unique_ptr<Data::Feed>> _feeds;
MessageIdsList _mimeForwardIds;
rpl::lifetime _lifetime;
};