diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index c14632a0a..3d2cefe60 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -324,13 +324,19 @@ IF(WITH_QT5)
ENDIF()
# freetype is needed since Qt 5.5
- IF(UNIX)
- SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
- ELSEIF(WIN32)
- SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib")
- ENDIF()
- IF(EXISTS ${FREETYPE_LIB})
- SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB})
+ FIND_PACKAGE(FreeType)
+
+ IF(FREETYPE_FOUND)
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES})
+ ELSE()
+ IF(UNIX)
+ SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
+ ELSEIF(WIN32)
+ SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib")
+ ENDIF()
+ IF(EXISTS ${FREETYPE_LIB})
+ SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB})
+ ENDIF()
ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
@@ -344,7 +350,8 @@ IF(WITH_QT5)
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Crypt32.lib
- ${WINSDK_LIBRARY_DIR}/WS2_32.Lib)
+ ${WINSDK_LIBRARY_DIR}/WS2_32.Lib
+ ${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib)
ENDIF()
# Core
diff --git a/code/CMakeModules/FindLuabind.cmake b/code/CMakeModules/FindLuabind.cmake
index 64fd5e1cf..c21d64e4f 100644
--- a/code/CMakeModules/FindLuabind.cmake
+++ b/code/CMakeModules/FindLuabind.cmake
@@ -124,7 +124,7 @@ IF(WITH_LUA51)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua51d)
- ENDIF(WITH_STLPORT)
+ ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua51)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua51d)
@@ -134,7 +134,7 @@ IF(WITH_LUA50)
IF(WITH_STLPORT)
LIST(APPEND LIBRARY_NAME_RELEASE luabind_stlport_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_stlport_lua50d)
- ENDIF(WITH_STLPORT)
+ ENDIF()
LIST(APPEND LIBRARY_NAME_RELEASE luabind_lua50)
LIST(APPEND LIBRARY_NAME_DEBUG luabind_lua50d)
@@ -195,7 +195,7 @@ IF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
SET(LUABIND_FOUND TRUE)
SET(LUABIND_LIBRARIES ${LUABIND_LIBRARY_DEBUG})
ENDIF(LUABIND_LIBRARY_RELEASE AND LUABIND_LIBRARY_DEBUG)
-ENDIF(LUABIND_INCLUDE_DIR AND Boost_INCLUDE_DIR)
+ENDIF()
IF(LUABIND_FOUND)
SET(LUABIND_INCLUDE_DIR ${LUABIND_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
@@ -203,17 +203,17 @@ IF(LUABIND_FOUND)
FIND_FILE(LUABIND_VERSION_FILE luabind/version.hpp PATHS ${LUABIND_INCLUDE_DIR})
IF(LUABIND_VERSION_FILE)
SET(LUABIND_DEFINITIONS "-DHAVE_LUABIND_VERSION")
- ENDIF(LUABIND_VERSION_FILE)
+ ENDIF()
FIND_CORRECT_LUA_VERSION()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Found Luabind: ${LUABIND_LIBRARIES}")
ENDIF(NOT Luabind_FIND_QUIETLY)
-ELSE(LUABIND_FOUND)
+ELSE()
IF(NOT Luabind_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find Luabind!")
- ENDIF(NOT Luabind_FIND_QUIETLY)
+ ENDIF()
ENDIF(LUABIND_FOUND)
MARK_AS_ADVANCED(LUABIND_LIBRARY_RELEASE LUABIND_LIBRARY_DEBUG Boost_LIB_DIAGNOSTIC_DEFINITIONS)
diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake
index 3995dcbf8..51ffaf950 100644
--- a/code/CMakeModules/nel.cmake
+++ b/code/CMakeModules/nel.cmake
@@ -533,31 +533,31 @@ MACRO(NL_SETUP_BUILD)
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC12)
- ADD_PLATFORM_FLAGS("/Gy- /MP")
+ ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000")
# /Ox is working with VC++ 2013, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC11)
- ADD_PLATFORM_FLAGS("/Gy- /MP")
+ ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000")
# /Ox is working with VC++ 2012, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC10)
- ADD_PLATFORM_FLAGS("/Gy- /MP")
+ ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000")
# /Ox is working with VC++ 2010, but custom optimizations don't exist
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Od /Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC90)
- ADD_PLATFORM_FLAGS("/Gy- /MP")
+ ADD_PLATFORM_FLAGS("/Gy- /MP /Zm1000")
# don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ob2 /Oi /Ot /Oy /GT /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
SET(DEBUG_CFLAGS "/Ob1 /GF- ${DEBUG_CFLAGS}")
ELSEIF(MSVC80)
- ADD_PLATFORM_FLAGS("/Gy- /Wp64")
+ ADD_PLATFORM_FLAGS("/Gy- /Wp64 /Zm1000")
# don't use a /O[012x] flag if you want custom optimizations
SET(RELEASE_CFLAGS "/Ox /GF /GS- ${RELEASE_CFLAGS}")
# without inlining it's unusable, use custom optimizations again
@@ -566,7 +566,7 @@ MACRO(NL_SETUP_BUILD)
MESSAGE(FATAL_ERROR "Can't determine compiler version ${MSVC_VERSION}")
ENDIF(MSVC14)
- ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /Zm1000 /wd4250")
+ ADD_PLATFORM_FLAGS("/D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /DWIN32 /D_WINDOWS /wd4250")
IF(TARGET_X64)
# Fix a bug with Intellisense
diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp
index ad5bb04b9..2b7fa8fa9 100644
--- a/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp
+++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_vertex.cpp
@@ -125,7 +125,7 @@ uint8 *CVBDrvInfosD3D::lock (uint begin, uint end, bool readOnly)
}
else
{
- nlinfo("Buffer %s at %x is Locked", (*it)->VertexBufferPtr->getName().c_str(), (int) *it);
+ nlinfo("Buffer %s at %p is Locked", (*it)->VertexBufferPtr->getName().c_str(), *it);
}
}
}
diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp
index 2c225b3ce..30dd3ec3f 100644
--- a/code/nel/src/gui/group_html.cpp
+++ b/code/nel/src/gui/group_html.cpp
@@ -50,8 +50,8 @@ using namespace std;
using namespace NLMISC;
-// Default timeout to connect a server
-#define DEFAULT_RYZOM_CONNECTION_TIMEOUT (30.0)
+// Default maximum time the request is allowed to take
+#define DEFAULT_RYZOM_CONNECTION_TIMEOUT (300.0)
// Allow up to 10 redirects, then give up
#define DEFAULT_RYZOM_REDIRECT_LIMIT (10)
//
@@ -1166,7 +1166,7 @@ namespace NLGUI
pos = toLower(content).find("url=");
if (pos != string::npos)
- _RefreshUrl = content.substr(pos + 4);
+ _RefreshUrl = getAbsoluteUrl(content.substr(pos + 4));
}
_NextRefreshTime += timeSec;
diff --git a/code/nel/src/gui/url_parser.cpp b/code/nel/src/gui/url_parser.cpp
index 68d4f8496..7369289f2 100644
--- a/code/nel/src/gui/url_parser.cpp
+++ b/code/nel/src/gui/url_parser.cpp
@@ -78,7 +78,7 @@ namespace NLGUI
pos = uri.find("?");
if (pos != npos)
{
- query = uri.substr(pos + 1);
+ query = uri.substr(pos);
uri = uri.substr(0, pos);
}
@@ -210,7 +210,9 @@ namespace NLGUI
result += path;
if (!query.empty())
- result += "?" + query;
+ if (query.find_first_of("?") != 0)
+ result += "?";
+ result += query;
if (!hash.empty())
result += "#" + hash;
diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp
index 37a115965..f866594c9 100644
--- a/code/nel/src/gui/widget_manager.cpp
+++ b/code/nel/src/gui/widget_manager.cpp
@@ -1258,7 +1258,7 @@ namespace NLGUI
getWindowForActiveMasterGroup(newCtrl->getContextHelpWindowName());
uint32 _ScreenH, _ScreenW;
- CViewRenderer::getInstance()->getScreenSize( _ScreenH, _ScreenW );
+ CViewRenderer::getInstance()->getScreenSize( _ScreenW, _ScreenH );
if(ttPosRef==Hotspot_TTAuto || ttParentRef==Hotspot_TTAuto)
{
diff --git a/code/nel/src/logic/logic_state.cpp b/code/nel/src/logic/logic_state.cpp
index 3259a5ebb..9e943c7ce 100644
--- a/code/nel/src/logic/logic_state.cpp
+++ b/code/nel/src/logic/logic_state.cpp
@@ -15,6 +15,7 @@
// along with this program. If not, see .
+#include "stdlogic.h"
#include "nel/logic/logic_state.h"
#include "nel/logic/logic_state_machine.h"
diff --git a/code/nel/src/misc/cmd_args.cpp b/code/nel/src/misc/cmd_args.cpp
index 65aae5769..d9370b831 100644
--- a/code/nel/src/misc/cmd_args.cpp
+++ b/code/nel/src/misc/cmd_args.cpp
@@ -220,6 +220,11 @@ bool CCmdArgs::parse(int argc, char **argv)
for(sint i = 0; i < argc; ++i)
{
+#ifdef NL_OS_MAC
+ // get rid of -psn_* arguments under OS X
+ if (strncmp(argv[i], "-psn_", 5) == 0) continue;
+#endif
+
args.push_back(argv[i]);
}
@@ -245,7 +250,7 @@ bool CCmdArgs::parse(const std::vector &argv)
uint argc = argv.size();
// process each argument
- for (sint i = 1; i < argc; i++)
+ for (uint i = 1; i < argc; i++)
{
std::string name = argv[i];
diff --git a/code/nel/src/sound/sound_bank.cpp b/code/nel/src/sound/sound_bank.cpp
index 6421e722b..59330f3f8 100644
--- a/code/nel/src/sound/sound_bank.cpp
+++ b/code/nel/src/sound/sound_bank.cpp
@@ -363,7 +363,7 @@ CSound* CSoundBank::getSound(const NLMISC::CSheetId &sheetId)
if (sheetId.getShortId() >= _Sounds.size())
{
std::string sheetName = sheetId.toString();
- nlwarning("NLSOUND: Sound sheet id '%s' exceeds loaded sound sheets", sheetName.c_str());
+ nldebug("NLSOUND: Sound sheet id '%s' exceeds loaded sound sheets", sheetName.c_str());
return NULL;
}
diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml
index c6f08c3b2..51bc04178 100644
--- a/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml
+++ b/code/ryzom/client/data/gamedev/interfaces_v3/appzone.xml
@@ -212,7 +212,6 @@
background_bitmap_view=""
home=""
browse_next_time="false"
- timeout="5"
form_text_area_group="edit_box_widget_multiline">
+
+
+
+
+
+
+
+
+
@@ -44,6 +53,83 @@
onclick_l="proc"
params_l="inv_left_click_on_slot"
auto_grayed="false" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
= current_quantity then
webig:deleteItem(db..":"..ctrl)
else
- addDbProp(db..":"..ctrl..":QUANTITY", current_quantity-new_quantity)
+ addDbProp(db..":"..ctrl..":QUANTITY", new_quantity)
end
end
diff --git a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
index b806edb8d..5234846f1 100644
--- a/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
+++ b/code/ryzom/client/data/gamedev/interfaces_v3/widgets.xml
@@ -6977,8 +6977,7 @@
form_text_area_group="edit_box_widget_multiline"
browse_refresh="#browse_refresh"
browse_undo="#browse_undo"
- browse_redo="#browse_redo"
- timeout="10">
+ browse_redo="#browse_redo">
displaySystemInfo(msg, "AROUND");
return true;
}
+
+NLMISC_COMMAND(playedTime, "Display character played time", "")
+{
+ ucstring msg = CI18N::get("uiPlayedTime");
+ strFindReplace(msg, "%time", NLMISC::secondsToHumanReadable(CharPlayedTime));
+ CInterfaceManager::getInstance()->displaySystemInfo(msg, "AROUND");
+ return true;
+}
diff --git a/code/ryzom/client/src/far_tp.cpp b/code/ryzom/client/src/far_tp.cpp
index 48b2eea61..ba85862b6 100644
--- a/code/ryzom/client/src/far_tp.cpp
+++ b/code/ryzom/client/src/far_tp.cpp
@@ -569,7 +569,7 @@ void CLoginStateMachine::run()
break;
case st_disconnect:
// Far TP part 2: disconnect from the FS and unload shard-specific data (called from farTPmainLoop())
- FarTP.disconnectFromPreviousShard();
+ // FarTP.disconnectFromPreviousShard();
SM_BEGIN_EVENT_TABLE
SM_EVENT(ev_connect, st_reconnect_fs);
@@ -1406,6 +1406,9 @@ void CFarTP::farTPmainLoop()
{
ConnectionReadySent = false;
LoginSM.pushEvent(CLoginStateMachine::ev_far_tp_main_loop_entered);
+
+ disconnectFromPreviousShard();
+
uint nbRecoSelectCharReceived = 0;
bool welcomeWindow = true;
diff --git a/code/ryzom/client/src/http_client_curl.cpp b/code/ryzom/client/src/http_client_curl.cpp
index 5056815d2..e19a435c9 100644
--- a/code/ryzom/client/src/http_client_curl.cpp
+++ b/code/ryzom/client/src/http_client_curl.cpp
@@ -20,6 +20,7 @@
#include
#include
+#include
using namespace NLMISC;
using namespace NLNET;
@@ -62,11 +63,11 @@ bool CCurlHttpClient::authenticate(const std::string &user, const std::string &p
const char *CAFilename = "ssl_ca_cert.pem"; // this is the certificate "Thawte Server CA"
// ***************************************************************************
-static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
+static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm */)
{
// look for certificate in search paths
string path = CPath::lookup(CAFilename);
- nldebug("Cert path '%s'", path.c_str());
+ nlinfo("Cert path '%s'", path.c_str());
if (path.empty())
{
@@ -91,6 +92,8 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
// get a BIO
BIO *bio = BIO_new_mem_buf(&buffer[0], file.getFileSize());
+
+ char errorBuffer[1024];
if (bio)
{
@@ -108,13 +111,24 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
{
X509_INFO *itmp = sk_X509_INFO_value(info, i);
- if (itmp->x509)
+ if (itmp && itmp->x509)
{
// add our certificate to this store
if (X509_STORE_add_cert(store, itmp->x509) == 0)
{
- nlwarning("Error adding certificate");
- res = CURLE_SSL_CACERT;
+ uint errCode = ERR_get_error();
+
+ // ignore already in hash table errors
+ if (ERR_GET_LIB(errCode) != ERR_LIB_X509 || ERR_GET_REASON(errCode) != X509_R_CERT_ALREADY_IN_HASH_TABLE)
+ {
+ ERR_error_string_n(errCode, errorBuffer, 1024);
+ nlwarning("Error adding certificate %s: %s", itmp->x509->name, errorBuffer);
+ res = CURLE_SSL_CACERT;
+ }
+ }
+ else
+ {
+ nlinfo("Added certificate %s", itmp->x509->name);
}
}
}
@@ -175,7 +189,7 @@ bool CCurlHttpClient::sendRequest(const std::string& methodWB, const std::string
}
// Set POST params
- if ((methodWB == "POST ") && (!postParams.empty()))
+ if ((methodWB == "POST") && (!postParams.empty()))
{
curl_easy_setopt(_Curl, CURLOPT_POSTFIELDS, postParams.c_str());
}
@@ -221,25 +235,25 @@ void CCurlHttpClient::pushReceivedData(uint8 *buffer, uint size)
// ***************************************************************************
bool CCurlHttpClient::sendGet(const string &url, const string& params, bool verbose)
{
- return sendRequest("GET ", url + (params.empty() ? "" : ("?" + params)), string(), string(), string(), verbose);
+ return sendRequest("GET", url + (params.empty() ? "" : ("?" + params)), string(), string(), string(), verbose);
}
// ***************************************************************************
bool CCurlHttpClient::sendGetWithCookie(const string &url, const string &name, const string &value, const string& params, bool verbose)
{
- return sendRequest("GET ", url + (params.empty() ? "" : ("?" + params)), name, value, string(), verbose);
+ return sendRequest("GET", url + (params.empty() ? "" : ("?" + params)), name, value, string(), verbose);
}
// ***************************************************************************
bool CCurlHttpClient::sendPost(const string &url, const string& params, bool verbose)
{
- return sendRequest("POST ", url, string(), string(), params, verbose);
+ return sendRequest("POST", url, string(), string(), params, verbose);
}
// ***************************************************************************
bool CCurlHttpClient::sendPostWithCookie(const string &url, const string &name, const string &value, const string& params, bool verbose)
{
- return sendRequest("POST ", url, name, value, params, verbose);
+ return sendRequest("POST", url, name, value, params, verbose);
}
// ***************************************************************************
@@ -247,11 +261,11 @@ bool CCurlHttpClient::receive(string &res, bool verbose)
{
if (verbose)
{
- nldebug("Receiving %u bytes", _ReceiveBuffer.size());
+ nldebug("Receiving %u bytes", (uint)_ReceiveBuffer.size());
}
res.clear();
- if (_ReceiveBuffer.size())
+ if (!_ReceiveBuffer.empty())
res.assign((const char*)&(*(_ReceiveBuffer.begin())), _ReceiveBuffer.size());
_ReceiveBuffer.clear();
return true;
diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp
index 4d2248249..fab67d55e 100644
--- a/code/ryzom/client/src/interface_v3/interface_manager.cpp
+++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp
@@ -1826,7 +1826,8 @@ bool CInterfaceManager::saveConfig (const string &filename)
COFile f;
- if (!f.open(filename)) return false;
+ // using temporary file, so no f.close() unless its a success
+ if (!f.open(filename, false, false, true)) return false;
CInterfaceConfig ic;
@@ -1873,7 +1874,6 @@ bool CInterfaceManager::saveConfig (const string &filename)
{
nlwarning("Config saving failed");
// couldn't save result so do not continue
- f.close();
return false;
}
@@ -1929,14 +1929,14 @@ bool CInterfaceManager::saveConfig (const string &filename)
nlwarning("Bad user dyn chat saving");
return false;
}
+
+ f.close();
}
catch(const NLMISC::EStream &)
{
- f.close();
nlwarning("Config saving failed.");
return false;
}
- f.close();
ContinentMngr.serialFOWMaps();
@@ -2645,7 +2645,8 @@ bool CInterfaceManager::saveKeys(const std::string &filename)
try
{
COFile file;
- if (file.open (filename))
+ // using temporary file, so no file.close() unless its a success
+ if (file.open (filename, false, false, true))
{
COXml xmlStream;
xmlStream.init (&file);
@@ -2675,8 +2676,7 @@ bool CInterfaceManager::saveKeys(const std::string &filename)
}
catch (const Exception &e)
{
- nlwarning ("Error while writing the file %s : %s. Remove it.", filename.c_str(), e.what ());
- CFile::deleteFile(filename);
+ nlwarning ("Error while writing the file %s : %s.", filename.c_str(), e.what ());
}
return ret;
}
diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp
index 987e50dd2..944a212e0 100644
--- a/code/ryzom/client/src/login.cpp
+++ b/code/ryzom/client/src/login.cpp
@@ -2719,8 +2719,10 @@ string checkLogin(const string &login, const string &password, const string &cli
string res;
+ std::string url = ClientCfg.ConfigFile.getVar("StartupHost").asString() + ClientCfg.ConfigFile.getVar("StartupPage").asString();
+
// ask server for salt
- if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=ask&login="+login+"&lg="+ClientCfg.LanguageCode, "", pPM->isVerboseLog()))
+ if(!HttpClient.sendGet(url + "?cmd=ask&cp=2&login=" + login + "&lg=" + ClientCfg.LanguageCode, "", pPM->isVerboseLog()))
return "Can't send (error code 60)";
if(pPM->isVerboseLog()) nlinfo("Sent request for password salt");
@@ -2750,7 +2752,7 @@ string checkLogin(const string &login, const string &password, const string &cli
return res;
}
- // send login + crypted password + client app and cp=1 (as crypted password)
+ // send login + crypted password + client app and cp=2 (as crypted password)
if(!HttpClient.connectToLogin())
return "Can't connect (error code 63)";
@@ -2760,7 +2762,8 @@ string checkLogin(const string &login, const string &password, const string &cli
{
// R2 login sequence
std::string cryptedPassword = CCrypt::crypt(password, Salt);
- if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=login&login="+login+"&password="+cryptedPassword+"&clientApplication="+clientApp+"&cp=1"+"&lg="+ClientCfg.LanguageCode))
+
+ if(!HttpClient.sendGet(url + "?cmd=login&login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2" + "&lg=" + ClientCfg.LanguageCode))
return "Can't send (error code 2)";
// the response should contains the result code and the cookie value
@@ -2839,7 +2842,8 @@ string checkLogin(const string &login, const string &password, const string &cli
{
// standard ryzom login sequence
std::string cryptedPassword = CCrypt::crypt(password, Salt);
- if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?login="+login+"&password="+cryptedPassword+"&clientApplication="+clientApp+"&cp=1"))
+
+ if(!HttpClient.sendGet(url + "?login=" + login + "&password=" + cryptedPassword + "&clientApplication=" + clientApp + "&cp=2"))
return "Can't send (error code 2)";
/*
if(!send(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?login="+login+"&password="+password+"&clientApplication="+clientApp))
@@ -2934,7 +2938,8 @@ string checkLogin(const string &login, const string &password, const string &cli
// ***************************************************************************
string selectShard(uint32 shardId, string &cookie, string &addr)
{
- cookie = addr = "";
+ cookie.clear();
+ addr.clear();
if(!HttpClient.connectToLogin()) return "Can't connect (error code 7)";
@@ -2942,9 +2947,12 @@ string selectShard(uint32 shardId, string &cookie, string &addr)
if(LoginPassword.empty()) return "Empty Password (error code 9)";
if(ClientApp.empty()) return "Empty Client Application (error code 10)";
- // send login + crypted password + client app and cp=1 (as crypted password)
+ // send login + crypted password + client app and cp=2 (as crypted password)
std::string cryptedPassword = CCrypt::crypt(LoginPassword, Salt);
- if(!HttpClient.sendGet(ClientCfg.ConfigFile.getVar("StartupPage").asString()+"?cmd=login&shardid="+toString(shardId)+"&login="+LoginLogin+"&password="+cryptedPassword+"&clientApplication="+ClientApp+"&cp=1"))
+
+ std::string url = ClientCfg.ConfigFile.getVar("StartupHost").asString() + ClientCfg.ConfigFile.getVar("StartupPage").asString();
+
+ if(!HttpClient.sendGet(url + "?cmd=login&shardid=" + toString(shardId) + "&login=" + LoginLogin + "&password=" + cryptedPassword + "&clientApplication=" + ClientApp + "&cp=2"))
return "Can't send (error code 11)";
string res;
diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp
index bbd896ec9..019baaab5 100644
--- a/code/ryzom/client/src/login_patch.cpp
+++ b/code/ryzom/client/src/login_patch.cpp
@@ -1040,6 +1040,13 @@ void CPatchManager::executeBatchFile()
arguments.push_back(startupPath);
#endif
+ // log parameters passed to Ryzom client
+ nlinfo("Restarting Ryzom...");
+ nlinfo("RyzomFilename = %s", RyzomFilename.c_str());
+ nlinfo("ClientPatchPath = %s", ClientPatchPath.c_str());
+ nlinfo("ClientRootPath = %s", ClientRootPath.c_str());
+ nlinfo("StartupPath = %s", startupPath.c_str());
+
batchFilename += UpdateBatchFilename;
// make script executable
diff --git a/code/ryzom/common/src/game_share/http_client.cpp b/code/ryzom/common/src/game_share/http_client.cpp
index d9add4692..3e100c762 100644
--- a/code/ryzom/common/src/game_share/http_client.cpp
+++ b/code/ryzom/common/src/game_share/http_client.cpp
@@ -98,52 +98,81 @@ bool CHttpClient::send(const std::string& buffer, bool verbose)
// ***************************************************************************
bool CHttpClient::sendRequest(const std::string& methodWB, const std::string &url, const std::string &cookieName, const std::string &cookieValue, const std::string& postParams, bool verbose)
{
- // Remove the host from the URL
- string path;
+ std::string path, host;
+
+ // Remove the protocol from the URL
if (url.substr(0, 7) == "http://")
path = url.substr(7);
else
path = url;
- path = path.substr(path.find( "/" ));
+
+ std::string::size_type pos = path.find("/");
+
+ // Remove the host from the URL
+ if (pos != std::string::npos)
+ {
+ host = path.substr(0, pos);
+ path = path.substr(pos);
+ }
+ else
+ {
+ host = path;
+ path.clear();
+ }
+
+ // build HTTP request
+ std::string request;
+ request += methodWB + " " + path + " HTTP/1.1\r\n";
+ request += "Host: " + host + "\r\n";
// Send
if (cookieName.empty() && postParams.empty())
{
- return send(methodWB + path + "\r\n", verbose);
+ request += "\r\n";
+
+ return send(request, verbose);
}
else
{
- string cookieStr, postStr;
if (!cookieName.empty())
- cookieStr = "Cookie: " + cookieName + "=" + cookieValue + "\r\n";
+ request += "Cookie: " + cookieName + "=" + cookieValue + "\r\n";
+
if (!postParams.empty())
- postStr = "Content-Type: application/x-www-form-urlencoded\r\nContent-Length: " + toString(postParams.size()) + "\r\n\r\n" + postParams;
- return send(methodWB + path + " HTTP/1.0\r\n" + cookieStr + postStr + "\r\n", verbose);
+ {
+ request += "Content-Type: application/x-www-form-urlencoded\r\n";
+ request += "Content-Length: " + toString(postParams.size()) + "\r\n";
+ request += "\r\n";
+ request += postParams;
+ }
+
+ request += "\r\n";
+
+ return send(request, verbose);
}
}
// ***************************************************************************
bool CHttpClient::sendGet(const string &url, const string& params, bool verbose)
{
- return sendRequest("GET ", url + (params.empty() ? "" : ("?" + params)), string(), string(), string(), verbose);
+ return sendRequest("GET", url + (params.empty() ? "" : ("?" + params)), string(), string(), string(), verbose);
}
// ***************************************************************************
bool CHttpClient::sendGetWithCookie(const string &url, const string &name, const string &value, const string& params, bool verbose)
{
- return sendRequest("GET ", url + (params.empty() ? "" : ("?" + params)), name, value, string(), verbose);
+ return sendRequest("GET", url + (params.empty() ? "" : ("?" + params)), name, value, string(), verbose);
}
// ***************************************************************************
bool CHttpClient::sendPost(const string &url, const string& params, bool verbose)
{
- return sendRequest("POST ", url, string(), string(), params, verbose);
+ return sendRequest("POST", url, string(), string(), params, verbose);
}
// ***************************************************************************
bool CHttpClient::sendPostWithCookie(const string &url, const string &name, const string &value, const string& params, bool verbose)
{
- return sendRequest("POST ", url, name, value, params, verbose);
+ return sendRequest("POST", url, name, value, params, verbose);
}
// ***************************************************************************
@@ -152,7 +181,7 @@ bool CHttpClient::receive(string &res, bool verbose)
nlassert(_Sock.connected());
uint32 size;
- res = "";
+ res.clear();
uint8 buf[1024];
@@ -164,21 +193,31 @@ bool CHttpClient::receive(string &res, bool verbose)
if (_Sock.receive((uint8*)buf, size, false) == CSock::Ok)
{
- if(verbose) nlinfo("Received OK %d bytes", size);
+ if (verbose) nlinfo("Received OK %u bytes", size);
buf[1023] = '\0';
res += (char*)buf;
//nlinfo("block received '%s'", buf);
}
else
{
- if(verbose) nlinfo("Received CLOSE %d bytes", size);
+ if (verbose) nlinfo("Received CLOSE %u bytes", size);
buf[size] = '\0';
res += (char*)buf;
//nlwarning ("server connection closed");
break;
}
}
+
//nlinfo("all received '%s'", res.c_str());
+
+ // only keep content (delimited by two \r\n) and discard server headers
+ std::string::size_type pos = res.find("\r\n\r\n");
+
+ if (pos != std::string::npos)
+ {
+ res = res.substr(pos + 4);
+ }
+
return true;
}
diff --git a/code/ryzom/server/src/input_output_service/chat_manager.cpp b/code/ryzom/server/src/input_output_service/chat_manager.cpp
index e6dc5c254..872aa4501 100644
--- a/code/ryzom/server/src/input_output_service/chat_manager.cpp
+++ b/code/ryzom/server/src/input_output_service/chat_manager.cpp
@@ -488,7 +488,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
{
// if( itCl->second->isMuted() )
CEntityId eid = TheDataset.getEntityId(sender);
- if(_MutedUniverseUsers.find( eid ) != _MutedUniverseUsers.end())
+ if(_MutedUsers.find( eid ) != _MutedUsers.end())
{
nldebug("IOSCM: chat The player %s:%x is universe muted",
TheDataset.getEntityId(sender).toString().c_str(),
@@ -650,7 +650,7 @@ void CChatManager::chat( const TDataSetRow& sender, const ucstring& ucstr )
// If universal channel check if player muted
if (session->getChan()->UniversalChannel)
{
- if(_MutedUsers.find( eid ) != _MutedUsers.end())
+ if(_MutedUniverseUsers.find( eid ) != _MutedUniverseUsers.end())
{
nldebug("IOSCM: chat The player %s:%x is muted",
TheDataset.getEntityId(sender).toString().c_str(),
diff --git a/code/ryzom/server/src/shard_unifier_service/chat_unifier.cpp b/code/ryzom/server/src/shard_unifier_service/chat_unifier.cpp
index e4c52f4a2..6c3a188e5 100644
--- a/code/ryzom/server/src/shard_unifier_service/chat_unifier.cpp
+++ b/code/ryzom/server/src/shard_unifier_service/chat_unifier.cpp
@@ -225,7 +225,7 @@ namespace CHATUNI
{
// no IOS for the hosting shard !
cucSender.recvFarTellFail(this, senderCharId, destName, TFailInfo::fi_no_ios_module);
-nldebug("sendFatTell : no module proxy for shard %u", hostShardId);
+ nldebug("sendFatTell : no module proxy for shard %u", hostShardId);
return;
}
@@ -235,7 +235,7 @@ nldebug("sendFatTell : no module proxy for shard %u", hostShardId);
{
// no character synchronizer to retrieve sender name !
cucSender.recvFarTellFail(this, senderCharId, destName, TFailInfo::fi_no_char_sync);
-nldebug("sendFarTell : can't finc character sync singleton");
+ nldebug("sendFarTell : can't finc character sync singleton");
return;
}
@@ -245,7 +245,7 @@ nldebug("sendFarTell : can't finc character sync singleton");
{
// no character synchronizer to retrieve sender name !
cucSender.recvFarTellFail(this, senderCharId, destName, TFailInfo::fi_sender_char_unknown);
-nldebug("sendFarTell : can't get character name from sender char id %s", senderCharId.toString().c_str());
+ nldebug("sendFarTell : can't get character name from sender char id %s", senderCharId.toString().c_str());
return;
}
diff --git a/code/web/private_php/ams/autoload/users.php b/code/web/private_php/ams/autoload/users.php
index 5b3bfaa2d..81bc0599f 100644
--- a/code/web/private_php/ams/autoload/users.php
+++ b/code/web/private_php/ams/autoload/users.php
@@ -336,36 +336,31 @@ class Users{
public static function createPermissions($pvalues) {
try {
- $values = array('username' => $pvalues[0]);
+ // bind to the shard database (guess so :p)
$dbs = new DBLayer("shard");
- $sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
- $result = $sth->fetchAll();
- $dbl = new DBLayer("lib");
-
- $UId = $result['0']['UId'];
-
- $statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
- $json = $statement->fetch();
- $json = json_decode($json['Value'],true);
-
- $db = new DBLayer( 'shard' );
- // get all domains
- $statement = $db -> executeWithoutParams( "SELECT * FROM domain" );
- $rows = $statement -> fetchAll();
+ // retrieve the user UId
+ $values = array('username' => $pvalues[0]);
+ $statement = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
+ $result = $statement->fetchAll();
+ $UId = $result['0']['UId'];
+
+ // retrieve the default access privileges (don't understand what exactly is done)
+ $dbl = new DBLayer("lib");
+ $statement = $dbl->execute("SELECT Value FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
+ //$statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
+ $json = $statement->fetch();
+ $accessPriv = $json['Value'];
+ //$accessPriv = json_decode($json['Value'],true);
+
+ // get all shardIds and domain_ids
+ $statement = $dbs -> executeWithoutParams( "SELECT ShardId, domain_id FROM shard" );
+ $shardIds = $statement -> fetchAll();
- //error_log(print_r($rows,true));
- //error_log(print_r($result,true));
- //error_log(print_r($json,true));
- if ($json) foreach ($json as $key => $value) {
- //error_log(print_r($key,true));
- //error_log(print_r($value,true));
-
- $ins_values = array('UId' => $UId, 'DomainId' => $key, 'AccessPrivilege' => $value['1']);
- error_log(print_r($ins_values,true));
- $dbs = new DBLayer("shard");
- $dbs->insert("permission", $ins_values);
- }
+ foreach($shardIds as $shardId) { // add default access privileges to the user for each shard
+ $ins_values = array('UId' => $UId, 'DomainId' => $shardId['domain_id'], 'ShardId' => $shardId['ShardId'], 'AccessPrivilege' => $accessPriv);
+ $dbs->insert("permission", $ins_values);
+ }
}
catch (PDOException $e) {
//oh noooz, the shard is offline! Put it in query queue at ams_lib db!
diff --git a/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php b/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php
index a99ac5551..5362eef6b 100644
--- a/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php
+++ b/code/web/private_php/ams/plugins/Domain_Management/Domain_Management.php
@@ -156,7 +156,7 @@ function domain_management_hook_return_global()
}
-function api_key_management_hook_activate()
+function domain_management_hook_activate()
{
$dbl = new DBLayer( "lib" );
$sql = "INSERT INTO `settings` (Setting)