New error messages.

This commit is contained in:
lotodore
2008-03-06 21:48:14 +00:00
parent e85eb879bb
commit 4bc902b229
7 changed files with 59 additions and 16 deletions
+3
View File
@@ -897,10 +897,13 @@ Error Reason:
0x0007 - Init - Server Maintenance 0x0007 - Init - Server Maintenance
0x0010 - Avatar - Too large 0x0010 - Avatar - Too large
0x0011 - Avatar - Wrong size 0x0011 - Avatar - Wrong size
0x0012 - Avatar - Upload blocked
0x0020 - Join Game - Unknown Game 0x0020 - Join Game - Unknown Game
0xFF01 - General Error - Invalid packet 0xFF01 - General Error - Invalid packet
0xFF02 - General Error - Invalid state 0xFF02 - General Error - Invalid state
0xFF03 - General Error - Kicked from the server 0xFF03 - General Error - Kicked from the server
0xFF04 - General Error - Banned from the server
0xFF05 - General Error - Session timeout
0xFFFF - Other reason 0xFFFF - Other reason
+17
View File
@@ -3214,6 +3214,18 @@ void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
tr("You were kicked from the server."), tr("You were kicked from the server."),
QMessageBox::Close); } QMessageBox::Close); }
break; break;
case ERR_NET_PLAYER_BANNED:
{ mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"),
tr("You were temporarily banned from the server."),
QMessageBox::Close); }
break;
case ERR_NET_SESSION_TIMED_OUT:
{ mySession->terminateNetworkClient();
QMessageBox::warning(this, tr("Network Error"),
tr("Your server connection timed out due to inactivity. You are very welcome to reconnect!"),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_PLAYER_COUNT: case ERR_NET_INVALID_PLAYER_COUNT:
{ QMessageBox::warning(this, tr("Network Error"), { QMessageBox::warning(this, tr("Network Error"),
tr("The client player count is invalid."), tr("The client player count is invalid."),
@@ -3235,6 +3247,11 @@ void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
tr("The selected avatar file is too large. Please choose a different avatar."), tr("The selected avatar file is too large. Please choose a different avatar."),
QMessageBox::Close); } QMessageBox::Close); }
break; break;
case ERR_NET_AVATAR_UPLOAD_BLOCKED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("You cannot upload a new avatar file at this time. Please try again in a few seconds."),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_REQUEST_ID: case ERR_NET_INVALID_REQUEST_ID:
{ QMessageBox::warning(this, tr("Network Error"), { QMessageBox::warning(this, tr("Network Error"),
tr("An internal avatar error occured. Please report this to an admin in the lobby chat."), tr("An internal avatar error occured. Please report this to an admin in the lobby chat."),
@@ -48,13 +48,12 @@ void timeoutMsgBoxImpl::timerRefresh() {
if (sec < 0) sec = 0; if (sec < 0) sec = 0;
switch (msgID) { switch (msgID) {
case NETWORK_TIMEOUT_GAME_ADMIN_IDLE: case NETWORK_TIMEOUT_GAME_ADMIN_IDLE:
this->setText(tr("Your open game reaches timeout in %1 seconds.").arg(sec,0,10)); this->setText(tr("Your open game will time out in %1 seconds.").arg(sec,0,10));
break; break;
default: default:
this->setText(tr("Your connection is about to time out due to inactivity in %1 seconds.").arg(sec,0,10)); this->setText(tr("Your connection is about to time out due to inactivity in %1 seconds.").arg(sec,0,10));
break; break;
} }
} }
void timeoutMsgBoxImpl::stopTimeout() { void timeoutMsgBoxImpl::stopTimeout() {
+21
View File
@@ -114,10 +114,13 @@ using namespace std;
#define NET_ERR_INIT_SERVER_MAINTENANCE 0x0007 #define NET_ERR_INIT_SERVER_MAINTENANCE 0x0007
#define NET_ERR_AVATAR_TOO_LARGE 0x0010 #define NET_ERR_AVATAR_TOO_LARGE 0x0010
#define NET_ERR_AVATAR_WRONG_SIZE 0x0011 #define NET_ERR_AVATAR_WRONG_SIZE 0x0011
#define NET_ERR_AVATAR_UPLOAD_BLOCKED 0x0012
#define NET_ERR_JOIN_GAME_UNKNOWN_GAME 0x0020 #define NET_ERR_JOIN_GAME_UNKNOWN_GAME 0x0020
#define NET_ERR_GENERAL_INVALID_PACKET 0xFF01 #define NET_ERR_GENERAL_INVALID_PACKET 0xFF01
#define NET_ERR_GENERAL_INVALID_STATE 0xFF02 #define NET_ERR_GENERAL_INVALID_STATE 0xFF02
#define NET_ERR_GENERAL_PLAYER_KICKED 0xFF03 #define NET_ERR_GENERAL_PLAYER_KICKED 0xFF03
#define NET_ERR_GENERAL_PLAYER_BANNED 0xFF04
#define NET_ERR_GENERAL_SESSION_TIMED_OUT 0xFF05
#define NET_ERR_OTHER 0xFFFF #define NET_ERR_OTHER 0xFFFF
// Statistics types // Statistics types
@@ -4663,6 +4666,9 @@ NetPacketError::SetData(const NetPacketError::Data &inData)
case ERR_NET_WRONG_AVATAR_SIZE : case ERR_NET_WRONG_AVATAR_SIZE :
tmpData->errorReason = htons(NET_ERR_AVATAR_WRONG_SIZE); tmpData->errorReason = htons(NET_ERR_AVATAR_WRONG_SIZE);
break; break;
case ERR_NET_AVATAR_UPLOAD_BLOCKED :
tmpData->errorReason = htons(NET_ERR_AVATAR_UPLOAD_BLOCKED);
break;
case ERR_NET_UNKNOWN_GAME : case ERR_NET_UNKNOWN_GAME :
tmpData->errorReason = htons(NET_ERR_JOIN_GAME_UNKNOWN_GAME); tmpData->errorReason = htons(NET_ERR_JOIN_GAME_UNKNOWN_GAME);
break; break;
@@ -4677,6 +4683,12 @@ NetPacketError::SetData(const NetPacketError::Data &inData)
case ERR_NET_PLAYER_KICKED : case ERR_NET_PLAYER_KICKED :
tmpData->errorReason = htons(NET_ERR_GENERAL_PLAYER_KICKED); tmpData->errorReason = htons(NET_ERR_GENERAL_PLAYER_KICKED);
break; break;
case ERR_NET_PLAYER_BANNED :
tmpData->errorReason = htons(NET_ERR_GENERAL_PLAYER_BANNED);
break;
case ERR_NET_SESSION_TIMED_OUT :
tmpData->errorReason = htons(NET_ERR_GENERAL_SESSION_TIMED_OUT);
break;
default : default :
tmpData->errorReason = htons(NET_ERR_OTHER); tmpData->errorReason = htons(NET_ERR_OTHER);
break; break;
@@ -4718,6 +4730,9 @@ NetPacketError::GetData(NetPacketError::Data &outData) const
case NET_ERR_AVATAR_WRONG_SIZE : case NET_ERR_AVATAR_WRONG_SIZE :
outData.errorCode = ERR_NET_WRONG_AVATAR_SIZE; outData.errorCode = ERR_NET_WRONG_AVATAR_SIZE;
break; break;
case NET_ERR_AVATAR_UPLOAD_BLOCKED :
outData.errorCode = ERR_NET_AVATAR_UPLOAD_BLOCKED;
break;
case NET_ERR_JOIN_GAME_UNKNOWN_GAME : case NET_ERR_JOIN_GAME_UNKNOWN_GAME :
outData.errorCode = ERR_NET_UNKNOWN_GAME; outData.errorCode = ERR_NET_UNKNOWN_GAME;
break; break;
@@ -4732,6 +4747,12 @@ NetPacketError::GetData(NetPacketError::Data &outData) const
case NET_ERR_GENERAL_PLAYER_KICKED : case NET_ERR_GENERAL_PLAYER_KICKED :
outData.errorCode = ERR_NET_PLAYER_KICKED; outData.errorCode = ERR_NET_PLAYER_KICKED;
break; break;
case NET_ERR_GENERAL_PLAYER_BANNED :
outData.errorCode = ERR_NET_PLAYER_BANNED;
break;
case NET_ERR_GENERAL_SESSION_TIMED_OUT :
outData.errorCode = ERR_NET_SESSION_TIMED_OUT;
break;
default : default :
outData.errorCode = ERR_SOCK_INTERNAL; outData.errorCode = ERR_SOCK_INTERNAL;
break; break;
+1 -1
View File
@@ -340,7 +340,7 @@ ServerGameStateInit::Process(ServerGameThread &server)
SessionWrapper session = server.GetSessionManager().GetSessionByUniquePlayerId(server.GetAdminPlayerId()); SessionWrapper session = server.GetSessionManager().GetSessionByUniquePlayerId(server.GetAdminPlayerId());
if (session.sessionData.get()) if (session.sessionData.get())
{ {
server.RemovePlayer(session.playerData->GetUniqueId(), ERR_NET_PLAYER_KICKED); // TODO use proper error code. server.RemovePlayer(session.playerData->GetUniqueId(), ERR_NET_SESSION_TIMED_OUT);
} }
} }
return AbstractServerGameStateReceiving::Process(server); return AbstractServerGameStateReceiving::Process(server);
+2 -2
View File
@@ -469,7 +469,7 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const NetPacketIn
avatarRecentlyRequested = true; avatarRecentlyRequested = true;
} }
if (avatarRecentlyRequested) if (avatarRecentlyRequested)
SessionError(session, ERR_NET_INVALID_AVATAR_FILE); SessionError(session, ERR_NET_AVATAR_UPLOAD_BLOCKED);
else else
RequestPlayerAvatar(session); RequestPlayerAvatar(session);
} }
@@ -1014,7 +1014,7 @@ ServerLobbyThread::InternalCheckSessionTimeouts(SessionWrapper session)
} }
} }
if (closeSession) if (closeSession)
RemovePlayer(session.playerData->GetUniqueId(), ERR_NET_PLAYER_KICKED); // TODO new error code RemovePlayer(session.playerData->GetUniqueId(), ERR_NET_SESSION_TIMED_OUT);
} }
void void
+14 -11
View File
@@ -60,17 +60,20 @@
#define ERR_NET_NO_CURRENT_PLAYER 116 #define ERR_NET_NO_CURRENT_PLAYER 116
#define ERR_NET_PLAYER_NOT_ACTIVE 117 #define ERR_NET_PLAYER_NOT_ACTIVE 117
#define ERR_NET_PLAYER_KICKED 118 #define ERR_NET_PLAYER_KICKED 118
#define ERR_NET_INVALID_PLAYER_COUNT 119 #define ERR_NET_PLAYER_BANNED 119
#define ERR_NET_TOO_MANY_MANUAL_BLINDS 120 #define ERR_NET_SESSION_TIMED_OUT 120
#define ERR_NET_INVALID_AVATAR_FILE 121 #define ERR_NET_INVALID_PLAYER_COUNT 121
#define ERR_NET_AVATAR_TOO_LARGE 122 #define ERR_NET_TOO_MANY_MANUAL_BLINDS 122
#define ERR_NET_BUF_INVALID_SIZE 123 #define ERR_NET_INVALID_AVATAR_FILE 123
#define ERR_NET_INVALID_REQUEST_ID 124 #define ERR_NET_AVATAR_TOO_LARGE 124
#define ERR_NET_WRONG_AVATAR_SIZE 125 #define ERR_NET_BUF_INVALID_SIZE 125
#define ERR_NET_START_TIMEOUT 126 #define ERR_NET_INVALID_REQUEST_ID 126
#define ERR_NET_GAME_TERMINATION_FAILED 127 #define ERR_NET_WRONG_AVATAR_SIZE 127
#define ERR_NET_INTERNAL_GAME_ERROR 128 #define ERR_NET_START_TIMEOUT 128
#define ERR_NET_DEALER_NOT_FOUND 129 #define ERR_NET_GAME_TERMINATION_FAILED 129
#define ERR_NET_INTERNAL_GAME_ERROR 130
#define ERR_NET_DEALER_NOT_FOUND 131
#define ERR_NET_AVATAR_UPLOAD_BLOCKED 132
#define ERR_IRC_INTERNAL 151 #define ERR_IRC_INTERNAL 151
#define ERR_IRC_CONNECT_FAILED 152 #define ERR_IRC_CONNECT_FAILED 152