a licence agreement dialog can be requested by the server

This commit is contained in:
Volker Fischer 2015-01-23 19:43:18 +00:00
parent a6cd448ca9
commit 72c5f4cc63
13 changed files with 150 additions and 67 deletions

View file

@ -1,11 +1,17 @@
3.3.5 3.3.6
- a licence agreement dialog can be requested by the server
3.3.5 (2014-07-30)
- new compile config options for disabling old CELT, use OPUS in a shared - new compile config options for disabling old CELT, use OPUS in a shared
library and change the executable name library and change the executable name
- added a Linux jamulus.desktop file - added a Linux jamulus.desktop file
3.3.4 3.3.4 (2014-02-25)
- true stereo reverberation effect (previously it was a mono reverberation - true stereo reverberation effect (previously it was a mono reverberation
effect on both stereo channels) effect on both stereo channels)

View file

@ -111,6 +111,10 @@ QObject::connect ( &Protocol,
QObject::connect ( &Protocol, QObject::connect ( &Protocol,
SIGNAL ( ReqNetTranspProps() ), SIGNAL ( ReqNetTranspProps() ),
this, SLOT ( OnReqNetTranspProps() ) ); this, SLOT ( OnReqNetTranspProps() ) );
QObject::connect( &Protocol,
SIGNAL ( LicenceRequired ( ELicenceType ) ),
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
} }
bool CChannel::ProtocolIsEnabled() bool CChannel::ProtocolIsEnabled()

View file

