Add mute_new_members and allowed_change_mute_new_members flags to group call.

This commit is contained in:
levlam 2020-11-27 01:40:48 +03:00
parent 86573be3ad
commit 54cfb02698
3 changed files with 23 additions and 4 deletions

View File

@ -2059,8 +2059,14 @@ callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_informat
callStateError error:error = CallState;
//@description Describes a group call @id Group call identifier @is_active True, if the call is active @member_count Number of members in the group call @duration Call duration; for ended calls only
groupCall id:string is_active:Bool member_count:int32 duration:int32 = GroupCall;
//@description Describes a group call
//@id Group call identifier
//@is_active True, if the call is active
//@member_count Number of members in the group call
//@mute_new_members True, if only group call administrators can unmute new members
//@allowed_change_mute_new_members True, if group call administrators can enable or disable mute_new_members setting
//@duration Call duration; for ended calls only
groupCall id:string is_active:Bool member_count:int32 mute_new_members:Bool allowed_change_mute_new_members:Bool duration:int32 = GroupCall;
//@description Describes a payload fingerprint for interaction with tgcalls @hash Value of the field hash @setup Value of the field setup @fingerprint Value of the field fingerprint
groupCallPayloadFingerprint hash:string setup:string fingerprint:string = GroupCallPayloadFingerprint;

Binary file not shown.

View File

@ -167,6 +167,8 @@ class DiscardGroupCallQuery : public Td::ResultHandler {
struct GroupCallManager::GroupCall {
bool is_active = false;
bool mute_new_members = false;
bool allowed_change_mute_new_members = false;
int32 member_count = 0;
int32 version = -1;
int32 duration = 0;
@ -393,6 +395,8 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
auto group_call = static_cast<const telegram_api::groupCall *>(group_call_ptr.get());
call_id = InputGroupCallId(group_call->id_, group_call->access_hash_);
call.is_active = true;
call.mute_new_members = group_call->join_muted_;
call.allowed_change_mute_new_members = group_call->can_change_join_muted_;
call.member_count = group_call->participants_count_;
call.version = group_call->version_;
if (group_call->params_ != nullptr) {
@ -427,9 +431,17 @@ InputGroupCallId GroupCallManager::update_group_call(const tl_object_ptr<telegra
*group_call = std::move(call);
need_update = true;
} else {
auto mute_flags_changed = call.mute_new_members != group_call->mute_new_members ||
call.allowed_change_mute_new_members != group_call->allowed_change_mute_new_members;
if (call.version > group_call->version) {
need_update = call.member_count != group_call->member_count;
need_update = call.member_count != group_call->member_count || mute_flags_changed;
*group_call = std::move(call);
} else if (call.version == group_call->version) {
if (mute_flags_changed) {
group_call->mute_new_members = call.mute_new_members;
group_call->allowed_change_mute_new_members = call.allowed_change_mute_new_members;
need_update = true;
}
}
}
}
@ -445,7 +457,8 @@ tl_object_ptr<td_api::groupCall> GroupCallManager::get_group_call_object(InputGr
const GroupCall *group_call) {
CHECK(group_call != nullptr);
return td_api::make_object<td_api::groupCall>(group_call_id.get_group_call_id(), group_call->is_active,
group_call->member_count, group_call->duration);
group_call->member_count, group_call->mute_new_members,
group_call->allowed_change_mute_new_members, group_call->duration);
}
tl_object_ptr<td_api::updateGroupCall> GroupCallManager::get_update_group_call_object(InputGroupCallId group_call_id,