| 750 | } |
| 751 | |
| 752 | void Histories::checkEmptyState(not_null<History*> history) { |
| 753 | const auto empty = [](const State &state) { |
| 754 | return state.postponed.empty() |
| 755 | && !state.postponedRequestEntry |
| 756 | && state.sent.empty() |
| 757 | && (state.willReadTill == 0) |
| 758 | && (state.sentReadTill == 0); |
| 759 | }; |
| 760 | const auto i = _states.find(history); |
| 761 | if (i != end(_states) && empty(i->second)) { |
| 762 | _states.erase(i); |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | bool Histories::postponeHistoryRequest(const State &state) const { |
| 767 | const auto proj = [](const auto &pair) { |