From 43ccd84af0707b29b146a9ea3d21094d6eb30e3a Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sat, 27 Feb 2010 10:35:57 -0700 Subject: Report more info on client in cURL useragent and Desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer Reviewed-by: Chuck Miller --- src/gui/widgets/desktop.cpp | 12 +++++++++++- src/main.h | 29 ++++++++++++++++++++++++++++- src/net/download.cpp | 11 ++++++----- 3 files changed, 45 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index e7cd949a..2a80cc11 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -20,6 +20,7 @@ #include "gui/widgets/desktop.h" +#include "configuration.h" #include "graphics.h" #include "log.h" #include "main.h" @@ -32,6 +33,8 @@ #include "resources/resourcemanager.h" #include "resources/wallpaper.h" +#include "utils/stringutils.h" + Desktop::Desktop() : mWallpaper(0) { @@ -39,7 +42,14 @@ Desktop::Desktop() Wallpaper::loadWallpapers(); - mVersionLabel = new Label(FULL_VERSION); + std::string appName = branding.getValue("appName", ""); + + if (appName.empty()) + mVersionLabel = new Label(FULL_VERSION); + else + mVersionLabel = new Label(strprintf("%s (Mana %s)", appName.c_str(), + FULL_VERSION)); + mVersionLabel->setBackgroundColor(gcn::Color(255, 255, 255, 128)); add(mVersionLabel, 25, 2); } diff --git a/src/main.h b/src/main.h index 03e0c7b3..3f30ef14 100644 --- a/src/main.h +++ b/src/main.h @@ -55,7 +55,7 @@ #elif defined WIN32 #include "winver.h" #elif defined __APPLE__ -#define PACKAGE_VERSION "0.0.29.1" +#define PACKAGE_VERSION "1.0.0" #endif #ifdef PACKAGE_VERSION @@ -64,6 +64,33 @@ #define FULL_VERSION "Unknown Version" #endif +#ifdef PACKAGE_OS +// If it's already been defined, let's not change it +#elif defined __APPLE__ +#define PACKAGE_OS "Apple" +#elif defined __FreeBSD__ || defined __DragonFly__ +#define PACKAGE_OS "FreeBSD" +#elif defined __NetBSD__ +#define PACKAGE_OS "NetBSD" +#elif defined __OpenBSD__ +#define PACKAGE_OS "OpenBSD" +#elif defined __linux__ || defined __linux +#define PACKAGE_OS "Linux" +#elif defined __GNU__ +#define PACKAGE_OS "GNU Hurd" +#elif defined WIN32 || defined _WIN32 || defined __WIN32__ || defined __NT__ \ + || defined WIN64 || defined _WIN64 || defined __WIN64__ +#define PACKAGE_OS "Windows" +#else +#define PACKAGE_OS "Other" +#endif + +#ifdef PACKAGE_VERSION +#define PACKAGE_EXTENDED_VERSION "Mana/" PACKAGE_VERSION " (" PACKAGE_OS "; %s)" +#else +#define PACKAGE_EXTENDED_VERSION "Mana (" PACKAGE_OS "; %s)" +#endif + #ifndef PKG_DATADIR #define PKG_DATADIR "" #endif diff --git a/src/net/download.cpp b/src/net/download.cpp index ba5b6b35..2b96a6b9 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -20,9 +20,12 @@ #include "net/download.h" +#include "configuration.h" #include "log.h" #include "main.h" +#include "utils/stringutils.h" + #include #include @@ -217,11 +220,9 @@ int Download::downloadThread(void *ptr) curl_easy_setopt(d->mCurl, CURLOPT_WRITEDATA, file); } -#ifdef PACKAGE_VERSION - curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana/" PACKAGE_VERSION); -#else - curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, "Mana"); -#endif + curl_easy_setopt(d->mCurl, CURLOPT_USERAGENT, + strprintf(PACKAGE_EXTENDED_VERSION, branding + .getValue("appShort", "mana").c_str()).c_str()); curl_easy_setopt(d->mCurl, CURLOPT_ERRORBUFFER, d->mError); curl_easy_setopt(d->mCurl, CURLOPT_URL, d->mUrl.c_str()); curl_easy_setopt(d->mCurl, CURLOPT_NOPROGRESS, 0); -- cgit v1.2.3-70-g09d2