From d9755e237b12cc5c22857e4ef720cbbcf11173d7 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 1 Dec 2007 10:25:59 +0100 Subject: Added /reload command --- src/core/wee-command.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) (limited to 'src/core/wee-command.c') diff --git a/src/core/wee-command.c b/src/core/wee-command.c index acaf8bbb2..05967700f 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -153,12 +153,16 @@ struct command weechat_commands[] = "Without argument, /plugin command lists loaded plugins."), "list|listfull|load|autoload|reload|unload %P", 0, 2, 0, command_plugin }, { "quit", - "", "", "", + N_("quit WeeChat"), "", "", NULL, 0, 0, 0, command_quit }, + { "reload", + N_("reload WeeChat and plugins configuration files from disk"), + "", "", + NULL, 0, 0, 0, command_reload }, { "save", - N_("save configuration files to disk"), + N_("save WeeChat and plugins configuration files to disk"), "", "", - NULL, 0, 1, 0, command_save }, + NULL, 0, 0, 0, command_save }, { "set", N_("set config options"), N_("[option [ = value]]"), N_("option: name of an option (if name is full " @@ -1515,6 +1519,43 @@ command_quit (struct t_gui_buffer *buffer, return 0; } +/* + * command_reload: reload WeeChat and plugins options from disk + */ + +int +command_reload (struct t_gui_buffer *buffer, + int argc, char **argv, char **argv_eol) +{ + /* make C compiler happy */ + (void) buffer; + (void) argc; + (void) argv; + (void) argv_eol; + + /* reload WeeChat configuration */ + if (config_weechat_reload () == 0) + gui_chat_printf (NULL, + _("%sWeeChat configuration file reloaded"), + gui_chat_prefix[GUI_CHAT_PREFIX_INFO]); + else + gui_chat_printf (NULL, + _("%sError: failed to read WeeChat configuration " + "file"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + + /* reload plugins configuration */ + if (plugin_config_reload () == 0) + gui_chat_printf (NULL, _("%sPlugins options reloaded"), + gui_chat_prefix[GUI_CHAT_PREFIX_INFO]); + else + gui_chat_printf (NULL, + _("%sError: failed to read plugins options"), + gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); + + return 0; +} + /* * command_save: save WeeChat and plugins options to disk */ @@ -1536,7 +1577,8 @@ command_save (struct t_gui_buffer *buffer, gui_chat_prefix[GUI_CHAT_PREFIX_INFO]); else gui_chat_printf (NULL, - _("%sError: failed to save configuration file"), + _("%sError: failed to save WeeChat configuration " + "file"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]); /* save plugins configuration */ -- cgit v1.2.3