diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-04-24 18:54:59 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-05-19 02:49:07 +0200 |
commit | 75720325b1fb4ab93eeabed8acc19dbd30ddaf84 (patch) | |
tree | a2dbab4f3086f76c58ae4fa0c92d5dc7b92e82cc | |
parent | extract the common updater path info into methods (diff) | |
download | core-75720325b1fb4ab93eeabed8acc19dbd30ddaf84.tar.gz core-75720325b1fb4ab93eeabed8acc19dbd30ddaf84.zip |
better reporting for normal response from updater
Change-Id: I26cbd69c46afadc21eeab73cbccddc6873c43655
-rw-r--r-- | desktop/source/app/updater.cxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx index a0e0e3bf4f6f..388c45e7211e 100644 --- a/desktop/source/app/updater.cxx +++ b/desktop/source/app/updater.cxx @@ -194,6 +194,7 @@ struct update_info { OUString aFromBuildID; OUString aSeeAlsoURL; + OUString aMessage; update_file aUpdateFile; std::vector<language_file> aLanguageFiles; @@ -356,6 +357,13 @@ update_info parse_response(const std::string& rResponse) { throw invalid_update_info(); } + else if (std::find(aRootKeys.begin(), aRootKeys.end(), "response") != aRootKeys.end()) + { + update_info aUpdateInfo; + auto aMsgNode = aDocumentRoot.child("response"); + aUpdateInfo.aMessage = toOUString(aMsgNode.string_value().str()); + return aUpdateInfo; + } orcus::json::detail::node aFromNode = aDocumentRoot.child("from"); if (aFromNode.type() != orcus::json_node_t::string) @@ -544,8 +552,17 @@ void update_checker() if (!response_body.empty()) { update_info aUpdateInfo = parse_response(response_body); - download_file(aUpdateInfo.aUpdateFile.aURL, aUpdateInfo.aUpdateFile.nSize, aUpdateInfo.aUpdateFile.aHash, "update.mar"); - CreateValidUpdateDir(aUpdateInfo); + if (aUpdateInfo.aUpdateFile.aURL.isEmpty()) + { + // No update currently available + // add entry to updating.log with the message + SAL_WARN("desktop.updater", "Message received from the updater: " << aUpdateInfo.aMessage); + } + else + { + download_file(aUpdateInfo.aUpdateFile.aURL, aUpdateInfo.aUpdateFile.nSize, aUpdateInfo.aUpdateFile.aHash, "update.mar"); + CreateValidUpdateDir(aUpdateInfo); + } } } catch (const invalid_update_info&) |