2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Add call peer-to-peer setting in Privacy&Security.

This commit is contained in:
John Preston
2018-09-12 20:02:30 +03:00
parent 673fea47bd
commit c4ca180745
10 changed files with 206 additions and 15 deletions

View File

@@ -572,7 +572,20 @@ void Call::createAndStartController(const MTPDphoneCall &call) {
_controller->SetMicMute(_mute);
}
_controller->implData = static_cast<void*>(this);
_controller->SetRemoteEndpoints(endpoints, true, protocol.vmax_layer.v);
const auto p2p = [&] {
switch (Auth().settings().callsPeerToPeer()) {
case PeerToPeer::DefaultContacts:
case PeerToPeer::Contacts:
return _user->isContact();
case PeerToPeer::DefaultEveryone:
case PeerToPeer::Everyone:
return true;
case PeerToPeer::Nobody:
return false;
}
Unexpected("Calls::PeerToPeer value in Auth().settings().");
}();
_controller->SetRemoteEndpoints(endpoints, p2p, protocol.vmax_layer.v);
_controller->SetConfig(config);
_controller->SetEncryptionKey(reinterpret_cast<char*>(_authKey.data()), (_type == Type::Outgoing));
_controller->SetCallbacks(callbacks);