curl_easy_setopt (_curl, CURLOPT_WRITEFUNCTION, write_callback_wrapper);
curl_easy_setopt (_curl, CURLOPT_WRITEDATA, this);
curl_easy_setopt (_curl, CURLOPT_TIMEOUT, 20);
-
+
string const agent = "dcpomatic/" + string (dcpomatic_version);
curl_easy_setopt (_curl, CURLOPT_USERAGENT, agent.c_str ());
UpdateChecker::~UpdateChecker ()
{
/* We are not cleaning up our thread, but hey well */
-
+
curl_easy_cleanup (_curl);
curl_global_cleanup ();
delete[] _buffer;
}
--_to_do;
lock.unlock ();
-
+
try {
_offset = 0;
/* Perform the request */
-
+
int r = curl_easy_perform (_curl);
if (r != CURLE_OK) {
set_state (FAILED);
}
/* Parse the reply */
-
+
_buffer[_offset] = '\0';
string s (_buffer);
cxml::Document doc ("Update");
if (version_less_than (dcpomatic_version, stable)) {
_stable = stable;
}
-
+
if (Config::instance()->check_for_test_updates() && version_less_than (dcpomatic_version, test)) {
_test = test;
}
}
}
}
-
+
size_t
UpdateChecker::write_callback (void* data, size_t size, size_t nmemb)
{
} else {
am = raw_convert<int> (ap[2]);
}
-
+
float bm;
if (ends_with (bp[2], "devel")) {
bm = raw_convert<int> (bp[2].substr (0, bp[2].length() - 5)) + 0.5;
} else {
bm = raw_convert<int> (bp[2]);
}
-
+
return am < bm;
}