tdlight/td/telegram/GroupCallParticipant.h

103 lines
2.9 KiB
C
Raw Normal View History

2020-12-08 15:29:25 +01:00
//
2021-01-01 13:57:46 +01:00
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
2020-12-08 15:29:25 +01: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
#include "td/telegram/DialogId.h"
2021-03-15 16:32:28 +01:00
#include "td/telegram/GroupCallParticipantOrder.h"
2020-12-08 15:29:25 +01: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 {
class Td;
2020-12-08 15:29:25 +01:00
struct GroupCallParticipant {
DialogId dialog_id;
2021-03-05 13:27:52 +01:00
string about;
2021-01-11 13:02:02 +01:00
int32 audio_source = 0;
2020-12-08 15:29:25 +01:00
int32 joined_date = 0;
int32 active_date = 0;
2020-12-31 01:10:41 +01:00
int32 volume_level = 10000;
int64 raise_hand_rating = 0;
bool is_volume_level_local = false;
bool server_is_muted_by_themselves = false;
bool server_is_muted_by_admin = false;
bool server_is_muted_locally = false;
2021-03-05 10:39:57 +01:00
bool is_self = false;
2020-12-08 15:29:25 +01: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;
bool is_min = false;
bool is_fake = false;
2020-12-11 15:43:23 +01:00
bool is_just_joined = false;
2020-12-08 15:29:25 +01:00
bool is_speaking = false;
2020-12-11 15:43:23 +01:00
int32 local_active_date = 0;
2021-03-15 16:32:28 +01:00
GroupCallParticipantOrder order;
2020-12-08 15:29:25 +01:00
int32 pending_volume_level = 0;
uint64 pending_volume_level_generation = 0;
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;
bool have_pending_is_hand_raised = false;
bool pending_is_hand_raised = false;
uint64 pending_is_hand_raised_generation = 0;
static constexpr int32 MIN_VOLUME_LEVEL = 1;
static constexpr int32 MAX_VOLUME_LEVEL = 20000;
GroupCallParticipant() = default;
explicit GroupCallParticipant(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
static bool is_versioned_update(const tl_object_ptr<telegram_api::groupCallParticipant> &participant);
void update_from(const GroupCallParticipant &old_participant);
2021-03-05 10:39:57 +01:00
bool update_can_be_muted(bool can_manage, bool is_admin);
2021-03-05 10:39:57 +01:00
bool set_pending_is_muted(bool is_muted, bool can_manage, bool is_admin);
GroupCallParticipantOrder get_real_order(bool can_manage) const;
2020-12-11 15:43:23 +01:00
2020-12-08 15:29:25 +01:00
bool is_valid() const {
return dialog_id.is_valid();
2020-12-08 15:29:25 +01: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;
int32 get_volume_level() const;
bool get_is_hand_raised() const;
td_api::object_ptr<td_api::groupCallParticipant> get_group_call_participant_object(Td *td) const;
2020-12-08 15:29:25 +01:00
};
2020-12-11 15:43:23 +01:00
bool operator==(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs);
bool operator!=(const GroupCallParticipant &lhs, const GroupCallParticipant &rhs);
2020-12-08 15:29:25 +01:00
StringBuilder &operator<<(StringBuilder &string_builder, const GroupCallParticipant &group_call_participant);
} // namespace td