|
45 | 45 | \******************************************************************************/ |
46 | 46 |
|
47 | 47 | #include "server.h" |
| 48 | +#include "util.h" |
48 | 49 |
|
49 | 50 | // CServer implementation ****************************************************** |
50 | 51 | CServer::CServer ( const int iNewMaxNumChan, |
@@ -291,6 +292,8 @@ CServer::CServer ( const int iNewMaxNumChan, |
291 | 292 |
|
292 | 293 | QObject::connect ( &ConnLessProtocol, &CProtocol::CLReqConnClientsList, this, &CServer::OnCLReqConnClientsList ); |
293 | 294 |
|
| 295 | + QObject::connect ( &ConnLessProtocol, &CProtocol::CLReqServerFeatures, this, &CServer::OnCLReqServerFeatures ); |
| 296 | + |
294 | 297 | QObject::connect ( &ServerListManager, &CServerListManager::SvrRegStatusChanged, this, &CServer::SvrRegStatusChanged ); |
295 | 298 |
|
296 | 299 | QObject::connect ( &JamController, &recorder::CJamController::RestartRecorder, this, &CServer::RestartRecorder ); |
@@ -472,6 +475,60 @@ void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAd |
472 | 475 | Logging.AddNewConnection ( RecHostAddr.InetAddr, iTotChans ); |
473 | 476 | } |
474 | 477 |
|
| 478 | +void CServer::OnCLReqServerFeatures ( CHostAddress RecHostAddr ) |
| 479 | +{ |
| 480 | + // This is a bitmask of features enabled at the server. |
| 481 | + // EFeatureSet from util.h is used to shift each bool into position |
| 482 | + uint32_t iFeatures = 0; |
| 483 | + |
| 484 | + // Use 64 samples frame size mode? (argument -F) |
| 485 | + iFeatures |= ( !bUseDoubleSystemFrameSize << FS_FAST_UPDATE ); |
| 486 | + |
| 487 | + // Multithreading enabled? (argument -T) |
| 488 | + iFeatures |= ( bUseMultithreading << FS_MULTITHREADING ); |
| 489 | + |
| 490 | + // Recording directory set? (argument -R) |
| 491 | + // If a recording directory is set a server could potentially record all client audio |
| 492 | + iFeatures |= ( GetRecorderInitialised() << FS_RECORDER_ENABLED ); |
| 493 | + |
| 494 | + // Will an idle server start recording when a client joins or is it already recording an active session? |
| 495 | + // (argument --norecord disables recording by default) |
| 496 | + iFeatures |= ( ( JamController.GetRecorderState() == RS_RECORDING ) << FS_IS_RECORDING ); |
| 497 | + |
| 498 | + // Delay pan enabled? (argument -P) |
| 499 | + iFeatures |= ( bDelayPan << FS_DELAY_PAN ); |
| 500 | + |
| 501 | + // IPv6 available? (argument --noipv6 disables this feature) |
| 502 | + iFeatures |= ( bIPv6Available << FS_IPV6_AVAILABLE ); |
| 503 | + |
| 504 | + // "Max" audio quality setting enabled? (argument --noraw disables this feature) |
| 505 | + iFeatures |= ( !bDisableRaw << FS_RAW_AUDIO ); |
| 506 | + |
| 507 | + // Disconnect all clients on quit? (argument -d) |
| 508 | + iFeatures |= ( bDisconnectAllClientsOnQuit << FS_DISCONONQUIT ); |
| 509 | + |
| 510 | + // Has welcome message? (argument -w) |
| 511 | + iFeatures |= ( !strWelcomeMessage.isEmpty() << FS_HAS_WELCOME_MESSAGE ); |
| 512 | + |
| 513 | + // Logging enabled? (argument -l) |
| 514 | + iFeatures |= ( Logging.IsLogging() << FS_IS_LOGGING ); |
| 515 | + |
| 516 | + // Licence agreement required? (argument -L) |
| 517 | + iFeatures |= ( ( eLicenceType != LT_NO_LICENCE ) << FS_HAS_LICENCE ); |
| 518 | + |
| 519 | + // TODO: |
| 520 | + // Running a GUI? (argument -n disables the GUI) |
| 521 | + // iFeatures |= ( << FS_HAS_GUI ); |
| 522 | + // |
| 523 | + // // RPC interface enabled? (argument --jsonrpcport) |
| 524 | + // iFeatures |= ( << FS_RPC_ENABLED ); |
| 525 | + |
| 526 | + // qDebug() << QString::number(iFeatures, 2).rightJustified(32, '0'); |
| 527 | + |
| 528 | + // Create and send the message |
| 529 | + ConnLessProtocol.CreateCLServerFeaturesMes ( RecHostAddr, iFeatures ); |
| 530 | +} |
| 531 | + |
475 | 532 | void CServer::OnServerFull ( CHostAddress RecHostAddr ) |
476 | 533 | { |
477 | 534 | // note: no mutex required here |
|
0 commit comments