diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2019-06-13 14:03:25 -0700 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2019-06-19 14:11:25 +0000 |
commit | a9584f072945bfda5d7741d43cb870dcb291fd70 (patch) | |
tree | 478405523fab82ffd1adfa11824e61820751f47b /binding | |
parent | b70b8c29fdf0c9f19b40cc5a6474ca1adf3cbae9 (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>
Diffstat (limited to 'binding')
-rw-r--r-- | binding/bluetooth-map-api.c | 22 |
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; } |