Merge with develop

This commit is contained in:
kervala 2016-05-14 12:35:12 +02:00
commit 8f4ac24f0b
25 changed files with 376 additions and 109 deletions

View file

@ -324,6 +324,11 @@ IF(WITH_QT5)
ENDIF()
# freetype is needed since Qt 5.5
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)
@ -332,6 +337,7 @@ IF(WITH_QT5)
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

View file

@ -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)

View file

@ -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

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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)
{

View file

@ -15,6 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdlogic.h"
#include "nel/logic/logic_state.h"
#include "nel/logic/logic_state_machine.h"

View file

@ -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<std::string> &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];

View file

@ -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;
}

View file

@ -212,7 +212,6 @@
background_bitmap_view=""
home=""
browse_next_time="false"
timeout="5"
form_text_area_group="edit_box_widget_multiline">
<group id="black"
posref="BR BR"

View file

@ -27,6 +27,15 @@
<!-- Yoyo: prefer show an empty list when clicking -->
<!-- <action handler="leave_modal" cond="eq(getprop('ui:interface:bag_choose:list:nbelt'),0)" /> -->
</proc>
<proc id="select_special_items">
<action handler="set" params="target_property=ui:interface:inventory:content:bag:iil:active|value=0" />
<action handler="set" params="target_property=ui:interface:inventory:content:bag:webitems:active|value=1" />
<action handler="browse_home" params="name=ui:interface:inventory:content:bag:webitems:html" />
</proc>
<proc id="select_bag_items">
<action handler="set" params="target_property=ui:interface:inventory:content:bag:iil:active|value=1" />
<action handler="set" params="target_property=ui:interface:inventory:content:bag:webitems:active|value=0" />
</proc>
<!-- ************* -->
<!-- * EQUIPMENT * -->
<!-- ************* -->
@ -44,6 +53,83 @@
onclick_l="proc"
params_l="inv_left_click_on_slot"
auto_grayed="false" />
<template name="img_button"
id="image_button"
ok_text="uittOK"
tx_over="blank.tga"
cancel_text="uittCancel"
posparent="parent"
posref="BM TM"
onclick_ok=""
onclick_ok_param=""
x="0"
y="0"
keep="true"
tooltip_ok=""
avoid_resize_parent="false">
<group id="#id"
posparent="#posparent"
posref="#posref"
child_resize_w="true"
child_resize_h="true"
x="#x"
y="#y"
avoid_resize_parent="#avoid_resize_parent">
<ctrl style="button_ok"
id="bb"
x="0"
y="0"
posref="TL TL"
text_y="-2"
onclick_l="#onclick_ok"
params_l="#onclick_ok_param"
hardtext="#ok_text"
tooltip="#tooltip_ok" />
<ctrl type="button"
id="button"
button_type="push_button"
posref="TL TL"
x="0"
y="0"
scale="false"
tx_over="#tx_over"
color="255 255 255 255"
col_pushed="255 255 255 255"
col_over="255 255 255 0"
onclick_l="#onclick_ok"
params_l="#onclick_ok_param" />
</group>
</template>
<template name="image_button"
tx_over="blank.tga"
onclick_l=""
params_l="" >
<group id="#id"
posref="TL TL"
x="0"
y="0"
sizeref="wh"
w="0"
h="0">
<ctrl type="button"
id=""
button_type="push_button"
posref=""
posparent=""
x=""
y=""
scale="false"
tx_over="#tx_over"
color="255 255 255 255"
col_pushed="255 255 255 255"
col_over="255 255 255 0"
onclick_l="#onclick_l"
params_l="#params_l" />
</group>
</template>
<!-- For the moment we use a template because we have to make the fake container -->
<template name="tinv_equip">
<group id="equip"
@ -481,6 +567,7 @@
posref="TL TL"
group_onclick_r="active_menu"
group_params_r="menu=ui:interface:base_menu_with_color">
<group type="tab"
id="inv_select"
child_resize_w="true"
@ -624,6 +711,99 @@
sizeref="wh"
w="0"
h="0">
<!-- Special Items -->
<ctrl style="text_button_16"
id="bag_items"
posref="TL TL"
y="-2"
x="10"
wmargin="8"
hardtext="uitabInvBag"
tooltip="uitabInvBag"
onclick_l="proc"
params_l="select_bag_items" />
<ctrl style="text_button_16"
id="special_items"
posref="TR TL"
posparent="bag_items"
y="0"
x="2"
wmargin="8"
hardtext="uiSpecialLabo"
tooltip="uiSpecialLabo"
onclick_l="proc"
params_l="select_special_items" />
<!-- Keys
<ctrl style="text_button_16"
id="keys"
posref="TR TL"
posparent="special_items"
y="0"
x="2"
wmargin="8"
hardtext="Keys"
tooltip="uiSpecialLabo"
onclick_l="open_title_help"
params_l="from=user" />-->
<group id="webitems" posref="TL TL" sizeref="wh" h="-40" w="0" x="0" y="-18" active="0">
<group type="webig_html"
id="html"
url="http://app.ryzom.com/app_arcc/index.php?action=mItem_DisplayUserItems"
title_prefix=""
sizeref="wh"
x="10"
y="0"
w="0"
h="0"
background_color="0 0 0 255"
error_color="255 240 48 255"
link_color="240 155 100 255"
text_color="210 210 210 255"
h1_color="255 255 255 255"
h2_color="255 255 255 255"
h3_color="255 255 255 255"
h4_color="255 255 255 255"
h5_color="255 255 255 255"
h6_color="100 255 100 255"
text_font_size="10"
h1_font_size="20"
h2_font_size="18"
h3_font_size="16"
h4_font_size="14"
h5_font_size="12"
h6_font_size="10"
paragraph_begin_space="1"
multi_line_space_factor="0.25"
td_begin_space="16"
li_begin_space="4"
ul_begin_space="12"
li_indent="0"
ul_indent="30"
checkbox_bitmap_normal="w_slot_on.tga"
checkbox_bitmap_pushed="w_opacity_on.tga"
checkbox_bitmap_over=""
background_bitmap_view="black2"
home="http://app.ryzom.com/app_arcc/index.php?action=mItem_DisplayUserItems"
browse_next_time="true"
form_text_area_group="edit_box_widget_multiline">
<group type="list"
id="text_list"
fontsize="9"
posref="TL TL"
posparent="black"
x="9"
y="-2"
space="0"
sizeref="hw"
w="-4"
h="-4"
maxelements="2000" />
<ctrl style="skin_scroll"
id="scroll_bar" />
</group>
</group>
<instance template="tinv_nbslots_bulk_weight"
id="ibw"
x="0"
@ -632,7 +812,7 @@
<instance template="tinv_item_list"
id="iil"
inv_branch_nb="%max_bag_invslot"
y="-16"
y="-18"
sizeref="wh"
h="-16"
inv_branch="%bag"

