From ea61211a610937452ee87903e6998cffe91a4dea Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 1 Jun 2019 00:51:57 +0300 Subject: [PATCH] Version 1.7.2: Mix peer to grouped_id. --- Telegram/SourceFiles/data/data_types.h | 27 +++++++++---------- Telegram/SourceFiles/history/history_item.h | 2 +- .../SourceFiles/history/history_message.cpp | 3 ++- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Telegram/SourceFiles/data/data_types.h b/Telegram/SourceFiles/data/data_types.h index 9bccded6d7..6bf06ac453 100644 --- a/Telegram/SourceFiles/data/data_types.h +++ b/Telegram/SourceFiles/data/data_types.h @@ -86,30 +86,29 @@ private: } // namespace Data struct MessageGroupId { - using Underlying = uint64; + uint64 peer = 0; + uint64 value = 0; - enum Type : Underlying { - None = 0, - } value; - - MessageGroupId(Type value = None) : value(value) { - } - static MessageGroupId FromRaw(Underlying value) { - return static_cast(value); + MessageGroupId() = default; + static MessageGroupId FromRaw(uint64 peer, uint64 value) { + auto result = MessageGroupId(); + result.peer = peer; + result.value = value; + return result; } bool empty() const { - return value == None; + return !value; } explicit operator bool() const { return !empty(); } - Underlying raw() const { - return static_cast(value); + uint64 raw() const { + return value; } - friend inline Type value_ordering_helper(MessageGroupId value) { - return value.value; + friend inline std::pair value_ordering_helper(MessageGroupId value) { + return std::make_pair(value.value, value.peer); } }; diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index a8bd395b2a..510149cd03 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -347,7 +347,7 @@ private: HistoryView::Element *_mainView = nullptr; friend class HistoryView::Element; - MessageGroupId _groupId = MessageGroupId::None; + MessageGroupId _groupId = MessageGroupId(); }; diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index e874f11943..1ce9da70b5 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -370,7 +370,8 @@ HistoryMessage::HistoryMessage( setText({ text, entities }); if (data.has_grouped_id()) { - setGroupId(MessageGroupId::FromRaw(data.vgrouped_id.v)); + setGroupId( + MessageGroupId::FromRaw(history->peer->id, data.vgrouped_id.v)); } }