2020-11-26 13:47:20 +03:00
|
|
|
//
|
2023-01-01 00:28:08 +03:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2020-11-26 13:47:20 +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
|
|
|
|
|
2020-12-13 14:52:07 +03:00
|
|
|
#include "td/telegram/DialogId.h"
|
2021-01-25 17:26:04 +03:00
|
|
|
#include "td/telegram/DialogParticipant.h"
|
2020-12-03 19:52:50 +03:00
|
|
|
#include "td/telegram/GroupCallId.h"
|
2020-12-11 17:43:23 +03:00
|
|
|
#include "td/telegram/GroupCallParticipant.h"
|
2021-03-27 05:19:22 +03:00
|
|
|
#include "td/telegram/GroupCallParticipantOrder.h"
|
2020-11-26 13:47:20 +03:00
|
|
|
#include "td/telegram/InputGroupCallId.h"
|
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2020-11-27 15:22:19 +03:00
|
|
|
#include "td/telegram/UserId.h"
|
2020-11-26 13:47:20 +03:00
|
|
|
|
|
|
|
#include "td/actor/actor.h"
|
2022-07-02 23:32:18 +03:00
|
|
|
#include "td/actor/MultiTimeout.h"
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2020-12-22 15:51:57 +03:00
|
|
|
#include "td/utils/common.h"
|
2022-02-08 00:04:34 +03:00
|
|
|
#include "td/utils/FlatHashMap.h"
|
2022-06-27 13:30:18 +03:00
|
|
|
#include "td/utils/Promise.h"
|
2020-12-03 19:52:50 +03:00
|
|
|
#include "td/utils/Status.h"
|
|
|
|
|
2021-07-12 20:21:34 +03:00
|
|
|
#include <utility>
|
2020-11-26 13:47:20 +03:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
2021-07-04 05:58:54 +03:00
|
|
|
class GroupCallManager final : public Actor {
|
2020-11-26 13:47:20 +03:00
|
|
|
public:
|
|
|
|
GroupCallManager(Td *td, ActorShared<> parent);
|
2020-11-26 18:02:18 +03:00
|
|
|
GroupCallManager(const GroupCallManager &) = delete;
|
|
|
|
GroupCallManager &operator=(const GroupCallManager &) = delete;
|
|
|
|
GroupCallManager(GroupCallManager &&) = delete;
|
|
|
|
GroupCallManager &operator=(GroupCallManager &&) = delete;
|
2021-07-03 23:51:36 +03:00
|
|
|
~GroupCallManager() final;
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-03-07 01:06:51 +03:00
|
|
|
bool is_group_call_being_joined(InputGroupCallId input_group_call_id) const;
|
|
|
|
|
2021-03-07 02:21:08 +03:00
|
|
|
bool is_group_call_joined(InputGroupCallId input_group_call_id) const;
|
|
|
|
|
2020-12-13 14:52:07 +03:00
|
|
|
GroupCallId get_group_call_id(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
2020-12-03 19:52:50 +03:00
|
|
|
|
2021-03-08 20:25:56 +03:00
|
|
|
void get_group_call_join_as(DialogId dialog_id, Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
|
|
|
|
2021-04-07 16:25:29 +03:00
|
|
|
void set_group_call_default_join_as(DialogId dialog_id, DialogId as_dialog_id, Promise<Unit> &&promise);
|
|
|
|
|
2022-02-22 16:37:11 +03:00
|
|
|
void create_voice_chat(DialogId dialog_id, string title, int32 start_date, bool is_rtmp_stream,
|
|
|
|
Promise<GroupCallId> &&promise);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2022-02-25 17:58:03 +03:00
|
|
|
void get_voice_chat_rtmp_stream_url(DialogId dialog_id, bool revoke,
|
|
|
|
Promise<td_api::object_ptr<td_api::rtmpUrl>> &&promise);
|
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
void get_group_call(GroupCallId group_call_id, Promise<td_api::object_ptr<td_api::groupCall>> &&promise);
|
2020-12-03 02:00:46 +03:00
|
|
|
|
2020-12-17 18:27:01 +03:00
|
|
|
void on_update_group_call_rights(InputGroupCallId input_group_call_id);
|
|
|
|
|
2020-12-16 16:38:06 +03:00
|
|
|
void reload_group_call(InputGroupCallId input_group_call_id,
|
|
|
|
Promise<td_api::object_ptr<td_api::groupCall>> &&promise);
|
|
|
|
|
2022-02-22 17:42:58 +03:00
|
|
|
void get_group_call_streams(GroupCallId group_call_id,
|
|
|
|
Promise<td_api::object_ptr<td_api::groupCallStreams>> &&promise);
|
|
|
|
|
2021-08-23 16:59:00 +03:00
|
|
|
void get_group_call_stream_segment(GroupCallId group_call_id, int64 time_offset, int32 scale, int32 channel_id,
|
|
|
|
td_api::object_ptr<td_api::GroupCallVideoQuality> quality,
|
2021-03-10 22:50:14 +03:00
|
|
|
Promise<string> &&promise);
|
|
|
|
|
2021-04-07 02:11:14 +03:00
|
|
|
void start_scheduled_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
|
|
|
|
|
2021-04-30 19:53:39 +03:00
|
|
|
void join_group_call(GroupCallId group_call_id, DialogId as_dialog_id, int32 audio_source, string &&payload,
|
2021-05-02 02:40:22 +03:00
|
|
|
bool is_muted, bool is_my_video_enabled, const string &invite_hash, Promise<string> &&promise);
|
2020-11-26 14:32:29 +03:00
|
|
|
|
2021-07-06 02:33:42 +03:00
|
|
|
void start_group_call_screen_sharing(GroupCallId group_call_id, int32 audio_source, string &&payload,
|
|
|
|
Promise<string> &&promise);
|
2021-04-30 19:53:39 +03:00
|
|
|
|
2021-04-30 20:21:07 +03:00
|
|
|
void end_group_call_screen_sharing(GroupCallId group_call_id, Promise<Unit> &&promise);
|
|
|
|
|
2021-03-02 19:44:57 +03:00
|
|
|
void set_group_call_title(GroupCallId group_call_id, string title, Promise<Unit> &&promise);
|
|
|
|
|
2021-06-01 20:11:18 +03:00
|
|
|
void toggle_group_call_is_my_video_paused(GroupCallId group_call_id, bool is_my_video_paused,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2021-05-02 02:40:22 +03:00
|
|
|
void toggle_group_call_is_my_video_enabled(GroupCallId group_call_id, bool is_my_video_enabled,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2021-06-02 00:38:08 +03:00
|
|
|
void toggle_group_call_is_my_presentation_paused(GroupCallId group_call_id, bool is_my_presentation_paused,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2021-04-07 03:04:56 +03:00
|
|
|
void toggle_group_call_start_subscribed(GroupCallId group_call_id, bool start_subscribed, Promise<Unit> &&promise);
|
|
|
|
|
2020-12-08 17:51:37 +03:00
|
|
|
void toggle_group_call_mute_new_participants(GroupCallId group_call_id, bool mute_new_participants,
|
|
|
|
Promise<Unit> &&promise);
|
2020-11-27 01:58:36 +03:00
|
|
|
|
2021-03-12 19:31:52 +03:00
|
|
|
void revoke_group_call_invite_link(GroupCallId group_call_id, Promise<Unit> &&promise);
|
2021-03-12 18:58:43 +03:00
|
|
|
|
2020-12-08 17:51:37 +03:00
|
|
|
void invite_group_call_participants(GroupCallId group_call_id, vector<UserId> &&user_ids, Promise<Unit> &&promise);
|
2020-11-27 15:22:19 +03:00
|
|
|
|
2021-03-12 19:29:06 +03:00
|
|
|
void get_group_call_invite_link(GroupCallId group_call_id, bool can_self_unmute, Promise<string> &&promise);
|
|
|
|
|
2021-08-23 15:29:03 +03:00
|
|
|
void toggle_group_call_recording(GroupCallId group_call_id, bool is_enabled, string title, bool record_video,
|
|
|
|
bool use_portrait_orientation, Promise<Unit> &&promise);
|
2021-03-11 22:19:19 +03:00
|
|
|
|
2021-01-11 15:02:02 +03:00
|
|
|
void set_group_call_participant_is_speaking(GroupCallId group_call_id, int32 audio_source, bool is_speaking,
|
2020-12-12 15:31:56 +03:00
|
|
|
Promise<Unit> &&promise, int32 date = 0);
|
2020-12-04 17:06:37 +03:00
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
void toggle_group_call_participant_is_muted(GroupCallId group_call_id, DialogId dialog_id, bool is_muted,
|
2020-12-08 17:51:37 +03:00
|
|
|
Promise<Unit> &&promise);
|
2020-11-27 17:40:29 +03:00
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
void set_group_call_participant_volume_level(GroupCallId group_call_id, DialogId dialog_id, int32 volume_level,
|
2021-01-02 22:59:48 +03:00
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2021-03-15 01:56:59 +03:00
|
|
|
void toggle_group_call_participant_is_hand_raised(GroupCallId group_call_id, DialogId dialog_id, bool is_hand_raised,
|
|
|
|
Promise<Unit> &&promise);
|
|
|
|
|
2020-12-11 19:39:27 +03:00
|
|
|
void load_group_call_participants(GroupCallId group_call_id, int32 limit, Promise<Unit> &&promise);
|
|
|
|
|
2020-12-04 01:56:27 +03:00
|
|
|
void leave_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
void discard_group_call(GroupCallId group_call_id, Promise<Unit> &&promise);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-03-07 13:06:34 +03:00
|
|
|
void on_update_dialog_about(DialogId dialog_id, const string &about, bool from_server);
|
|
|
|
|
2021-04-30 19:53:39 +03:00
|
|
|
void on_update_group_call_connection(string &&connection_params);
|
2021-04-30 17:07:01 +03:00
|
|
|
|
2020-12-13 14:52:07 +03:00
|
|
|
void on_update_group_call(tl_object_ptr<telegram_api::GroupCall> group_call_ptr, DialogId dialog_id);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2023-04-12 11:24:06 +03:00
|
|
|
void on_user_speaking_in_group_call(GroupCallId group_call_id, DialogId dialog_id, bool is_muted_by_admin, int32 date,
|
2021-03-18 22:36:59 +03:00
|
|
|
bool is_recursive = false);
|
2020-12-07 00:38:23 +03:00
|
|
|
|
|
|
|
void on_get_group_call_participants(InputGroupCallId input_group_call_id,
|
2020-12-11 19:39:27 +03:00
|
|
|
tl_object_ptr<telegram_api::phone_groupParticipants> &&participants, bool is_load,
|
|
|
|
const string &offset);
|
2020-12-06 10:40:26 +03:00
|
|
|
|
2020-12-11 18:12:07 +03:00
|
|
|
void on_update_group_call_participants(InputGroupCallId input_group_call_id,
|
|
|
|
vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
2021-03-18 22:36:59 +03:00
|
|
|
int32 version, bool is_recursive = false);
|
2020-12-11 18:12:07 +03:00
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
void process_join_group_call_response(InputGroupCallId input_group_call_id, uint64 generation,
|
2020-11-26 14:32:29 +03:00
|
|
|
tl_object_ptr<telegram_api::Updates> &&updates, Promise<Unit> &&promise);
|
|
|
|
|
2021-04-30 19:53:39 +03:00
|
|
|
void process_join_group_call_presentation_response(InputGroupCallId input_group_call_id, uint64 generation,
|
|
|
|
tl_object_ptr<telegram_api::Updates> &&updates, Status status);
|
|
|
|
|
2020-11-26 13:47:20 +03:00
|
|
|
private:
|
|
|
|
struct GroupCall;
|
2020-12-11 17:43:23 +03:00
|
|
|
struct GroupCallParticipants;
|
2020-12-06 10:40:26 +03:00
|
|
|
struct GroupCallRecentSpeakers;
|
2020-11-26 17:33:28 +03:00
|
|
|
struct PendingJoinRequest;
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-01-05 22:46:35 +03:00
|
|
|
static constexpr int32 RECENT_SPEAKER_TIMEOUT = 60 * 60;
|
2021-03-15 22:04:11 +03:00
|
|
|
static constexpr int32 UPDATE_GROUP_CALL_PARTICIPANT_ORDER_TIMEOUT = 10;
|
2020-12-28 00:30:27 +03:00
|
|
|
static constexpr int32 CHECK_GROUP_CALL_IS_JOINED_TIMEOUT = 10;
|
2021-03-16 17:20:53 +03:00
|
|
|
static constexpr size_t MAX_TITLE_LENGTH = 64; // server side limit for group call/call record title length
|
2020-12-06 21:18:12 +03:00
|
|
|
|
2021-07-03 23:51:36 +03:00
|
|
|
void tear_down() final;
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-03-15 22:04:11 +03:00
|
|
|
static void on_update_group_call_participant_order_timeout_callback(void *group_call_manager_ptr,
|
|
|
|
int64 group_call_id_int);
|
|
|
|
|
|
|
|
void on_update_group_call_participant_order_timeout(GroupCallId group_call_id);
|
|
|
|
|
2020-12-28 00:30:27 +03:00
|
|
|
static void on_check_group_call_is_joined_timeout_callback(void *group_call_manager_ptr, int64 group_call_id_int);
|
|
|
|
|
|
|
|
void on_check_group_call_is_joined_timeout(GroupCallId group_call_id);
|
|
|
|
|
2020-12-04 17:06:37 +03:00
|
|
|
static void on_pending_send_speaking_action_timeout_callback(void *group_call_manager_ptr, int64 group_call_id_int);
|
|
|
|
|
|
|
|
void on_send_speaking_action_timeout(GroupCallId group_call_id);
|
|
|
|
|
2020-12-06 20:07:23 +03:00
|
|
|
static void on_recent_speaker_update_timeout_callback(void *group_call_manager_ptr, int64 group_call_id_int);
|
|
|
|
|
|
|
|
void on_recent_speaker_update_timeout(GroupCallId group_call_id);
|
|
|
|
|
2020-12-12 14:10:37 +03:00
|
|
|
static void on_sync_participants_timeout_callback(void *group_call_manager_ptr, int64 group_call_id_int);
|
|
|
|
|
|
|
|
void on_sync_participants_timeout(GroupCallId group_call_id);
|
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
Result<InputGroupCallId> get_input_group_call_id(GroupCallId group_call_id);
|
|
|
|
|
|
|
|
GroupCallId get_next_group_call_id(InputGroupCallId input_group_call_id);
|
|
|
|
|
2020-12-13 14:52:07 +03:00
|
|
|
GroupCall *add_group_call(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
2020-12-03 02:00:46 +03:00
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
const GroupCall *get_group_call(InputGroupCallId input_group_call_id) const;
|
|
|
|
GroupCall *get_group_call(InputGroupCallId input_group_call_id);
|
2020-12-03 02:00:46 +03:00
|
|
|
|
2023-03-22 15:36:45 +03:00
|
|
|
Status can_join_group_calls(DialogId dialog_id) const;
|
|
|
|
|
2020-12-17 02:07:05 +03:00
|
|
|
Status can_manage_group_calls(DialogId dialog_id) const;
|
|
|
|
|
|
|
|
bool can_manage_group_call(InputGroupCallId input_group_call_id) const;
|
2020-12-15 18:20:44 +03:00
|
|
|
|
2021-04-06 01:48:41 +03:00
|
|
|
bool get_group_call_can_self_unmute(InputGroupCallId input_group_call_id) const;
|
|
|
|
|
2021-03-18 02:36:31 +03:00
|
|
|
bool get_group_call_joined_date_asc(InputGroupCallId input_group_call_id) const;
|
|
|
|
|
2020-12-13 15:18:33 +03:00
|
|
|
void on_voice_chat_created(DialogId dialog_id, InputGroupCallId input_group_call_id, Promise<GroupCallId> &&promise);
|
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
void finish_get_group_call(InputGroupCallId input_group_call_id,
|
2020-12-03 02:00:46 +03:00
|
|
|
Result<tl_object_ptr<telegram_api::phone_groupCall>> &&result);
|
|
|
|
|
2022-03-01 03:12:56 +03:00
|
|
|
void finish_get_group_call_streams(InputGroupCallId input_group_call_id, int32 audio_source,
|
|
|
|
Result<td_api::object_ptr<td_api::groupCallStreams>> &&result,
|
|
|
|
Promise<td_api::object_ptr<td_api::groupCallStreams>> &&promise);
|
|
|
|
|
2021-03-17 14:30:51 +03:00
|
|
|
void finish_get_group_call_stream_segment(InputGroupCallId input_group_call_id, int32 audio_source,
|
|
|
|
Result<string> &&result, Promise<string> &&promise);
|
2021-03-17 03:16:34 +03:00
|
|
|
|
2021-01-11 15:02:02 +03:00
|
|
|
void finish_check_group_call_is_joined(InputGroupCallId input_group_call_id, int32 audio_source,
|
|
|
|
Result<Unit> &&result);
|
2020-12-28 00:30:27 +03:00
|
|
|
|
2021-03-02 19:44:57 +03:00
|
|
|
static const string &get_group_call_title(const GroupCall *group_call);
|
|
|
|
|
2021-04-07 03:04:56 +03:00
|
|
|
static bool get_group_call_start_subscribed(const GroupCall *group_call);
|
|
|
|
|
2021-06-01 20:11:18 +03:00
|
|
|
static bool get_group_call_is_my_video_paused(const GroupCall *group_call);
|
|
|
|
|
2021-05-02 02:40:22 +03:00
|
|
|
static bool get_group_call_is_my_video_enabled(const GroupCall *group_call);
|
|
|
|
|
2021-06-02 00:38:08 +03:00
|
|
|
static bool get_group_call_is_my_presentation_paused(const GroupCall *group_call);
|
|
|
|
|
2021-02-15 18:12:50 +03:00
|
|
|
static bool get_group_call_mute_new_participants(const GroupCall *group_call);
|
|
|
|
|
2021-03-11 22:19:19 +03:00
|
|
|
static int32 get_group_call_record_start_date(const GroupCall *group_call);
|
|
|
|
|
2021-08-24 17:49:08 +03:00
|
|
|
static bool get_group_call_is_video_recorded(const GroupCall *group_call);
|
|
|
|
|
2021-03-11 22:19:19 +03:00
|
|
|
static bool get_group_call_has_recording(const GroupCall *group_call);
|
|
|
|
|
2021-07-08 19:59:16 +03:00
|
|
|
static bool get_group_call_can_enable_video(const GroupCall *group_call);
|
|
|
|
|
2020-12-11 17:43:23 +03:00
|
|
|
bool need_group_call_participants(InputGroupCallId input_group_call_id) const;
|
|
|
|
|
2021-01-30 23:52:16 +03:00
|
|
|
bool need_group_call_participants(InputGroupCallId input_group_call_id, const GroupCall *group_call) const;
|
|
|
|
|
2020-12-12 15:00:37 +03:00
|
|
|
bool process_pending_group_call_participant_updates(InputGroupCallId input_group_call_id);
|
2020-12-12 14:10:37 +03:00
|
|
|
|
2023-04-13 17:06:02 +03:00
|
|
|
bool is_my_audio_source(InputGroupCallId input_group_call_id, const GroupCall *group_call, int32 audio_source);
|
|
|
|
|
2020-12-12 14:10:37 +03:00
|
|
|
void sync_group_call_participants(InputGroupCallId input_group_call_id);
|
|
|
|
|
2021-07-09 18:36:35 +03:00
|
|
|
void on_sync_group_call_participants(InputGroupCallId input_group_call_id,
|
|
|
|
Result<tl_object_ptr<telegram_api::phone_groupCall>> &&result);
|
2020-12-15 12:41:26 +03:00
|
|
|
|
2021-10-19 18:11:16 +03:00
|
|
|
static GroupCallParticipantOrder get_real_participant_order(bool can_self_unmute,
|
|
|
|
const GroupCallParticipant &participant,
|
|
|
|
const GroupCallParticipants *participants);
|
2021-02-03 18:58:06 +03:00
|
|
|
|
2021-03-18 22:03:14 +03:00
|
|
|
void process_my_group_call_participant(InputGroupCallId input_group_call_id, GroupCallParticipant &&participant);
|
|
|
|
|
2020-12-11 17:43:23 +03:00
|
|
|
void process_group_call_participants(InputGroupCallId group_call_id,
|
2020-12-11 23:31:46 +03:00
|
|
|
vector<tl_object_ptr<telegram_api::groupCallParticipant>> &&participants,
|
2021-03-19 02:44:20 +03:00
|
|
|
int32 version, const string &offset, bool is_load, bool is_sync);
|
2020-12-11 23:03:50 +03:00
|
|
|
|
2021-10-19 18:11:16 +03:00
|
|
|
static bool update_group_call_participant_can_be_muted(bool can_manage, const GroupCallParticipants *participants,
|
|
|
|
GroupCallParticipant &participant);
|
2020-12-17 02:07:05 +03:00
|
|
|
|
|
|
|
void update_group_call_participants_can_be_muted(InputGroupCallId input_group_call_id, bool can_manage,
|
|
|
|
GroupCallParticipants *participants);
|
|
|
|
|
2021-06-06 03:21:34 +03:00
|
|
|
void update_group_call_participants_order(InputGroupCallId input_group_call_id, bool can_self_unmute,
|
|
|
|
GroupCallParticipants *participants, const char *source);
|
|
|
|
|
2021-07-12 20:21:34 +03:00
|
|
|
// returns participant_count_diff and video_participant_count_diff
|
|
|
|
std::pair<int32, int32> process_group_call_participant(InputGroupCallId group_call_id,
|
|
|
|
GroupCallParticipant &&participant);
|
2020-12-07 00:38:23 +03:00
|
|
|
|
2021-03-07 13:06:34 +03:00
|
|
|
void on_add_group_call_participant(InputGroupCallId input_group_call_id, DialogId participant_dialog_id);
|
|
|
|
|
|
|
|
void on_remove_group_call_participant(InputGroupCallId input_group_call_id, DialogId participant_dialog_id);
|
|
|
|
|
2020-12-16 20:30:52 +03:00
|
|
|
void try_load_group_call_administrators(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
|
|
|
|
2021-01-25 17:26:04 +03:00
|
|
|
void finish_load_group_call_administrators(InputGroupCallId input_group_call_id, Result<DialogParticipants> &&result);
|
2020-12-16 20:30:52 +03:00
|
|
|
|
2021-02-10 19:27:30 +03:00
|
|
|
int32 cancel_join_group_call_request(InputGroupCallId input_group_call_id);
|
2021-02-10 18:09:42 +03:00
|
|
|
|
2021-04-30 19:53:39 +03:00
|
|
|
int32 cancel_join_group_call_presentation_request(InputGroupCallId input_group_call_id);
|
|
|
|
|
2020-12-06 14:33:15 +03:00
|
|
|
bool on_join_group_call_response(InputGroupCallId input_group_call_id, string json_response);
|
2020-11-26 14:32:29 +03:00
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
void finish_join_group_call(InputGroupCallId input_group_call_id, uint64 generation, Status error);
|
2020-11-26 14:32:29 +03:00
|
|
|
|
2021-03-15 02:03:52 +03:00
|
|
|
void process_group_call_after_join_requests(InputGroupCallId input_group_call_id, const char *source);
|
2021-02-16 13:08:58 +03:00
|
|
|
|
2020-12-16 20:30:52 +03:00
|
|
|
GroupCallParticipants *add_group_call_participants(InputGroupCallId input_group_call_id);
|
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
GroupCallParticipant *get_group_call_participant(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
2021-02-15 18:18:34 +03:00
|
|
|
|
2021-03-15 02:15:01 +03:00
|
|
|
GroupCallParticipant *get_group_call_participant(GroupCallParticipants *group_call_participants,
|
|
|
|
DialogId dialog_id) const;
|
2021-02-02 00:40:40 +03:00
|
|
|
|
2021-03-02 19:44:57 +03:00
|
|
|
void send_edit_group_call_title_query(InputGroupCallId input_group_call_id, const string &title);
|
|
|
|
|
|
|
|
void on_edit_group_call_title(InputGroupCallId input_group_call_id, const string &title, Result<Unit> &&result);
|
|
|
|
|
2021-04-07 03:04:56 +03:00
|
|
|
void send_toggle_group_call_start_subscription_query(InputGroupCallId input_group_call_id, bool start_subscribed);
|
|
|
|
|
|
|
|
void on_toggle_group_call_start_subscription(InputGroupCallId input_group_call_id, bool start_subscribed,
|
|
|
|
Result<Unit> &&result);
|
|
|
|
|
2021-06-01 20:11:18 +03:00
|
|
|
void send_toggle_group_call_is_my_video_paused_query(InputGroupCallId input_group_call_id, DialogId as_dialog_id,
|
|
|
|
bool is_my_video_paused);
|
|
|
|
|
|
|
|
void on_toggle_group_call_is_my_video_paused(InputGroupCallId input_group_call_id, bool is_my_video_paused,
|
|
|
|
Result<Unit> &&result);
|
|
|
|
|
2021-05-02 02:40:22 +03:00
|
|
|
void send_toggle_group_call_is_my_video_enabled_query(InputGroupCallId input_group_call_id, DialogId as_dialog_id,
|
|
|
|
bool is_my_video_enabled);
|
|
|
|
|
|
|
|
void on_toggle_group_call_is_my_video_enabled(InputGroupCallId input_group_call_id, bool is_my_video_enabled,
|
|
|
|
Result<Unit> &&result);
|
|
|
|
|
2021-06-02 00:38:08 +03:00
|
|
|
void send_toggle_group_call_is_my_presentation_paused_query(InputGroupCallId input_group_call_id,
|
|
|
|
DialogId as_dialog_id, bool is_my_presentation_paused);
|
|
|
|
|
|
|
|
void on_toggle_group_call_is_my_presentation_paused(InputGroupCallId input_group_call_id,
|
|
|
|
bool is_my_presentation_paused, Result<Unit> &&result);
|
|
|
|
|
2021-02-15 18:12:50 +03:00
|
|
|
void send_toggle_group_call_mute_new_participants_query(InputGroupCallId input_group_call_id,
|
|
|
|
bool mute_new_participants);
|
|
|
|
|
|
|
|
void on_toggle_group_call_mute_new_participants(InputGroupCallId input_group_call_id, bool mute_new_participants,
|
|
|
|
Result<Unit> &&result);
|
|
|
|
|
2021-03-11 22:19:19 +03:00
|
|
|
void send_toggle_group_call_recording_query(InputGroupCallId input_group_call_id, bool is_enabled,
|
2021-08-23 15:29:03 +03:00
|
|
|
const string &title, bool record_video, bool use_portrait_orientation,
|
|
|
|
uint64 generation);
|
2021-03-11 22:19:19 +03:00
|
|
|
|
|
|
|
void on_toggle_group_call_recording(InputGroupCallId input_group_call_id, uint64 generation, Result<Unit> &&result);
|
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
void on_toggle_group_call_participant_is_muted(InputGroupCallId input_group_call_id, DialogId dialog_id,
|
2021-02-12 15:41:20 +03:00
|
|
|
uint64 generation, Promise<Unit> &&promise);
|
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
void on_set_group_call_participant_volume_level(InputGroupCallId input_group_call_id, DialogId dialog_id,
|
2021-02-02 00:40:40 +03:00
|
|
|
uint64 generation, Promise<Unit> &&promise);
|
2021-02-01 02:43:23 +03:00
|
|
|
|
2021-03-15 01:56:59 +03:00
|
|
|
void on_toggle_group_call_participant_is_hand_raised(InputGroupCallId input_group_call_id, DialogId dialog_id,
|
|
|
|
uint64 generation, Promise<Unit> &&promise);
|
|
|
|
|
2021-01-11 15:02:02 +03:00
|
|
|
void on_group_call_left(InputGroupCallId input_group_call_id, int32 audio_source, bool need_rejoin);
|
2020-12-04 01:56:27 +03:00
|
|
|
|
2021-04-05 00:33:21 +03:00
|
|
|
void on_group_call_left_impl(GroupCall *group_call, bool need_rejoin, const char *source);
|
2020-12-15 17:06:11 +03:00
|
|
|
|
2020-12-13 14:52:07 +03:00
|
|
|
InputGroupCallId update_group_call(const tl_object_ptr<telegram_api::GroupCall> &group_call_ptr, DialogId dialog_id);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-02-02 01:23:12 +03:00
|
|
|
void on_receive_group_call_version(InputGroupCallId input_group_call_id, int32 version, bool immediate_sync = false);
|
2020-12-11 18:12:07 +03:00
|
|
|
|
2020-12-15 14:54:47 +03:00
|
|
|
void on_participant_speaking_in_group_call(InputGroupCallId input_group_call_id,
|
|
|
|
const GroupCallParticipant &participant);
|
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
void remove_recent_group_call_speaker(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
2020-12-15 14:04:06 +03:00
|
|
|
|
2020-12-06 20:07:23 +03:00
|
|
|
void on_group_call_recent_speakers_updated(const GroupCall *group_call, GroupCallRecentSpeakers *recent_speakers);
|
2020-12-06 10:40:26 +03:00
|
|
|
|
2021-03-05 14:40:54 +03:00
|
|
|
DialogId set_group_call_participant_is_speaking_by_source(InputGroupCallId input_group_call_id, int32 audio_source,
|
|
|
|
bool is_speaking, int32 date);
|
2020-12-07 02:56:13 +03:00
|
|
|
|
2021-04-09 18:50:07 +03:00
|
|
|
bool try_clear_group_call_participants(InputGroupCallId input_group_call_id);
|
2020-12-11 17:43:23 +03:00
|
|
|
|
2021-03-19 04:02:53 +03:00
|
|
|
bool set_group_call_participant_count(GroupCall *group_call, int32 count, const char *source,
|
2021-03-19 03:30:39 +03:00
|
|
|
bool force_update = false);
|
2021-03-19 00:18:55 +03:00
|
|
|
|
2021-07-12 20:21:34 +03:00
|
|
|
bool set_group_call_unmuted_video_count(GroupCall *group_call, int32 count, const char *source);
|
|
|
|
|
2021-03-19 03:30:39 +03:00
|
|
|
void update_group_call_dialog(const GroupCall *group_call, const char *source, bool force);
|
2020-12-15 19:20:03 +03:00
|
|
|
|
2020-12-28 14:19:29 +03:00
|
|
|
vector<td_api::object_ptr<td_api::groupCallRecentSpeaker>> get_recent_speakers(const GroupCall *group_call,
|
|
|
|
bool for_update);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-10-19 18:11:16 +03:00
|
|
|
static tl_object_ptr<td_api::updateGroupCall> get_update_group_call_object(
|
|
|
|
const GroupCall *group_call, vector<td_api::object_ptr<td_api::groupCallRecentSpeaker>> recent_speakers);
|
2020-11-26 13:47:20 +03:00
|
|
|
|
2021-10-19 18:11:16 +03:00
|
|
|
static tl_object_ptr<td_api::groupCall> get_group_call_object(
|
|
|
|
const GroupCall *group_call, vector<td_api::object_ptr<td_api::groupCallRecentSpeaker>> recent_speakers);
|
2020-12-06 21:41:56 +03:00
|
|
|
|
2020-12-11 17:43:23 +03:00
|
|
|
tl_object_ptr<td_api::updateGroupCallParticipant> get_update_group_call_participant_object(
|
|
|
|
GroupCallId group_call_id, const GroupCallParticipant &participant);
|
|
|
|
|
2020-12-15 16:18:43 +03:00
|
|
|
void send_update_group_call(const GroupCall *group_call, const char *source);
|
2020-12-06 21:22:55 +03:00
|
|
|
|
2021-04-05 22:39:38 +03:00
|
|
|
void send_update_group_call_participant(GroupCallId group_call_id, const GroupCallParticipant &participant,
|
|
|
|
const char *source);
|
2020-12-11 17:43:23 +03:00
|
|
|
|
2021-04-05 22:39:38 +03:00
|
|
|
void send_update_group_call_participant(InputGroupCallId input_group_call_id, const GroupCallParticipant &participant,
|
|
|
|
const char *source);
|
2020-12-11 17:43:23 +03:00
|
|
|
|
2020-11-26 13:47:20 +03:00
|
|
|
Td *td_;
|
|
|
|
ActorShared<> parent_;
|
|
|
|
|
2020-12-03 19:52:50 +03:00
|
|
|
GroupCallId max_group_call_id_;
|
|
|
|
|
|
|
|
vector<InputGroupCallId> input_group_call_ids_;
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<InputGroupCallId, unique_ptr<GroupCall>, InputGroupCallIdHash> group_calls_;
|
2020-11-26 14:32:29 +03:00
|
|
|
|
2021-04-30 19:53:39 +03:00
|
|
|
string pending_group_call_join_params_;
|
2021-04-30 17:07:01 +03:00
|
|
|
|
2022-02-08 00:04:34 +03:00
|
|
|
FlatHashMap<InputGroupCallId, unique_ptr<GroupCallParticipants>, InputGroupCallIdHash> group_call_participants_;
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<DialogId, vector<InputGroupCallId>, DialogIdHash> participant_id_to_group_call_id_;
|
2020-12-11 17:43:23 +03:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<GroupCallId, unique_ptr<GroupCallRecentSpeakers>, GroupCallIdHash> group_call_recent_speakers_;
|
2020-12-06 10:40:26 +03:00
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<InputGroupCallId, vector<Promise<td_api::object_ptr<td_api::groupCall>>>, InputGroupCallIdHash>
|
2020-12-03 02:00:46 +03:00
|
|
|
load_group_call_queries_;
|
|
|
|
|
2022-02-07 20:41:07 +01:00
|
|
|
FlatHashMap<InputGroupCallId, unique_ptr<PendingJoinRequest>, InputGroupCallIdHash> pending_join_requests_;
|
|
|
|
FlatHashMap<InputGroupCallId, unique_ptr<PendingJoinRequest>, InputGroupCallIdHash>
|
2021-04-30 19:53:39 +03:00
|
|
|
pending_join_presentation_requests_;
|
2020-11-26 14:32:29 +03:00
|
|
|
uint64 join_group_request_generation_ = 0;
|
2020-12-04 17:06:37 +03:00
|
|
|
|
2021-03-11 22:19:19 +03:00
|
|
|
uint64 toggle_recording_generation_ = 0;
|
|
|
|
|
2021-03-15 01:56:59 +03:00
|
|
|
uint64 toggle_is_muted_generation_ = 0;
|
|
|
|
|
2021-02-02 00:40:40 +03:00
|
|
|
uint64 set_volume_level_generation_ = 0;
|
|
|
|
|
2021-03-15 01:56:59 +03:00
|
|
|
uint64 toggle_is_hand_raised_generation_ = 0;
|
2021-02-12 15:41:20 +03:00
|
|
|
|
2021-03-15 22:04:11 +03:00
|
|
|
MultiTimeout update_group_call_participant_order_timeout_{"UpdateGroupCallParticipantOrderTimeout"};
|
2020-12-28 00:30:27 +03:00
|
|
|
MultiTimeout check_group_call_is_joined_timeout_{"CheckGroupCallIsJoinedTimeout"};
|
2020-12-04 17:06:37 +03:00
|
|
|
MultiTimeout pending_send_speaking_action_timeout_{"PendingSendSpeakingActionTimeout"};
|
2020-12-06 21:41:56 +03:00
|
|
|
MultiTimeout recent_speaker_update_timeout_{"RecentSpeakerUpdateTimeout"};
|
2020-12-12 14:10:37 +03:00
|
|
|
MultiTimeout sync_participants_timeout_{"SyncParticipantsTimeout"};
|
2020-11-26 13:47:20 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace td
|