diff options
| author | levlam <levlam@telegram.org> | 2021-07-09 18:48:10 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2021-07-09 18:48:10 +0300 |
| commit | 3682029db2c27bf3efe59b0472a58efaf06da529 (patch) | |
| tree | 6bb164eb026d07c64fed3869d10eff70b4621022 /td/telegram/GroupCallParticipantOrder.cpp | |
| parent | 3e351a09468d89fe1109629a58f10ab6d04b6aa6 (diff) | |
Support new order of group call participants.
Diffstat (limited to 'td/telegram/GroupCallParticipantOrder.cpp')
| -rw-r--r-- | td/telegram/GroupCallParticipantOrder.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/td/telegram/GroupCallParticipantOrder.cpp b/td/telegram/GroupCallParticipantOrder.cpp index 1d1d91f34..0f45026a2 100644 --- a/td/telegram/GroupCallParticipantOrder.cpp +++ b/td/telegram/GroupCallParticipantOrder.cpp @@ -15,11 +15,11 @@ namespace td { GroupCallParticipantOrder GroupCallParticipantOrder::min() { - return GroupCallParticipantOrder(0, 0, 1); + return GroupCallParticipantOrder(false, 0, 0, 1); } GroupCallParticipantOrder GroupCallParticipantOrder::max() { - return GroupCallParticipantOrder(std::numeric_limits<int32>::max(), std::numeric_limits<int64>::max(), + return GroupCallParticipantOrder(true, std::numeric_limits<int32>::max(), std::numeric_limits<int64>::max(), std::numeric_limits<int32>::max()); } @@ -31,12 +31,12 @@ string GroupCallParticipantOrder::get_group_call_participant_order_object() cons if (!is_valid()) { return string(); } - return PSTRING() << lpad0(to_string(active_date), 10) << lpad0(to_string(raise_hand_rating), 19) - << lpad0(to_string(joined_date), 10); + return PSTRING() << (has_video ? '1' : '0') << lpad0(to_string(active_date), 10) + << lpad0(to_string(raise_hand_rating), 19) << lpad0(to_string(joined_date), 10); } bool operator==(const GroupCallParticipantOrder &lhs, const GroupCallParticipantOrder &rhs) { - return lhs.active_date == rhs.active_date && lhs.joined_date == rhs.joined_date && + return lhs.has_video == rhs.has_video && lhs.active_date == rhs.active_date && lhs.joined_date == rhs.joined_date && lhs.raise_hand_rating == rhs.raise_hand_rating; } @@ -45,8 +45,10 @@ bool operator!=(const GroupCallParticipantOrder &lhs, const GroupCallParticipant } bool operator<(const GroupCallParticipantOrder &lhs, const GroupCallParticipantOrder &rhs) { - return std::tie(lhs.active_date, lhs.raise_hand_rating, lhs.joined_date) < - std::tie(rhs.active_date, rhs.raise_hand_rating, rhs.joined_date); + auto lhs_has_video = static_cast<int32>(lhs.has_video); + auto rhs_has_video = static_cast<int32>(rhs.has_video); + return std::tie(lhs_has_video, lhs.active_date, lhs.raise_hand_rating, lhs.joined_date) < + std::tie(rhs_has_video, rhs.active_date, rhs.raise_hand_rating, rhs.joined_date); } bool operator<=(const GroupCallParticipantOrder &lhs, const GroupCallParticipantOrder &rhs) { @@ -63,8 +65,8 @@ bool operator>=(const GroupCallParticipantOrder &lhs, const GroupCallParticipant StringBuilder &operator<<(StringBuilder &string_builder, const GroupCallParticipantOrder &group_call_participant_order) { - return string_builder << group_call_participant_order.active_date << '/' - << group_call_participant_order.raise_hand_rating << '/' + return string_builder << group_call_participant_order.has_video << '/' << group_call_participant_order.active_date + << '/' << group_call_participant_order.raise_hand_rating << '/' << group_call_participant_order.joined_date; } |
