From 40deda1e9bb2a968c3a1d5c5405597338368c3fe Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 24 Apr 2023 22:31:38 +0400 Subject: [PATCH] Divide groupId of scheduled / normal messages. --- Telegram/SourceFiles/data/data_groups.h | 1 - Telegram/SourceFiles/data/data_types.h | 10 +++++++--- Telegram/SourceFiles/history/history_item.cpp | 10 ++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/data/data_groups.h b/Telegram/SourceFiles/data/data_groups.h index b58c1a551..f8cf259ae 100644 --- a/Telegram/SourceFiles/data/data_groups.h +++ b/Telegram/SourceFiles/data/data_groups.h @@ -41,7 +41,6 @@ private: not_null _data; std::map _groups; - std::map _alias; }; diff --git a/Telegram/SourceFiles/data/data_types.h b/Telegram/SourceFiles/data/data_types.h index aa3ade241..e07df91e3 100644 --- a/Telegram/SourceFiles/data/data_types.h +++ b/Telegram/SourceFiles/data/data_types.h @@ -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; } diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 489a06a66..c72d2454f 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -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)); } }