Add related to voice chats chat log event actions.

This commit is contained in:
levlam 2020-12-08 20:02:12 +03:00
parent 707f83e755
commit 07735c27e8
3 changed files with 53 additions and 6 deletions

View File

@ -2376,6 +2376,18 @@ chatEventLocationChanged old_location:chatLocation new_location:chatLocation = C
//@description The is_all_history_available setting of a supergroup was toggled @is_all_history_available New value of is_all_history_available
chatEventIsAllHistoryAvailableToggled is_all_history_available:Bool = ChatEventAction;
//@description A voice chat was created @group_call_id Group call identifier
chatEventVoiceChatCreated group_call_id:int32 = ChatEventAction;
//@description A voice chat was discarded @group_call_id Group call identifier
chatEventVoiceChatDiscarded group_call_id:int32 = ChatEventAction;
//@description A voice chat participant was muted or unmuted @user_id Voice chat participant user identifier @is_muted New value of is_muted
chatEventVoiceChatParticipantIsMutedToggled user_id:int32 is_muted:Bool = ChatEventAction;
//@description The mute_new_participants setting of a voice chat was toggled @mute_new_participants New value of the mute_new_participants setting
chatEventVoiceChatMuteNewParticipantsToggled mute_new_participants:Bool = ChatEventAction;
//@description Represents a chat event @id Chat event identifier @date Point in time (Unix timestamp) when the event happened @user_id Identifier of the user who performed the action that triggered the event @action Action performed by the user
chatEvent id:int64 date:int32 user_id:int32 action:ChatEventAction = ChatEvent;

Binary file not shown.

View File

@ -23,6 +23,7 @@
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"
#include "td/telegram/GroupCallManager.h"
#include "td/telegram/GroupCallParticipant.h"
#include "td/telegram/InlineQueriesManager.h"
#include "td/telegram/InputMessageText.h"
#include "td/telegram/Location.h"
@ -30777,12 +30778,46 @@ tl_object_ptr<td_api::ChatEventAction> MessagesManager::get_chat_event_action_ob
auto new_slow_mode_delay = clamp(action->new_value_, 0, 86400 * 366);
return make_tl_object<td_api::chatEventSlowModeDelayChanged>(old_slow_mode_delay, new_slow_mode_delay);
}
case telegram_api::channelAdminLogEventActionStartGroupCall::ID:
case telegram_api::channelAdminLogEventActionDiscardGroupCall::ID:
case telegram_api::channelAdminLogEventActionParticipantMute::ID:
case telegram_api::channelAdminLogEventActionParticipantUnmute::ID:
case telegram_api::channelAdminLogEventActionToggleGroupCallSetting::ID:
case telegram_api::channelAdminLogEventActionStartGroupCall::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionStartGroupCall>(action_ptr);
auto input_group_call_id = InputGroupCallId(action->call_);
if (!input_group_call_id.is_valid()) {
return nullptr;
}
return make_tl_object<td_api::chatEventVoiceChatCreated>(
td_->group_call_manager_->get_group_call_id(input_group_call_id, channel_id).get());
}
case telegram_api::channelAdminLogEventActionDiscardGroupCall::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionDiscardGroupCall>(action_ptr);
auto input_group_call_id = InputGroupCallId(action->call_);
if (!input_group_call_id.is_valid()) {
return nullptr;
}
return make_tl_object<td_api::chatEventVoiceChatDiscarded>(
td_->group_call_manager_->get_group_call_id(input_group_call_id, channel_id).get());
}
case telegram_api::channelAdminLogEventActionParticipantMute::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantMute>(action_ptr);
GroupCallParticipant participant(std::move(action->participant_));
if (!participant.is_valid()) {
return nullptr;
}
return make_tl_object<td_api::chatEventVoiceChatParticipantIsMutedToggled>(
td_->contacts_manager_->get_user_id_object(participant.user_id, "LogEventActionParticipantMute"), true);
}
case telegram_api::channelAdminLogEventActionParticipantUnmute::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionParticipantUnmute>(action_ptr);
GroupCallParticipant participant(std::move(action->participant_));
if (!participant.is_valid()) {
return nullptr;
}
return make_tl_object<td_api::chatEventVoiceChatParticipantIsMutedToggled>(
td_->contacts_manager_->get_user_id_object(participant.user_id, "LogEventActionParticipantUnmute"), false);
}
case telegram_api::channelAdminLogEventActionToggleGroupCallSetting::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionToggleGroupCallSetting>(action_ptr);
return make_tl_object<td_api::chatEventVoiceChatMuteNewParticipantsToggled>(action->join_muted_);
}
default:
UNREACHABLE();
return nullptr;