diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-05 19:39:49 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-08-05 19:39:49 +0000 |
commit | 6109f05c3895664c42bfb268312d73036f6069b9 (patch) | |
tree | 19ddbcc7ab641158db0c44a2aa7513f9588cc23e /libs | |
parent | 7c39d2171f485fc44dec9b43621e80909ec26633 (diff) |
first pass a "phone home" facility for version tracking and update notification
git-svn-id: svn://localhost/ardour2/branches/3.0@7549 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/callback.h | 8 | ||||
-rw-r--r-- | libs/ardour/callback.cc | 65 | ||||
-rw-r--r-- | libs/ardour/wscript | 1 |
3 files changed, 74 insertions, 0 deletions
diff --git a/libs/ardour/ardour/callback.h b/libs/ardour/ardour/callback.h new file mode 100644 index 0000000000..fe190dbd5e --- /dev/null +++ b/libs/ardour/ardour/callback.h @@ -0,0 +1,8 @@ +#ifndef __libardour_callback_h__ +#define __libardour_callback_h__ + +#include <string> + +void call_the_mothership (const std::string&); + +#endif /* __libardour_callback_h__ */ diff --git a/libs/ardour/callback.cc b/libs/ardour/callback.cc new file mode 100644 index 0000000000..fceb1b4f4b --- /dev/null +++ b/libs/ardour/callback.cc @@ -0,0 +1,65 @@ +#include <iostream> +#include <string> + +#include <sys/utsname.h> +#include <curl/curl.h> + +#include "pbd/compose.h" +#include "ardour/callback.h" + +using namespace std; + +#define PING_URL "http://ardour.org/pingback/versioncheck" + +static size_t +curl_write_data (char *bufptr, size_t size, size_t nitems, void *ptr) +{ + return size * nitems; +} + +static string +watermark () +{ + return ""; +} + +void +call_the_mothership (const string& version) +{ + CURL* c; + struct utsname utb; + + if (uname (&utb)) { + return; + } + + curl_global_init (CURL_GLOBAL_NOTHING); + + c = curl_easy_init (); + + string data; + string wm; + + data = string_compose ("version=%1&platform=%2 %3 %4", version, utb.sysname, utb.release, utb.machine); + + wm = watermark(); + if (!wm.empty()) { + data += string_compose ("&watermark=%1", wm); + } + + curl_easy_setopt(c, CURLOPT_POSTFIELDS, data.c_str()); + curl_easy_setopt(c, CURLOPT_URL, PING_URL); + curl_easy_setopt(c, CURLOPT_WRITEFUNCTION, curl_write_data); + curl_easy_setopt(c, CURLOPT_WRITEDATA, 0); + + std::cerr << "Callback to ardour.org ...\n"; + + char errbuf[CURL_ERROR_SIZE]; + curl_easy_setopt(c, CURLOPT_ERRORBUFFER, errbuf); + + if (curl_easy_perform (c) == 0) { + + } + + curl_easy_cleanup (c); +} diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 0f103c9688..051054c9a7 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -61,6 +61,7 @@ libardour_sources = [ 'buffer_set.cc', 'bundle.cc', 'butler.cc', + 'callback.cc', 'chan_count.cc', 'chan_mapping.cc', 'configuration.cc', |