summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-04 22:28:59 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-04 22:28:59 +0200
commit0ecd297c6fab28d5b0309084a72fd39033445da2 (patch)
treea66f1699883fe63b3850e58b9d459a473dc504fe /degesch.c
parentbda1239a335f76e065e23ee3878bb20f5843e112 (diff)
downloadxK-0ecd297c6fab28d5b0309084a72fd39033445da2.tar.gz
xK-0ecd297c6fab28d5b0309084a72fd39033445da2.tar.xz
xK-0ecd297c6fab28d5b0309084a72fd39033445da2.zip
degesch: stubplement /server
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 },