MCPcopy Create free account
hub / github.com/TDesktop-x64/tdesktop / FillVideoChatMenu

Function FillVideoChatMenu

Telegram/SourceFiles/window/window_peer_menu.cpp:4109–4155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4107}
4108
4109bool FillVideoChatMenu(
4110 not_null<SessionController*> controller,
4111 Dialogs::EntryState request,
4112 const PeerMenuCallback &addAction) {
4113 const auto peer = request.key.peer();
4114 if (!peer || peer->isUser()) {
4115 return false;
4116 }
4117
4118 const auto callback = [=](Calls::StartGroupCallArgs &&args) {
4119 controller->startOrJoinGroupCall(peer, std::move(args));
4120 };
4121 const auto rtmpCallback = [=] {
4122 Core::App().calls().showStartWithRtmp(controller->uiShow(), peer);
4123 };
4124 const auto livestream = !peer->isMegagroup() && peer->isChannel();
4125 const auto has = (peer->groupCall() != nullptr);
4126 const auto manager = peer->canManageGroupCall();
4127 if (has) {
4128 addAction(
4129 tr::lng_menu_start_group_call_join(tr::now),
4130 [=] { callback({}); },
4131 &st::menuIconVideoChat);
4132 } else if (manager) {
4133 addAction(
4134 (livestream
4135 ? tr::lng_menu_start_group_call_channel
4136 : tr::lng_menu_start_group_call)(tr::now),
4137 [=] { callback({}); },
4138 &st::menuIconStartStream);
4139 }
4140 if (!has && manager) {
4141 addAction(
4142 (livestream
4143 ? tr::lng_menu_start_group_call_scheduled_channel
4144 : tr::lng_menu_start_group_call_scheduled)(tr::now),
4145 [=] { callback({ .scheduleNeeded = true }); },
4146 &st::menuIconReschedule);
4147 addAction(
4148 (livestream
4149 ? tr::lng_menu_start_group_call_with_channel
4150 : tr::lng_menu_start_group_call_with)(tr::now),
4151 rtmpCallback,
4152 &st::menuIconStartStreamWith);
4153 }
4154 return has || manager;
4155}
4156
4157void FillSenderUserpicMenu(
4158 not_null<SessionController*> controller,

Callers 2

addVideoChatMethod · 0.85
showGroupCallMenuMethod · 0.85

Calls 10

AppClass · 0.85
showStartWithRtmpMethod · 0.80
isChannelMethod · 0.80
canManageGroupCallMethod · 0.80
peerMethod · 0.45
isUserMethod · 0.45
startOrJoinGroupCallMethod · 0.45
uiShowMethod · 0.45
isMegagroupMethod · 0.45
groupCallMethod · 0.45

Tested by

no test coverage detected