--HG--
branch : compatibility-develop
hg/compatibility-develop
ulukyn 7 years ago
commit 203187542c

@ -38,6 +38,21 @@ MACRO(PARSE_VERSION_OTHER FILENAME)
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
# macro to define FIND_PACKAGE options with a different package name
MACRO(FIX_PACKAGE_OPTIONS OLDNAME NEWNAME)
# append other options if needed
SET(_OPTIONS COMPONENTS REQUIRED QUIETLY)
# process each options
FOREACH(_OPTION ${_OPTIONS})
SET(OLD_OPTION ${OLDNAME}_FIND_${_OPTION})
IF(DEFINED )
SET(NEW_OPTION ${NEWNAME}_FIND_${_OPTION})
SET(${NEW_OPTION} ${OLD_OPTION})
ENDIF()
ENDFOREACH()
ENDMACRO()
MACRO(FIND_PACKAGE_HELPER NAME INCLUDE) MACRO(FIND_PACKAGE_HELPER NAME INCLUDE)
# Looks for a directory containing NAME. # Looks for a directory containing NAME.
# #
@ -692,11 +707,11 @@ MACRO(ADD_QT_LIBRARY _NAME)
ENDIF() ENDIF()
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}") SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}.${_EXT}")
IF(EXISTS ${_LIB}) IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) LIST(APPEND QT_LIBRARIES optimized ${_LIB})
ENDIF() ENDIF()
SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}") SET(_LIB "${QT_LIBRARY_DIR}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB}) IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) LIST(APPEND QT_LIBRARIES debug ${_LIB})
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
@ -710,11 +725,11 @@ MACRO(ADD_QT_PLUGIN _TYPE _NAME)
ENDIF() ENDIF()
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}") SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}.${_EXT}")
IF(EXISTS ${_LIB}) IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} optimized ${_LIB}) LIST(APPEND QT_LIBRARIES optimized ${_LIB})
ENDIF() ENDIF()
SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}") SET(_LIB "${QT_PLUGINS_DIR}/${_TYPE}/${_PREFIX}${_NAME}d.${_EXT}")
IF(EXISTS ${_LIB}) IF(EXISTS ${_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} debug ${_LIB}) LIST(APPEND QT_LIBRARIES debug ${_LIB})
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
@ -789,12 +804,12 @@ MACRO(FIND_QT5)
SET(QT_LIBRARIES Qt5::Widgets) SET(QT_LIBRARIES Qt5::Widgets)
# Gui # Gui
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL) LIST(APPEND QT_LIBRARIES Qt5::Gui Qt5::OpenGL)
ADD_QT_LIBRARY(PrintSupport) ADD_QT_LIBRARY(PrintSupport)
IF(WIN32) IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES} LIST(APPEND QT_LIBRARIES
${WINSDK_LIBRARY_DIR}/Imm32.lib ${WINSDK_LIBRARY_DIR}/Imm32.lib
${WINSDK_LIBRARY_DIR}/OpenGL32.lib ${WINSDK_LIBRARY_DIR}/OpenGL32.lib
${WINSDK_LIBRARY_DIR}/WinMM.Lib) ${WINSDK_LIBRARY_DIR}/WinMM.Lib)
@ -812,7 +827,7 @@ MACRO(FIND_QT5)
FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration) FIND_LIBRARY(SYSTEMCONFIGURATION_FRAMEWORK SystemConfiguration)
FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL) FIND_LIBRARY(OPENGL_FRAMEWORK NAMES OpenGL)
SET(QT_LIBRARIES ${QT_LIBRARIES} LIST(APPEND QT_LIBRARIES
${CUPS_LIBRARY} ${CUPS_LIBRARY}
${COCOA_FRAMEWORK} ${COCOA_FRAMEWORK}
${SYSTEMCONFIGURATION_FRAMEWORK} ${SYSTEMCONFIGURATION_FRAMEWORK}
@ -839,7 +854,7 @@ MACRO(FIND_QT5)
ADD_QT_LIBRARY(DBus) ADD_QT_LIBRARY(DBus)
IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a") IF(EXISTS "${QT_LIBRARY_DIR}/libxcb-static.a")
SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a") LIST(APPEND QT_LIBRARIES "${QT_LIBRARY_DIR}/libxcb-static.a")
ENDIF() ENDIF()
# always link these in dynamic, API never changes # always link these in dynamic, API never changes
@ -871,14 +886,14 @@ MACRO(FIND_QT5)
SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib") SET(HB_LIB "${QT_LIBRARY_DIR}/qtharfbuzzng.lib")
ENDIF() ENDIF()
IF(EXISTS ${HB_LIB}) IF(EXISTS ${HB_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${HB_LIB}) LIST(APPEND QT_LIBRARIES ${HB_LIB})
ENDIF() ENDIF()
# freetype is needed since Qt 5.5 # freetype is needed since Qt 5.5
FIND_PACKAGE(Freetype) FIND_PACKAGE(Freetype)
IF(FREETYPE_FOUND) IF(FREETYPE_FOUND)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIBRARIES}) LIST(APPEND QT_LIBRARIES ${FREETYPE_LIBRARIES})
ELSE() ELSE()
IF(UNIX) IF(UNIX)
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a") SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/libqtfreetype.a")
@ -886,27 +901,27 @@ MACRO(FIND_QT5)
SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib") SET(FREETYPE_LIB "${QT_LIBRARY_DIR}/qtfreetype.lib")
ENDIF() ENDIF()
IF(EXISTS ${FREETYPE_LIB}) IF(EXISTS ${FREETYPE_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) LIST(APPEND QT_LIBRARIES ${FREETYPE_LIB})
ENDIF() ENDIF()
ENDIF() ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets) ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY}) LIST(APPEND QT_LIBRARIES ${PNG_LIBRARIES} ${JPEG_LIBRARY})
# Network # Network
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Network Qt5::Xml) LIST(APPEND QT_LIBRARIES Qt5::Network Qt5::Xml)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES}) LIST(APPEND QT_LIBRARIES ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
IF(WIN32) IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES} LIST(APPEND QT_LIBRARIES
${WINSDK_LIBRARY_DIR}/Crypt32.lib ${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib ${WINSDK_LIBRARY_DIR}/WS2_32.Lib
${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib) ${WINSDK_LIBRARY_DIR}/IPHlpApi.Lib)
ENDIF() ENDIF()
# Core # Core
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Core) LIST(APPEND QT_LIBRARIES Qt5::Core)
# pcre is needed since Qt 5.5 # pcre is needed since Qt 5.5
IF(UNIX) IF(UNIX)
@ -918,7 +933,7 @@ MACRO(FIND_QT5)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib") SET(PCRE_LIB "${QT_LIBRARY_DIR}/qtpcre.lib")
ENDIF() ENDIF()
IF(EXISTS ${PCRE_LIB}) IF(EXISTS ${PCRE_LIB})
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB}) LIST(APPEND QT_LIBRARIES ${PCRE_LIB})
ENDIF() ENDIF()
IF(APPLE) IF(APPLE)
@ -926,13 +941,14 @@ MACRO(FIND_QT5)
FIND_LIBRARY(SECURITY_FRAMEWORK Security) FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES} LIST(APPEND QT_LIBRARIES
${PCRE_LIBRARY} ${PCRE_LIBRARY}
${FOUNDATION_FRAMEWORK} ${FOUNDATION_FRAMEWORK}
${CARBON_FRAMEWORK} ${CARBON_FRAMEWORK}
${SECURITY_FRAMEWORK}) ${SECURITY_FRAMEWORK})
ELSEIF(UNIX) ELSEIF(UNIX)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl -lrt) FIND_PACKAGE(Threads)
LIST(APPEND QT_LIBRARIES ${ZLIB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS} -lrt)
ENDIF() ENDIF()
ELSE() ELSE()
SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core) SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core)

