From 79f26924eae66fcbb69c5b12a35189611fdb9c31 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 20 Nov 2022 12:03:18 +0000 Subject: [PATCH] Add functions for listing clients --- include/neatvnc.h | 3 +++ src/server.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/neatvnc.h b/include/neatvnc.h index a0ccbb7..ee778ff 100644 --- a/include/neatvnc.h +++ b/include/neatvnc.h @@ -134,6 +134,9 @@ bool nvnc_client_supports_cursor(const struct nvnc_client* client); const char* nvnc_client_get_hostname(const struct nvnc_client* client); const char* nvnc_client_get_auth_username(const struct nvnc_client* client); +struct nvnc_client* nvnc_client_first(struct nvnc* self); +struct nvnc_client* nvnc_client_next(struct nvnc_client* client); + void nvnc_set_name(struct nvnc* self, const char* name); void nvnc_set_key_fn(struct nvnc* self, nvnc_key_fn); diff --git a/src/server.c b/src/server.c index 423079f..95cc3fd 100644 --- a/src/server.c +++ b/src/server.c @@ -1603,6 +1603,19 @@ const char* nvnc_client_get_auth_username(const struct nvnc_client* client) { return client->username; } +EXPORT +struct nvnc_client* nvnc_client_first(struct nvnc* self) +{ + return LIST_FIRST(&self->clients); +} + +EXPORT +struct nvnc_client* nvnc_client_next(struct nvnc_client* client) +{ + assert(client); + return LIST_NEXT(client, link); +} + EXPORT bool nvnc_client_supports_cursor(const struct nvnc_client* client) {