From bb2ba50589f4f2598601db92c9611bff63ef46e4 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 16 Oct 2012 00:58:49 +0000 Subject: [PATCH] - attempt to let user know when host does not have data port open --- .../menu/menu_state_connected_game.cpp | 27 +++++++++++++++++++ .../include/platform/posix/miniftpclient.h | 3 ++- .../sources/platform/posix/miniftpclient.cpp | 7 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index 1a36eaf0..3b3b5069 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -3749,6 +3749,15 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, sprintf(szMsg,"Player: %s FAILED to download the map: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version); } clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + + if(result.first == ftp_crt_HOST_NOT_ACCEPTING) { + if(lang.hasString("HostNotAcceptingDataConnections",languageList[i]) == true) { + clientInterface->sendTextMessage(lang.get("DataMissingMapFailDownload",languageList[i]),-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + else { + clientInterface->sendTextMessage("*Warning* the host is not accepting data connections.",-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + } } console.addLine(result.second,true); @@ -3823,6 +3832,15 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, sprintf(szMsg,"Player: %s FAILED to download the tileset: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version); } clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + + if(result.first == ftp_crt_HOST_NOT_ACCEPTING) { + if(lang.hasString("HostNotAcceptingDataConnections",languageList[i]) == true) { + clientInterface->sendTextMessage(lang.get("DataMissingMapFailDownload",languageList[i]),-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + else { + clientInterface->sendTextMessage("*Warning* the host is not accepting data connections.",-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + } } console.addLine(result.second,true); @@ -3899,6 +3917,15 @@ void MenuStateConnectedGame::FTPClient_CallbackEvent(string itemName, sprintf(szMsg,"Player: %s FAILED to download the techtree: [%s] using CURL version [%s]",getHumanPlayerName().c_str(),itemName.c_str(),curlVersion->version); } clientInterface->sendTextMessage(szMsg,-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + + if(result.first == ftp_crt_HOST_NOT_ACCEPTING) { + if(lang.hasString("HostNotAcceptingDataConnections",languageList[i]) == true) { + clientInterface->sendTextMessage(lang.get("DataMissingMapFailDownload",languageList[i]),-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + else { + clientInterface->sendTextMessage("*Warning* the host is not accepting data connections.",-1, lang.isLanguageLocal(languageList[i]),languageList[i]); + } + } } console.addLine(result.second,true); diff --git a/source/shared_lib/include/platform/posix/miniftpclient.h b/source/shared_lib/include/platform/posix/miniftpclient.h index abde42b4..e631d289 100644 --- a/source/shared_lib/include/platform/posix/miniftpclient.h +++ b/source/shared_lib/include/platform/posix/miniftpclient.h @@ -30,7 +30,8 @@ enum FTP_Client_ResultType { ftp_crt_SUCCESS = 0, ftp_crt_PARTIALFAIL = 1, ftp_crt_FAIL = 2, - ftp_crt_ABORTED = 3 + ftp_crt_ABORTED = 3, + ftp_crt_HOST_NOT_ACCEPTING = 4 }; enum FTP_Client_CallbackType { diff --git a/source/shared_lib/sources/platform/posix/miniftpclient.cpp b/source/shared_lib/sources/platform/posix/miniftpclient.cpp index fd105e40..980172c9 100644 --- a/source/shared_lib/sources/platform/posix/miniftpclient.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpclient.cpp @@ -338,6 +338,9 @@ pair FTPClientThread::getMapFromServer(pair FTPClientThread::getFileFromServer(FTP_Clien if(res == CURLE_PARTIAL_FILE || ftpfile.isValidXfer == true) { result.first = ftp_crt_PARTIALFAIL; } + else if(res == CURLE_COULDNT_CONNECT) { + result.first = ftp_crt_HOST_NOT_ACCEPTING; + } + if(destRootFolder != "") { if(pathCreated == true) {