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
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<Type>(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<Underlying>(value);
uint64 raw() const {
return value;
}
friend inline Type value_ordering_helper(MessageGroupId value) {
return value.value;
friend inline std::pair<uint64, uint64> value_ordering_helper(MessageGroupId value) {
return std::make_pair(value.value, value.peer);
}
};

View File

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

View File

@ -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));
}
}