summaryrefslogtreecommitdiffstats
path: root/src/installation_proxy.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2015-01-27 21:37:38 +0100
committerGravatar Martin Szulecki2015-01-27 22:01:23 +0100
commit73b36cce1475c7465a1407ccc29f0526699035b9 (patch)
treed397608846266d8d16f2ca64efc53fa33e2a4afe /src/installation_proxy.c
parentd44af054c88ffc2aa1baeee609fa6e704afb2b77 (diff)
downloadlibimobiledevice-73b36cce1475c7465a1407ccc29f0526699035b9.tar.gz
libimobiledevice-73b36cce1475c7465a1407ccc29f0526699035b9.tar.bz2
installation_proxy: Use char* array to pass appids for lookup command
Diffstat (limited to 'src/installation_proxy.c')
-rw-r--r--src/installation_proxy.c43
1 files changed, 28 insertions, 15 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index e4484ad..76eb0ba 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -605,25 +605,39 @@ static void instproxy_copy_lookup_result_cb(plist_t command, plist_t status, voi
}
}
-LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup(instproxy_client_t client, plist_t appids, plist_t client_options, plist_t *result)
+LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup(instproxy_client_t client, const char** appids, plist_t client_options, plist_t *result)
{
- if (!client || !client->parent || !result)
- return INSTPROXY_E_INVALID_ARG;
-
- if (appids && (plist_get_node_type(appids) != PLIST_ARRAY && plist_get_node_type(appids) != PLIST_STRING))
- return INSTPROXY_E_INVALID_ARG;
-
instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
-
+ int i = 0;
plist_t lookup_result = NULL;
+ plist_t command = NULL;
+ plist_t appid_array = NULL;
+ plist_t node = NULL;
- plist_t command = plist_new_dict();
+ if (!client || !client->parent || !result)
+ return INSTPROXY_E_INVALID_ARG;
+
+ command = plist_new_dict();
plist_dict_set_item(command, "Command", plist_new_string("Lookup"));
+ if (client_options) {
+ node = plist_copy(client_options);
+ } else if (appids) {
+ node = plist_new_dict();
+ }
+
+ /* add bundle identifiers to client options */
if (appids) {
- plist_dict_set_item(client_options, "BundleIDs", plist_copy(appids));
+ appid_array = plist_new_array();
+ while (appids[i]) {
+ plist_array_append_item(appid_array, plist_new_string(appids[i]));
+ i++;
+ }
+ plist_dict_set_item(node, "BundleIDs", appid_array);
+ }
+
+ if (node) {
+ plist_dict_set_item(command, "ClientOptions", node);
}
- if (client_options)
- plist_dict_set_item(command, "ClientOptions", plist_copy(client_options));
res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_SYNC, instproxy_copy_lookup_result_cb, (void*)&lookup_result);
@@ -973,12 +987,11 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_client_get_path_for_bundle_iden
instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", "Path", NULL);
// only query for specific appid
- plist_t appid_node = plist_new_string(appid);
+ const char* appids[] = {appid, NULL};
// query device for list of apps
- instproxy_error_t ierr = instproxy_lookup(client, appid_node, client_opts, &apps);
+ instproxy_error_t ierr = instproxy_lookup(client, appids, client_opts, &apps);
- plist_free(appid_node);
instproxy_client_options_free(client_opts);
if (ierr != INSTPROXY_E_SUCCESS) {