diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-06 14:18:59 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-06 14:18:59 +0000 |
commit | 7d34a65515630ddfe5ff91bfea1768374da59d10 (patch) | |
tree | 1ba90cefb9bb4201951d44c6ed03971b739de9e5 /hcid | |
parent | b95fa5823167ea5e7d1507d69346fd4fce0a2b1b (diff) |
hcid: ListRecentRemoteDevices - force appending connected devices(lastused might not match)
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-adapter.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index 2d3edef8..8ee779c6 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -2886,6 +2886,19 @@ static DBusHandlerResult adapter_list_remote_devices(DBusConnection *conn, return send_message_and_unref(conn, reply); } +static void append_connected(struct active_conn_info *dev, GSList *list) +{ + GSList *l; + char address[18]; + + ba2str(&dev->bdaddr, address); + l = g_slist_find_custom(list, address, (GCompareFunc) strcasecmp); + if (l) + return; + + list = g_slist_append(list, g_strdup(address)); +} + static DBusHandlerResult adapter_list_recent_remote_devices(DBusConnection *conn, DBusMessage *msg, void *data) @@ -2927,6 +2940,9 @@ static DBusHandlerResult adapter_list_recent_remote_devices(DBusConnection *conn create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "lastused"); textfile_foreach(filename, list_remote_devices_do_append, ¶m); + /* connected: force appending connected devices, lastused might not match */ + g_slist_foreach(adapter->active_conn, (GFunc) append_connected, param.list); + reply = dbus_message_new_method_return(msg); dbus_message_iter_init_append(reply, &iter); |