mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Allow discard invite or cancel ringing.
This commit is contained in:
parent
344c0f6427
commit
55c05d1a6e
4 changed files with 30 additions and 10 deletions
|
@ -4811,7 +4811,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_context_pin_screen" = "Pin screencast";
|
"lng_group_call_context_pin_screen" = "Pin screencast";
|
||||||
"lng_group_call_context_unpin_screen" = "Unpin screencast";
|
"lng_group_call_context_unpin_screen" = "Unpin screencast";
|
||||||
"lng_group_call_context_remove" = "Remove";
|
"lng_group_call_context_remove" = "Remove";
|
||||||
"lng_group_call_context_cancel_invite" = "Cancel invitation";
|
"lng_group_call_context_cancel_invite" = "Discard invite";
|
||||||
"lng_group_call_context_stop_ringing" = "Stop calling";
|
"lng_group_call_context_stop_ringing" = "Stop calling";
|
||||||
"lng_group_call_context_ban_from_call" = "Ban from call";
|
"lng_group_call_context_ban_from_call" = "Ban from call";
|
||||||
"lng_group_call_remove_channel" = "Remove {channel} from the video chat and ban them?";
|
"lng_group_call_remove_channel" = "Remove {channel} from the video chat and ban them?";
|
||||||
|
|
|
@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "data/data_changes.h"
|
#include "data/data_changes.h"
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
#include "data/data_chat.h"
|
#include "data/data_chat.h"
|
||||||
|
#include "data/data_histories.h"
|
||||||
#include "data/data_session.h"
|
#include "data/data_session.h"
|
||||||
#include "media/audio/media_audio_track.h"
|
#include "media/audio/media_audio_track.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
|
@ -982,7 +983,8 @@ void Instance::declineIncomingConferenceInvites(CallId conferenceId) {
|
||||||
|
|
||||||
void Instance::declineOutgoingConferenceInvite(
|
void Instance::declineOutgoingConferenceInvite(
|
||||||
CallId conferenceId,
|
CallId conferenceId,
|
||||||
not_null<UserData*> user) {
|
not_null<UserData*> user,
|
||||||
|
bool discard) {
|
||||||
const auto i = _conferenceInvites.find(conferenceId);
|
const auto i = _conferenceInvites.find(conferenceId);
|
||||||
if (i == end(_conferenceInvites)) {
|
if (i == end(_conferenceInvites)) {
|
||||||
return;
|
return;
|
||||||
|
@ -992,10 +994,22 @@ void Instance::declineOutgoingConferenceInvite(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto api = &user->session().api();
|
const auto api = &user->session().api();
|
||||||
for (const auto &messageId : base::take(j->second.outgoing)) {
|
auto ids = base::take(j->second.outgoing);
|
||||||
api->request(MTPphone_DeclineConferenceCallInvite(
|
auto inputs = QVector<MTPint>();
|
||||||
MTP_int(messageId.bare)
|
for (const auto &messageId : ids) {
|
||||||
)).send();
|
if (discard) {
|
||||||
|
inputs.push_back(MTP_int(messageId.bare));
|
||||||
|
} else {
|
||||||
|
api->request(MTPphone_DeclineConferenceCallInvite(
|
||||||
|
MTP_int(messageId.bare)
|
||||||
|
)).send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!inputs.empty()) {
|
||||||
|
user->owner().histories().deleteMessages(
|
||||||
|
user->owner().history(user),
|
||||||
|
std::move(inputs),
|
||||||
|
true);
|
||||||
}
|
}
|
||||||
if (!j->second.incoming.empty()) {
|
if (!j->second.incoming.empty()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -138,7 +138,8 @@ public:
|
||||||
void declineIncomingConferenceInvites(CallId conferenceId);
|
void declineIncomingConferenceInvites(CallId conferenceId);
|
||||||
void declineOutgoingConferenceInvite(
|
void declineOutgoingConferenceInvite(
|
||||||
CallId conferenceId,
|
CallId conferenceId,
|
||||||
not_null<UserData*> user);
|
not_null<UserData*> user,
|
||||||
|
bool discard = false);
|
||||||
|
|
||||||
[[nodiscard]] FnMut<void()> addAsyncWaiter();
|
[[nodiscard]] FnMut<void()> addAsyncWaiter();
|
||||||
|
|
||||||
|
|
|
@ -1468,14 +1468,19 @@ base::unique_qptr<Ui::PopupMenu> Members::Controller::createRowContextMenu(
|
||||||
&& participantPeer->isUser()
|
&& participantPeer->isUser()
|
||||||
&& conference) {
|
&& conference) {
|
||||||
const auto id = conference->id();
|
const auto id = conference->id();
|
||||||
const auto cancelInvite = [=] {
|
const auto cancelInvite = [=](bool discard) {
|
||||||
Core::App().calls().declineOutgoingConferenceInvite(
|
Core::App().calls().declineOutgoingConferenceInvite(
|
||||||
id,
|
id,
|
||||||
participantPeer->asUser());
|
participantPeer->asUser(),
|
||||||
|
discard);
|
||||||
};
|
};
|
||||||
|
result->addAction(
|
||||||
|
tr::lng_group_call_context_stop_ringing(tr::now),
|
||||||
|
[=] { cancelInvite(false); });
|
||||||
result->addAction(
|
result->addAction(
|
||||||
tr::lng_group_call_context_cancel_invite(tr::now),
|
tr::lng_group_call_context_cancel_invite(tr::now),
|
||||||
cancelInvite);
|
[=] { cancelInvite(true); });
|
||||||
|
result->addSeparator();
|
||||||
}
|
}
|
||||||
result->addAction(
|
result->addAction(
|
||||||
(participantPeer->isUser()
|
(participantPeer->isUser()
|
||||||
|
|
Loading…
Add table
Reference in a new issue