mirror of
https://github.com/weechat/weechat.git
synced 2026-07-08 18:45:42 +02:00
core: make "input_commands_allowed" work with /wait and /repeat commands (issue #928)
This commit is contained in:
+34
-27
File diff suppressed because it is too large
Load Diff
+53
-17
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,9 @@ extern char **input_commands_allowed;
|
||||
extern int input_exec_command (struct t_gui_buffer *buffer,
|
||||
int any_plugin,
|
||||
struct t_weechat_plugin *plugin,
|
||||
const char *string);
|
||||
extern int input_data (struct t_gui_buffer *buffer, const char *data);
|
||||
const char *string,
|
||||
const char *commands_allowed);
|
||||
extern int input_data (struct t_gui_buffer *buffer, const char *data,
|
||||
const char *commands_allowed);
|
||||
|
||||
#endif /* WEECHAT_INPUT_H */
|
||||
|
||||
+1
-1
@@ -432,7 +432,7 @@ gui_input_return (struct t_gui_buffer *buffer)
|
||||
gui_input_text_changed_modifier_and_signal (buffer,
|
||||
0, /* save undo */
|
||||
1); /* stop completion */
|
||||
(void) input_data (buffer, command);
|
||||
(void) input_data (buffer, command, NULL);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1159,7 +1159,7 @@ gui_key_focus_command (const char *key, int context,
|
||||
command,
|
||||
ptr_buffer->full_name);
|
||||
}
|
||||
(void) input_data (ptr_buffer, command);
|
||||
(void) input_data (ptr_buffer, command, NULL);
|
||||
free (command);
|
||||
}
|
||||
}
|
||||
@@ -1388,7 +1388,7 @@ gui_key_pressed (const char *key_str)
|
||||
for (i = 0; commands[i]; i++)
|
||||
{
|
||||
(void) input_data (gui_current_window->buffer,
|
||||
commands[i]);
|
||||
commands[i], NULL);
|
||||
}
|
||||
string_free_split (commands);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ void
|
||||
run_cmd (const char *command)
|
||||
{
|
||||
printf (">>> Running command: %s\n", command);
|
||||
input_data (ptr_core_buffer, command);
|
||||
input_data (ptr_core_buffer, command, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user