Divide groupId of scheduled / normal messages.

This commit is contained in:
John Preston 2023-04-24 22:31:38 +04:00
parent 2d50e893b5
commit 40deda1e9b
3 changed files with 15 additions and 6 deletions

View File

@ -41,7 +41,6 @@ private:
not_null<Session*> _data;
std::map<MessageGroupId, Group> _groups;
std::map<MessageGroupId, MessageGroupId> _alias;
};

View File

@ -63,13 +63,17 @@ struct FileOrigin;
} // namespace Data
struct MessageGroupId {
PeerId peer = 0;
uint64 peerAndScheduledFlag = 0;
uint64 value = 0;
MessageGroupId() = default;
static MessageGroupId FromRaw(PeerId peer, uint64 value) {
static MessageGroupId FromRaw(
PeerId peer,
uint64 value,
bool scheduled) {
auto result = MessageGroupId();
result.peer = peer;
result.peerAndScheduledFlag = peer.value
| (scheduled ? (1ULL << 55) : 0);
result.value = value;
return result;
}

View File

@ -317,7 +317,10 @@ HistoryItem::HistoryItem(
setText(_media ? textWithEntities : EnsureNonEmpty(textWithEntities));
if (const auto groupedId = data.vgrouped_id()) {
setGroupId(
MessageGroupId::FromRaw(history->peer->id, groupedId->v));
MessageGroupId::FromRaw(
history->peer->id,
groupedId->v,
_flags & MessageFlag::IsOrWasScheduled));
}
setReactions(data.vreactions());
applyTTL(data);
@ -507,7 +510,10 @@ HistoryItem::HistoryItem(
setMedia(media);
setText(textWithEntities);
if (groupedId) {
setGroupId(MessageGroupId::FromRaw(history->peer->id, groupedId));
setGroupId(MessageGroupId::FromRaw(
history->peer->id,
groupedId,
flags & MessageFlag::IsOrWasScheduled));
}
}