summaryrefslogtreecommitdiff
path: root/src/gui/updatewindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/updatewindow.cpp')
-rw-r--r--src/gui/updatewindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index d41dfe13..fe78a27b 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -28,8 +28,6 @@
#include <SDL_thread.h>
#include <zlib.h>
-#include <curl/curl.h>
-
#include <guichan/widgets/label.hpp>
#include "browserbox.h"
@@ -37,6 +35,9 @@
#include "progressbar.h"
#include "scrollarea.h"
+// Curl should be included after Guichan to avoid Windows redefinitions
+#include <curl/curl.h>
+
#include "../configuration.h"
#include "../log.h"
#include "../main.h"
@@ -137,7 +138,7 @@ void UpdaterWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "cancel")
{
// Register the user cancel
- mUserCancel=true;
+ mUserCancel = true;
// Skip the updating process
if (mDownloadStatus == UPDATE_COMPLETE)
{
@@ -262,6 +263,11 @@ int UpdaterWindow::downloadThread(void *ptr)
curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
}
+#ifdef PACKAGE_VERSION
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, "TMW/" PACKAGE_VERSION);
+#else
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, "TMW");
+#endif
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, uw->mCurlError);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
@@ -365,13 +371,13 @@ void UpdaterWindow::logic()
case UPDATE_ERROR:
if (mThread)
{
- if(mUserCancel){
+ if (mUserCancel) {
// Kill the thread, because user has canceled
SDL_KillThread(mThread);
// Set the flag to false again
mUserCancel = false;
}
- else{
+ else {
SDL_WaitThread(mThread, NULL);
}
mThread = NULL;