Some internal HistoryItem refactoring.

Replace most IsServerMsgId / id <=> 0 with isRegular().
Track isLocal / isHistoryEntry in flags.
Remove toHistoryMessage.
This commit is contained in:
John Preston
2021-11-07 12:06:00 +04:00
parent 22b37c4bf8
commit c534f3f22e
52 changed files with 460 additions and 524 deletions
+4 -5
View File
@@ -73,7 +73,7 @@ void Groups::refreshMessage(
unregisterMessage(item);
return;
}
if (!IsServerMsgId(item->id) && !item->isScheduled()) {
if (!item->isRegular() && !item->isScheduled()) {
return;
}
const auto groupId = item->groupId();
@@ -112,14 +112,13 @@ void Groups::refreshMessage(
HistoryItemsList::const_iterator Groups::findPositionForItem(
const HistoryItemsList &group,
not_null<HistoryItem*> item) {
const auto itemId = item->id;
const auto last = end(group);
if (!IsServerMsgId(itemId)) {
if (!item->isRegular()) {
return last;
}
const auto itemId = item->id;
for (auto result = begin(group); result != last; ++result) {
const auto alreadyId = (*result)->id;
if (IsServerMsgId(alreadyId) && alreadyId > itemId) {
if ((*result)->isRegular() && (*result)->id > itemId) {
return result;
}
}