summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-06-13 14:03:25 -0700
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2019-06-19 14:11:25 +0000
commita9584f072945bfda5d7741d43cb870dcb291fd70 (patch)
tree478405523fab82ffd1adfa11824e61820751f47b
parentb70b8c29fdf0c9f19b40cc5a6474ca1adf3cbae9 (diff)
binding: bluetooth-map: add notification check on org.bluez.obex.Message1 interfaces
Preventing of broadcasting of sent, and previously received messages over the notification event. This happens because a ListMessage call to the org.bluez.obex.MessageAccess1 interface will cause message interfaces to be created. Bug-AGL: SPEC-2512 Change-Id: I291b36be732c394c116db0d2e82cb8d4c0ce759a Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
-rw-r--r--binding/bluetooth-map-api.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/binding/bluetooth-map-api.c b/binding/bluetooth-map-api.c
index 5023c5a..a52df61 100644
--- a/binding/bluetooth-map-api.c
+++ b/binding/bluetooth-map-api.c
@@ -408,6 +408,21 @@ static void map_notification_event(struct map_state *ns, gchar *filename)
g_free(buf);
}
+static gboolean map_notification_check(GVariant *var)
+{
+ GVariantIter *array = g_variant_iter_new(var);
+ const char *name = NULL;
+ GVariant *val = NULL;
+
+ while (g_variant_iter_next(array, "{&sv}", &name, &val)) {
+ if (g_strcmp0("Status", name))
+ continue;
+ return !g_strcmp0("notification", g_variant_get_string(val, NULL));
+ }
+
+ return FALSE;
+}
+
static void bluez_map_signal_callback(
GDBusConnection *connection,
const gchar *sender_name,
@@ -437,6 +452,13 @@ static void bluez_map_signal_callback(
GVariant *val = NULL;
if (!g_strcmp0(key, BLUEZ_OBEX_MESSAGE_INTERFACE)) {
+
+ /* ListMessages will send all messages as events
+ * if notification status isn't checked
+ */
+ if (!map_notification_check(var))
+ return;
+
map_request_message(ns, path);
continue;
}