summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2015-01-26 22:35:17 +0100
committerGravatar Martin Szulecki2015-01-27 22:01:23 +0100
commitdb4f941a4c83b997e301f8cb14a5ae301d059689 (patch)
tree361f42d306ec9d0be84749c1bf95b63597484516
parent4902178daf5c7861b4e6ecb1bdb05120ca8bf70d (diff)
downloadlibimobiledevice-db4f941a4c83b997e301f8cb14a5ae301d059689.tar.gz
libimobiledevice-db4f941a4c83b997e301f8cb14a5ae301d059689.tar.bz2
installation_proxy: Add new helper to set return attributes in client options
-rw-r--r--include/libimobiledevice/installation_proxy.h10
-rw-r--r--src/installation_proxy.c21
2 files changed, 31 insertions, 0 deletions
diff --git a/include/libimobiledevice/installation_proxy.h b/include/libimobiledevice/installation_proxy.h
index c15f0d0..a2189e9 100644
--- a/include/libimobiledevice/installation_proxy.h
+++ b/include/libimobiledevice/installation_proxy.h
@@ -295,6 +295,16 @@ plist_t instproxy_client_options_new(void);
295void instproxy_client_options_add(plist_t client_options, ...); 295void instproxy_client_options_add(plist_t client_options, ...);
296 296
297/** 297/**
298 * Adds attributes to the given client_options to filter browse results.
299 *
300 * @param client_options The client options to modify.
301 * @param ... VALUE, VALUE, [VALUE], NULL
302 *
303 * @note The values passed are expected to be strings.
304 */
305void instproxy_client_options_set_return_attributes(plist_t client_options, ...);
306
307/**
298 * Frees client_options plist. 308 * Frees client_options plist.
299 * 309 *
300 * @param client_options The client options plist to free. Does nothing if NULL 310 * @param client_options The client options plist to free. Does nothing if NULL
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index e279edf..3d9d314 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -578,6 +578,27 @@ LIBIMOBILEDEVICE_API void instproxy_client_options_add(plist_t client_options, .
578 va_end(args); 578 va_end(args);
579} 579}
580 580
581LIBIMOBILEDEVICE_API void instproxy_client_options_set_return_attributes(plist_t client_options, ...)
582{
583 if (!client_options)
584 return;
585
586 plist_t return_attributes = plist_new_array();
587
588 va_list args;
589 va_start(args, client_options);
590 char *arg = va_arg(args, char*);
591 while (arg) {
592 char *attribute = strdup(arg);
593 plist_array_append_item(return_attributes, plist_new_string(attribute));
594 free(attribute);
595 arg = va_arg(args, char*);
596 }
597 va_end(args);
598
599 plist_dict_set_item(client_options, "ReturnAttributes", return_attributes);
600}
601
581LIBIMOBILEDEVICE_API void instproxy_client_options_free(plist_t client_options) 602LIBIMOBILEDEVICE_API void instproxy_client_options_free(plist_t client_options)
582{ 603{
583 if (client_options) { 604 if (client_options) {