degesch: stubplement /server

This commit is contained in:
Přemysl Eric Janouch 2015-07-04 22:28:59 +02:00
parent bda1239a33
commit 0ecd297c6f

View File

@ -7084,6 +7084,38 @@ handle_command_disconnect (struct handler_args *a)
return true; 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 static bool
handle_command_names (struct handler_args *a) handle_command_names (struct handler_args *a)
{ {
@ -7275,12 +7307,16 @@ g_command_handlers[] =
"<user>... [<channel>]", "<user>... [<channel>]",
handle_command_invite, HANDLER_SERVER | HANDLER_CHANNEL_LAST }, 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", { "connect", "Connect to the server",
"[<server>]", "[<server>]",
handle_command_connect, 0 }, handle_command_connect, 0 },
{ "disconnect", "Disconnect from the server", { "disconnect", "Disconnect from the server",
"[<server> [<reason>]]", "[<server> [<reason>]]",
handle_command_disconnect, 0 }, handle_command_disconnect, 0 },
{ "list", "List channels and their topic", { "list", "List channels and their topic",
"[<channel>[,<channel>...]] [<target>]", "[<channel>[,<channel>...]] [<target>]",
handle_command_list, HANDLER_SERVER }, handle_command_list, HANDLER_SERVER },