diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-01-16 10:09:05 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-01-16 10:09:05 +0000 |
commit | 424e98b0d14ffe676fb478ed48d083fced91e111 (patch) | |
tree | 4dedd1fa42410bf75e120f10a5dacae0f2e0a5a5 /hcid/dbus-service.c | |
parent | d25a07673af6e6320baa7380eca777533b67c1ef (diff) |
Implement FindService method
Diffstat (limited to 'hcid/dbus-service.c')
-rw-r--r-- | hcid/dbus-service.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hcid/dbus-service.c b/hcid/dbus-service.c index 5a6d8199..4f935ff5 100644 --- a/hcid/dbus-service.c +++ b/hcid/dbus-service.c @@ -877,6 +877,30 @@ void release_services(DBusConnection *conn) services = NULL; } +const char *search_service(DBusConnection *conn, const char *pattern) +{ + GSList *l = services; + struct service *service; + const char *path; + + while (l) { + path = l->data; + + l = l->next; + + if (!dbus_connection_get_object_path_data(conn, path, (void *) &service)) + continue; + + if (!service) + continue; + + if (service->ident && !strcmp(service->ident, pattern)) + return path; + } + + return NULL; +} + void append_available_services(DBusMessageIter *array_iter) { GSList *l; |