summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-02-05 16:37:45 +0100
committerGravatar Martin Szulecki2012-02-05 16:37:45 +0100
commit4aa787d322720b613a28ac1d7b1434fb3c3963fa (patch)
tree786c19220af7bbc32296486cef48e9babcbdf3e6
parent3495adc8b576f9bf93620e7ffa0c476d2b8aeaa3 (diff)
downloadidevicerestore-4aa787d322720b613a28ac1d7b1434fb3c3963fa.tar.gz
idevicerestore-4aa787d322720b613a28ac1d7b1434fb3c3963fa.tar.bz2
restore: Implement handling of PreviousRestoreLogMsg message
-rw-r--r--src/restore.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/restore.c b/src/restore.c
index 361ccb6..ea93569 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -362,6 +362,23 @@ const char* restore_progress_string(unsigned int operation) {
static int lastop = 0;
+int restore_handle_previous_restore_log_msg(restored_client_t client, plist_t msg) {
+ plist_t node = NULL;
+ char* restorelog = NULL;
+
+ node = plist_dict_get_item(msg, "PreviousRestoreLog");
+ if (!node || plist_get_node_type(node) != PLIST_STRING) {
+ debug("Failed to parse restore log from PreviousRestoreLog plist\n");
+ return -1;
+ }
+ plist_get_string_val(node, &restorelog);
+
+ info("Previous Restore Log Received:\n%s\n", restorelog);
+ free(restorelog);
+
+ return 0;
+}
+
int restore_handle_progress_msg(restored_client_t client, plist_t msg) {
plist_t node = NULL;
uint64_t progress = 0;
@@ -822,6 +839,11 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit
error = restore_handle_data_request_msg(client, device, restore, message, build_identity, filesystem);
}
+ // previous restore logs are available if a previous restore failed
+ else if (!strcmp(type, "PreviousRestoreLogMsg")) {
+ error = restore_handle_previous_restore_log_msg(restore, message);
+ }
+
// progress notification messages sent by the restored inform the client
// of it's current operation and sometimes percent of progress is complete
else if (!strcmp(type, "ProgressMsg")) {