1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

core: make "input_commands_allowed" work with /wait and /repeat commands (issue #928)

This commit is contained in:
Sébastien Helleu
2019-03-28 18:45:22 +01:00
parent 9b4fa10923
commit 2f37de9148
7 changed files with 102 additions and 76 deletions
+7 -26
View File
@@ -303,44 +303,25 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options)
{
char *command2, **old_commands_allowed, **new_commands_allowed;
const char *ptr_commands;
char *command2;
const char *ptr_commands_allowed;
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,
",",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0,
NULL);
input_commands_allowed = new_commands_allowed;
}
}
ptr_commands_allowed = (options) ?
hashtable_get (options, "commands") : NULL;
command2 = string_iconv_to_internal (plugin->charset, command);
if (!buffer)
buffer = gui_current_window->buffer;
rc = input_data (buffer, (command2) ? command2 : command);
rc = input_data (buffer,
(command2) ? command2 : command,
ptr_commands_allowed);
if (command2)
free (command2);
if (new_commands_allowed)
string_free_split (new_commands_allowed);
input_commands_allowed = old_commands_allowed;
return rc;
}