1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

api: add function command_options (issue #928)

This commit is contained in:
Sébastien Helleu
2019-02-28 00:14:38 +01:00
parent 64043d5a6c
commit 80b980b2af
43 changed files with 693 additions and 165 deletions
+29 -12
View File
@@ -1278,6 +1278,33 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
return new_item;
}
/*
* Executes a command on a buffer (simulates user entry) with options.
*/
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)
{
char *command2;
int rc;
command2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, command) : NULL;
rc = weechat_command_options (buffer,
(command2) ? command2 : command,
options);
if (command2)
free (command2);
return rc;
}
/*
* Executes a command on a buffer (simulates user entry).
*/
@@ -1287,18 +1314,8 @@ plugin_script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer, const char *command)
{
char *command2;
int rc;
command2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, command) : NULL;
rc = weechat_command (buffer, (command2) ? command2 : command);
if (command2)
free (command2);
return rc;
return plugin_script_api_command_options (weechat_plugin, script, buffer,
command, NULL);
}
/*