summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-07-08 22:38:25 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-07-09 15:18:33 -0700
commit6d7586ee12d4bbf0cc47c5b9bf8d300d64783e3b (patch)
treed585114b9f69e4f0ebc419c16ac20840feaa8b50 /binding
parent589ba36bde23173b65a2e63a451eb48668f433a3 (diff)
binding: bluetooth-map: add 'downloaded' field to list_messages resultshalibut_7.99.3halibut/7.99.37.99.3
Signal that all the message is downloaded which is usually if the subject/message is under 256 characters with a 'downloaded' boolean parameter. This avoids libqtappfw from doing a OBEX transfer per message that under this threshold. Bug-AGL: SPEC-2512 Change-Id: I9f59337b2b4995a0359587c22e2efeee19bdae8e Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/bluetooth-map-api.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c
index efe2cdf..2784243 100644
--- a/binding/bluetooth-map-api.c
+++ b/binding/bluetooth-map-api.c
@@ -503,7 +503,8 @@ static void list_msgs(afb_req_t request)
while (g_variant_iter_loop(iter, "{oa{sv}}", &path, &iter2)) {
const char *key = NULL;
GVariant *val = NULL;
- json_object *msg = json_object_new_object();
+ json_object *msg = json_object_new_object(), *val1;
+ size_t size = 0;
while (g_variant_iter_loop(iter2, "{sv}", &key, &val)) {
GError *error = NULL;
@@ -519,6 +520,13 @@ static void list_msgs(afb_req_t request)
g_clear_error(&error);
}
}
+
+ if (json_object_object_get_ex(msg, "size", &val1))
+ size = json_object_get_int(val1);
+ if (json_object_object_get_ex(msg, "subject", &val1))
+ size -= strlen(json_object_get_string(val1));
+
+ json_object_object_add(msg, "downloaded", json_object_new_boolean(!size));
json_object_object_add(jmessage, path + strlen(session) + 1, msg);
}