2020-12-08 17:29:25 +03:00
|
|
|
//
|
2024-01-01 03:07:21 +03:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2020-12-08 17:29:25 +03:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
#include "td/telegram/DialogId.h"
|
2021-03-15 18:32:28 +03:00
|
|
|
#include "td/telegram/GroupCallParticipantOrder.h"
|
2021-01-12 17:05:25 +03:00
|
|
|
#include "td/telegram/GroupCallVideoPayload.h"
|
2020-12-08 17:29:25 +03:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2021-03-05 12:50:39 +03:00
|
|
|
class Td;
|
2020-12-08 17:29:25 +03:00
|
|
|
|
|
|
|
struct GroupCallParticipant {
|
2021-03-05 14:40:54 +03:00
|
|
|
DialogId dialog_id;
|
2021-03-05 15:27:52 +03:00
|
|
|
string about;
|
2021-05-03 16:30:14 +03:00
|
|
|
GroupCallVideoPayload video_payload;
|
|
|
|
GroupCallVideoPayload presentation_payload;
|
2021-01-11 15:02:02 +03:00
|
|
|
int32 audio_source = 0;
|
2021-07-06 02:33:42 +03:00
|
|
|
int32 presentation_audio_source = 0;
|
2022-02-11 18:26:43 +03:00
|
|
|
int64 raise_hand_rating = 0;
|
2020-12-08 17:29:25 +03:00
|
|
|
int32 joined_date = 0;
|
|
|
|
int32 active_date = 0;
|
2020-12-31 03:10:41 +03:00
|
|
|
int32 volume_level = 10000;
|
2021-02-01 22:29:45 +03:00
|
|
|
bool is_volume_level_local = false;
|
2021-02-11 20:34:24 +03:00
|
|
|
bool server_is_muted_by_themselves = false;
|
|
|
|
bool server_is_muted_by_admin = false;
|
|
|
|
bool server_is_muted_locally = false;
|
2021-03-05 12:39:57 +03:00
|
|
|
bool is_self = false;
|
2020-12-08 17:29:25 +03:00
|
|
|
|
2020-12-31 02:48:45 +03:00
|
|
|
bool can_be_muted_for_all_users = false;
|
|
|
|
bool can_be_unmuted_for_all_users = false;
|
|
|
|
bool can_be_muted_only_for_self = false;
|
|
|
|
bool can_be_unmuted_only_for_self = false;
|
2020-12-17 02:07:05 +03:00
|
|
|
|
2021-02-01 22:29:45 +03:00
|
|
|
bool is_min = false;
|
2021-02-10 18:00:27 +03:00
|
|
|
bool is_fake = false;
|
2020-12-11 17:43:23 +03:00
|
|
|
bool is_just_joined = false;
|
2020-12-08 17:29:25 +03:00
|
|
|
bool is_speaking = false;
|
2021-07-12 20:21:34 +03:00
|
|
|
int32 video_diff = 0;
|
2020-12-11 17:43:23 +03:00
|
|
|
int32 local_active_date = 0;
|
2021-03-15 18:32:28 +03:00
|
|
|
GroupCallParticipantOrder order;
|
2021-03-19 02:44:20 +03:00
|
|
|
int32 version = 0;
|
2020-12-08 17:29:25 +03:00
|
|
|
|
2021-02-02 00:40:40 +03:00
|
|
|
int32 pending_volume_level = 0;
|
|
|
|
uint64 pending_volume_level_generation = 0;
|
|
|
|
|
2021-02-12 15:41:20 +03:00
|
|
|
bool have_pending_is_muted = false;
|
|
|
|
bool pending_is_muted_by_themselves = false;
|
|
|
|
bool pending_is_muted_by_admin = false;
|
|
|
|
bool pending_is_muted_locally = false;
|
|
|
|
uint64 pending_is_muted_generation = 0;
|
|
|
|
|
2021-03-05 16:44:43 +03:00
|
|
|
bool have_pending_is_hand_raised = false;
|
|
|
|
bool pending_is_hand_raised = false;
|
|
|
|
uint64 pending_is_hand_raised_generation = 0;
|
|
|
|
|
2021-01-02 22:59:48 +03:00
|
|
|
static constexpr int32 MIN_VOLUME_LEVEL = 1;
|
|
|
|
static constexpr int32 MAX_VOLUME_LEVEL = 20000;
|
|
|
|
|
2020-12-17 02:07:05 +03:00
|
|
|
GroupCallParticipant() = default;
|
|
|
|
|
2021-03-19 02:44:20 +03:00
|
|
|
GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant, int32 call_version);
|
2020-12-17 02:07:05 +03:00
|
|
|
|
2020-12-18 15:20:05 +03:00
|
|
|
static bool is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
|
|
|
|
|
2021-02-02 01:06:49 +03:00
|
|
|
void update_from(const GroupCallParticipant &old_participant);
|
|
|
|
|
2021-03-05 12:39:57 +03:00
|
|
|
bool update_can_be_muted(bool can_manage, bool is_admin);
|
2020-12-17 02:07:05 +03:00
|
|
|
|
2021-03-05 12:39:57 +03:00
|
|
|
bool set_pending_is_muted(bool is_muted, bool can_manage, bool is_admin);
|
2021-02-12 15:41:20 +03:00
|
|
|
|
2022-05-10 21:37:10 +03:00
|
|
|
GroupCallParticipantOrder get_real_order(bool can_self_unmute, bool joined_date_asc) const;
|
|
|
|
|
|
|
|
GroupCallParticipantOrder get_server_order(bool can_self_unmute, bool joined_date_asc) const;
|
2020-12-11 17:43:23 +03:00
|
|
|
|
2020-12-08 17:29:25 +03:00
|
|
|
bool is_valid() const {
|
2021-03-05 14:40:54 +03:00
|
|
|
return dialog_id.is_valid();
|
2020-12-08 17:29:25 +03:00
|
|
|
}
|
|
|
|
|
2021-02-12 15:41:20 +03:00
|
|
|
bool get_is_muted_by_themselves() const;
|
|
|
|
|
|
|
|
bool get_is_muted_by_admin() const;
|
|
|
|
|
|
|
|
bool get_is_muted_locally() const;
|
|
|
|
|
|
|
|
bool get_is_muted_for_all_users() const;
|
2021-02-11 20:34:24 +03:00
|
|
|
|
2021-02-02 00:40:40 +03:00
|
|
|
int32 get_volume_level() const;
|
|
|
|
|
2021-03-05 16:44:43 +03:00
|
|
|
bool get_is_hand_raised() const;
|
|
|
|
|
2021-07-13 03:14:48 +03:00
|
|
|
int32 get_has_video() const;
|
|
|
|
|
2021-03-05 12:50:39 +03:00
|
|
|
td_api::object_ptr<td_api::groupCallParticipant> get_group_call_participant_object(Td *td) const;
|
2020-12-08 17:29:25 +03:00
|
|
|
};
|
|
|
|
|
2020-12-11 17:43:23 +03:00
|
|
|
bool operator==(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs);
|
|
|
|
|
|
|
|
bool operator!=(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs);
|
|
|
|
|
2020-12-08 17:29:25 +03:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const GroupCallParticipant &group_call_participant);
|
|
|
|
|
|
|
|
} // namespace td
|