Make fiedls of GroupCallVideoPayload private.
This commit is contained in:
parent
f7ed3d6b99
commit
ca61c97c13
@ -80,7 +80,7 @@ GroupCallParticipantOrder GroupCallParticipant::get_real_order(bool can_self_unm
|
||||
}
|
||||
auto sort_raise_hand_rating = can_self_unmute ? raise_hand_rating : 0;
|
||||
auto sort_joined_date = joined_date_asc ? std::numeric_limits<int32>::max() - joined_date : joined_date;
|
||||
bool has_video = !video_payload.endpoint.empty() || !presentation_payload.endpoint.empty();
|
||||
bool has_video = !video_payload.is_empty() || !presentation_payload.is_empty();
|
||||
return GroupCallParticipantOrder(has_video, sort_active_date, sort_raise_hand_rating, sort_joined_date);
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,22 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
static bool operator==(const GroupCallVideoSourceGroup &lhs, const GroupCallVideoSourceGroup &rhs) {
|
||||
return lhs.semantics == rhs.semantics && lhs.source_ids == rhs.source_ids;
|
||||
}
|
||||
|
||||
bool operator==(const GroupCallVideoPayload &lhs, const GroupCallVideoPayload &rhs) {
|
||||
return lhs.source_groups == rhs.source_groups && lhs.endpoint == rhs.endpoint && lhs.is_paused == rhs.is_paused;
|
||||
if (lhs.source_groups_.size() != rhs.source_groups_.size() || lhs.endpoint_ != rhs.endpoint_ ||
|
||||
lhs.is_paused_ != rhs.is_paused_) {
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < lhs.source_groups_.size(); i++) {
|
||||
if (lhs.source_groups_[i].semantics_ != rhs.source_groups_[i].semantics_ ||
|
||||
lhs.source_groups_[i].source_ids_ != rhs.source_groups_[i].source_ids_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GroupCallVideoPayload::is_empty() const {
|
||||
return endpoint.empty() || source_groups.empty();
|
||||
return endpoint_.empty() || source_groups_.empty();
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::groupCallParticipantVideoInfo>
|
||||
@ -29,10 +35,10 @@ GroupCallVideoPayload::get_group_call_participant_video_info_object() const {
|
||||
}
|
||||
|
||||
auto get_group_call_video_source_group_object = [](const GroupCallVideoSourceGroup &group) {
|
||||
return td_api::make_object<td_api::groupCallVideoSourceGroup>(group.semantics, vector<int32>(group.source_ids));
|
||||
return td_api::make_object<td_api::groupCallVideoSourceGroup>(group.semantics_, vector<int32>(group.source_ids_));
|
||||
};
|
||||
return td_api::make_object<td_api::groupCallParticipantVideoInfo>(
|
||||
transform(source_groups, get_group_call_video_source_group_object), endpoint, is_paused);
|
||||
transform(source_groups_, get_group_call_video_source_group_object), endpoint_, is_paused_);
|
||||
}
|
||||
|
||||
GroupCallVideoPayload::GroupCallVideoPayload(const telegram_api::groupCallParticipantVideo *video) {
|
||||
@ -40,14 +46,16 @@ GroupCallVideoPayload::GroupCallVideoPayload(const telegram_api::groupCallPartic
|
||||
return;
|
||||
}
|
||||
|
||||
endpoint = video->endpoint_;
|
||||
source_groups = transform(video->source_groups_, [](auto &&source_group) {
|
||||
endpoint_ = video->endpoint_;
|
||||
source_groups_ = transform(video->source_groups_, [](auto &&source_group) {
|
||||
GroupCallVideoSourceGroup result;
|
||||
result.semantics = source_group->semantics_;
|
||||
result.source_ids = source_group->sources_;
|
||||
result.semantics_ = source_group->semantics_;
|
||||
result.source_ids_ = source_group->sources_;
|
||||
return result;
|
||||
});
|
||||
is_paused = video->paused_;
|
||||
if (!is_empty()) {
|
||||
is_paused_ = video->paused_;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -13,17 +13,21 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
struct GroupCallVideoSourceGroup {
|
||||
string semantics;
|
||||
vector<int32> source_ids;
|
||||
};
|
||||
class GroupCallVideoPayload {
|
||||
struct GroupCallVideoSourceGroup {
|
||||
string semantics_;
|
||||
vector<int32> source_ids_;
|
||||
};
|
||||
|
||||
struct GroupCallVideoPayload {
|
||||
vector<GroupCallVideoSourceGroup> source_groups;
|
||||
string endpoint;
|
||||
bool is_paused = false;
|
||||
vector<GroupCallVideoSourceGroup> source_groups_;
|
||||
string endpoint_;
|
||||
bool is_paused_ = false;
|
||||
|
||||
friend bool operator==(const GroupCallVideoPayload &lhs, const GroupCallVideoPayload &rhs);
|
||||
|
||||
public:
|
||||
GroupCallVideoPayload() = default;
|
||||
|
||||
explicit GroupCallVideoPayload(const telegram_api::groupCallParticipantVideo *video);
|
||||
|
||||
bool is_empty() const;
|
||||
|
Loading…
Reference in New Issue
Block a user