Add GroupCallParticipant class.

This commit is contained in:
levlam 2020-12-08 17:29:25 +03:00
parent 593a2bfb3e
commit 901d603808
5 changed files with 96 additions and 0 deletions

View File

@ -320,6 +320,7 @@ set(TDLIB_SOURCE
td/telegram/Game.cpp
td/telegram/Global.cpp
td/telegram/GroupCallManager.cpp
td/telegram/GroupCallParticipant.cpp
td/telegram/HashtagHints.cpp
td/telegram/InlineQueriesManager.cpp
td/telegram/InputDialogId.cpp
@ -494,6 +495,7 @@ set(TDLIB_SOURCE
td/telegram/Game.h
td/telegram/Global.h
td/telegram/GroupCallManager.h
td/telegram/GroupCallParticipant.h
td/telegram/HashtagHints.h
td/telegram/InlineQueriesManager.h
td/telegram/InputDialogId.h

View File

@ -2087,6 +2087,11 @@ groupCallJoinResponseCandidate port:string protocol:string network:string genera
//@description Describes a join response for interaction with tgcalls @payload Join response payload to pass to tgcalls @candidates Join response candidates to pass to tgcalls
groupCallJoinResponse payload:groupCallPayload candidates:vector<groupCallJoinResponseCandidate> = GroupCallJoinResponse;
//@description Represents a group call participant @user_id Identifier of the user @source User's synchronization source
//@is_speaking True, if the user is speaking as set by setGroupCallMemberIsSpeaking @is_muted True, if the user is muted @can_self_unmute True, if the user can unmute themself
//@order User's order in the group call participant list. The bigger is order, the higher is user in the list
groupCallParticipant user_id:int32 source:int32 is_speaking:Bool is_muted:Bool can_self_unmute:Bool order:int64 = GroupCallParticipant;
//@class CallProblem @description Describes the exact type of a problem with a call

Binary file not shown.

View File

@ -0,0 +1,45 @@
//
// 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)
//
#include "td/telegram/GroupCallParticipant.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/Td.h"
#include "td/utils/common.h"
namespace td {
GroupCallParticipant::GroupCallParticipant(tl_object_ptr<telegram_api::groupCallParticipant> &&participant) {
CHECK(participant != nullptr);
user_id = UserId(participant->user_id_);
source = participant->source_;
is_muted = participant->muted_;
can_self_unmute = participant->can_self_unmute_;
if (!participant->left_) {
joined_date = participant->date_;
if ((participant->flags_ & telegram_api::groupCallParticipant::ACTIVE_DATE_MASK) != 0) {
active_date = participant->active_date_;
}
}
}
td_api::object_ptr<td_api::groupCallParticipant> GroupCallParticipant::get_group_call_participant_object(Td *td) const {
if (!is_valid()) {
return nullptr;
}
return td_api::make_object<td_api::groupCallParticipant>(
td->contacts_manager_->get_user_id_object(user_id, "get_group_call_participant_object"), source, is_speaking,
is_muted, can_self_unmute, order);
}
StringBuilder &operator<<(StringBuilder &string_builder, const GroupCallParticipant &group_call_participant) {
return string_builder << '[' << group_call_participant.user_id << " with source " << group_call_participant.source
<< " and order " << group_call_participant.order << ']';
}
} // namespace td

View File

@ -0,0 +1,44 @@
//
// 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 {
class Td;
struct GroupCallParticipant {
UserId user_id;
int32 source = 0;
bool is_muted = false;
bool can_self_unmute = false;
int32 joined_date = 0;
int32 active_date = 0;
bool is_speaking = false;
int64 order = 0;
bool is_valid() const {
return user_id.is_valid();
}
GroupCallParticipant() = default;
GroupCallParticipant(tl_object_ptr<telegram_api::groupCallParticipant> &&participant);
td_api::object_ptr<td_api::groupCallParticipant> get_group_call_participant_object(Td *td) const;
};
StringBuilder &operator<<(StringBuilder &string_builder, const GroupCallParticipant &group_call_participant);
} // namespace td