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
library and change the executable name
- 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
effect on both stereo channels)

View File

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

View File

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

View File

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

View File

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

View File

@ -441,7 +441,16 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
SIGNAL ( ChatTextReceived ( 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 ) ) );
QObject::connect ( pClient,
@ -703,6 +712,25 @@ void CClientDlg::OnChatTextReceived ( QString strChatText )
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 )
{
// update mixer board with the additional client infos

View File

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

View File

@ -53,23 +53,24 @@ int main ( int argc, char** argv )
// initialize all flags and string which might be changed by command line
// arguments
bool bIsClient = true;
bool bUseGUI = true;
bool bStartMinimized = false;
bool bConnectOnStartup = false;
bool bShowComplRegConnList = false;
bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
QString strIniFileName = "";
QString strHTMLStatusFileName = "";
QString strServerName = "";
QString strLoggingFileName = "";
QString strHistoryFileName = "";
QString strCentralServer = "";
QString strServerInfo = "";
QString strWelcomeMessage = "";
bool bIsClient = true;
bool bUseGUI = true;
bool bStartMinimized = false;
bool bConnectOnStartup = false;
bool bShowComplRegConnList = false;
bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
ELicenceType eLicenceType = LT_NO_LICENCE;
QString strIniFileName = "";
QString strHTMLStatusFileName = "";
QString strServerName = "";
QString strLoggingFileName = "";
QString strHistoryFileName = "";
QString strCentralServer = "";
QString strServerInfo = "";
QString strWelcomeMessage = "";
// QT docu: argv()[0] is the program name, argv()[1] is the first
// argument and argv()[argc()-1] is the last argument.
@ -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 ------------------------------------------
if ( GetNumericArgument ( tsConsole,
argc,
@ -419,7 +433,8 @@ int main ( int argc, char** argv )
strCentralServer,
strServerInfo,
strWelcomeMessage,
bCentServPingServerInList );
bCentServPingServerInList,
eLicenceType );
if ( bUseGUI )
{
@ -507,6 +522,8 @@ QString UsageArguments ( char **argv )
" -h, -?, --help this help text\n"
" -i, --inifile initialization file name (client only)\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"
" 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
@ -1359,7 +1359,8 @@ bool CProtocol::EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData )
const ELicenceType eLicenceType =
static_cast<ELicenceType> ( GetValFromStream ( vecData, iPos, 1 ) );
if ( eLicenceType != LT_CREATIVECOMMONS )
if ( ( eLicenceType != LT_CREATIVECOMMONS ) &&
( eLicenceType != LT_NO_LICENCE ) )
{
return true; // return error code
}

View File

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

View File

@ -121,16 +121,17 @@ class CServer : public QObject
Q_OBJECT
public:
CServer ( const int iNewMaxNumChan,
const QString& strLoggingFileName,
const quint16 iPortNumber,
const QString& strHTMLStatusFileName,
const QString& strHistoryFileName,
const QString& strServerNameForHTMLStatusFile,
const QString& strCentralServer,
const QString& strServerInfo,
const QString& strNewWelcomeMessage,
const bool bNCentServPingServerInList );
CServer ( const int iNewMaxNumChan,
const QString& strLoggingFileName,
const quint16 iPortNumber,
const QString& strHTMLStatusFileName,
const QString& strHistoryFileName,
const QString& strServerNameForHTMLStatusFile,
const QString& strCentralServer,
const QString& strServerInfo,
const QString& strNewWelcomeMessage,
const bool bNCentServPingServerInList,
const ELicenceType eNLicenceType );
void Start();
void Stop();
@ -271,6 +272,7 @@ protected:
// messaging
QString strWelcomeMessage;
ELicenceType eLicenceType;
signals:
void Started();

View File

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

View File

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