degesch: add command placeholders
This commit is contained in:
parent
ad4ebc2101
commit
789db85915
121
degesch.c
121
degesch.c
|
@ -4821,68 +4821,85 @@ handle_command_quote (struct app_context *ctx, char *arguments)
|
|||
|
||||
static bool handle_command_help (struct app_context *, char *);
|
||||
|
||||
#define NOT_IMPLEMENTED(name) { #name, "(Not implemented)", NULL, NULL },
|
||||
|
||||
static struct command_handler
|
||||
{
|
||||
const char *name;
|
||||
bool (*handler) (struct app_context *ctx, char *arguments);
|
||||
const char *description;
|
||||
const char *usage;
|
||||
bool (*handler) (struct app_context *ctx, char *arguments);
|
||||
}
|
||||
g_command_handlers[] =
|
||||
{
|
||||
{ "help", handle_command_help, "Show help",
|
||||
"[<command> | <option>]" },
|
||||
{ "quit", handle_command_quit, "Quit the program",
|
||||
"[<message>]" },
|
||||
{ "buffer", handle_command_buffer, "Manage buffers",
|
||||
"list | clear | move | { close [<number> | <name>] } | <number>" },
|
||||
{ "set", handle_command_set, "Manage configuration",
|
||||
"[<option>]" },
|
||||
{ "save", handle_command_save, "Save configuration",
|
||||
"" },
|
||||
{ "help", "Show help",
|
||||
"[<command> | <option>]",
|
||||
handle_command_help },
|
||||
{ "quit", "Quit the program",
|
||||
"[<message>]",
|
||||
handle_command_quit },
|
||||
{ "buffer", "Manage buffers",
|
||||
"list | clear | move | { close [<number> | <name>] } | <number>",
|
||||
handle_command_buffer },
|
||||
{ "set", "Manage configuration",
|
||||
"[<option>]",
|
||||
handle_command_set },
|
||||
{ "save", "Save configuration",
|
||||
NULL,
|
||||
handle_command_save },
|
||||
|
||||
{ "msg", handle_command_msg, "Send message to a nick or channel",
|
||||
"<target> <message>" },
|
||||
{ "query", handle_command_query, "Send a private message to a nick",
|
||||
"<nick> <message>" },
|
||||
{ "notice", handle_command_notice, "Send notice to a nick or channel",
|
||||
"<target> <message>" },
|
||||
{ "ctcp", handle_command_ctcp, "Send a CTCP query",
|
||||
"<target> <tag>" },
|
||||
{ "me", handle_command_me, "Send a CTCP action",
|
||||
"<message>" },
|
||||
{ "msg", "Send message to a nick or channel",
|
||||
"<target> <message>",
|
||||
handle_command_msg },
|
||||
{ "query", "Send a private message to a nick",
|
||||
"<nick> <message>",
|
||||
handle_command_query },
|
||||
{ "notice", "Send notice to a nick or channel",
|
||||
"<target> <message>",
|
||||
handle_command_notice },
|
||||
{ "ctcp", "Send a CTCP query",
|
||||
"<target> <tag>",
|
||||
handle_command_ctcp },
|
||||
{ "me", "Send a CTCP action",
|
||||
"<message>",
|
||||
handle_command_me },
|
||||
|
||||
{ "join", handle_command_join, "Join channels",
|
||||
"[<channel>[,<channel>...]]" },
|
||||
{ "part", handle_command_part, "Leave channels",
|
||||
"[<channel>[,<channel>...]]" },
|
||||
#if 0
|
||||
{ "cycle", NULL, "", "" },
|
||||
{ "join", "Join channels",
|
||||
"[<channel>[,<channel>...]]",
|
||||
handle_command_join },
|
||||
{ "part", "Leave channels",
|
||||
"[<channel>[,<channel>...]]",
|
||||
handle_command_part },
|
||||
NOT_IMPLEMENTED (cycle)
|
||||
|
||||
{ "mode", NULL, "", "" },
|
||||
{ "topic", NULL, "", "" },
|
||||
{ "kick", NULL, "", "" },
|
||||
{ "kickban", NULL, "", "" },
|
||||
{ "ban", NULL, "", "" },
|
||||
{ "invite", NULL, "", "" },
|
||||
#endif
|
||||
NOT_IMPLEMENTED (mode)
|
||||
NOT_IMPLEMENTED (topic)
|
||||
NOT_IMPLEMENTED (kick)
|
||||
NOT_IMPLEMENTED (kickban)
|
||||
NOT_IMPLEMENTED (ban)
|
||||
NOT_IMPLEMENTED (invite)
|
||||
|
||||
{ "connect", handle_command_connect, "Connect to the server",
|
||||
"" },
|
||||
{ "list", handle_command_list, "List channels and their topic",
|
||||
"[<channel>[,<channel>...]] [server]" },
|
||||
#if 0
|
||||
{ "names", NULL, "", "" },
|
||||
{ "who", NULL, "", "" },
|
||||
{ "whois", NULL, "", "" },
|
||||
{ "connect", "Connect to the server",
|
||||
NULL,
|
||||
handle_command_connect },
|
||||
{ "disconnect", "Disconnect from the server",
|
||||
NULL,
|
||||
NULL },
|
||||
{ "list", "List channels and their topic",
|
||||
"[<channel>[,<channel>...]] [server]",
|
||||
handle_command_list },
|
||||
NOT_IMPLEMENTED (names)
|
||||
NOT_IMPLEMENTED (who)
|
||||
NOT_IMPLEMENTED (whois)
|
||||
|
||||
{ "motd", NULL, "", "" },
|
||||
{ "away", NULL, "", "" },
|
||||
#endif
|
||||
{ "nick", handle_command_nick, "Change current nick",
|
||||
"<nickname>" },
|
||||
{ "quote", handle_command_quote, "Send a raw command to the server",
|
||||
"<command>" },
|
||||
NOT_IMPLEMENTED (motd)
|
||||
NOT_IMPLEMENTED (away)
|
||||
{ "nick", "Change current nick",
|
||||
"<nickname>",
|
||||
handle_command_nick },
|
||||
{ "quote", "Send a raw command to the server",
|
||||
"<command>",
|
||||
handle_command_quote },
|
||||
};
|
||||
|
||||
static bool
|
||||
|
@ -4947,7 +4964,7 @@ handle_command_help (struct app_context *ctx, char *arguments)
|
|||
buffer_send_status (ctx, ctx->global_buffer, "%s: %s",
|
||||
handler->name, handler->description);
|
||||
buffer_send_status (ctx, ctx->global_buffer, " Arguments: %s",
|
||||
handler->usage);
|
||||
handler->usage ? handler->usage : "(none)");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5011,6 +5028,10 @@ process_user_command (struct app_context *ctx, char *command)
|
|||
if (!handler)
|
||||
buffer_send_error (ctx, ctx->global_buffer,
|
||||
"%s: %s", "No such command", name);
|
||||
// TODO: remove once everything is implemented
|
||||
else if (!handler->handler)
|
||||
buffer_send_error (ctx, ctx->global_buffer,
|
||||
"%s: %s", "Not implemented", name);
|
||||
else if (!handler->handler (ctx, command))
|
||||
buffer_send_error (ctx, ctx->global_buffer,
|
||||
"%s: /%s %s", "Usage", handler->name, handler->usage);
|
||||
|
|
Loading…
Reference in New Issue