degesch: make "/server" alone list all servers

This commit is contained in:
Přemysl Eric Janouch 2015-07-13 20:51:23 +02:00
parent a3074ef83d
commit 1285ba2d13
1 changed files with 6 additions and 2 deletions

View File

@ -7450,7 +7450,7 @@ handle_command_disconnect (struct handler_args *a)
return true; return true;
} }
static void static bool
show_servers_list (struct app_context *ctx) show_servers_list (struct app_context *ctx)
{ {
log_global_indent (ctx, ""); log_global_indent (ctx, "");
@ -7461,6 +7461,7 @@ show_servers_list (struct app_context *ctx)
struct server *s; struct server *s;
while ((s = str_map_iter_next (&iter))) while ((s = str_map_iter_next (&iter)))
log_global_indent (ctx, " #s", s->name); log_global_indent (ctx, " #s", s->name);
return true;
} }
static bool static bool
@ -7480,10 +7481,13 @@ static bool
handle_command_server (struct handler_args *a) handle_command_server (struct handler_args *a)
{ {
struct app_context *ctx = a->ctx; struct app_context *ctx = a->ctx;
if (!*a->arguments)
return show_servers_list (ctx);
char *action = cut_word (&a->arguments); char *action = cut_word (&a->arguments);
bool result = true; bool result = true;
if (!strcasecmp_ascii (action, "list")) if (!strcasecmp_ascii (action, "list"))
show_servers_list (ctx); result = show_servers_list (ctx);
else if (!strcasecmp_ascii (action, "add")) else if (!strcasecmp_ascii (action, "add"))
result = handle_server_add (a); result = handle_server_add (a);
else if (!strcasecmp_ascii (action, "remove")) else if (!strcasecmp_ascii (action, "remove"))