@ -3,6 +3,10 @@ INCLUDE(FindHelpers)
FIND_PACKAGE_HELPER(RyzomGameShare game_share/continent.h RELEASE ryzom_gameshare_r ryzom_gameshare DEBUG ryzom_gameshare_d DIR ${NEL_DIR} ${RYZOM_DIR} SUFFIXES ryzom) FIND_PACKAGE_HELPER(RyzomGameShare game_share/continent.h RELEASE ryzom_gameshare_r ryzom_gameshare DEBUG ryzom_gameshare_d DIR ${NEL_DIR} ${RYZOM_DIR} SUFFIXES ryzom)
IF(RYZOMGAMESHARE_FOUND) IF(RYZOMGAMESHARE_FOUND)
FIND_PACKAGE(NeL REQUIRED)
LIST(APPEND RYZOMGAMESHARE_INCLUDE_DIRS ${NEL_INCLUDE_DIRS})
LIST(APPEND RYZOMGAMESHARE_LIBRARIES ${NELMISC_LIBRARIES} ${NELLIGO_LIBRARIES} ${NELNET_LIBRARIES} ${NELGEORGES_LIBRARIES})
SET(RYZOM_GAMESHARE_LIBRARIES ${RYZOMGAMESHARE_LIBRARIES}) SET(RYZOM_GAMESHARE_LIBRARIES ${RYZOMGAMESHARE_LIBRARIES})
SET(RYZOM_GAMESHARE_FOUND ${RYZOMGAMESHARE_FOUND}) SET(RYZOM_GAMESHARE_FOUND ${RYZOMGAMESHARE_FOUND})
SET(RYZOM_GAMESHARE_INCLUDE_DIR ${RYZOMGAMESHARE_INCLUDE_DIR}) SET(RYZOM_GAMESHARE_INCLUDE_DIR ${RYZOMGAMESHARE_INCLUDE_DIR})

