summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c36
1 files changed, 36 insertions, 0 deletions
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: <name>
+ else if (!strcasecmp_ascii (action, "remove"))
+ ; // TODO: <name>
+ else if (!strcasecmp_ascii (action, "rename"))
+ ; // TODO: <old> <new>
+ else
+ result = false;
+ return result;
+}
+
static bool
handle_command_names (struct handler_args *a)
{
@@ -7275,12 +7307,16 @@ g_command_handlers[] =
"<user>... [<channel>]",
handle_command_invite, HANDLER_SERVER | HANDLER_CHANNEL_LAST },
+ { "server", "Manage servers",
+ "list | add <name> | delete <name> | rename <old> <new>",
+ handle_command_server, 0 },
{ "connect", "Connect to the server",
"[<server>]",
handle_command_connect, 0 },
{ "disconnect", "Disconnect from the server",
"[<server> [<reason>]]",
handle_command_disconnect, 0 },
+
{ "list", "List channels and their topic",
"[<channel>[,<channel>...]] [<target>]",
handle_command_list, HANDLER_SERVER },