2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Added handler for SCHEDULE_STATUS_PRIVATE error when send file.

This commit is contained in:
23rd
2020-01-26 21:32:19 +03:00
committed by John Preston
parent ef5055f4f3
commit e7fbcce9d9
3 changed files with 29 additions and 0 deletions

View File

@@ -112,6 +112,27 @@ MsgId ScheduledMessages::lookupId(not_null<HistoryItem*> item) const {
return j->second;
}
HistoryItem *ScheduledMessages::lookupItem(PeerId peer, MsgId msg) const {
const auto history = _session->data().historyLoaded(peer);
if (!history) {
return nullptr;
}
const auto i = _data.find(history);
if (i == end(_data)) {
return nullptr;
}
const auto &items = i->second.items;
const auto j = ranges::find_if(items, [&](auto &item) {
return item->id == msg;
});
if (j == end(items)) {
return nullptr;
}
return (*j).get();
}
int ScheduledMessages::count(not_null<History*> history) const {
const auto i = _data.find(history);
return (i != end(_data)) ? i->second.items.size() : 0;