From 0ecd297c6fab28d5b0309084a72fd39033445da2 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sat, 4 Jul 2015 22:28:59 +0200 Subject: degesch: stubplement /server --- degesch.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/degesch.c b/degesch.c index 19eb68b..8cd192b 100644 --- a/degesch.c +++ b/degesch.c @@ -7084,6 +7084,38 @@ handle_command_disconnect (struct handler_args *a) return true; } +static void +show_servers_list (struct app_context *ctx) +{ + log_global_indent (ctx, ""); + log_global_indent (ctx, "Servers list:"); + + struct str_map_iter iter; + str_map_iter_init (&iter, &ctx->servers); + struct server *s; + while ((s = str_map_iter_next (&iter))) + log_global_indent (ctx, " #s", s->name); +} + +static bool +handle_command_server (struct handler_args *a) +{ + struct app_context *ctx = a->ctx; + char *action = cut_word (&a->arguments); + bool result = true; + if (!strcasecmp_ascii (action, "list")) + show_servers_list (ctx); + else if (!strcasecmp_ascii (action, "add")) + ; // TODO: + else if (!strcasecmp_ascii (action, "remove")) + ; // TODO: + else if (!strcasecmp_ascii (action, "rename")) + ; // TODO: + else + result = false; + return result; +} + static bool handle_command_names (struct handler_args *a) { @@ -7275,12 +7307,16 @@ g_command_handlers[] = "... []", handle_command_invite, HANDLER_SERVER | HANDLER_CHANNEL_LAST }, + { "server", "Manage servers", + "list | add | delete | rename ", + handle_command_server, 0 }, { "connect", "Connect to the server", "[]", handle_command_connect, 0 }, { "disconnect", "Disconnect from the server", "[ []]", handle_command_disconnect, 0 }, + { "list", "List channels and their topic", "[[,...]] []", handle_command_list, HANDLER_SERVER }, -- cgit v1.2.3-70-g09d2