Merge branch 'master' into windows
[ardour.git] / gtk2_ardour / pingback.cc
index 11429c120521d9359e4771d6d4e258a5418dfa19..ccec81cba7a70164d93728cd5a36e21c7e97470f 100644 (file)
 #include <fstream>
 #include <cstring>
 
+#ifndef WIN32
 #include <sys/utsname.h>
+#endif
+
 #include <curl/curl.h>
 
 #include <glibmm/miscutils.h>
 
 #include "pbd/compose.h"
 #include "pbd/pthread_utils.h"
+
 #include "ardour/filesystem_paths.h"
+#include "ardour/rc_configuration.h"
 
 #include "pingback.h"
 
 using std::string;
+using namespace ARDOUR;
 
 static size_t
 curl_write_data (char *bufptr, size_t size, size_t nitems, void *ptr)
@@ -67,6 +73,7 @@ struct ping_call {
 static void*
 _pingback (void *arg)
 {
+#ifndef WIN32
        ping_call* cm = static_cast<ping_call*> (arg);
        CURL* c;
        struct utsname utb;
@@ -85,20 +92,13 @@ _pingback (void *arg)
        curl_easy_setopt (c, CURLOPT_WRITEDATA, &return_str); 
        char errbuf[CURL_ERROR_SIZE];
        curl_easy_setopt (c, CURLOPT_ERRORBUFFER, errbuf); 
-       /* we really would prefer to be able to authenticate the certificate
-          but this has issues that right now (march 2013), i don't understand.
-       */
-       curl_easy_setopt (c, CURLOPT_SSL_VERIFYPEER, 0);
-
-       //get announcements from our server
-       std::cerr << "Checking for Announcements from ardour.org  ...\n";
 
        string url;
 
 #ifdef __APPLE__
-       url = "https://community.ardour.org/pingback/osx/";
+       url = Config->get_osx_pingback_url ();
 #else
-       url = "https://community.ardour.org/pingback/linux/";
+       url = Config->get_linux_pingback_url ();
 #endif
 
        char* v = curl_easy_escape (c, cm->version.c_str(), cm->version.length());
@@ -127,14 +127,12 @@ _pingback (void *arg)
        url += s;
        free (query);
 
-       std::cerr << "ping using " << url << std::endl;
-
        curl_easy_setopt (c, CURLOPT_URL, url.c_str());
 
        return_str = "";
 
        if (curl_easy_perform (c) == 0) {
-               int http_status; 
+               long http_status; 
 
                curl_easy_getinfo (c, CURLINFO_RESPONSE_CODE, &http_status);
 
@@ -164,6 +162,8 @@ _pingback (void *arg)
        curl_easy_cleanup (c);
        delete cm;
 
+#endif /* WIN32 */
+
        return 0;
 }