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

Delete history for specific days in private chats.

This commit is contained in:
John Preston
2021-11-16 11:26:35 +04:00
parent aa0a9b2db9
commit 80fcffcc40
18 changed files with 211 additions and 59 deletions

View File

@@ -462,6 +462,20 @@ void History::destroyMessage(not_null<HistoryItem*> item) {
}
}
void History::destroyMessagesByDates(TimeId minDate, TimeId maxDate) {
auto toDestroy = std::vector<not_null<HistoryItem*>>();
for (const auto &message : _messages) {
if (message->isRegular()
&& message->date() > minDate
&& message->date() < maxDate) {
toDestroy.push_back(message.get());
}
}
for (const auto item : toDestroy) {
item->destroy();
}
}
void History::unpinAllMessages() {
session().storage().remove(
Storage::SharedMediaRemoveAll(