From db4f941a4c83b997e301f8cb14a5ae301d059689 Mon Sep 17 00:00:00 2001
From: Martin Szulecki
Date: Mon, 26 Jan 2015 22:35:17 +0100
Subject: installation_proxy: Add new helper to set return attributes in client
 options

---
 include/libimobiledevice/installation_proxy.h | 10 ++++++++++
 src/installation_proxy.c                      | 21 +++++++++++++++++++++
 2 files changed, 31 insertions(+)

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
@@ -294,6 +294,16 @@ plist_t instproxy_client_options_new(void);
  */
 void instproxy_client_options_add(plist_t client_options, ...);
 
+/**
+ * Adds attributes to the given client_options to filter browse results.
+ *
+ * @param client_options The client options to modify.
+ * @param ... VALUE, VALUE, [VALUE], NULL
+ *
+ * @note The values passed are expected to be strings.
+ */
+void instproxy_client_options_set_return_attributes(plist_t client_options, ...);
+
 /**
  * Frees client_options plist.
  *
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, .
 	va_end(args);
 }
 
+LIBIMOBILEDEVICE_API void instproxy_client_options_set_return_attributes(plist_t client_options, ...)
+{
+	if (!client_options)
+		return;
+
+	plist_t return_attributes = plist_new_array();
+
+	va_list args;
+	va_start(args, client_options);
+	char *arg = va_arg(args, char*);
+	while (arg) {
+		char *attribute = strdup(arg);
+		plist_array_append_item(return_attributes, plist_new_string(attribute));
+		free(attribute);
+		arg = va_arg(args, char*);
+	}
+	va_end(args);
+
+	plist_dict_set_item(client_options, "ReturnAttributes", return_attributes);
+}
+
 LIBIMOBILEDEVICE_API void instproxy_client_options_free(plist_t client_options)
 {
 	if (client_options) {
-- 
cgit v1.1-32-gdbae