2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

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

View File

@@ -100,7 +100,7 @@ void Histories::readInbox(not_null<History*> history) {
void Histories::readInboxTill(not_null<HistoryItem*> item) {
const auto history = item->history();
if (!IsServerMsgId(item->id)) {
if (!item->isRegular()) {
readClientSideMessage(item);
auto view = item->mainView();
if (!view) {
@@ -123,11 +123,11 @@ void Histories::readInboxTill(not_null<HistoryItem*> item) {
}
}
item = view->data();
if (IsServerMsgId(item->id)) {
if (item->isRegular()) {
break;
}
}
if (!IsServerMsgId(item->id)) {
if (!item->isRegular()) {
LOG(("App Error: "
"Can't read history till unknown local message."));
return;
@@ -235,7 +235,7 @@ void Histories::readInboxTill(
}
void Histories::readInboxOnNewMessage(not_null<HistoryItem*> item) {
if (!IsServerMsgId(item->id)) {
if (!item->isRegular()) {
readClientSideMessage(item);
} else {
readInboxTill(item->history(), item->id, true);
@@ -728,7 +728,7 @@ void Histories::deleteMessages(const MessageIdsList &ids, bool revoke) {
continue;
}
remove.push_back(item);
if (IsServerMsgId(item->id)) {
if (item->isRegular()) {
idsByPeer[history].push_back(MTP_int(itemId.msg));
}
}