summaryrefslogtreecommitdiff
path: root/src/core/hook/wee-hook-command.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2019-03-10 13:16:59 +0100
committerSébastien Helleu <flashcode@flashtux.org>2019-03-10 18:29:16 +0100
commit2b70d71aa1c891f2f251aa775cf239e5611576d5 (patch)
tree33b7daaa910582482c420e4e1e06a2d8851572e9 /src/core/hook/wee-hook-command.c
parent8aa5f5375e2a16d538fdf96babcd52a2f8f7801c (diff)
downloadweechat-2b70d71aa1c891f2f251aa775cf239e5611576d5.zip
core: replace argument "keep_eol" by "flags" in function string_split (closes #1322)
Diffstat (limited to 'src/core/hook/wee-hook-command.c')
-rw-r--r--src/core/hook/wee-hook-command.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/core/hook/wee-hook-command.c b/src/core/hook/wee-hook-command.c
index 7934da3a0..31d9a90d5 100644
--- a/src/core/hook/wee-hook-command.c
+++ b/src/core/hook/wee-hook-command.c
@@ -171,9 +171,14 @@ hook_command_build_completion (struct t_hook_command *hook_command)
hook_command->cplt_templates_static[i] = strdup (hook_command->cplt_templates[i]);
/* build arguments for each template */
- hook_command->cplt_template_args[i] = string_split (hook_command->cplt_templates[i],
- " ", 0, 0,
- &(hook_command->cplt_template_num_args[i]));
+ hook_command->cplt_template_args[i] = string_split (
+ hook_command->cplt_templates[i],
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &(hook_command->cplt_template_num_args[i]));
if (hook_command->cplt_template_num_args[i] > hook_command->cplt_template_num_args_concat)
hook_command->cplt_template_num_args_concat = hook_command->cplt_template_num_args[i];
}
@@ -210,8 +215,14 @@ hook_command_build_completion (struct t_hook_command *hook_command)
{
if (i < hook_command->cplt_template_num_args[j])
{
- items = string_split (hook_command->cplt_template_args[j][i],
- "|", 0, 0, &num_items);
+ items = string_split (
+ hook_command->cplt_template_args[j][i],
+ "|",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
for (k = 0; k < num_items; k++)
{
if (!weelist_search (list, items[k]))
@@ -338,13 +349,22 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
if (hook_command_run_exec (buffer, string) == WEECHAT_RC_OK_EAT)
return HOOK_COMMAND_EXEC_OK;
- argv = string_split (string, " ", 0, 0, &argc);
+ argv = string_split (string, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argc == 0)
{
string_free_split (argv);
return HOOK_COMMAND_EXEC_NOT_FOUND;
}
- argv_eol = string_split (string, " ", 1, 0, NULL);
+ argv_eol = string_split (string, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0, NULL);
ptr_command_name = utf8_next_char (argv[0]);
length_command_name = strlen (ptr_command_name);