diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-input.c | 23 | ||||
-rw-r--r-- | src/core/wee-input.h | 2 | ||||
-rw-r--r-- | src/plugins/guile/weechat-guile-api.c | 29 | ||||
-rw-r--r-- | src/plugins/javascript/weechat-js-api.cpp | 28 | ||||
-rw-r--r-- | src/plugins/lua/weechat-lua-api.c | 30 | ||||
-rw-r--r-- | src/plugins/perl/weechat-perl-api.c | 30 | ||||
-rw-r--r-- | src/plugins/php/weechat-php-api.c | 34 | ||||
-rw-r--r-- | src/plugins/php/weechat-php-api.h | 1 | ||||
-rw-r--r-- | src/plugins/php/weechat-php.c | 1 | ||||
-rw-r--r-- | src/plugins/plugin-api.c | 40 | ||||
-rw-r--r-- | src/plugins/plugin-api.h | 4 | ||||
-rw-r--r-- | src/plugins/plugin-script-api.c | 27 | ||||
-rw-r--r-- | src/plugins/plugin-script-api.h | 5 | ||||
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/python/weechat-python-api.c | 30 | ||||
-rw-r--r-- | src/plugins/ruby/weechat-ruby-api.c | 36 | ||||
-rw-r--r-- | src/plugins/tcl/weechat-tcl-api.c | 31 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 8 |
18 files changed, 349 insertions, 11 deletions
diff --git a/src/core/wee-input.c b/src/core/wee-input.c index 4037df2aa..00c7edc3c 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -39,6 +39,9 @@ #include "../plugins/plugin.h" +char **input_commands_allowed = NULL; + + /* * Sends data to buffer input callback. */ @@ -103,8 +106,25 @@ input_exec_command (struct t_gui_buffer *buffer, return WEECHAT_RC_ERROR; } - /* execute command */ rc = WEECHAT_RC_OK; + + /* check if command is allowed */ + if (input_commands_allowed + && !string_match_list (command_name + 1, + (const char **)input_commands_allowed, 0)) + { + if (weechat_debug_core >= 1) + { + gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER, + _("debug: command \"%s\" is not " + "allowed in this context"), + command_name); + } + rc = WEECHAT_RC_ERROR; + goto end; + } + + /* execute command */ switch (hook_command_exec (buffer, any_plugin, plugin, command)) { case HOOK_COMMAND_EXEC_OK: @@ -171,6 +191,7 @@ input_exec_command (struct t_gui_buffer *buffer, break; } +end: free (command); free (command_name); diff --git a/src/core/wee-input.h b/src/core/wee-input.h index a35f2284f..d6c6b3dac 100644 --- a/src/core/wee-input.h +++ b/src/core/wee-input.h @@ -23,6 +23,8 @@ struct t_gui_buffer; struct t_weechat_plugin; +extern char **input_commands_allowed; + extern int input_exec_command (struct t_gui_buffer *buffer, int any_plugin, struct t_weechat_plugin *plugin, diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c index 29f8fbf78..410eebe49 100644 --- a/src/plugins/guile/weechat-guile-api.c +++ b/src/plugins/guile/weechat-guile-api.c @@ -4077,6 +4077,34 @@ weechat_guile_api_command (SCM buffer, SCM command) } SCM +weechat_guile_api_command_options (SCM buffer, SCM command, SCM options) +{ + struct t_hashtable *c_options; + int rc; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (!scm_is_string (buffer) || !scm_is_string (command) + || !scm_list_p (options)) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + c_options = weechat_guile_alist_to_hashtable (options, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_guile_plugin, + guile_current_script, + API_STR2PTR(API_SCM_TO_STRING(buffer)), + API_SCM_TO_STRING(command), + c_options); + + if (c_options) + weechat_hashtable_free (c_options); + + API_RETURN_INT(rc); +} + +SCM weechat_guile_api_info_get (SCM info_name, SCM arguments) { const char *result; @@ -5016,6 +5044,7 @@ weechat_guile_api_module_init (void *data) API_DEF_FUNC(bar_update, 1); API_DEF_FUNC(bar_remove, 1); API_DEF_FUNC(command, 2); + API_DEF_FUNC(command_options, 3); API_DEF_FUNC(info_get, 2); API_DEF_FUNC(info_get_hashtable, 2); API_DEF_FUNC(infolist_new, 0); diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp index 8f0032bac..7dd8272d4 100644 --- a/src/plugins/javascript/weechat-js-api.cpp +++ b/src/plugins/javascript/weechat-js-api.cpp @@ -3976,6 +3976,33 @@ API_FUNC(command) API_RETURN_INT(rc); } +API_FUNC(command_options) +{ + struct t_hashtable *options; + int rc; + + API_INIT_FUNC(1, "command_options", "ssh", API_RETURN_INT(WEECHAT_RC_ERROR)); + + v8::String::Utf8Value buffer(args[0]); + v8::String::Utf8Value command(args[1]); + options = weechat_js_object_to_hashtable ( + args[2]->ToObject(), + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_js_plugin, + js_current_script, + (struct t_gui_buffer *)API_STR2PTR(*buffer), + *command, + options); + + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(rc); +} + API_FUNC(info_get) { const char *result; @@ -4967,6 +4994,7 @@ WeechatJsV8::loadLibs() API_DEF_FUNC(bar_update); API_DEF_FUNC(bar_remove); API_DEF_FUNC(command); + API_DEF_FUNC(command_options); API_DEF_FUNC(info_get); API_DEF_FUNC(info_get_hashtable); API_DEF_FUNC(infolist_new); diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c index a07709fa1..908097a4c 100644 --- a/src/plugins/lua/weechat-lua-api.c +++ b/src/plugins/lua/weechat-lua-api.c @@ -4312,6 +4312,35 @@ API_FUNC(command) API_RETURN_INT(rc); } +API_FUNC(command_options) +{ + const char *buffer, *command; + struct t_hashtable *options; + int rc; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (lua_gettop (L) < 3) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + buffer = lua_tostring (L, -3); + command = lua_tostring (L, -2); + options = weechat_lua_tohashtable (L, -1, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_lua_plugin, + lua_current_script, + API_STR2PTR(buffer), + command, + options); + + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(rc); +} + API_FUNC(info_get) { const char *info_name, *arguments, *result; @@ -5318,6 +5347,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = { API_DEF_FUNC(bar_update), API_DEF_FUNC(bar_remove), API_DEF_FUNC(command), + API_DEF_FUNC(command_options), API_DEF_FUNC(info_get), API_DEF_FUNC(info_get_hashtable), API_DEF_FUNC(infolist_new), diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c index 9192bbe97..5c0ab0e0e 100644 --- a/src/plugins/perl/weechat-perl-api.c +++ b/src/plugins/perl/weechat-perl-api.c @@ -4233,6 +4233,35 @@ API_FUNC(command) API_RETURN_INT(rc); } +API_FUNC(command_options) +{ + char *buffer, *command; + struct t_hashtable *options; + int rc; + dXSARGS; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (items < 3) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + buffer = SvPV_nolen (ST (0)); + command = SvPV_nolen (ST (1)); + options = weechat_perl_hash_to_hashtable (ST (2), + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_perl_plugin, + perl_current_script, + API_STR2PTR(buffer), + command, + options); + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(rc); +} + API_FUNC(info_get) { char *info_name, *arguments; @@ -5277,6 +5306,7 @@ weechat_perl_api_init (pTHX) API_DEF_FUNC(bar_update); API_DEF_FUNC(bar_remove); API_DEF_FUNC(command); + API_DEF_FUNC(command_options); API_DEF_FUNC(info_get); API_DEF_FUNC(info_get_hashtable); API_DEF_FUNC(infolist_new); diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c index e95bf5786..f648efd41 100644 --- a/src/plugins/php/weechat-php-api.c +++ b/src/plugins/php/weechat-php-api.c @@ -4144,6 +4144,40 @@ API_FUNC(command) API_RETURN_INT(result); } +API_FUNC(command_options) +{ + zend_string *z_buffer, *z_command; + zval *z_options; + struct t_gui_buffer *buffer; + char *command; + struct t_hashtable *options; + int result; + + API_INIT_FUNC(1, "command", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (zend_parse_parameters (ZEND_NUM_ARGS(), "SSa", &z_buffer, + &z_command, &z_options) == FAILURE) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + buffer = (struct t_gui_buffer *)API_STR2PTR(ZSTR_VAL(z_buffer)); + command = ZSTR_VAL(z_command); + options = weechat_php_array_to_hashtable ( + z_options, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + result = plugin_script_api_command_options (weechat_php_plugin, + php_current_script, + buffer, + (const char *)command, + options); + + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(result); +} + API_FUNC(info_get) { zend_string *z_info_name, *z_arguments; diff --git a/src/plugins/php/weechat-php-api.h b/src/plugins/php/weechat-php-api.h index ca01f3f02..06195a0b6 100644 --- a/src/plugins/php/weechat-php-api.h +++ b/src/plugins/php/weechat-php-api.h @@ -197,6 +197,7 @@ PHP_FUNCTION(weechat_bar_set); PHP_FUNCTION(weechat_bar_update); PHP_FUNCTION(weechat_bar_remove); PHP_FUNCTION(weechat_command); +PHP_FUNCTION(weechat_command_options); PHP_FUNCTION(weechat_info_get); PHP_FUNCTION(weechat_info_get_hashtable); PHP_FUNCTION(weechat_infolist_new); diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index f84e49f4f..85dd6b3ea 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -251,6 +251,7 @@ const zend_function_entry weechat_functions[] = { PHP_FE(weechat_bar_update, NULL) PHP_FE(weechat_bar_remove, NULL) PHP_FE(weechat_command, NULL) + PHP_FE(weechat_command_options, NULL) PHP_FE(weechat_info_get, NULL) PHP_FE(weechat_info_get_hashtable, NULL) PHP_FE(weechat_infolist_new, NULL) diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 174ee9093..69615e8c4 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -28,6 +28,7 @@ #include "../core/weechat.h" #include "../core/wee-config.h" +#include "../core/wee-hashtable.h" #include "../core/wee-hook.h" #include "../core/wee-infolist.h" #include "../core/wee-input.h" @@ -294,19 +295,35 @@ plugin_api_color (const char *color_name) } /* - * Executes a command on a buffer (simulates user entry). + * Executes a command on a buffer (simulates user entry) with options. */ int -plugin_api_command (struct t_weechat_plugin *plugin, - struct t_gui_buffer *buffer, const char *command) +plugin_api_command_options (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, const char *command, + struct t_hashtable *options) { - char *command2; + char *command2, **old_commands_allowed, **new_commands_allowed; + const char *ptr_commands; int rc; if (!plugin || !command) return WEECHAT_RC_ERROR; + old_commands_allowed = input_commands_allowed; + new_commands_allowed = NULL; + + if (options) + { + ptr_commands = hashtable_get (options, "commands"); + if (ptr_commands) + { + new_commands_allowed = string_split (ptr_commands, ",", 0, 0, + NULL); + input_commands_allowed = new_commands_allowed; + } + } + command2 = string_iconv_to_internal (plugin->charset, command); if (!buffer) buffer = gui_current_window->buffer; @@ -314,10 +331,25 @@ plugin_api_command (struct t_weechat_plugin *plugin, if (command2) free (command2); + if (new_commands_allowed) + string_free_split (new_commands_allowed); + input_commands_allowed = old_commands_allowed; + return rc; } /* + * Executes a command on a buffer (simulates user entry). + */ + +int +plugin_api_command (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, const char *command) +{ + return plugin_api_command_options (plugin, buffer, command, NULL); +} + +/* * Modifier to decode ANSI colors. */ diff --git a/src/plugins/plugin-api.h b/src/plugins/plugin-api.h index 405f1edbe..5223585b2 100644 --- a/src/plugins/plugin-api.h +++ b/src/plugins/plugin-api.h @@ -54,6 +54,10 @@ extern const char *plugin_api_prefix (const char *prefix); extern const char *plugin_api_color (const char *color_name); /* command */ +extern int plugin_api_command_options (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, + const char *command, + struct t_hashtable *options); extern int plugin_api_command (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, const char *command); diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c index bb797ced1..11b404d92 100644 --- a/src/plugins/plugin-script-api.c +++ b/src/plugins/plugin-script-api.c @@ -1279,13 +1279,15 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin, } /* - * Executes a command on a buffer (simulates user entry). + * Executes a command on a buffer (simulates user entry) with options. */ int -plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, - struct t_plugin_script *script, - struct t_gui_buffer *buffer, const char *command) +plugin_script_api_command_options (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script *script, + struct t_gui_buffer *buffer, + const char *command, + struct t_hashtable *options) { char *command2; int rc; @@ -1293,7 +1295,9 @@ plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, command2 = (script && script->charset && script->charset[0]) ? weechat_iconv_to_internal (script->charset, command) : NULL; - rc = weechat_command (buffer, (command2) ? command2 : command); + rc = weechat_command_options (buffer, + (command2) ? command2 : command, + options); if (command2) free (command2); @@ -1302,6 +1306,19 @@ plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, } /* + * Executes a command on a buffer (simulates user entry). + */ + +int +plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script *script, + struct t_gui_buffer *buffer, const char *command) +{ + return plugin_script_api_command_options (weechat_plugin, script, buffer, + command, NULL); +} + +/* * Gets value of a script option (format in file is "plugin.script.option"). */ diff --git a/src/plugins/plugin-script-api.h b/src/plugins/plugin-script-api.h index ce7bd285a..55f6d55f3 100644 --- a/src/plugins/plugin-script-api.h +++ b/src/plugins/plugin-script-api.h @@ -353,6 +353,11 @@ extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_p struct t_hashtable *extra_info), const char *function, const char *data); +extern int plugin_script_api_command_options (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script *script, + struct t_gui_buffer *buffer, + const char *command, + struct t_hashtable *options); extern int plugin_script_api_command (struct t_weechat_plugin *weechat_plugin, struct t_plugin_script *script, struct t_gui_buffer *buffer, diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index dd04d1a7d..6ed45e602 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -828,6 +828,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv) new_plugin->bar_remove = &gui_bar_free; new_plugin->command = &plugin_api_command; + new_plugin->command_options = &plugin_api_command_options; new_plugin->network_pass_proxy = &network_pass_proxy; new_plugin->network_connect_to = &network_connect_to; diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c index f27d1e169..572ce70aa 100644 --- a/src/plugins/python/weechat-python-api.c +++ b/src/plugins/python/weechat-python-api.c @@ -4247,6 +4247,35 @@ API_FUNC(command) API_RETURN_INT(rc); } +API_FUNC(command_options) +{ + char *buffer, *command; + struct t_hashtable *options; + int rc; + PyObject *dict; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + buffer = NULL; + command = NULL; + options = NULL; + if (!PyArg_ParseTuple (args, "ssO", &buffer, &command, &dict)) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + options = weechat_python_dict_to_hashtable (dict, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + rc = plugin_script_api_command_options (weechat_python_plugin, + python_current_script, + API_STR2PTR(buffer), + command, + options); + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(rc); +} + API_FUNC(info_get) { char *info_name, *arguments; @@ -5227,6 +5256,7 @@ PyMethodDef weechat_python_funcs[] = API_DEF_FUNC(bar_update), API_DEF_FUNC(bar_remove), API_DEF_FUNC(command), + API_DEF_FUNC(command_options), API_DEF_FUNC(info_get), API_DEF_FUNC(info_get_hashtable), API_DEF_FUNC(infolist_new), diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c index dbd7ce278..c5f0475d6 100644 --- a/src/plugins/ruby/weechat-ruby-api.c +++ b/src/plugins/ruby/weechat-ruby-api.c @@ -5119,6 +5119,41 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command) } static VALUE +weechat_ruby_api_command_options (VALUE class, VALUE buffer, VALUE command, + VALUE options) +{ + char *c_buffer, *c_command; + struct t_hashtable *c_options; + int rc; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (NIL_P (buffer) || NIL_P (command) || NIL_P (options)) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + Check_Type (buffer, T_STRING); + Check_Type (command, T_STRING); + Check_Type (options, T_HASH); + + c_buffer = StringValuePtr (buffer); + c_command = StringValuePtr (command); + c_options = weechat_ruby_hash_to_hashtable (options, + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_ruby_plugin, + ruby_current_script, + API_STR2PTR(c_buffer), + c_command, + c_options); + + if (c_options) + weechat_hashtable_free (c_options); + + API_RETURN_INT(rc); +} + +static VALUE weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments) { char *c_info_name, *c_arguments; @@ -6388,6 +6423,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) API_DEF_FUNC(bar_update, 1); API_DEF_FUNC(bar_remove, 1); API_DEF_FUNC(command, 2); + API_DEF_FUNC(command_options, 3); API_DEF_FUNC(info_get, 2); API_DEF_FUNC(info_get_hashtable, 2); API_DEF_FUNC(infolist_new, 0); diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c index 527380e48..08b7e4f93 100644 --- a/src/plugins/tcl/weechat-tcl-api.c +++ b/src/plugins/tcl/weechat-tcl-api.c @@ -4598,6 +4598,36 @@ API_FUNC(command) API_RETURN_INT(rc); } +API_FUNC(command_options) +{ + Tcl_Obj *objp; + char *buffer, *command; + struct t_hashtable *options; + int i, rc; + + API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR)); + if (objc < 4) + API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR)); + + buffer = Tcl_GetStringFromObj (objv[1], &i); + command = Tcl_GetStringFromObj (objv[2], &i); + options = weechat_tcl_dict_to_hashtable (interp, objv[3], + WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE, + WEECHAT_HASHTABLE_STRING, + WEECHAT_HASHTABLE_STRING); + + rc = plugin_script_api_command_options (weechat_tcl_plugin, + tcl_current_script, + API_STR2PTR(buffer), + command, + options); + + if (options) + weechat_hashtable_free (options); + + API_RETURN_INT(rc); +} + API_FUNC(info_get) { Tcl_Obj *objp; @@ -5753,6 +5783,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp) API_DEF_FUNC(bar_update); API_DEF_FUNC(bar_remove); API_DEF_FUNC(command); + API_DEF_FUNC(command_options); API_DEF_FUNC(info_get); API_DEF_FUNC(info_get_hashtable); API_DEF_FUNC(infolist_new); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index da4eda6ba..b802f1960 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -67,7 +67,7 @@ struct timeval; * please change the date with current one; for a second change at same * date, increment the 01, otherwise please keep 01. */ -#define WEECHAT_PLUGIN_API_VERSION "20190226-01" +#define WEECHAT_PLUGIN_API_VERSION "20190228-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -985,6 +985,9 @@ struct t_weechat_plugin /* command */ int (*command) (struct t_weechat_plugin *plugin, struct t_gui_buffer *buffer, const char *command); + int (*command_options) (struct t_weechat_plugin *plugin, + struct t_gui_buffer *buffer, const char *command, + struct t_hashtable *options); /* network */ int (*network_pass_proxy) (const char *proxy, int sock, @@ -1899,6 +1902,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); /* command */ #define weechat_command(__buffer, __command) \ (weechat_plugin->command)(weechat_plugin, __buffer, __command) +#define weechat_command_options(__buffer, __command, __options) \ + (weechat_plugin->command_options)(weechat_plugin, __buffer, \ + __command, __options) /* network */ #define weechat_network_pass_proxy(__proxy, __sock, __address, __port) \ |