View file

@ -176,7 +176,7 @@ function webig:doRemoveDbSheetQuantity(sheet_list, ctrl)
if new_quantity >= current_quantity then
webig:deleteItem(db..":"..ctrl)
else
addDbProp(db..":"..ctrl..":QUANTITY", current_quantity-new_quantity)
addDbProp(db..":"..ctrl..":QUANTITY", new_quantity)
end
end

View file

@ -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">
<group id="black"
posref="BR BR"
sizeref="hw"

View file

@ -5798,3 +5798,11 @@ NLMISC_COMMAND(time, "Shows information about the current time", "")
CInterfaceManager::getInstance()->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;
}

View file

@ -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;

View file

@ -20,6 +20,7 @@
#include <curl/curl.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
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())
{
@ -92,6 +93,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)
{
// get a pointer to the X509 certificate store (which may be empty!)
@ -108,15 +111,26 @@ 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");
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);
}
}
}
// cleanup
@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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

View file

@ -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;
}

View file

@ -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(),

View file

@ -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;
}

View file

@ -336,34 +336,29 @@ 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");
// retrieve the user UId
$values = array('username' => $pvalues[0]);
$statement = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
$result = $statement->fetchAll();
$UId = $result['0']['UId'];
$statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", Array('setting' => 'Domain_Auto_Add'));
// 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();
$json = json_decode($json['Value'],true);
$accessPriv = $json['Value'];
//$accessPriv = json_decode($json['Value'],true);
$db = new DBLayer( 'shard' );
// get all shardIds and domain_ids
$statement = $dbs -> executeWithoutParams( "SELECT ShardId, domain_id FROM shard" );
$shardIds = $statement -> fetchAll();
// get all domains
$statement = $db -> executeWithoutParams( "SELECT * FROM domain" );
$rows = $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");
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);
}
}

View file

@ -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)