Use string as groupCallParticipant.order.

This commit is contained in:
levlam 2021-03-15 18:53:51 +03:00
parent 1c92315439
commit 7987912230
4 changed files with 14 additions and 6 deletions

View File

@ -2162,8 +2162,8 @@ groupCallJoinResponseStream = GroupCallJoinResponse;
//@is_muted_for_current_user True, if the participant is muted for the current user
//@can_unmute_self True, if the participant is muted for all users, but can unmute themself
//@volume_level Participant's volume level; 1-20000 in hundreds of percents
//@order User's order in the group call participant list. The bigger is order, the higher is user in the list. If order is 0, the user must be removed from the participant list
groupCallParticipant participant:MessageSender source:int32 bio:string is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:int64 = GroupCallParticipant;
//@order User's order in the group call participant list. Orders must be compared lexicographically. The bigger is order, the higher is user in the list. If order is empty, the user must be removed from the participant list
groupCallParticipant participant:MessageSender source:int32 bio:string is_speaking:Bool is_hand_raised:Bool can_be_muted_for_all_users:Bool can_be_unmuted_for_all_users:Bool can_be_muted_for_current_user:Bool can_be_unmuted_for_current_user:Bool is_muted_for_all_users:Bool is_muted_for_current_user:Bool can_unmute_self:Bool volume_level:int32 order:string = GroupCallParticipant;
//@class CallProblem @description Describes the exact type of a problem with a call

View File

@ -36,12 +36,16 @@ GroupCallParticipant::GroupCallParticipant(const tl_object_ptr<telegram_api::gro
active_date = participant->active_date_;
}
if (joined_date < 0 || active_date < 0) {
LOG(ERROR) << "Receive invalid " << to_string(participant);
LOG(ERROR) << "Receive invalid active_date/joined_date in " << to_string(participant);
joined_date = 0;
active_date = 0;
}
if ((participant->flags_ & telegram_api::groupCallParticipant::RAISE_HAND_RATING_MASK) != 0) {
raise_hand_rating = participant->raise_hand_rating_;
if (raise_hand_rating < 0) {
LOG(ERROR) << "Receive invalid raise_hand_rating in " << to_string(participant);
raise_hand_rating = 0;
}
}
}
is_just_joined = participant->just_joined_;

View File

@ -6,6 +6,9 @@
//
#include "td/telegram/GroupCallParticipantOrder.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include <limits>
#include <tuple>
@ -20,8 +23,9 @@ bool GroupCallParticipantOrder::is_valid() const {
return *this != GroupCallParticipantOrder();
}
int64 GroupCallParticipantOrder::get_group_call_participant_order_object() const {
return (static_cast<int64>(active_date) << 32) + joined_date;
string GroupCallParticipantOrder::get_group_call_participant_order_object() const {
return PSTRING() << 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) {

View File

@ -34,7 +34,7 @@ class GroupCallParticipantOrder {
bool is_valid() const;
int64 get_group_call_participant_order_object() const;
string get_group_call_participant_order_object() const;
};
bool operator==(const GroupCallParticipantOrder &lhs, const GroupCallParticipantOrder &rhs);