diff options
author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-03 20:08:12 +0000 |
---|---|---|
committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-08-03 20:08:12 +0000 |
commit | b7e27d3358a177e97b946bae7fbeda782014bfa0 (patch) | |
tree | b5c83cd33a1713aa68621db6492fc456024f613e /hcid | |
parent | 81368247ef622f98aaeac2d630b7b7c2bb76fe63 (diff) |
hcid: ListRemoteDevices - added trusted devices and connected devices, removed lastseen
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/dbus-adapter.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c index 83b0f516..489e4963 100644 --- a/hcid/dbus-adapter.c +++ b/hcid/dbus-adapter.c @@ -2836,6 +2836,19 @@ static void list_remote_devices_do_append(char *key, char *value, void *data) param->list = g_slist_append(param->list, address); } +static void active_conn_append(void *value, void *data) +{ + struct active_conn_info *con = value; + GSList *l = data; + char address[18]; + + ba2str(&con->bdaddr, address); + if (g_slist_find_custom(l, address, (GCompareFunc) strcasecmp)) + return; + + l = g_slist_append(l, g_strdup(address)); +} + static void remote_devices_do_append(void *data, void *user_data) { DBusMessageIter *iter = user_data; @@ -2861,13 +2874,15 @@ static DBusHandlerResult adapter_list_remote_devices(DBusConnection *conn, create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "linkkeys"); textfile_foreach(filename, list_remote_devices_do_append, ¶m); + /* Add Trusted devices to the list */ + create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "trusts"); + textfile_foreach(filename, list_remote_devices_do_append, ¶m); + /* Add Last Used devices to the list */ create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "lastused"); textfile_foreach(filename, list_remote_devices_do_append, ¶m); - /* Add Last Seen devices to the list */ - create_name(filename, PATH_MAX, STORAGEDIR, adapter->address, "lastseen"); - textfile_foreach(filename, list_remote_devices_do_append, ¶m); + g_slist_foreach(adapter->active_conn, active_conn_append, param.list); reply = dbus_message_new_method_return(msg); |