summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegis Merlino <regis.merlino@intel.com>2013-03-28 10:25:34 +0100
committerRegis Merlino <regis.merlino@intel.com>2013-03-28 10:27:11 +0100
commit4c19ed2c349e73fd35d9007a4f411e7ca2536218 (patch)
treebf7856d4367eba26a1d8a0e6b5dcd1478411f61f
parent96f167287afc2447e51b47c1794db72cf4fbb529 (diff)
downloaddleyna-server-4c19ed2c349e73fd35d9007a4f411e7ca2536218.tar.gz
[Props] Handle wild cards for SortCaps & SearchCaps
Signed-off-by: Regis Merlino <regis.merlino@intel.com>
-rw-r--r--doc/server/dbus/API.txt6
-rw-r--r--libdleyna/server/device.c22
2 files changed, 19 insertions, 9 deletions
diff --git a/doc/server/dbus/API.txt b/doc/server/dbus/API.txt
index 6c816eb..fbac2f9 100644
--- a/doc/server/dbus/API.txt
+++ b/doc/server/dbus/API.txt
@@ -198,11 +198,17 @@ below:
|------------------------------------------------------------------------------|
| SearchCaps | as | m | List of property names that can be used |
| | | | in search queries. |
+| | | | A wildcard (“*”) indicates that the |
+| | | | device supports search queries using |
+| | | | any property name(s). |
| | | | Empty if not supported by the device. |
|------------------------------------------------------------------------------|
| SortCaps | as | m | List of property names that can be used |
| | | | to sort Search() or Browse() action |
| | | | results. |
+| | | | A wildcard (“*”) indicates that the |
+| | | | device supports sorting using all |
+| | | | property names. |
| | | | Empty if not supported by the device. |
|------------------------------------------------------------------------------|
| SortExtCaps | as | o | List of sort modifiers that can be used |
diff --git a/libdleyna/server/device.c b/libdleyna/server/device.c
index a3dfcf0..2c7cf49 100644
--- a/libdleyna/server/device.c
+++ b/libdleyna/server/device.c
@@ -747,19 +747,23 @@ static void prv_get_capabilities_analyze(GHashTable *property_map,
g_variant_builder_init(&caps_vb, G_VARIANT_TYPE("as"));
- caps = g_strsplit(result, ",", 0);
- saved = caps;
+ if (!strcmp(result, "*")) {
+ g_variant_builder_add(&caps_vb, "s", "*");
+ } else {
+ caps = g_strsplit(result, ",", 0);
+ saved = caps;
- while (caps && *caps) {
- prop_name = g_hash_table_lookup(property_map, *caps);
+ while (caps && *caps) {
+ prop_name = g_hash_table_lookup(property_map, *caps);
- if (prop_name)
- g_variant_builder_add(&caps_vb, "s", prop_name);
+ if (prop_name)
+ g_variant_builder_add(&caps_vb, "s", prop_name);
- caps++;
- }
+ caps++;
+ }
- g_strfreev(saved);
+ g_strfreev(saved);
+ }
*variant = g_variant_ref_sink(g_variant_builder_end(&caps_vb));