From bc3fa9fd4cddd24d066b60f11c08d3c8e5ff1e61 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 19 Mar 2010 19:28:19 +0100 Subject: Move /away command from irc plugin to core --- src/core/wee-command.c | 14 ++++++++++++++ src/core/wee-command.h | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'src/core') diff --git a/src/core/wee-command.c b/src/core/wee-command.c index a4b28b31d..974a2e4b4 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -62,6 +62,12 @@ #include "../plugins/plugin-config.h" +/* + * command_away: toggle away status + */ + +COMMAND_EMPTY(away) + /* * command_bar_list: list bars */ @@ -4066,6 +4072,14 @@ command_window (void *data, struct t_gui_buffer *buffer, void command_init () { + hook_command (NULL, "away", + N_("toggle away status"), + N_("[-all] [message]"), + N_(" -all: toggle away status on all connected " + "servers\n" + "message: message for away (if no message is " + "given, away status is removed)"), + "-all", &command_away, NULL); hook_command (NULL, "bar", N_("manage bars"), N_("[add barname type[,cond1,cond2,...] position size " diff --git a/src/core/wee-command.h b/src/core/wee-command.h index b689add38..0b72f5ee7 100644 --- a/src/core/wee-command.h +++ b/src/core/wee-command.h @@ -20,6 +20,25 @@ #ifndef __WEECHAT_COMMAND_H #define __WEECHAT_COMMAND_H 1 +/* + * This macro is used to create an "empty" command in WeeChat core: + * command does nothing, but plugins or scripts can catch it when it + * is used by user, with weechat_hook_command_run("/xxx", ...) + * where "xxx" is command name. + */ +#define COMMAND_EMPTY(__command) \ + int \ + command_##__command (void *data, struct t_gui_buffer *buffer, \ + int argc, char **argv, char **argv_eol) \ + { \ + (void) data; \ + (void) buffer; \ + (void) argc; \ + (void) argv; \ + (void) argv_eol; \ + return WEECHAT_RC_OK; \ + } + struct t_gui_buffer; extern int command_reload (void *data, struct t_gui_buffer *buffer, -- cgit v1.2.3