diff options
-rw-r--r-- | include/libiphone/installation_proxy.h | 5 | ||||
-rw-r--r-- | src/InstallationProxy.c | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/include/libiphone/installation_proxy.h b/include/libiphone/installation_proxy.h index dcf668f..f432e8a 100644 --- a/include/libiphone/installation_proxy.h +++ b/include/libiphone/installation_proxy.h @@ -47,6 +47,9 @@ typedef enum { INSTPROXY_APPTYPE_USER = 2 } instproxy_apptype_t; +#define INSTPROXY_ARCHIVE_APP_ONLY (1 << 0) +#define INSTPROXY_ARCHIVE_SKIP_UNINSTALL (1 << 1) + struct instproxy_client_int; typedef struct instproxy_client_int *instproxy_client_t; @@ -62,7 +65,7 @@ instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_p instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t *result); -instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); +instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, uint32_t options, instproxy_status_cb_t status_cb); instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); diff --git a/src/InstallationProxy.c b/src/InstallationProxy.c index 7a8ef5a..917886d 100644 --- a/src/InstallationProxy.c +++ b/src/InstallationProxy.c @@ -676,6 +676,11 @@ leave_unlock: * * @param client The connected installation proxy client * @param appid ApplicationIdentifier of the app to archive. + * @param options This is either 0 for default behaviour (make an archive + * including app/user settings etc. AND uninstall the application), + * or one or a combination of the following options: + * INSTPROXY_ARCHIVE_APP_ONLY (1) + * INSTPROXY_ARCHIVE_SKIP_UNINSTALL (2) * @param status_cb Callback function for progress and status information. If * NULL is passed, this function will run synchronously. * @@ -687,7 +692,7 @@ leave_unlock: * created successfully; any error occuring during the operation has to be * handled inside the specified callback function. */ -instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb) +instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, uint32_t options, instproxy_status_cb_t status_cb) { if (!client || !client->connection || !appid) return INSTPROXY_E_INVALID_ARG; @@ -700,6 +705,16 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid plist_t dict = plist_new_dict(); plist_dict_insert_item(dict, "ApplicationIdentifier", plist_new_string(appid)); + if (options > 0) { + plist_t client_opts = plist_new_dict(); + if (options & INSTPROXY_ARCHIVE_APP_ONLY) { + plist_dict_insert_item(client_opts, "ArchiveType", plist_new_string("ApplicationOnly")); + } + if (options & INSTPROXY_ARCHIVE_SKIP_UNINSTALL) { + plist_dict_insert_item(client_opts, "SkipUninstall", plist_new_bool(1)); + } + plist_dict_insert_item(dict, "ClientOptions", client_opts); + } plist_dict_insert_item(dict, "Command", plist_new_string("Archive")); instproxy_lock(client); |