Version 1.7.2: Mix peer to grouped_id.

This commit is contained in:
John Preston 2019-06-01 00:51:57 +03:00
parent c560f327cd
commit ea61211a61
3 changed files with 16 additions and 16 deletions

View File

@ -86,30 +86,29 @@ private:
} // namespace Data } // namespace Data
struct MessageGroupId { struct MessageGroupId {
using Underlying = uint64; uint64 peer = 0;
uint64 value = 0;
enum Type : Underlying { MessageGroupId() = default;
None = 0, static MessageGroupId FromRaw(uint64 peer, uint64 value) {
} value; auto result = MessageGroupId();
result.peer = peer;
MessageGroupId(Type value = None) : value(value) { result.value = value;
} return result;
static MessageGroupId FromRaw(Underlying value) {
return static_cast<Type>(value);
} }
bool empty() const { bool empty() const {
return value == None; return !value;
} }
explicit operator bool() const { explicit operator bool() const {
return !empty(); return !empty();
} }
Underlying raw() const { uint64 raw() const {
return static_cast<Underlying>(value); return value;
} }
friend inline Type value_ordering_helper(MessageGroupId value) { friend inline std::pair<uint64, uint64> value_ordering_helper(MessageGroupId value) {
return value.value; return std::make_pair(value.value, value.peer);
} }
}; };

View File

@ -347,7 +347,7 @@ private:
HistoryView::Element *_mainView = nullptr; HistoryView::Element *_mainView = nullptr;
friend class HistoryView::Element; friend class HistoryView::Element;
MessageGroupId _groupId = MessageGroupId::None; MessageGroupId _groupId = MessageGroupId();
}; };

View File

@ -370,7 +370,8 @@ HistoryMessage::HistoryMessage(
setText({ text, entities }); setText({ text, entities });
if (data.has_grouped_id()) { if (data.has_grouped_id()) {
setGroupId(MessageGroupId::FromRaw(data.vgrouped_id.v)); setGroupId(
MessageGroupId::FromRaw(history->peer->id, data.vgrouped_id.v));
} }
} }