summaryrefslogtreecommitdiffstats
path: root/hcid/dbus-service.c
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2006-10-27 17:55:17 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2006-10-27 17:55:17 +0000
commit1c01dbb402afcffd227432ab81dd163dd7b1893e (patch)
treed62e784d2cf30b943bca43bd19be095fc5835ad2 /hcid/dbus-service.c
parentf6b3297c6123445d3db8111eb4bcbc17d24fd132 (diff)
Added IsTrusted in the Service interface
Diffstat (limited to 'hcid/dbus-service.c')
-rw-r--r--hcid/dbus-service.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c
index 865e3f36..5c085fb6 100644
--- a/hcid/dbus-service.c
+++ b/hcid/dbus-service.c
@@ -501,7 +501,29 @@ static DBusHandlerResult set_trusted(DBusConnection *conn,
static DBusHandlerResult is_trusted(DBusConnection *conn,
DBusMessage *msg, void *data)
{
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ struct service_agent *agent = data;
+ struct slist *l;
+ DBusMessage *reply;
+ const char *address;
+ dbus_bool_t trusted;
+
+ if (!dbus_message_get_args(msg, NULL,
+ DBUS_TYPE_STRING, &address,
+ DBUS_TYPE_INVALID))
+ return error_invalid_arguments(conn, msg);
+
+ l = slist_find(agent->trusted_devices, address, (cmp_func_t) strcmp);
+ trusted = (l? TRUE : FALSE);
+
+ reply = dbus_message_new_method_return(msg);
+ if (!reply)
+ return DBUS_HANDLER_RESULT_NEED_MEMORY;
+
+ dbus_message_append_args(msg,
+ DBUS_TYPE_BOOLEAN, &trusted,
+ DBUS_TYPE_INVALID);
+
+ return send_message_and_unref(conn, reply);
}
static DBusHandlerResult remove_trust(DBusConnection *conn,