| 2989 | } |
| 2990 | |
| 2991 | void Session::processMessagesDeleted( |
| 2992 | PeerId peerId, |
| 2993 | const QVector<MTPint> &data) { |
| 2994 | const auto list = messagesList(peerId); |
| 2995 | const auto affected = historyLoaded(peerId); |
| 2996 | if (!list && !affected) { |
| 2997 | return; |
| 2998 | } |
| 2999 | |
| 3000 | auto toDestroy = std::vector<not_null<HistoryItem*>>(); |
| 3001 | auto historiesToCheck = base::flat_set<not_null<History*>>(); |
| 3002 | for (const auto &messageId : data) { |
| 3003 | const auto i = list ? list->find(messageId.v) : Messages::iterator(); |
| 3004 | if (list && i != list->end()) { |
| 3005 | const auto history = i->second->history(); |
| 3006 | toDestroy.push_back(i->second); |
| 3007 | historiesToCheck.emplace(history); |
| 3008 | } else if (affected) { |
| 3009 | affected->unknownMessageDeleted(messageId.v); |
| 3010 | } |
| 3011 | } |
| 3012 | if (!toDestroy.empty()) { |
| 3013 | notifyItemsAboutToBeDestroyed(toDestroy); |
| 3014 | for (const auto &item : toDestroy) { |
| 3015 | item->destroy(); |
| 3016 | } |
| 3017 | } |
| 3018 | for (const auto &history : historiesToCheck) { |
| 3019 | if (!history->chatListMessageKnown()) { |
| 3020 | history->requestChatListMessage(); |
| 3021 | } |
| 3022 | } |
| 3023 | } |
| 3024 | |
| 3025 | void Session::processNonChannelMessagesDeleted(const QVector<MTPint> &data) { |
| 3026 | auto toDestroy = std::vector<not_null<HistoryItem*>>(); |
no test coverage detected