@ -154,6 +154,7 @@ Protocol.CreateChanNameMes ( ChInfo.strName );
void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); } void CreateReqJitBufMes() { Protocol.CreateReqJitBufMes(); }
void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); } void CreateReqConnClientsList() { Protocol.CreateReqConnClientsList(); }
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); } void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
void CreateLicReqMes ( const ELicenceType eLicenceType ) { Protocol.CreateLicenceRequiredMes ( eLicenceType ); }
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
void CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo ) void CreateConClientListNameMes ( const CVector<CChannelInfo>& vecChanInfo )
@ -262,6 +263,7 @@ signals:
void OpusSupported(); void OpusSupported();
void ChatTextReceived ( QString strChatText ); void ChatTextReceived ( QString strChatText );
void ReqNetTranspProps(); void ReqNetTranspProps();
void LicenceRequired ( ELicenceType eLicenceType );
void Disconnected(); void Disconnected();
void DetectedCLMessage ( CVector<uint8_t> vecbyMesBodyData, void DetectedCLMessage ( CVector<uint8_t> vecbyMesBodyData,

View file

@ -182,6 +182,10 @@ CClient::CClient ( const quint16 iPortNumber ) :
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
SIGNAL ( ChatTextReceived ( QString ) ) ); SIGNAL ( ChatTextReceived ( QString ) ) );
QObject::connect( &Channel,
SIGNAL ( LicenceRequired ( ELicenceType ) ),
SIGNAL ( LicenceRequired ( ELicenceType ) ) );
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### // #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
#ifdef USE_LEGACY_CELT #ifdef USE_LEGACY_CELT
QObject::connect ( &Channel, SIGNAL ( OpusSupported() ), QObject::connect ( &Channel, SIGNAL ( OpusSupported() ),

View file

@ -417,6 +417,7 @@ signals:
void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo ); void ConClientListNameMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo ); void ConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void ChatTextReceived ( QString strChatText ); void ChatTextReceived ( QString strChatText );
void LicenceRequired ( ELicenceType eLicenceType );
void PingTimeReceived ( int iPingTime ); void PingTimeReceived ( int iPingTime );
void CLServerListReceived ( CHostAddress InetAddr, void CLServerListReceived ( CHostAddress InetAddr,

View file

@ -441,7 +441,16 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
SIGNAL ( ChatTextReceived ( QString ) ), SIGNAL ( ChatTextReceived ( QString ) ),
this, SLOT ( OnChatTextReceived ( QString ) ) ); this, SLOT ( OnChatTextReceived ( QString ) ) );
QObject::connect ( pClient, SIGNAL ( PingTimeReceived ( int ) ), // This connection is a special case. On receiving a licence required message via the
// protocol, a modal licence dialog is opened. Since this blocks the thread, we need
// a queued connection to make sure the core protocol mechanism is not blocked, too.
qRegisterMetaType<ELicenceType> ( "ELicenceType" );
QObject::connect ( pClient,
SIGNAL ( LicenceRequired ( ELicenceType ) ),
this, SLOT ( OnLicenceRequired ( ELicenceType ) ), Qt::QueuedConnection );
QObject::connect ( pClient,
SIGNAL ( PingTimeReceived ( int ) ),
this, SLOT ( OnPingTimeResult ( int ) ) ); this, SLOT ( OnPingTimeResult ( int ) ) );
QObject::connect ( pClient, QObject::connect ( pClient,
@ -703,6 +712,25 @@ void CClientDlg::OnChatTextReceived ( QString strChatText )
UpdateDisplay(); UpdateDisplay();
} }
void CClientDlg::OnLicenceRequired ( ELicenceType eLicenceType )
{
// right now only the creative common licence is supported
if ( eLicenceType == LT_CREATIVECOMMONS )
{
CLicenceDlg LicenceDlg;
// TODO mute the client
// Open the licence dialog and check if the licence was accepted. In
// case the dialog is just closed or the decline button was pressed,
// disconnect from that server.
if ( !LicenceDlg.exec() )
{
Disconnect();
}
}
}
void CClientDlg::OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo ) void CClientDlg::OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo )
{ {
// update mixer board with the additional client infos // update mixer board with the additional client infos

View file

@ -158,6 +158,7 @@ public slots:
void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo ); void OnConClientListMesReceived ( CVector<CChannelInfo> vecChanInfo );
void OnFaderTagTextChanged ( const QString& strNewName ); void OnFaderTagTextChanged ( const QString& strNewName );
void OnChatTextReceived ( QString strChatText ); void OnChatTextReceived ( QString strChatText );
void OnLicenceRequired ( ELicenceType eLicenceType );
void OnChangeChanGain ( int iId, double dGain ) void OnChangeChanGain ( int iId, double dGain )
{ pClient->SetRemoteChanGain ( iId, dGain ); } { pClient->SetRemoteChanGain ( iId, dGain ); }

View file

@ -62,6 +62,7 @@ int main ( int argc, char** argv )
bool bCentServPingServerInList = false; bool bCentServPingServerInList = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
ELicenceType eLicenceType = LT_NO_LICENCE;
QString strIniFileName = ""; QString strIniFileName = "";
QString strHTMLStatusFileName = ""; QString strHTMLStatusFileName = "";
QString strServerName = ""; QString strServerName = "";
@ -100,6 +101,19 @@ int main ( int argc, char** argv )
} }
// Use licence flag ----------------------------------------------------
if ( GetFlagArgument ( argv,
i,
"-L",
"--licence" ) )
{
// right now only the creative commons licence is supported
eLicenceType = LT_CREATIVECOMMONS;
tsConsole << "- licence required" << endl;
continue;
}
// Maximum number of channels ------------------------------------------ // Maximum number of channels ------------------------------------------
if ( GetNumericArgument ( tsConsole, if ( GetNumericArgument ( tsConsole,
argc, argc,
@ -419,7 +433,8 @@ int main ( int argc, char** argv )
strCentralServer, strCentralServer,
strServerInfo, strServerInfo,
strWelcomeMessage, strWelcomeMessage,
bCentServPingServerInList ); bCentServPingServerInList,
eLicenceType );
if ( bUseGUI ) if ( bUseGUI )
{ {
@ -507,6 +522,8 @@ QString UsageArguments ( char **argv )
" -h, -?, --help this help text\n" " -h, -?, --help this help text\n"
" -i, --inifile initialization file name (client only)\n" " -i, --inifile initialization file name (client only)\n"
" -l, --log enable logging, set file name\n" " -l, --log enable logging, set file name\n"
" -L, --licence a licence must be accepted on a new\n"
" connection (server only)\n"
" -m, --htmlstatus enable HTML status file, set file name (server\n" " -m, --htmlstatus enable HTML status file, set file name (server\n"
" only)\n" " only)\n"
" -n, --nogui disable GUI (server only)\n" " -n, --nogui disable GUI (server only)\n"

View file

@ -200,7 +200,7 @@ CONNECTION LESS MESSAGES
+-----------------------------+---------------------------------+ +-----------------------------+---------------------------------+
- PROTMESSID_SERVER_FULL: Connection less server full message - PROTMESSID_CLM_SERVER_FULL: Connection less server full message
note: does not have any data -> n = 0 note: does not have any data -> n = 0
@ -1359,7 +1359,8 @@ bool CProtocol::EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData )
const ELicenceType eLicenceType = const ELicenceType eLicenceType =
static_cast<ELicenceType> ( GetValFromStream ( vecData, iPos, 1 ) ); static_cast<ELicenceType> ( GetValFromStream ( vecData, iPos, 1 ) );
if ( eLicenceType != LT_CREATIVECOMMONS ) if ( ( eLicenceType != LT_CREATIVECOMMONS ) &&
( eLicenceType != LT_NO_LICENCE ) )
{ {
return true; // return error code return true; // return error code
} }

View file

@ -206,7 +206,8 @@ CServer::CServer ( const int iNewMaxNumChan,
const QString& strCentralServer, const QString& strCentralServer,
const QString& strServerInfo, const QString& strServerInfo,
const QString& strNewWelcomeMessage, const QString& strNewWelcomeMessage,
const bool bNCentServPingServerInList ) : const bool bNCentServPingServerInList,
const ELicenceType eNLicenceType ) :
iMaxNumChannels ( iNewMaxNumChan ), iMaxNumChannels ( iNewMaxNumChan ),
Socket ( this, iPortNumber ), Socket ( this, iPortNumber ),
bWriteStatusHTMLFile ( false ), bWriteStatusHTMLFile ( false ),
@ -217,7 +218,8 @@ CServer::CServer ( const int iNewMaxNumChan,
bNCentServPingServerInList, bNCentServPingServerInList,
&ConnLessProtocol ), &ConnLessProtocol ),
bAutoRunMinimized ( false ), bAutoRunMinimized ( false ),
strWelcomeMessage ( strNewWelcomeMessage ) strWelcomeMessage ( strNewWelcomeMessage ),
eLicenceType ( eNLicenceType )
{ {
int iOpusError; int iOpusError;
int i; int i;
@ -608,6 +610,12 @@ CreateAndSendChanListForAllConChannels();
vecChannels[iChID].CreateChatTextMes ( strWelcomeMessageFormated ); vecChannels[iChID].CreateChatTextMes ( strWelcomeMessageFormated );
} }
// send licence request message (if enabled)
if ( eLicenceType != LT_NO_LICENCE )
{
vecChannels[iChID].CreateLicReqMes ( eLicenceType );
}
} }
void CServer::OnServerFull ( CHostAddress RecHostAddr ) void CServer::OnServerFull ( CHostAddress RecHostAddr )

