mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Improve confcall invite management.
This commit is contained in:
parent
01a6b432f3
commit
698d9c208f
9 changed files with 67 additions and 7 deletions
|
@ -4805,6 +4805,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_group_call_context_pin_screen" = "Pin screencast";
|
||||
"lng_group_call_context_unpin_screen" = "Unpin screencast";
|
||||
"lng_group_call_context_remove" = "Remove";
|
||||
"lng_group_call_context_cancel_invite" = "Cancel invitation";
|
||||
"lng_group_call_remove_channel" = "Remove {channel} from the video chat and ban them?";
|
||||
"lng_group_call_remove_channel_from_channel" = "Remove {channel} from the live stream?";
|
||||
"lng_group_call_mac_access" = "Telegram Desktop does not have access to system wide keyboard input required for Push to Talk.";
|
||||
|
|
|
@ -1489,8 +1489,12 @@ void Call::finish(
|
|||
|| state == State::Failed) {
|
||||
return;
|
||||
} else if (conferenceInvite()) {
|
||||
Core::App().calls().declineIncomingConferenceInvites(_conferenceId);
|
||||
setState(finalState);
|
||||
if (migrateCall) {
|
||||
_delegate->callFinished(this);
|
||||
} else {
|
||||
Core::App().calls().declineIncomingConferenceInvites(_conferenceId);
|
||||
setState(finalState);
|
||||
}
|
||||
return;
|
||||
} else if (!_id) {
|
||||
setState(finalState);
|
||||
|
|
|
@ -976,6 +976,33 @@ void Instance::declineIncomingConferenceInvites(CallId conferenceId) {
|
|||
}
|
||||
}
|
||||
|
||||
void Instance::declineOutgoingConferenceInvite(
|
||||
CallId conferenceId,
|
||||
not_null<UserData*> user) {
|
||||
const auto i = _conferenceInvites.find(conferenceId);
|
||||
if (i == end(_conferenceInvites)) {
|
||||
return;
|
||||
}
|
||||
const auto j = i->second.users.find(user);
|
||||
if (j == end(i->second.users)) {
|
||||
return;
|
||||
}
|
||||
const auto api = &user->session().api();
|
||||
for (const auto &messageId : base::take(j->second.outgoing)) {
|
||||
api->request(MTPphone_DeclineConferenceCallInvite(
|
||||
MTP_int(messageId.bare)
|
||||
)).send();
|
||||
}
|
||||
if (!j->second.incoming.empty()) {
|
||||
return;
|
||||
}
|
||||
i->second.users.erase(j);
|
||||
if (i->second.users.empty()) {
|
||||
_conferenceInvites.erase(i);
|
||||
}
|
||||
user->owner().unregisterInvitedToCallUser(conferenceId, user);
|
||||
}
|
||||
|
||||
void Instance::showConferenceInvite(
|
||||
not_null<UserData*> user,
|
||||
MsgId conferenceInviteMsgId) {
|
||||
|
|
|
@ -147,6 +147,9 @@ public:
|
|||
not_null<UserData*> user,
|
||||
MsgId conferenceInviteMsgId);
|
||||
void declineIncomingConferenceInvites(CallId conferenceId);
|
||||
void declineOutgoingConferenceInvite(
|
||||
CallId conferenceId,
|
||||
not_null<UserData*> user);
|
||||
|
||||
[[nodiscard]] FnMut<void()> addAsyncWaiter();
|
||||
|
||||
|
|
|
@ -3739,6 +3739,7 @@ void GroupCall::inviteUsers(
|
|||
if (const auto call = _conferenceCall.get()) {
|
||||
for (const auto &user : users) {
|
||||
_api.request(MTPphone_InviteConferenceCallParticipant(
|
||||
MTP_flags(0),
|
||||
inputCallSafe(),
|
||||
user->inputUser
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
|
@ -3752,6 +3753,8 @@ void GroupCall::inviteUsers(
|
|||
state->result.privacyRestricted.push_back(user);
|
||||
} else if (type == u"USER_ALREADY_PARTICIPANT"_q) {
|
||||
state->result.alreadyIn.push_back(user);
|
||||
} else if (type == u"GROUPCALL_FORBIDDEN"_q) {
|
||||
startRejoin();
|
||||
}
|
||||
finishRequest();
|
||||
}).send();
|
||||
|
|
|
@ -319,6 +319,10 @@ object_ptr<Ui::BoxContent> PrepareInviteBox(
|
|||
}) | ranges::to_vector;
|
||||
const auto done = [=](GroupCall::InviteResult result) {
|
||||
(*close)();
|
||||
if (result.invited.empty()
|
||||
&& result.privacyRestricted.empty()) {
|
||||
return;
|
||||
}
|
||||
showToast({ ComposeInviteResultToast(result) });
|
||||
};
|
||||
call->inviteUsers(users, done);
|
||||
|
|
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "calls/group/calls_volume_item.h"
|
||||
#include "calls/group/calls_group_members_row.h"
|
||||
#include "calls/group/calls_group_viewport.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -1308,6 +1309,9 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|
|||
const auto participantPeer = row->peer();
|
||||
const auto real = static_cast<Row*>(row.get());
|
||||
const auto muteState = real->state();
|
||||
if (muteState == Row::State::WithAccess) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto muted = (muteState == Row::State::Muted)
|
||||
|| (muteState == Row::State::RaisedHand);
|
||||
const auto addCover = !_call->rtmp();
|
||||
|
@ -1459,6 +1463,20 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|
|||
removeHand);
|
||||
}
|
||||
} else {
|
||||
const auto conference = _call->conferenceCall().get();
|
||||
if (muteState == Row::State::Invited
|
||||
&& participantPeer->isUser()
|
||||
&& conference) {
|
||||
const auto id = conference->id();
|
||||
const auto cancelInvite = [=] {
|
||||
Core::App().calls().declineOutgoingConferenceInvite(
|
||||
id,
|
||||
participantPeer->asUser());
|
||||
};
|
||||
result->addAction(
|
||||
tr::lng_group_call_context_cancel_invite(tr::now),
|
||||
cancelInvite);
|
||||
}
|
||||
result->addAction(
|
||||
(participantPeer->isUser()
|
||||
? tr::lng_context_view_profile(tr::now)
|
||||
|
@ -1473,9 +1491,8 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|
|||
}
|
||||
const auto canKick = [&] {
|
||||
const auto user = participantPeer->asUser();
|
||||
const auto state = static_cast<Row*>(row.get())->state();
|
||||
if (state == Row::State::Invited
|
||||
|| state == Row::State::WithAccess) {
|
||||
if (muteState == Row::State::Invited
|
||||
|| muteState == Row::State::WithAccess) {
|
||||
return false;
|
||||
} else if (const auto chat = _peer->asChat()) {
|
||||
return chat->amCreator()
|
||||
|
|
|
@ -639,6 +639,7 @@ void MembersRow::paintComplexStatusText(
|
|||
const auto &font = st::normalFont;
|
||||
const auto useAbout = !_about.isEmpty()
|
||||
&& (_state != State::WithAccess)
|
||||
&& (_state != State::Invited)
|
||||
&& (style != MembersRowStyle::Video)
|
||||
&& ((_state == State::RaisedHand && !_raisedHandStatus)
|
||||
|| (_state != State::RaisedHand && !_speaking));
|
||||
|
|
|
@ -187,7 +187,7 @@ messageActionStarGift#4717e8a4 flags:# name_hidden:flags.0?true saved:flags.2?tr
|
|||
messageActionStarGiftUnique#acdfcb81 flags:# upgrade:flags.0?true transferred:flags.1?true saved:flags.2?true refunded:flags.5?true gift:StarGift can_export_at:flags.3?int transfer_stars:flags.4?long from_id:flags.6?Peer peer:flags.7?Peer saved_id:flags.7?long = MessageAction;
|
||||
messageActionPaidMessagesRefunded#ac1f1fcd count:int stars:long = MessageAction;
|
||||
messageActionPaidMessagesPrice#bcd71419 stars:long = MessageAction;
|
||||
messageActionConferenceCall#2ffe2f7a flags:# missed:flags.0?true active:flags.1?true call_id:long duration:flags.2?int other_participants:flags.3?Vector<Peer> = MessageAction;
|
||||
messageActionConferenceCall#2ffe2f7a flags:# missed:flags.0?true active:flags.1?true video:flags.4?true call_id:long duration:flags.2?int other_participants:flags.3?Vector<Peer> = MessageAction;
|
||||
|
||||
dialog#d58a08c6 flags:# pinned:flags.2?true unread_mark:flags.3?true view_forum_as_messages:flags.6?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int unread_mentions_count:int unread_reactions_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage folder_id:flags.4?int ttl_period:flags.5?int = Dialog;
|
||||
dialogFolder#71bd134c flags:# pinned:flags.2?true folder:Folder peer:Peer top_message:int unread_muted_peers_count:int unread_unmuted_peers_count:int unread_muted_messages_count:int unread_unmuted_messages_count:int = Dialog;
|
||||
|
@ -2610,7 +2610,7 @@ phone.saveCallLog#41248786 peer:InputPhoneCall file:InputFile = Bool;
|
|||
phone.createConferenceCall#fbcefee6 random_id:int = phone.GroupCall;
|
||||
phone.deleteConferenceCallParticipants#f9231114 call:InputGroupCall ids:Vector<long> block:bytes = Updates;
|
||||
phone.sendConferenceCallBroadcast#c6701900 call:InputGroupCall block:bytes = Updates;
|
||||
phone.inviteConferenceCallParticipant#3e9cf7ee call:InputGroupCall user_id:InputUser = Updates;
|
||||
phone.inviteConferenceCallParticipant#bcf22685 flags:# video:flags.0?true call:InputGroupCall user_id:InputUser = Updates;
|
||||
phone.declineConferenceCallInvite#3c479971 msg_id:int = Updates;
|
||||
phone.getGroupCallChainBlocks#ee9f88a6 call:InputGroupCall sub_chain_id:int offset:int limit:int = Updates;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue