| 5810 | } |
| 5811 | |
| 5812 | HistoryItem *Session::messageWithPeer(PeerId id) const { |
| 5813 | if (id == _session->userPeerId()) { |
| 5814 | return nullptr; |
| 5815 | } |
| 5816 | const auto i = _messagesWithPeer.find(id); |
| 5817 | if (i == end(_messagesWithPeer)) { |
| 5818 | return nullptr; |
| 5819 | } |
| 5820 | auto &list = i->second; |
| 5821 | for (auto j = begin(list); j != end(list);) { |
| 5822 | if (const auto item = message(*j)) { |
| 5823 | return item; |
| 5824 | } |
| 5825 | j = list.erase(j); |
| 5826 | } |
| 5827 | _messagesWithPeer.erase(i); |
| 5828 | return nullptr; |
| 5829 | } |
| 5830 | |
| 5831 | } // namespace Data |
no test coverage detected