tdlight/td/telegram/GroupCallParticipant.h

63 lines
1.7 KiB
C
Raw Normal View History

2020-12-08 15:29:25 +01:00
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2020
//
// 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/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UserId.h"
#include "td/utils/common.h"
#include "td/utils/StringBuilder.h"
namespace td {
2020-12-11 15:43:23 +01:00
class ContactsManager;
2020-12-08 15:29:25 +01:00
struct GroupCallParticipant {
UserId user_id;
int32 source = 0;
int32 joined_date = 0;
int32 active_date = 0;
bool is_muted = false;
bool can_self_unmute = false;
2020-12-08 15:29:25 +01:00
bool can_be_muted = false;
bool can_be_unmuted = 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;
2020-12-08 15:29:25 +01:00
int64 order = 0;
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);
bool update_can_be_muted(bool can_manage, bool is_self, bool is_admin);
2020-12-11 15:43:23 +01:00
int64 get_real_order() const {
return (static_cast<int64>(max(active_date, local_active_date)) << 32) + joined_date;
}
2020-12-08 15:29:25 +01:00
bool is_valid() const {
return user_id.is_valid();
}
2020-12-11 15:43:23 +01:00
td_api::object_ptr<td_api::groupCallParticipant> get_group_call_participant_object(
ContactsManager *contacts_manager) 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