View file

@ -130,7 +130,8 @@ public:
const QString& strCentralServer, const QString& strCentralServer,
const QString& strServerInfo, const QString& strServerInfo,
const QString& strNewWelcomeMessage, const QString& strNewWelcomeMessage,
const bool bNCentServPingServerInList ); const bool bNCentServPingServerInList,
const ELicenceType eNLicenceType );
void Start(); void Start();
void Stop(); void Stop();
@ -271,6 +272,7 @@ protected:
// messaging // messaging
QString strWelcomeMessage; QString strWelcomeMessage;
ELicenceType eLicenceType;
signals: signals:
void Started(); void Started();

View file

@ -104,9 +104,10 @@ public slots:
CVector<CServerInfo> vecServerInfo ( 1 ); CVector<CServerInfo> vecServerInfo ( 1 );
CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort ); CHostAddress CurHostAddress ( QHostAddress ( sAddress ), iPort );
CChannelCoreInfo ChannelCoreInfo; CChannelCoreInfo ChannelCoreInfo;
ELicenceType eLicenceType;
// generate random protocol message // generate random protocol message
switch ( GenRandomIntInRange ( 0, 26 ) ) switch ( GenRandomIntInRange ( 0, 27 ) )
{ {
case 0: // PROTMESSID_JITT_BUF_SIZE case 0: // PROTMESSID_JITT_BUF_SIZE
Protocol.CreateJitBufMes ( GenRandomIntInRange ( 0, 10 ) ); Protocol.CreateJitBufMes ( GenRandomIntInRange ( 0, 10 ) );
@ -167,7 +168,14 @@ public slots:
Protocol.CreateChatTextMes ( GenRandomString() ); Protocol.CreateChatTextMes ( GenRandomString() );
break; break;
case 10: // PROTMESSID_NETW_TRANSPORT_PROPS case 10: // PROTMESSID_LICENCE_REQUIRED
eLicenceType =
static_cast<ELicenceType> ( GenRandomIntInRange ( 0, 1 ) );
Protocol.CreateLicenceRequiredMes ( eLicenceType );
break;
case 11: // PROTMESSID_NETW_TRANSPORT_PROPS
NetTrProps.eAudioCodingType = NetTrProps.eAudioCodingType =
static_cast<EAudComprType> ( GenRandomIntInRange ( 0, 2 ) ); static_cast<EAudComprType> ( GenRandomIntInRange ( 0, 2 ) );
@ -181,30 +189,30 @@ public slots:
Protocol.CreateNetwTranspPropsMes ( NetTrProps ); Protocol.CreateNetwTranspPropsMes ( NetTrProps );
break; break;
case 11: // PROTMESSID_REQ_NETW_TRANSPORT_PROPS case 12: // PROTMESSID_REQ_NETW_TRANSPORT_PROPS
Protocol.CreateReqNetwTranspPropsMes(); Protocol.CreateReqNetwTranspPropsMes();
break; break;
case 12: // PROTMESSID_OPUS_SUPPORTED case 13: // PROTMESSID_OPUS_SUPPORTED
Protocol.CreateOpusSupportedMes(); Protocol.CreateOpusSupportedMes();
break; break;
case 13: // PROTMESSID_CLM_PING_MS case 14: // PROTMESSID_CLM_PING_MS
Protocol.CreateCLPingMes ( CurHostAddress, Protocol.CreateCLPingMes ( CurHostAddress,
GenRandomIntInRange ( -2, 1000 ) ); GenRandomIntInRange ( -2, 1000 ) );
break; break;
case 14: // PROTMESSID_CLM_PING_MS_WITHNUMCLIENTS case 15: // PROTMESSID_CLM_PING_MS_WITHNUMCLIENTS
Protocol.CreateCLPingWithNumClientsMes ( CurHostAddress, Protocol.CreateCLPingWithNumClientsMes ( CurHostAddress,
GenRandomIntInRange ( -2, 1000 ), GenRandomIntInRange ( -2, 1000 ),
GenRandomIntInRange ( -2, 1000 ) ); GenRandomIntInRange ( -2, 1000 ) );
break; break;
case 15: // PROTMESSID_CLM_SERVER_FULL case 16: // PROTMESSID_CLM_SERVER_FULL
Protocol.CreateCLServerFullMes ( CurHostAddress ); Protocol.CreateCLServerFullMes ( CurHostAddress );
break; break;
case 16: // PROTMESSID_CLM_REGISTER_SERVER case 17: // PROTMESSID_CLM_REGISTER_SERVER
ServerInfo.bPermanentOnline = ServerInfo.bPermanentOnline =
static_cast<bool> ( GenRandomIntInRange ( 0, 1 ) ); static_cast<bool> ( GenRandomIntInRange ( 0, 1 ) );
@ -221,11 +229,11 @@ public slots:
ServerInfo ); ServerInfo );
break; break;
case 17: // PROTMESSID_CLM_UNREGISTER_SERVER case 18: // PROTMESSID_CLM_UNREGISTER_SERVER
Protocol.CreateCLUnregisterServerMes ( CurHostAddress ); Protocol.CreateCLUnregisterServerMes ( CurHostAddress );
break; break;
case 18: // PROTMESSID_CLM_SERVER_LIST case 19: // PROTMESSID_CLM_SERVER_LIST
vecServerInfo[0].bPermanentOnline = vecServerInfo[0].bPermanentOnline =
static_cast<bool> ( GenRandomIntInRange ( 0, 1 ) ); static_cast<bool> ( GenRandomIntInRange ( 0, 1 ) );
@ -243,37 +251,37 @@ public slots:
vecServerInfo ); vecServerInfo );
break; break;
case 19: // PROTMESSID_CLM_REQ_SERVER_LIST case 20: // PROTMESSID_CLM_REQ_SERVER_LIST
Protocol.CreateCLReqServerListMes ( CurHostAddress ); Protocol.CreateCLReqServerListMes ( CurHostAddress );
break; break;
case 20: // PROTMESSID_CLM_SEND_EMPTY_MESSAGE case 21: // PROTMESSID_CLM_SEND_EMPTY_MESSAGE
Protocol.CreateCLSendEmptyMesMes ( CurHostAddress, Protocol.CreateCLSendEmptyMesMes ( CurHostAddress,
CurHostAddress ); CurHostAddress );
break; break;
case 21: // PROTMESSID_CLM_EMPTY_MESSAGE case 22: // PROTMESSID_CLM_EMPTY_MESSAGE
Protocol.CreateCLEmptyMes ( CurHostAddress ); Protocol.CreateCLEmptyMes ( CurHostAddress );
break; break;
case 22: // PROTMESSID_CLM_DISCONNECTION case 23: // PROTMESSID_CLM_DISCONNECTION
Protocol.CreateCLDisconnection ( CurHostAddress ); Protocol.CreateCLDisconnection ( CurHostAddress );
break; break;
case 23: // PROTMESSID_CLM_VERSION_AND_OS case 24: // PROTMESSID_CLM_VERSION_AND_OS
Protocol.CreateCLVersionAndOSMes ( CurHostAddress ); Protocol.CreateCLVersionAndOSMes ( CurHostAddress );
break; break;
case 24: // PROTMESSID_CLM_REQ_VERSION_AND_OS case 25: // PROTMESSID_CLM_REQ_VERSION_AND_OS
Protocol.CreateCLReqVersionAndOSMes ( CurHostAddress ); Protocol.CreateCLReqVersionAndOSMes ( CurHostAddress );
break; break;
case 25: // PROTMESSID_ACKN case 26: // PROTMESSID_ACKN
Protocol.CreateAndImmSendAcknMess ( GenRandomIntInRange ( -10, 100 ), Protocol.CreateAndImmSendAcknMess ( GenRandomIntInRange ( -10, 100 ),
GenRandomIntInRange ( -100, 100 ) ); GenRandomIntInRange ( -100, 100 ) );
break; break;
case 26: case 27:
// arbitrary "audio" packet (with random sizes) // arbitrary "audio" packet (with random sizes)
CVector<uint8_t> vecMessage ( GenRandomIntInRange ( 1, 1000 ) ); CVector<uint8_t> vecMessage ( GenRandomIntInRange ( 1, 1000 ) );
OnSendProtMessage ( vecMessage ); OnSendProtMessage ( vecMessage );

View file

@ -502,7 +502,8 @@ enum EGUIDesign
enum ELicenceType enum ELicenceType
{ {
// used for protocol -> enum values must be fixed! // used for protocol -> enum values must be fixed!
LT_CREATIVECOMMONS = 0 LT_NO_LICENCE = 0,
LT_CREATIVECOMMONS = 1
}; };