added new PROTMESSID_LICENCE_REQUIRED message
This commit is contained in:
parent
f56d59fdeb
commit
815098a41d
2 changed files with 51 additions and 0 deletions
|
@ -166,6 +166,13 @@ MESSAGES (with connection)
|
|||
note: does not have any data -> n = 0
|
||||
|
||||
|
||||
- PROTMESSID_LICENCE_REQUIRED: Licence required to connect to the server
|
||||
|
||||
+---------------------+
|
||||
| 1 byte licence type |
|
||||
+---------------------+
|
||||
|
||||
|
||||
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
|
||||
- PROTMESSID_OPUS_SUPPORTED: Informs that OPUS codec is supported
|
||||
|
||||
|
@ -553,6 +560,10 @@ case PROTMESSID_CHANNEL_NAME:
|
|||
bRet = EvaluateReqNetwTranspPropsMes();
|
||||
break;
|
||||
|
||||
case PROTMESSID_LICENCE_REQUIRED:
|
||||
bRet = EvaluateLicenceRequiredMes ( vecbyMesBodyData );
|
||||
break;
|
||||
|
||||
// #### COMPATIBILITY OLD VERSION, TO BE REMOVED ####
|
||||
#ifdef USE_LEGACY_CELT
|
||||
case PROTMESSID_OPUS_SUPPORTED:
|
||||
|
@ -1323,6 +1334,42 @@ bool CProtocol::EvaluateReqNetwTranspPropsMes()
|
|||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateLicenceRequiredMes ( const ELicenceType eLicenceType )
|
||||
{
|
||||
CVector<uint8_t> vecData ( 1 ); // 1 bytes of data
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// build data vector
|
||||
PutValOnStream ( vecData, iPos, static_cast<uint32_t> ( eLicenceType ), 1 );
|
||||
|
||||
CreateAndSendMessage ( PROTMESSID_LICENCE_REQUIRED, vecData );
|
||||
}
|
||||
|
||||
bool CProtocol::EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData )
|
||||
{
|
||||
int iPos = 0; // init position pointer
|
||||
|
||||
// check size
|
||||
if ( vecData.Size() != 1 )
|
||||
{
|
||||
return true; // return error code
|
||||
}
|
||||
|
||||
// extract licence type
|
||||
const ELicenceType eLicenceType =
|
||||
static_cast<ELicenceType> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
|
||||
if ( eLicenceType != LT_CREATIVECOMMONS )
|
||||
{
|
||||
return true; // return error code
|
||||
}
|
||||
|
||||
// invoke message action
|
||||
emit LicenceRequired ( eLicenceType );
|
||||
|
||||
return false; // no error
|
||||
}
|
||||
|
||||
void CProtocol::CreateOpusSupportedMes()
|
||||
{
|
||||
CreateAndSendMessage ( PROTMESSID_OPUS_SUPPORTED,
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#define PROTMESSID_CONN_CLIENTS_LIST 24 // channel infos for connected clients
|
||||
#define PROTMESSID_CHANNEL_INFOS 25 // set channel infos
|
||||
#define PROTMESSID_OPUS_SUPPORTED 26 // tells that OPUS codec is supported
|
||||
#define PROTMESSID_LICENCE_REQUIRED 27 // licence required
|
||||
|
||||
// message IDs of connection less messages (CLM)
|
||||
// DEFINITION -> start at 1000, end at 1999, see IsConnectionLessMessageID
|
||||
|
@ -100,6 +101,7 @@ public:
|
|||
void CreateChatTextMes ( const QString strChatText );
|
||||
void CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrProps );
|
||||
void CreateReqNetwTranspPropsMes();
|
||||
void CreateLicenceRequiredMes ( const ELicenceType eLicenceType );
|
||||
void CreateOpusSupportedMes();
|
||||
|
||||
void CreateCLPingMes ( const CHostAddress& InetAddr, const int iMs );
|
||||
|
@ -213,6 +215,7 @@ protected:
|
|||
bool EvaluateChatTextMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData );
|
||||
bool EvaluateReqNetwTranspPropsMes();
|
||||
bool EvaluateLicenceRequiredMes ( const CVector<uint8_t>& vecData );
|
||||
#ifdef USE_LEGACY_CELT
|
||||
bool EvaluateOpusSupportedMes();
|
||||
#endif
|
||||
|
@ -269,6 +272,7 @@ signals:
|
|||
void ChatTextReceived ( QString strChatText );
|
||||
void NetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps );
|
||||
void ReqNetTranspProps();
|
||||
void LicenceRequired ( ELicenceType eLicenceType );
|
||||
|
||||
void CLPingReceived ( CHostAddress InetAddr,
|
||||
int iMs );
|
||||
|
|
Loading…
Reference in a new issue