summaryrefslogtreecommitdiff
path: root/xC.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-07 12:40:40 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-07 13:01:34 +0200
commit5fd76ba6f90f3d5c341f4ce7ca23560497e899a3 (patch)
tree35d9328c925781eb941df473f42e884794354346 /xC.c
parent41878a587f3c2ffc55448137d1cc72f835fb8bc5 (diff)
downloadxK-5fd76ba6f90f3d5c341f4ce7ca23560497e899a3.tar.gz
xK-5fd76ba6f90f3d5c341f4ce7ca23560497e899a3.tar.xz
xK-5fd76ba6f90f3d5c341f4ce7ca23560497e899a3.zip
xC: add a trivial /relay command
For there is otherwise no way of getting that information.
Diffstat (limited to 'xC.c')
-rw-r--r--xC.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xC.c b/xC.c
index e35cfc6..e7325e1 100644
--- a/xC.c
+++ b/xC.c
@@ -12055,6 +12055,23 @@ handle_command_plugin (struct handler_args *a)
}
static bool
+handle_command_relay (struct handler_args *a)
+{
+ if (*a->arguments)
+ return false;
+
+ int len = 0;
+ LIST_FOR_EACH (struct client, c, a->ctx->clients)
+ len++;
+
+ if (a->ctx->relay_fd == -1)
+ log_global_status (a->ctx, "The relay is not enabled");
+ else
+ log_global_status (a->ctx, "The relay has #d clients", len);
+ return true;
+}
+
+static bool
show_aliases_list (struct app_context *ctx)
{
log_global_indent (ctx, "");
@@ -12790,6 +12807,9 @@ g_command_handlers[] =
{ "plugin", "Manage plugins",
"list | load <name> | unload <name>",
handle_command_plugin, 0 },
+ { "relay", "Show relay information",
+ NULL,
+ handle_command_relay, 0 },
{ "alias", "List or set aliases",
"[<name> <definition>]",