@ -17,8 +17,6 @@
#ifndef CL_GROUP_HTML_H #ifndef CL_GROUP_HTML_H
#define CL_GROUP_HTML_H #define CL_GROUP_HTML_H
#include <curl/curl.h>
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/gui/interface_group.h" #include "nel/gui/interface_group.h"
#include "nel/gui/group_scrolltext.h" #include "nel/gui/group_scrolltext.h"
@ -27,6 +25,9 @@
#include "nel/gui/group_table.h" #include "nel/gui/group_table.h"
#include "nel/gui/libwww_types.h" #include "nel/gui/libwww_types.h"
// forward declaration
typedef void CURLM;
typedef std::map<std::string, std::string> TStyle; typedef std::map<std::string, std::string> TStyle;
namespace NLGUI namespace NLGUI
@ -863,11 +864,6 @@ namespace NLGUI
// HtmlType download finished // HtmlType download finished
void htmlDownloadFinished(const std::string &content, const std::string &type, long code); void htmlDownloadFinished(const std::string &content, const std::string &type, long code);
// cURL transfer callbacks
static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData);
static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData);
static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
}; };
// adapter group that store y offset for inputs inside an html form // adapter group that store y offset for inputs inside an html form

@ -20,11 +20,12 @@
#ifndef CL_LIB_WWW_H #ifndef CL_LIB_WWW_H
#define CL_LIB_WWW_H #define CL_LIB_WWW_H
#include <curl/curl.h>
#include "nel/misc/rgba.h" #include "nel/misc/rgba.h"
#include "nel/gui/libwww_types.h" #include "nel/gui/libwww_types.h"
// forward declaration to avoid curl.h inclusion everywhere
typedef void CURL;
namespace NLGUI namespace NLGUI
{ {
class CCtrlBaseButton; class CCtrlBaseButton;

@ -281,10 +281,10 @@ template <class T> T trimSeparators (const T &str)
{ {
typename T::size_type start = 0; typename T::size_type start = 0;
typename T::size_type size = str.size(); typename T::size_type size = str.size();
while (start < size && str[start] == ' ' && str[start] == '\t') while (start < size && (str[start] == ' ' || str[start] == '\t'))
start++; start++;
typename T::size_type end = size; typename T::size_type end = size;
while (end > start && str[end-1] == ' ' && str[end-1] == '\t') while (end > start && (str[end-1] == ' ' || str[end-1] == '\t'))
end--; end--;
return str.substr (start, end-start); return str.substr (start, end-start);
} }

@ -171,8 +171,7 @@ namespace NLNET
virtual void setTransportPeerInvisible(const std::string &transportInstanceName, bool peerInvisible) =0; virtual void setTransportPeerInvisible(const std::string &transportInstanceName, bool peerInvisible) =0;
/// Activate/stop firewalling mode on a transport /// Activate/stop firewalling mode on a transport
virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) =0;
throw (EGatewayFirewallBreak) =0;
/// Send a command to a transport /// Send a command to a transport
virtual void transportCommand(const TParsedCommandLine &commandLine) =0; virtual void transportCommand(const TParsedCommandLine &commandLine) =0;
@ -233,9 +232,7 @@ namespace NLNET
/** Disclose module information to a connected gateway. /** Disclose module information to a connected gateway.
* This can also be this gateway itself. * This can also be this gateway itself.
*/ */
virtual void discloseModule(IModuleProxy *moduleProxy) virtual void discloseModule(IModuleProxy *moduleProxy) =0;
throw (EGatewayNotConnected)
=0;
/** Retrieve the proxy for a locally plugged module. /** Retrieve the proxy for a locally plugged module.
* Each local module plugged in a gateway has an associated * Each local module plugged in a gateway has an associated

@ -25,6 +25,14 @@
#include <curl/curl.h> #include <curl/curl.h>
// for compatibility with older versions
#ifndef CURL_AT_LEAST_VERSION
#define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z)
#define CURL_AT_LEAST_VERSION(x,y,z) \
(LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z))
#endif
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -81,12 +89,15 @@ namespace NLGUI
// get information on CURL // get information on CURL
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
bool useOpenSSLBackend = false;
#if CURL_AT_LEAST_VERSION(7, 34, 0)
// get more information on CURL session // get more information on CURL session
curl_tlssessioninfo *sessionInfo; curl_tlssessioninfo *sessionInfo;
CURLINFO info; CURLINFO info;
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 48, 0) #if CURL_AT_LEAST_VERSION(7, 48, 0)
info = CURLINFO_TLS_SSL_PTR; info = CURLINFO_TLS_SSL_PTR;
#else #else
info = CURLINFO_TLS_SESSION; info = CURLINFO_TLS_SESSION;
@ -94,8 +105,30 @@ namespace NLGUI
CURLcode res = curl_easy_getinfo(curl, info, &sessionInfo); CURLcode res = curl_easy_getinfo(curl, info, &sessionInfo);
// CURL using OpenSSL backend
if ((res == CURLE_OK) && sessionInfo && sessionInfo->backend == CURLSSLBACKEND_OPENSSL) useOpenSSLBackend = true;
#elif CURL_AT_LEAST_VERSION(7, 12, 3)
// get a list of OpenSSL engines
struct curl_slist *engines;
CURLcode res = curl_easy_getinfo(curl, CURLINFO_SSL_ENGINES, &engines);
// CURL using OpenSSL backend
// With OpenSSL compiled without any engine, engines will too return NULL
// Fortunately, if OpenSSL isn't compiled with engines means we compiled it ourself and CURL is a recent version
if ((res == CURLE_OK) && engines)
{
// free engines
curl_slist_free_all(engines);
useOpenSSLBackend = true;
}
#else
// TODO: implement an equivalent, but CURL 7.12 was released in 2004
#endif
// only use OpenSSL callback if not using Windows SSPI and using OpenSSL backend // only use OpenSSL callback if not using Windows SSPI and using OpenSSL backend
if (!res && sessionInfo && sessionInfo->backend == CURLSSLBACKEND_OPENSSL && !(data && data->features & CURL_VERSION_SSPI)) if (useOpenSSLBackend && !(data && data->features & CURL_VERSION_SSPI))
{ {
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
// load native Windows CA Certs // load native Windows CA Certs
@ -181,7 +214,21 @@ namespace NLGUI
void addCertificatesFromFile(const std::string &cert) void addCertificatesFromFile(const std::string &cert)
{ {
if (!isInitialized || !isUsingOpenSSLBackend) return; if (!isInitialized)
{
nlwarning("CURL not initialized! Check if there are another errors");
return;
}
if (!isUsingOpenSSLBackend)
{
nlinfo("CURL not using OpenSSL backend! Unable to use custom certificates");
return;
}
else
{
nlinfo("CURL using OpenSSL backend!");
}
// this file was already loaded // this file was already loaded
if (std::find(CertList.begin(), CertList.end(), cert) != CertList.end()) return; if (std::find(CertList.begin(), CertList.end(), cert) != CertList.end()) return;

@ -49,6 +49,8 @@
#include "nel/gui/http_hsts.h" #include "nel/gui/http_hsts.h"
#include "nel/gui/curl_certificates.h" #include "nel/gui/curl_certificates.h"
#include <curl/curl.h>
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
@ -205,6 +207,47 @@ namespace NLGUI
std::map<std::string, std::string> HeadersRecv; std::map<std::string, std::string> HeadersRecv;
}; };
// cURL transfer callbacks
// ***************************************************************************
static size_t curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
{
std::string header;
header.append(buffer, size * nmemb);
me->setRecvHeader(header.substr(0, header.find_first_of("\n\r")));
}
return size * nmemb;
}
// ***************************************************************************
static size_t curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
me->Content.append(buffer, size * nmemb);
return size * nmemb;
}
// ***************************************************************************
static size_t curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
{
if (dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0)
{
nlwarning("> dltotal %d, dlnow %d, ultotal %d, ulnow %d, url '%s'", dltotal, dlnow, ultotal, ulnow, me->Url.c_str());
}
}
// return 1 to cancel download
return 0;
}
// Check if domain is on TrustedDomain // Check if domain is on TrustedDomain
bool CGroupHTML::isTrustedDomain(const string &domain) bool CGroupHTML::isTrustedDomain(const string &domain)
{ {
@ -423,7 +466,7 @@ namespace NLGUI
download.data->sendHeaders(headers); download.data->sendHeaders(headers);
// catch headers // catch headers
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlHeaderCallback); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, NLGUI::curlHeaderCallback);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, download.data); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, download.data);
std::string userAgent = options.appName + "/" + options.appVersion; std::string userAgent = options.appName + "/" + options.appVersion;
@ -4405,7 +4448,7 @@ namespace NLGUI
string buttonTemplate = DefaultButtonGroup; string buttonTemplate = DefaultButtonGroup;
// Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name"
string param = "name=" + this->_Id + "|url=" + getLink(); string param = "name=" + this->_Id + "|url=" + getLink();
string name = ""; string name;
if (!_AnchorName.empty()) if (!_AnchorName.empty())
name = _AnchorName.back(); name = _AnchorName.back();
typedef pair<string, string> TTmplParam; typedef pair<string, string> TTmplParam;
@ -4586,6 +4629,7 @@ namespace NLGUI
if (multiLine) if (multiLine)
templateParams.push_back (std::pair<std::string,std::string> ("multi_min_line", toString(rows))); templateParams.push_back (std::pair<std::string,std::string> ("multi_min_line", toString(rows)));
templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false")); templateParams.push_back (std::pair<std::string,std::string> ("want_return", multiLine?"true":"false"));
templateParams.push_back (std::pair<std::string,std::string> ("onenter", ""));
templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false")); templateParams.push_back (std::pair<std::string,std::string> ("enter_recover_focus", "false"));
if (maxlength > 0) if (maxlength > 0)
templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", toString(maxlength))); templateParams.push_back (std::pair<std::string,std::string> ("max_num_chars", toString(maxlength)));
@ -5478,17 +5522,17 @@ namespace NLGUI
_CurlWWW->sendHeaders(headers); _CurlWWW->sendHeaders(headers);
// catch headers for redirect // catch headers for redirect
curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, curlHeaderCallback); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, NLGUI::curlHeaderCallback);
curl_easy_setopt(curl, CURLOPT_WRITEHEADER, _CurlWWW); curl_easy_setopt(curl, CURLOPT_WRITEHEADER, _CurlWWW);
// catch body // catch body
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlDataCallback); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NLGUI::curlDataCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, _CurlWWW); curl_easy_setopt(curl, CURLOPT_WRITEDATA, _CurlWWW);
#if LOG_DL #if LOG_DL
// progress callback // progress callback
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, curlProgressCallback); curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, NLGUI::curlProgressCallback);
curl_easy_setopt(curl, CURLOPT_XFERINFODATA, _CurlWWW); curl_easy_setopt(curl, CURLOPT_XFERINFODATA, _CurlWWW);
#else #else
// progress off // progress off
@ -6200,6 +6244,12 @@ namespace NLGUI
{ {
const CStyleParams current = _Style; const CStyleParams current = _Style;
if (inherit)
{
style.Underlined = current.Underlined;
style.StrikeThrough = current.StrikeThrough;
}
float tmpf; float tmpf;
TStyle styles = parseStyle(styleString); TStyle styles = parseStyle(styleString);
TStyle::iterator it; TStyle::iterator it;
@ -6421,11 +6471,6 @@ namespace NLGUI
style.GlobalColor = b; style.GlobalColor = b;
} }
} }
if (inherit)
{
style.Underlined = current.Underlined || style.Underlined;
style.StrikeThrough = current.StrikeThrough || style.StrikeThrough;
}
} }
// *************************************************************************** // ***************************************************************************
@ -6496,46 +6541,6 @@ namespace NLGUI
} }
} }
// ***************************************************************************
size_t CGroupHTML::curlHeaderCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
{
std::string header;
header.append(buffer, size * nmemb);
me->setRecvHeader(header.substr(0, header.find_first_of("\n\r")));
}
return size * nmemb;
}
// ***************************************************************************
size_t CGroupHTML::curlDataCallback(char *buffer, size_t size, size_t nmemb, void *pCCurlWWWData)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
me->Content.append(buffer, size * nmemb);
return size * nmemb;
}
// ***************************************************************************
size_t CGroupHTML::curlProgressCallback(void *pCCurlWWWData, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
{
CCurlWWWData * me = static_cast<CCurlWWWData *>(pCCurlWWWData);
if (me)
{
if (dltotal > 0 || dlnow > 0 || ultotal > 0 || ulnow > 0)
{
nlwarning("> dltotal %d, dlnow %d, ultotal %d, ulnow %d, url '%s'", dltotal, dlnow, ultotal, ulnow, me->Url.c_str());
}
}
// return 1 to cancel download
return 0;
}
// *************************************************************************** // ***************************************************************************
std::string CGroupHTML::HTMLOListElement::getListMarkerText() const std::string CGroupHTML::HTMLOListElement::getListMarkerText() const
{ {

@ -19,6 +19,8 @@
#include "nel/gui/libwww.h" #include "nel/gui/libwww.h"
#include "nel/gui/group_html.h" #include "nel/gui/group_html.h"
#include <curl/curl.h>
using namespace NLMISC; using namespace NLMISC;
#ifdef DEBUG_NEW #ifdef DEBUG_NEW

@ -448,7 +448,6 @@ namespace NLNET
/// Activate/stop firewalling mode on a transport /// Activate/stop firewalling mode on a transport
virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled) virtual void setTransportFirewallMode(const std::string &transportInstanceName, bool firewalled)
throw (EGatewayFirewallBreak)
{ {
TTransportList::iterator it(_Transports.find(transportInstanceName)); TTransportList::iterator it(_Transports.find(transportInstanceName));
if (it == _Transports.end()) if (it == _Transports.end())
@ -1246,7 +1245,6 @@ namespace NLNET
} }
virtual void discloseModule(IModuleProxy *moduleProxy) virtual void discloseModule(IModuleProxy *moduleProxy)
throw (EGatewayNotConnected)
{ {
nlassert(moduleProxy->getModuleGateway() == this); nlassert(moduleProxy->getModuleGateway() == this);
@ -1584,7 +1582,6 @@ namespace NLNET
} }
virtual void _broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message) virtual void _broadcastModuleMessage(IModule *senderModule, const NLNET::CMessage &message)
throw (EModuleNotPluggedHere)
{ {
H_AUTO(CModuleGetaway__broadcastModuleMessage); H_AUTO(CModuleGetaway__broadcastModuleMessage);
// send the message to all proxies (except the sender module) // send the message to all proxies (except the sender module)

@ -102,7 +102,6 @@ namespace NLNET
/// Activate/stop firewalling mode on a transport /// Activate/stop firewalling mode on a transport
virtual void setTransportFirewallMode(const std::string &/* transportInstanceName */, bool /* firewalled */) virtual void setTransportFirewallMode(const std::string &/* transportInstanceName */, bool /* firewalled */)
throw (EGatewayFirewallBreak)
{ {
// unsupported // unsupported
nlstop; nlstop;
@ -174,12 +173,10 @@ namespace NLNET
// return; // return;
// } // }
// virtual void openGatewayServer(uint16 listeningPort) // virtual void openGatewayServer(uint16 listeningPort)
// throw (EGatewayAlreadyOpen, EGatewayPortInUse)
// { // {
// nlstop; // nlstop;
// } // }
// virtual void closeGatewayServer() // virtual void closeGatewayServer()
// throw (EGatewayNotOpen)
// { // {
// nlstop; // nlstop;
// } // }
@ -233,7 +230,6 @@ namespace NLNET
{ {
} }
virtual void discloseModule(IModuleProxy *moduleProxy) virtual void discloseModule(IModuleProxy *moduleProxy)
throw (EGatewayNotConnected)
{ {
// check that the module is plugged here // check that the module is plugged here
nlassert(_ModuleProxies.getB(moduleProxy) != NULL); nlassert(_ModuleProxies.getB(moduleProxy) != NULL);

@ -28,6 +28,8 @@
#include "../net_manager.h" #include "../net_manager.h"
#include "../connection.h" #include "../connection.h"
#include <curl/curl.h>
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;

@ -167,17 +167,17 @@ namespace INVENTORIES
pet_animal5, pet_animal5,
pet_animal6, pet_animal6,
pet_animal7, pet_animal7,
max_pet_animal, // 10 max_pet_animal, // 11
NUM_INVENTORY = max_pet_animal, // 10 NUM_INVENTORY = max_pet_animal, // 11
UNDEFINED = NUM_INVENTORY, // 10 UNDEFINED = NUM_INVENTORY, // 11
exchange, // 11 This is not a bug : exchange is a fake inventory exchange, // 12 This is not a bug : exchange is a fake inventory
exchange_proposition, // 12 and should not count in the number of inventory exchange_proposition, // 13 and should not count in the number of inventory
// same for botChat trading. // same for botChat trading.
trading, // 13 trading, // 14
reward_sharing, // 14 fake inventory, not in database.xml. Used by the item info protocol only reward_sharing, // 15 fake inventory, not in database.xml. Used by the item info protocol only
guild, // 15 (warning: number stored in guild saved file) guild, // 16 (warning: number stored in guild saved file)
player_room, // 16 player_room, // 17
NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY NUM_ALL_INVENTORY // warning: distinct from NUM_INVENTORY
}; };

@ -340,7 +340,7 @@ std::string CParticleWorkspace::getFilename() const
return CFile::getFilename(_Filename); return CFile::getFilename(_Filename);
} }
CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath) throw( NLMISC::Exception) CWorkspaceNode *CParticleWorkspace::addNode(const std::string &filenameWithFullPath)
{ {
// Check that file is not already inserted // Check that file is not already inserted
std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath); std::string fileName = NLMISC::CFile::getFilename(filenameWithFullPath);

Loading…
Cancel
Save