| 207 | } |
| 208 | |
| 209 | void Histories::readInboxTill(not_null<HistoryItem*> item) { |
| 210 | const auto history = item->history(); |
| 211 | if (!item->isRegular()) { |
| 212 | readClientSideMessage(item); |
| 213 | auto view = item->mainView(); |
| 214 | if (!view) { |
| 215 | return; |
| 216 | } |
| 217 | auto block = view->block(); |
| 218 | auto blockIndex = block->indexInHistory(); |
| 219 | auto itemIndex = view->indexInBlock(); |
| 220 | while (blockIndex > 0 || itemIndex > 0) { |
| 221 | if (itemIndex > 0) { |
| 222 | view = block->messages[--itemIndex].get(); |
| 223 | } else { |
| 224 | while (blockIndex > 0) { |
| 225 | block = history->blocks[--blockIndex].get(); |
| 226 | itemIndex = block->messages.size(); |
| 227 | if (itemIndex > 0) { |
| 228 | view = block->messages[--itemIndex].get(); |
| 229 | break; |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | item = view->data(); |
| 234 | if (item->isRegular()) { |
| 235 | break; |
| 236 | } |
| 237 | } |
| 238 | if (!item->isRegular()) { |
| 239 | LOG(("App Error: " |
| 240 | "Can't read history till unknown local message.")); |
| 241 | return; |
| 242 | } |
| 243 | } |
| 244 | readInboxTill(history, item->id); |
| 245 | } |
| 246 | |
| 247 | void Histories::readInboxTill(not_null<History*> history, MsgId tillId) { |
| 248 | readInboxTill(history, tillId, false); |
no test coverage detected