first pass a "phone home" facility for version tracking and update notification
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 5 Aug 2010 19:39:49 +0000 (19:39 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 5 Aug 2010 19:39:49 +0000 (19:39 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7549 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour_ui.cc
gtk2_ardour/wscript
libs/ardour/ardour/callback.h [new file with mode: 0644]
libs/ardour/callback.cc [new file with mode: 0644]
libs/ardour/wscript
wscript

index 14d8215a628ea4862c511908a8e4ae1ba44c518d..b28bccbc94a92fe26797842107c5ea1bba42ff15 100644 (file)
@@ -55,6 +55,7 @@
 #include "midi++/manager.h"
 
 #include "ardour/ardour.h"
+#include "ardour/callback.h"
 #include "ardour/profile.h"
 #include "ardour/session_directory.h"
 #include "ardour/session_route.h"
@@ -646,6 +647,11 @@ Please consider the possibilities, and perhaps (re)start JACK."));
 void
 ARDOUR_UI::startup ()
 {
+
+#ifdef PHONE_HOME
+        call_the_mothership (VERSIONSTRING);
+#endif
+
        if (get_session_parameters (true, ARDOUR_COMMAND_LINE::new_session, ARDOUR_COMMAND_LINE::load_template)) {
                exit (1);
        }
index e47ba21682d2ec6e05a5aacc14c9aa338c63a9ce..c97a6fcc0120d692a9ea88612d51da2ecd32f036 100644 (file)
@@ -289,6 +289,9 @@ def build(bld):
                obj.source += [ 'vst_pluginui.cc' ]
                obj.cxxflags += [ '-DVST_SUPPORT' ]
 
+        if bld.env['PHONE_HOME']:
+                obj.cxxflags += [ '-DPHONE_HOME' ]
+
        if bld.env['GTKOSX']:
                TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cc']
                obj.source += [ 'cocoacarbon.mm' ]
diff --git a/libs/ardour/ardour/callback.h b/libs/ardour/ardour/callback.h
new file mode 100644 (file)
index 0000000..fe190db
--- /dev/null
@@ -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 (file)
index 0000000..fceb1b4
--- /dev/null
@@ -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);
+}
index 0f103c9688de18f61288f35476deec51b861232b..051054c9a738faccb55753aacd1c3bf601a97724 100644 (file)
@@ -61,6 +61,7 @@ libardour_sources = [
        'buffer_set.cc',
        'bundle.cc',
        'butler.cc',
+        'callback.cc',
        'chan_count.cc',
        'chan_mapping.cc',
        'configuration.cc',
diff --git a/wscript b/wscript
index 9b41223a847ece4806ead97fbad1990808bb6bdb..b27cb9e4933a70f65c9256ca2be7c2e884fd3795 100644 (file)
--- a/wscript
+++ b/wscript
@@ -328,7 +328,7 @@ def set_options(opt):
        opt.add_option('--boost-sp-debug', action='store_true', default=False, dest='boost_sp_debug',
                        help='Compile with Boost shared pointer debugging')
        opt.add_option('--audiounits', action='store_true', default=False, dest='audiounits',
-                       help='Compile with Apple\'s AudioUnit library (experimental)')
+                       help='Compile with Apple\'s AudioUnit library')
        opt.add_option('--coreaudio', action='store_true', default=False, dest='coreaudio',
                        help='Compile with Apple\'s CoreAudio library')
        opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
@@ -351,6 +351,7 @@ def set_options(opt):
        opt.add_option('--nls', action='store_true', default=True, dest='nls',
                        help='Enable i18n (native language support) (default)')
        opt.add_option('--no-nls', action='store_false', dest='nls')
+       opt.add_option('--phone-home', action='store_false', default=True, dest='phone_home')
        opt.add_option('--stl-debug', action='store_true', default=False, dest='stl_debug',
                        help='Build with debugging for the STL')
        opt.add_option('--test', action='store_true', default=False, dest='build_tests', 
@@ -503,7 +504,13 @@ def configure(conf):
        conf.env.append_value('CXXFLAGS', '-DWAF_BUILD')
        
        autowaf.print_summary(conf)
+
+        # debug builds should not call home
+
        opts = Options.options
+        if opts.debug:
+                opts.phone_home = False;
+
        autowaf.display_header('Ardour Configuration')
        autowaf.display_msg(conf, 'Build Target', conf.env['build_target'])
        autowaf.display_msg(conf, 'Architecture flags', opts.arch)
@@ -514,6 +521,9 @@ def configure(conf):
                conf.define ('COREAUDIO', 1)
        if opts.audiounits:
                conf.define('AUDIOUNITS',1)
+       autowaf.display_msg(conf, 'Phone Home', opts.phone_home)
+       if opts.phone_home:
+               conf.env['PHONE_HOME'] = opts.phone_home
        autowaf.display_msg(conf, 'FPU Optimization', opts.fpu_optimization)
        if opts.fpu_optimization:
                conf.define('FPU_OPTIMIZATION', 1)
@@ -534,7 +544,7 @@ def configure(conf):
        autowaf.display_msg(conf, 'Tranzport', opts.tranzport)
        if opts.build_tests:
                conf.env['BUILD_TESTS'] = opts.build_tests
-               autowaf.display_msg(conf, 'Unit Tests', bool(conf.env['BUILD_TESTS']) and bool (conf.env['HAVE_CPPUNIT']))
+       autowaf.display_msg(conf, 'Unit Tests', bool(conf.env['BUILD_TESTS']) and bool (conf.env['HAVE_CPPUNIT']))
        if opts.tranzport:
                conf.define('TRANZPORT', 1)
        autowaf.display_msg(conf, 'Universal Binary', opts.universal)