diff --git a/src/protocol.cpp b/src/protocol.cpp index 145d5afc..5061fb88 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -2375,10 +2375,18 @@ bool CProtocol::EvaluateCLRegisterServerResp ( const CHostAddress& InetAddr, return true; } - ESvrRegResult eResult = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + // server registration result (1 byte) + const int iSvrRegResult = static_cast ( GetValFromStream ( vecData, iPos, 1 ) ); + + if ( ( iSvrRegResult != SRR_REGISTERED ) && + ( iSvrRegResult != SRR_CENTRAL_SVR_FULL ) && + ( iSvrRegResult != SRR_VERSION_TOO_OLD ) ) + { + return true; + } // invoke message action - emit CLRegisterServerResp ( InetAddr, eResult ); + emit CLRegisterServerResp ( InetAddr, static_cast ( iSvrRegResult ) ); return false; // no error } diff --git a/src/serverdlg.cpp b/src/serverdlg.cpp index 9a829dea..f6da4168 100755 --- a/src/serverdlg.cpp +++ b/src/serverdlg.cpp @@ -636,6 +636,7 @@ void CServerDlg::UpdateGUIDependencies() case SRS_BAD_ADDRESS: case SRS_TIME_OUT: case SRS_CENTRAL_SVR_FULL: + case SRS_VERSION_TOO_OLD: strStatus = "" + strStatus + ""; break; diff --git a/src/serverlist.cpp b/src/serverlist.cpp index b2a542b1..b6d51e88 100755 --- a/src/serverlist.cpp +++ b/src/serverlist.cpp @@ -511,6 +511,10 @@ void CServerListManager::StoreRegistrationResult ( ESvrRegResult eResult ) SetSvrRegStatus ( ESvrRegStatus::SRS_CENTRAL_SVR_FULL ); break; + case ESvrRegResult::SRR_VERSION_TOO_OLD: + SetSvrRegStatus ( ESvrRegStatus::SRS_VERSION_TOO_OLD ); + break; + default: SetSvrRegStatus ( ESvrRegStatus::SRS_UNKNOWN_RESP ); break; diff --git a/src/util.h b/src/util.h index 71e5babf..906fa541 100755 --- a/src/util.h +++ b/src/util.h @@ -569,6 +569,7 @@ enum ELicenceType // Server jam recorder state enum ---------------------------------------------- enum ERecorderState { + // used for protocol -> enum values must be fixed! RS_UNDEFINED = 0, RS_NOT_INITIALISED = 1, RS_NOT_ENABLED = 2, @@ -579,8 +580,8 @@ enum ERecorderState // Channel sort type ----------------------------------------------------------- enum EChSortType { - ST_BY_NAME = 0, - ST_BY_INSTRUMENT = 1 + ST_BY_NAME, + ST_BY_INSTRUMENT }; @@ -624,13 +625,14 @@ inline QString csCentServAddrTypeToString ( ECSAddType eAddrType ) // Slave server registration state --------------------------------------------- enum ESvrRegStatus { - SRS_UNREGISTERED = 0, - SRS_BAD_ADDRESS = 1, - SRS_REQUESTED = 2, - SRS_TIME_OUT = 3, - SRS_UNKNOWN_RESP = 4, - SRS_REGISTERED = 5, - SRS_CENTRAL_SVR_FULL = 6 + SRS_UNREGISTERED, + SRS_BAD_ADDRESS, + SRS_REQUESTED, + SRS_TIME_OUT, + SRS_UNKNOWN_RESP, + SRS_REGISTERED, + SRS_CENTRAL_SVR_FULL, + SRS_VERSION_TOO_OLD }; inline QString svrRegStatusToString ( ESvrRegStatus eSvrRegStatus ) @@ -657,6 +659,9 @@ inline QString svrRegStatusToString ( ESvrRegStatus eSvrRegStatus ) case SRS_CENTRAL_SVR_FULL: return QCoreApplication::translate ( "CServerDlg", "Central Server full" ); + + case SRS_VERSION_TOO_OLD: + return QCoreApplication::translate ( "CServerDlg", "Your server version is too old" ); } return QString ( QCoreApplication::translate ( "CServerDlg", "Unknown value " ) ).append ( eSvrRegStatus ); @@ -668,7 +673,8 @@ enum ESvrRegResult { // used for protocol -> enum values must be fixed! SRR_REGISTERED = 0, - SRR_CENTRAL_SVR_FULL = 1 + SRR_CENTRAL_SVR_FULL = 1, + SRR_VERSION_TOO_OLD = 2 };