summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/alias/alias-completion.c6
-rw-r--r--src/plugins/alias/alias.c6
-rw-r--r--src/plugins/buflist/buflist-config.c13
-rw-r--r--src/plugins/buflist/buflist-mouse.c6
-rw-r--r--src/plugins/exec/exec-buffer.c13
-rw-r--r--src/plugins/exec/exec-config.c7
-rw-r--r--src/plugins/fset/fset-buffer.c6
-rw-r--r--src/plugins/fset/fset-command.c6
-rw-r--r--src/plugins/fset/fset-completion.c7
-rw-r--r--src/plugins/fset/fset-config.c7
-rw-r--r--src/plugins/irc/irc-color.c6
-rw-r--r--src/plugins/irc/irc-command.c64
-rw-r--r--src/plugins/irc/irc-config.c65
-rw-r--r--src/plugins/irc/irc-info.c24
-rw-r--r--src/plugins/irc/irc-input.c9
-rw-r--r--src/plugins/irc/irc-message.c30
-rw-r--r--src/plugins/irc/irc-mode.c12
-rw-r--r--src/plugins/irc/irc-notify.c54
-rw-r--r--src/plugins/irc/irc-protocol.c97
-rw-r--r--src/plugins/irc/irc-redirect.c34
-rw-r--r--src/plugins/irc/irc-server.c43
-rw-r--r--src/plugins/irc/irc-upgrade.c20
-rw-r--r--src/plugins/plugin-api-info.c12
-rw-r--r--src/plugins/plugin-api.c10
-rw-r--r--src/plugins/plugin-script-api.c6
-rw-r--r--src/plugins/plugin-script.c18
-rw-r--r--src/plugins/plugin.c11
-rw-r--r--src/plugins/python/weechat-python.c6
-rw-r--r--src/plugins/relay/irc/relay-irc.c31
-rw-r--r--src/plugins/relay/relay-client.c5
-rw-r--r--src/plugins/relay/relay-config.c16
-rw-r--r--src/plugins/relay/relay-info.c6
-rw-r--r--src/plugins/relay/weechat/relay-weechat-msg.c21
-rw-r--r--src/plugins/relay/weechat/relay-weechat-protocol.c38
-rw-r--r--src/plugins/script/script-action.c37
-rw-r--r--src/plugins/script/script-completion.c10
-rw-r--r--src/plugins/script/script-config.c26
-rw-r--r--src/plugins/script/script-repo.c13
-rw-r--r--src/plugins/spell/spell-bar-item.c16
-rw-r--r--src/plugins/spell/spell-config.c11
-rw-r--r--src/plugins/spell/spell-speller.c18
-rw-r--r--src/plugins/trigger/trigger-buffer.c9
-rw-r--r--src/plugins/trigger/trigger-callback.c16
-rw-r--r--src/plugins/trigger/trigger-command.c7
-rw-r--r--src/plugins/trigger/trigger-completion.c22
-rw-r--r--src/plugins/trigger/trigger.c16
-rw-r--r--src/plugins/weechat-plugin.h14
-rw-r--r--src/plugins/xfer/xfer.c10
48 files changed, 772 insertions, 168 deletions
diff --git a/src/plugins/alias/alias-completion.c b/src/plugins/alias/alias-completion.c
index 031a4c1a0..9c4caf3eb 100644
--- a/src/plugins/alias/alias-completion.c
+++ b/src/plugins/alias/alias-completion.c
@@ -79,7 +79,11 @@ alias_completion_alias_value_cb (const void *pointer, void *data,
args = weechat_hook_completion_get_string (completion, "args");
if (args)
{
- argv = weechat_string_split (args, " ", 0, 0, &argc);
+ argv = weechat_string_split (args, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
if (argc > 0)
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 2e2aa3bcf..bf5c97969 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -190,7 +190,11 @@ alias_replace_args (const char *alias_args, const char *user_args)
const char *start, *pos;
int n, m, argc, length_res, args_count, offset;
- argv = weechat_string_split (user_args, " ", 0, 0, &argc);
+ argv = weechat_string_split (user_args, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
res = NULL;
length_res = 0;
diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c
index 46eb9ed40..2072211d3 100644
--- a/src/plugins/buflist/buflist-config.c
+++ b/src/plugins/buflist/buflist-config.c
@@ -165,7 +165,11 @@ buflist_config_hook_signals_refresh ()
BUFLIST_CONFIG_SIGNALS_REFRESH_NICK_PREFIX);
}
- signals = weechat_string_split (*all_signals, ",", 0, 0, &count);
+ signals = weechat_string_split (*all_signals, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &count);
if (signals)
{
signals_list = weechat_arraylist_new (
@@ -252,7 +256,12 @@ buflist_config_change_sort (const void *pointer, void *data,
buflist_config_sort_fields = weechat_string_split (
weechat_config_string (buflist_config_look_sort),
- ",", 0, 0, &buflist_config_sort_fields_count);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &buflist_config_sort_fields_count);
buflist_bar_item_update (0);
}
diff --git a/src/plugins/buflist/buflist-mouse.c b/src/plugins/buflist/buflist-mouse.c
index aab331aa7..b5aa0e685 100644
--- a/src/plugins/buflist/buflist-mouse.c
+++ b/src/plugins/buflist/buflist-mouse.c
@@ -87,7 +87,11 @@ buflist_focus_cb (const void *pointer, void *data, struct t_hashtable *info)
end:
/* get list of keys */
keys = weechat_hdata_get_string (buflist_hdata_buffer, "var_keys");
- list_keys = weechat_string_split (keys, ",", 0, 0, &num_keys);
+ list_keys = weechat_string_split (keys, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_keys);
if (!list_keys)
return info;
diff --git a/src/plugins/exec/exec-buffer.c b/src/plugins/exec/exec-buffer.c
index 4f83509da..230f46592 100644
--- a/src/plugins/exec/exec-buffer.c
+++ b/src/plugins/exec/exec-buffer.c
@@ -53,8 +53,17 @@ exec_buffer_input_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
- argv = weechat_string_split (input_data, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (input_data, " ", 1, 0, NULL);
+ argv = weechat_string_split (input_data, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
+ argv_eol = weechat_string_split (input_data, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0, NULL);
if (argv && argv_eol)
exec_command_run (buffer, argc, argv, argv_eol, 0);
diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c
index 8f3eb4729..fe993dfbe 100644
--- a/src/plugins/exec/exec-config.c
+++ b/src/plugins/exec/exec-config.c
@@ -63,7 +63,12 @@ exec_config_change_command_default_options (const void *pointer, void *data,
exec_config_cmd_options = weechat_string_split (
weechat_config_string (exec_config_command_default_options),
- " ", 0, 0, &exec_config_cmd_num_options);
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &exec_config_cmd_num_options);
}
/*
diff --git a/src/plugins/fset/fset-buffer.c b/src/plugins/fset/fset-buffer.c
index 9a6653e5e..6820148ca 100644
--- a/src/plugins/fset/fset-buffer.c
+++ b/src/plugins/fset/fset-buffer.c
@@ -782,7 +782,11 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option)
NULL);
if (line)
{
- lines = weechat_string_split (line, "\r\n", 0, 0, &num_lines);
+ lines = weechat_string_split (line, "\r\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_lines);
if (lines)
{
y = fset_option->index * fset_config_format_option_num_lines[format_number - 1];
diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c
index 6d9324e37..4b510a8a7 100644
--- a/src/plugins/fset/fset-command.c
+++ b/src/plugins/fset/fset-command.c
@@ -469,7 +469,11 @@ fset_command_run_set_cb (const void *pointer, void *data,
rc = WEECHAT_RC_OK;
- argv = weechat_string_split (command, " ", 0, 0, &argc);
+ argv = weechat_string_split (command, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argc > 2)
goto end;
diff --git a/src/plugins/fset/fset-completion.c b/src/plugins/fset/fset-completion.c
index 90124a3d7..25b2eb6ec 100644
--- a/src/plugins/fset/fset-completion.c
+++ b/src/plugins/fset/fset-completion.c
@@ -81,7 +81,12 @@ fset_completion_option_cb (const void *pointer, void *data,
WEECHAT_LIST_POS_SORT);
words = weechat_string_split (
weechat_config_option_get_string (ptr_option, "name"),
- "_", 0, 0, &num_words);
+ "_",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_words);
if (words && (num_words > 1))
{
for (i = 0; i < num_words; i++)
diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c
index 5994c9d5f..3a4b1bb18 100644
--- a/src/plugins/fset/fset-config.c
+++ b/src/plugins/fset/fset-config.c
@@ -153,7 +153,12 @@ fset_config_change_sort_cb (const void *pointer, void *data,
fset_config_sort_fields = weechat_string_split (
weechat_config_string (fset_config_look_sort),
- ",", 0, 0, &fset_config_sort_fields_count);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &fset_config_sort_fields_count);
if (fset_buffer)
{
diff --git a/src/plugins/irc/irc-color.c b/src/plugins/irc/irc-color.c
index dacfc4219..3a555caa8 100644
--- a/src/plugins/irc/irc-color.c
+++ b/src/plugins/irc/irc-color.c
@@ -497,7 +497,11 @@ irc_color_decode_ansi_cb (void *data, const char *text)
if (!text2)
goto end;
- items = weechat_string_split (text2, ";", 0, 0, &num_items);
+ items = weechat_string_split (text2, ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
if (!items)
goto end;
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 30e1e3c21..4d8afbcb0 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -419,7 +419,11 @@ irc_command_exec_all_channels (struct t_irc_server *server,
return;
channels = (str_channels && str_channels[0]) ?
- weechat_string_split (str_channels, ",", 0, 0, &num_channels) : NULL;
+ weechat_string_split (str_channels, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_channels) : NULL;
/* build a list of buffer names where the command will be executed */
list_buffers = weechat_list_new ();
@@ -654,7 +658,11 @@ irc_command_exec_all_servers (int inclusive, const char *str_servers, const char
return;
servers = (str_servers && str_servers[0]) ?
- weechat_string_split (str_servers, ",", 0, 0, &num_servers) : NULL;
+ weechat_string_split (str_servers, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_servers) : NULL;
/* build a list of buffer names where the command will be executed */
list_buffers = weechat_list_new ();
@@ -1080,8 +1088,17 @@ irc_command_run_away (const void *pointer, void *data,
int argc;
char **argv, **argv_eol;
- argv = weechat_string_split (command, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (command, " ", 1, 0, NULL);
+ argv = weechat_string_split (command, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
+ argv_eol = weechat_string_split (command, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0, NULL);
if (argv && argv_eol)
{
@@ -1549,7 +1566,11 @@ IRC_COMMAND_CALLBACK(ctcp)
IRC_COMMAND_CHECK_SERVER("ctcp", 1);
- targets = weechat_string_split (argv[arg_target], ",", 0, 0, &num_targets);
+ targets = weechat_string_split (argv[arg_target], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_targets);
if (!targets)
WEECHAT_COMMAND_ERROR;
@@ -1655,8 +1676,11 @@ IRC_COMMAND_CALLBACK(cycle)
{
channel_name = argv[1];
pos_args = argv_eol[2];
- channels = weechat_string_split (channel_name, ",", 0, 0,
- &num_channels);
+ channels = weechat_string_split (channel_name, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_channels);
if (channels)
{
for (i = 0; i < num_channels; i++)
@@ -2504,15 +2528,22 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
pos_keys++;
}
if (pos_keys[0])
- keys = weechat_string_split (pos_keys, ",", 0, 0, &num_keys);
+ keys = weechat_string_split (pos_keys, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_keys);
}
else
new_args = strdup (arguments);
if (new_args)
{
- channels = weechat_string_split (new_args, ",", 0, 0,
- &num_channels);
+ channels = weechat_string_split (new_args, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_channels);
free (new_args);
}
@@ -3260,8 +3291,11 @@ IRC_COMMAND_CALLBACK(msg)
IRC_COMMAND_CHECK_SERVER("msg", 1);
- targets = weechat_string_split (argv[arg_target], ",", 0, 0,
- &num_targets);
+ targets = weechat_string_split (argv[arg_target], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_targets);
if (!targets)
WEECHAT_COMMAND_ERROR;
@@ -4056,7 +4090,11 @@ IRC_COMMAND_CALLBACK(query)
IRC_COMMAND_CHECK_SERVER("query", 1);
- nicks = weechat_string_split (argv[arg_nick], ",", 0, 0, &num_nicks);
+ nicks = weechat_string_split (argv[arg_nick], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_nicks);
if (!nicks)
WEECHAT_COMMAND_ERROR;
diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c
index 6f429c5a9..015950753 100644
--- a/src/plugins/irc/irc-config.c
+++ b/src/plugins/irc/irc-config.c
@@ -359,7 +359,12 @@ irc_config_change_look_display_join_message (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (irc_config_look_display_join_message),
- ",", 0, 0, &num_items);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -582,7 +587,12 @@ irc_config_change_look_nicks_hide_password (const void *pointer, void *data,
if (nicks_hide_password && nicks_hide_password[0])
{
irc_config_nicks_hide_password = weechat_string_split (
- nicks_hide_password, ",", 0, 0,
+ nicks_hide_password,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
&irc_config_num_nicks_hide_password);
}
}
@@ -710,7 +720,12 @@ irc_config_change_color_mirc_remap (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (irc_config_color_mirc_remap),
- ";", 0, 0, &num_items);
+ ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -757,7 +772,12 @@ irc_config_change_color_nick_prefixes (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (irc_config_color_nick_prefixes),
- ";", 0, 0, &num_items);
+ ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -1023,14 +1043,26 @@ irc_config_check_autojoin (const char *autojoin)
if (strstr (string, ", ") || strstr (string, " ,"))
goto end;
- items = weechat_string_split (string, " ", 0, 0, &num_items);
+ items = weechat_string_split (string, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
if (!items || (num_items < 1) || (num_items > 2))
goto end;
- channels = weechat_string_split (items[0], ",", 0, 0, &num_channels);
+ channels = weechat_string_split (items[0], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_channels);
if (num_items == 2)
- keys = weechat_string_split (items[1], ",", 0, 0, &num_keys);
+ keys = weechat_string_split (items[1], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_keys);
/* error if there are more keys than channels to join */
if (num_keys > num_channels)
@@ -1477,8 +1509,23 @@ irc_config_ignore_read_cb (const void *pointer, void *data,
{
if (value && value[0])
{
- argv = weechat_string_split (value, ";", 0, 0, &argc);
- argv_eol = weechat_string_split (value, ";", 1, 0, NULL);
+ argv = weechat_string_split (
+ value,
+ ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &argc);
+ argv_eol = weechat_string_split (
+ value,
+ ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0,
+ NULL);
if (argv && argv_eol && (argc >= 3))
{
irc_ignore_new (argv_eol[2], argv[0], argv[1]);
diff --git a/src/plugins/irc/irc-info.c b/src/plugins/irc/irc-info.c
index 50dcaba41..b284e9148 100644
--- a/src/plugins/irc/irc-info.c
+++ b/src/plugins/irc/irc-info.c
@@ -512,7 +512,11 @@ irc_info_infolist_irc_channel_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
- argv = weechat_string_split (arguments, ",", 0, 0, &argc);
+ argv = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return NULL;
@@ -600,7 +604,11 @@ irc_info_infolist_irc_modelist_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
- argv = weechat_string_split (arguments, ",", 0, 0, &argc);
+ argv = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return NULL;
@@ -697,7 +705,11 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
- argv = weechat_string_split (arguments, ",", 0, 0, &argc);
+ argv = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return NULL;
@@ -805,7 +817,11 @@ irc_info_infolist_irc_nick_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
- argv = weechat_string_split (arguments, ",", 0, 0, &argc);
+ argv = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return NULL;
diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c
index f5a06ea2a..6e833c963 100644
--- a/src/plugins/irc/irc-input.c
+++ b/src/plugins/irc/irc-input.c
@@ -361,7 +361,14 @@ irc_input_send_cb (const void *pointer, void *data,
if (options && options[0])
{
- list_options = weechat_string_split (options, ",", 0, 0, &num_options);
+ list_options = weechat_string_split (
+ options,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_options);
if (list_options)
{
for (i = 0; i < num_options; i++)
diff --git a/src/plugins/irc/irc-message.c b/src/plugins/irc/irc-message.c
index 64034a3f6..45d6052ab 100644
--- a/src/plugins/irc/irc-message.c
+++ b/src/plugins/irc/irc-message.c
@@ -779,18 +779,30 @@ irc_message_split_join (struct t_hashtable *hashtable,
str = weechat_strndup (arguments, pos - arguments);
if (!str)
return 0;
- channels = weechat_string_split (str, ",", 0, 0, &channels_count);
+ channels = weechat_string_split (str, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &channels_count);
free (str);
while (pos[0] == ' ')
{
pos++;
}
if (pos[0])
- keys = weechat_string_split (pos, ",", 0, 0, &keys_count);
+ keys = weechat_string_split (pos, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &keys_count);
}
else
{
- channels = weechat_string_split (arguments, ",", 0, 0, &channels_count);
+ channels = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &channels_count);
}
snprintf (msg_to_send, sizeof (msg_to_send), "%s%sJOIN",
@@ -1042,8 +1054,16 @@ irc_message_split (struct t_irc_server *server, const char *message)
}
}
- argv = weechat_string_split (message, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (message, " ", 2, 0, NULL);
+ argv = weechat_string_split (message, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
+ argv_eol = weechat_string_split (message, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0, NULL);
if (argc < 2)
goto end;
diff --git a/src/plugins/irc/irc-mode.c b/src/plugins/irc/irc-mode.c
index 56a3b5c3d..34a870aba 100644
--- a/src/plugins/irc/irc-mode.c
+++ b/src/plugins/irc/irc-mode.c
@@ -130,7 +130,11 @@ irc_mode_channel_update (struct t_irc_server *server,
pos_args++;
while (pos_args[0] == ' ')
pos_args++;
- argv = weechat_string_split (pos_args, " ", 0, 0, &argc);
+ argv = weechat_string_split (pos_args, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
}
else
{
@@ -338,7 +342,11 @@ irc_mode_channel_set (struct t_irc_server *server,
argc = 0;
argv = NULL;
if (modes_arguments)
- argv = weechat_string_split (modes_arguments, " ", 0, 0, &argc);
+ argv = weechat_string_split (modes_arguments, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
current_arg = 0;
diff --git a/src/plugins/irc/irc-notify.c b/src/plugins/irc/irc-notify.c
index e887a30c9..cdbbe722f 100644
--- a/src/plugins/irc/irc-notify.c
+++ b/src/plugins/irc/irc-notify.c
@@ -373,7 +373,11 @@ irc_notify_new_for_server (struct t_irc_server *server)
if (!notify || !notify[0])
return;
- items = weechat_string_split (notify, ",", 0, 0, &num_items);
+ items = weechat_string_split (notify, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -388,8 +392,14 @@ irc_notify_new_for_server (struct t_irc_server *server)
{
pos_params++;
}
- params = weechat_string_split (pos_params, "/", 0, 0,
- &num_params);
+ params = weechat_string_split (
+ pos_params,
+ "/",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_params);
if (params)
{
for (j = 0; j < num_params; j++)
@@ -827,11 +837,24 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
if (strcmp (pattern, "ison") == 0)
{
/* redirection of command "ison" */
- messages = weechat_string_split (output, "\n", 0, 0, &num_messages);
+ messages = weechat_string_split (
+ output,
+ "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_messages);
if (messages)
{
- nicks_sent = weechat_string_split (ptr_args, " ", 0, 0,
- &num_nicks_sent);
+ nicks_sent = weechat_string_split (
+ ptr_args,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_nicks_sent);
if (!nicks_sent)
return WEECHAT_RC_OK;
for (ptr_notify = ptr_server->notify_list;
@@ -857,8 +880,14 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
}
if (pos[0])
{
- nicks_recv = weechat_string_split (pos, " ", 0, 0,
- &num_nicks_recv);
+ nicks_recv = weechat_string_split (
+ pos,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_nicks_recv);
if (nicks_recv)
{
for (j = 0; j < num_nicks_recv; j++)
@@ -920,7 +949,14 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
{
away_message_updated = 0;
no_such_nick = 0;
- messages = weechat_string_split (output, "\n", 0, 0, &num_messages);
+ messages = weechat_string_split (
+ output,
+ "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_messages);
if (messages)
{
for (i = 0; i < num_messages; i++)
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 3c4733261..71c9aacab 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -395,8 +395,14 @@ irc_protocol_cap_sync (struct t_irc_server *server, int sasl)
strcat (cap_option, "sasl");
}
cap_req[0] = '\0';
- caps_requested = weechat_string_split (cap_option, ",", 0, 0,
- &num_caps_requested);
+ caps_requested = weechat_string_split (
+ cap_option,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_requested);
if (caps_requested)
{
for (i = 0; i < num_caps_requested; i++)
@@ -506,8 +512,14 @@ IRC_PROTOCOL_CALLBACK(cap)
if (ptr_caps[0] == ':')
ptr_caps++;
- caps_supported = weechat_string_split (ptr_caps, " ", 0, 0,
- &num_caps_supported);
+ caps_supported = weechat_string_split (
+ ptr_caps,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_supported);
if (caps_supported)
{
for (i = 0; i < num_caps_supported; i++)
@@ -582,8 +594,14 @@ IRC_PROTOCOL_CALLBACK(cap)
if (ptr_caps[0] == ':')
ptr_caps++;
- caps_enabled = weechat_string_split (ptr_caps, " ", 0, 0,
- &num_caps_enabled);
+ caps_enabled = weechat_string_split (
+ ptr_caps,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_enabled);
if (caps_enabled)
{
for (i = 0; i < num_caps_enabled; i++)
@@ -637,8 +655,14 @@ IRC_PROTOCOL_CALLBACK(cap)
_("%s%s: client capability, enabled: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps);
sasl_to_do = 0;
- caps_supported = weechat_string_split (ptr_caps, " ", 0, 0,
- &num_caps_supported);
+ caps_supported = weechat_string_split (
+ ptr_caps,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_supported);
if (caps_supported)
{
for (i = 0; i < num_caps_supported; i++)
@@ -701,8 +725,14 @@ IRC_PROTOCOL_CALLBACK(cap)
server->buffer, date, NULL,
_("%s%s: client capability, now available: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps);
- caps_added = weechat_string_split (ptr_caps, " ", 0, 0,
- &num_caps_added);
+ caps_added = weechat_string_split (
+ ptr_caps,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_added);
if (caps_added)
{
for (i = 0; i < num_caps_added; i++)
@@ -741,8 +771,14 @@ IRC_PROTOCOL_CALLBACK(cap)
server->buffer, date, NULL,
_("%s%s: client capability, removed: %s"),
weechat_prefix ("network"), IRC_PLUGIN_NAME, ptr_caps);
- caps_removed = weechat_string_split (ptr_caps, " ", 0, 0,
- &num_caps_removed);
+ caps_removed = weechat_string_split (
+ ptr_caps,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_caps_removed);
if (caps_removed)
{
for (i = 0; i < num_caps_removed; i++)
@@ -5786,7 +5822,12 @@ IRC_PROTOCOL_CALLBACK(730)
nicks = weechat_string_split ((argv_eol[3][0] == ':') ?
argv_eol[3] + 1 : argv_eol[3],
- ",", 0, 0, &num_nicks);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_nicks);
if (nicks)
{
for (i = 0; i < num_nicks; i++)
@@ -5824,7 +5865,12 @@ IRC_PROTOCOL_CALLBACK(731)
nicks = weechat_string_split ((argv_eol[3][0] == ':') ?
argv_eol[3] + 1 : argv_eol[3],
- ",", 0, 0, &num_nicks);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_nicks);
if (nicks)
{
for (i = 0; i < num_nicks; i++)
@@ -6064,7 +6110,11 @@ irc_protocol_get_message_tags (const char *tags)
if (!hashtable)
return NULL;
- items = weechat_string_split (tags, ";", 0, 0, &num_items);
+ items = weechat_string_split (tags, ";",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -6164,7 +6214,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
const char *msg_channel)
{
int i, cmd_found, return_code, argc, decode_color, keep_trailing_spaces;
- int message_ignored;
+ int message_ignored, flags;
char *message_colors_decoded, *pos_space, *tags;
struct t_irc_channel *ptr_channel;
t_irc_recv_func *cmd_recv_func;
@@ -6478,9 +6528,18 @@ irc_protocol_recv_command (struct t_irc_server *server,
}
else
message_colors_decoded = NULL;
- argv = weechat_string_split (message_colors_decoded, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (message_colors_decoded, " ",
- 1 + keep_trailing_spaces, 0, NULL);
+ argv = weechat_string_split (message_colors_decoded, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
+ flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL;
+ if (keep_trailing_spaces)
+ flags |= WEECHAT_STRING_SPLIT_STRIP_RIGHT;
+ argv_eol = weechat_string_split (message_colors_decoded, " ", flags,
+ 0, NULL);
return_code = (int) (cmd_recv_func) (server,
date, nick, address_color,
diff --git a/src/plugins/irc/irc-redirect.c b/src/plugins/irc/irc-redirect.c
index 3020c96de..8ace5a4c0 100644
--- a/src/plugins/irc/irc-redirect.c
+++ b/src/plugins/irc/irc-redirect.c
@@ -422,13 +422,29 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
items[i] = NULL;
}
if (cmd_start)
- items[0] = weechat_string_split (cmd_start, ",", 0, 0, &num_items[0]);
+ items[0] = weechat_string_split (cmd_start, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items[0]);
if (cmd_stop)
- items[1] = weechat_string_split (cmd_stop, ",", 0, 0, &num_items[1]);
+ items[1] = weechat_string_split (cmd_stop, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items[1]);
if (cmd_extra)
- items[2] = weechat_string_split (cmd_extra, ",", 0, 0, &num_items[2]);
+ items[2] = weechat_string_split (cmd_extra, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items[2]);
if (cmd_filter)
- items[3] = weechat_string_split (cmd_filter, ",", 0, 0, &num_items[3]);
+ items[3] = weechat_string_split (cmd_filter, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items[3]);
for (i = 0; i < 4; i++)
{
if (items[i])
@@ -793,8 +809,14 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
if (arguments && arguments[0])
{
- arguments_argv = weechat_string_split (arguments, " ", 0, 0,
- &arguments_argc);
+ arguments_argv = weechat_string_split (
+ arguments,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &arguments_argc);
}
else
{
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index ecb3bd278..40bb47b7b 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -425,7 +425,11 @@ irc_server_eval_fingerprint (struct t_irc_server *server)
}
/* split fingerprint */
- fingerprints = weechat_string_split (fingerprint_eval, ",", 0, 0, NULL);
+ fingerprints = weechat_string_split (fingerprint_eval, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, NULL);
if (!fingerprints)
return fingerprint_eval;
@@ -607,7 +611,13 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
if (!addresses_eval)
return 1;
server->addresses_array = weechat_string_split (
- addresses_eval, ",", 0, 0, &server->addresses_count);
+ addresses_eval,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &server->addresses_count);
server->ports_array = malloc (
server->addresses_count * sizeof (server->ports_array[0]));
server->retry_array = malloc (
@@ -702,7 +712,12 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
/* set new nicks */
server->nicks_array = weechat_string_split (
(nicks2) ? nicks2 : IRC_SERVER_DEFAULT_NICKS,
- ",", 0, 0, &server->nicks_count);
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &server->nicks_count);
if (nicks2)
free (nicks2);
@@ -2615,7 +2630,11 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
}
rc = 1;
- items = weechat_string_split (vbuffer, "\n", 0, 0, &items_count);
+ items = weechat_string_split (vbuffer, "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &items_count);
for (i = 0; i < items_count; i++)
{
/* run modifier "irc_out1_xxx" (like "irc_out_xxx", but before split) */
@@ -4212,7 +4231,11 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
}
/* split good_fingerprints */
- fingerprints = weechat_string_split (good_fingerprints, ",", 0, 0, NULL);
+ fingerprints = weechat_string_split (good_fingerprints, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, NULL);
if (!fingerprints)
return 0;
@@ -5121,8 +5144,14 @@ irc_server_autojoin_create_buffers (struct t_irc_server *server)
strdup (autojoin);
if (autojoin2)
{
- channels = weechat_string_split (autojoin2, ",", 0, 0,
- &num_channels);
+ channels = weechat_string_split (
+ autojoin2,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_channels);
if (channels)
{
for (i = 0; i < num_channels; i++)
diff --git a/src/plugins/irc/irc-upgrade.c b/src/plugins/irc/irc-upgrade.c
index ea69c7fcc..a769c164e 100644
--- a/src/plugins/irc/irc-upgrade.c
+++ b/src/plugins/irc/irc-upgrade.c
@@ -549,8 +549,14 @@ irc_upgrade_read_cb (const void *pointer, void *data,
str = weechat_infolist_string (infolist, "join_msg_received");
if (str)
{
- items = weechat_string_split (str, ",", 0, 0,
- &num_items);
+ items = weechat_string_split (
+ str,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -605,8 +611,14 @@ irc_upgrade_read_cb (const void *pointer, void *data,
str = weechat_infolist_string (infolist, "join_smart_filtered");
if (str)
{
- nicks = weechat_string_split (str, ",", 0, 0,
- &nicks_count);
+ nicks = weechat_string_split (
+ str,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &nicks_count);
if (nicks)
{
for (i = 0; i < nicks_count; i++)
diff --git a/src/plugins/plugin-api-info.c b/src/plugins/plugin-api-info.c
index 1b09c3ce0..31abcaaca 100644
--- a/src/plugins/plugin-api-info.c
+++ b/src/plugins/plugin-api-info.c
@@ -670,7 +670,11 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
if (!arguments || !arguments[0])
goto error;
- argv = string_split (arguments, ",", 0, 0, &argc);
+ argv = string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv || (argc < 1))
goto error;
@@ -744,7 +748,11 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
if (!arguments || !arguments[0])
goto error;
- argv = string_split (arguments, ",", 0, 0, &argc);
+ argv = string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv || (argc < 2))
goto error;
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 69615e8c4..16b232dd7 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -318,8 +318,14 @@ plugin_api_command_options (struct t_weechat_plugin *plugin,
ptr_commands = hashtable_get (options, "commands");
if (ptr_commands)
{
- new_commands_allowed = string_split (ptr_commands, ",", 0, 0,
- NULL);
+ 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;
}
}
diff --git a/src/plugins/plugin-script-api.c b/src/plugins/plugin-script-api.c
index 11b404d92..3bf1fd7ca 100644
--- a/src/plugins/plugin-script-api.c
+++ b/src/plugins/plugin-script-api.c
@@ -64,7 +64,11 @@ plugin_script_api_string_match_list (struct t_weechat_plugin *weechat_plugin,
int match;
list_masks = (masks && masks[0]) ?
- weechat_string_split (masks, ",", 0, 0, NULL) : NULL;
+ weechat_string_split (masks, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, NULL) : NULL;
match = weechat_string_match_list (string,
(const char **)list_masks,
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 6cfd46e70..55076d4e7 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -1262,7 +1262,11 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
}
}
- argv = weechat_string_split (ptr_list, ",", 0, 0, &argc);
+ argv = weechat_string_split (ptr_list, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -1403,7 +1407,11 @@ plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
ptr_list += 3;
}
- argv = weechat_string_split (ptr_list, ",", 0, 0, &argc);
+ argv = weechat_string_split (ptr_list, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -1474,7 +1482,11 @@ plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
}
}
- argv = weechat_string_split (ptr_list, ",", 0, 0, &argc);
+ argv = weechat_string_split (ptr_list, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 6ed45e602..dadfdd2a3 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -1004,9 +1004,14 @@ plugin_auto_load (char *force_plugin_autoload,
if (ptr_plugin_autoload && ptr_plugin_autoload[0])
{
- plugin_autoload_array = string_split (ptr_plugin_autoload,
- ",", 0, 0,
- &plugin_autoload_count);
+ plugin_autoload_array = string_split (
+ ptr_plugin_autoload,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &plugin_autoload_count);
}
/* auto-load plugins in custom path */
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index 22ae3a94a..8aeacec0c 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -157,7 +157,11 @@ weechat_python_get_python2_bin ()
if (dir_separator && path)
{
- paths = weechat_string_split (path, ":", 0, 0, &num_paths);
+ paths = weechat_string_split (path, ":",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_paths);
if (paths)
{
for (i = 0; i < num_paths; i++)
diff --git a/src/plugins/relay/irc/relay-irc.c b/src/plugins/relay/irc/relay-irc.c
index bb97ca293..506afb020 100644
--- a/src/plugins/relay/irc/relay-irc.c
+++ b/src/plugins/relay/irc/relay-irc.c
@@ -337,7 +337,11 @@ relay_irc_tag_relay_client_id (const char *tags)
if (tags && tags[0])
{
- argv = weechat_string_split (tags, ",", 0, 0, &argc);
+ argv = weechat_string_split (tags, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -561,7 +565,11 @@ relay_irc_hsignal_irc_redir_cb (const void *pointer, void *data,
if (!output)
return WEECHAT_RC_OK;
- messages = weechat_string_split (output, "\n", 0, 0, &num_messages);
+ messages = weechat_string_split (output, "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_messages);
if (messages)
{
for (i = 0; i < num_messages; i++)
@@ -1347,8 +1355,23 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
irc_args = weechat_hashtable_get (hash_parsed, "arguments");
if (irc_args)
{
- irc_argv = weechat_string_split (irc_args, " ", 0, 0, &irc_argc);
- irc_argv_eol = weechat_string_split (irc_args, " ", 1, 0, NULL);
+ irc_argv = weechat_string_split (
+ irc_args,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &irc_argc);
+ irc_argv_eol = weechat_string_split (
+ irc_args,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0,
+ NULL);
}
/*
diff --git a/src/plugins/relay/relay-client.c b/src/plugins/relay/relay-client.c
index ecb1efbca..0ea02c356 100644
--- a/src/plugins/relay/relay-client.c
+++ b/src/plugins/relay/relay-client.c
@@ -340,7 +340,10 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
pos[0] = '\0';
lines = weechat_string_split (client->partial_message, "\n",
- 0, 0, &num_lines);
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_lines);
if (lines)
{
for (i = 0; i < num_lines; i++)
diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c
index 05d145cc5..bce42c2b0 100644
--- a/src/plugins/relay/relay-config.c
+++ b/src/plugins/relay/relay-config.c
@@ -404,7 +404,11 @@ relay_config_check_irc_backlog_tags (const void *pointer, void *data,
return rc;
/* split tags and check them */
- tags = weechat_string_split (value, ",", 0, 0, &num_tags);
+ tags = weechat_string_split (value, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_tags);
if (tags)
{
for (i = 0; i < num_tags; i++)
@@ -448,8 +452,14 @@ relay_config_change_irc_backlog_tags (const void *pointer, void *data,
else
weechat_hashtable_remove_all (relay_config_hashtable_irc_backlog_tags);
- items = weechat_string_split (weechat_config_string (relay_config_irc_backlog_tags),
- ",", 0, 0, &num_items);
+ items = weechat_string_split (
+ weechat_config_string (relay_config_irc_backlog_tags),
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
diff --git a/src/plugins/relay/relay-info.c b/src/plugins/relay/relay-info.c
index 55f2f3269..24b68b236 100644
--- a/src/plugins/relay/relay-info.c
+++ b/src/plugins/relay/relay-info.c
@@ -54,7 +54,11 @@ relay_info_info_relay_client_count_cb (const void *pointer, void *data,
protocol = -1;
status = -1;
- items = weechat_string_split (arguments, ",", 0, 0, &num_items);
+ items = weechat_string_split (arguments, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
if (num_items > 2)
goto end;
diff --git a/src/plugins/relay/weechat/relay-weechat-msg.c b/src/plugins/relay/weechat/relay-weechat-msg.c
index dd5ec27d9..42ce0a561 100644
--- a/src/plugins/relay/weechat/relay-weechat-msg.c
+++ b/src/plugins/relay/weechat/relay-weechat-msg.c
@@ -583,7 +583,11 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
goto end;
/* split path */
- list_path = weechat_string_split (pos + 1, "/", 0, 0, &num_path);
+ list_path = weechat_string_split (pos + 1, "/",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_path);
if (!list_path)
goto end;
@@ -649,7 +653,11 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
/* split keys */
if (!keys)
keys = weechat_hdata_get_string (ptr_hdata, "var_keys");
- list_keys = weechat_string_split (keys, ",", 0, 0, &num_keys);
+ list_keys = weechat_string_split (keys, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_keys);
if (!list_keys)
goto end;
@@ -782,7 +790,14 @@ relay_weechat_msg_add_infolist (struct t_relay_weechat_msg *msg,
fields = weechat_infolist_fields (ptr_infolist);
if (fields)
{
- list_fields = weechat_string_split (fields, ",", 0, 0, &num_fields);
+ list_fields = weechat_string_split (
+ fields,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_fields);
if (list_fields)
{
count_items++;
diff --git a/src/plugins/relay/weechat/relay-weechat-protocol.c b/src/plugins/relay/weechat/relay-weechat-protocol.c
index 1cc94af24..ed1a34d9e 100644
--- a/src/plugins/relay/weechat/relay-weechat-protocol.c
+++ b/src/plugins/relay/weechat/relay-weechat-protocol.c
@@ -1062,15 +1062,22 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(sync)
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
- buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",", 0, 0,
- &num_buffers);
+ buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_buffers);
if (buffers)
{
add_flags = RELAY_WEECHAT_PROTOCOL_SYNC_ALL;
if (argc > 1)
{
add_flags = 0;
- flags = weechat_string_split (argv[1], ",", 0, 0, &num_flags);
+ flags = weechat_string_split (argv[1], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_flags);
if (flags)
{
for (i = 0; i < num_flags; i++)
@@ -1141,15 +1148,22 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(desync)
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
- buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",", 0, 0,
- &num_buffers);
+ buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_buffers);
if (buffers)
{
sub_flags = RELAY_WEECHAT_PROTOCOL_SYNC_ALL;
if (argc > 1)
{
sub_flags = 0;
- flags = weechat_string_split (argv[1], ",", 0, 0, &num_flags);
+ flags = weechat_string_split (argv[1], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_flags);
if (flags)
{
for (i = 0; i < num_flags; i++)
@@ -1420,8 +1434,16 @@ relay_weechat_protocol_recv (struct t_relay_client *client, const char *data)
{
pos++;
}
- argv = weechat_string_split (pos, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (pos, " ", 2, 0, NULL);
+ argv = weechat_string_split (pos, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
+ argv_eol = weechat_string_split (pos, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0, NULL);
}
for (i = 0; protocol_cb[i].name; i++)
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c
index 6d4b2e5a5..c97e58b58 100644
--- a/src/plugins/script/script-action.c
+++ b/src/plugins/script/script-action.c
@@ -832,7 +832,11 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
{
if (out)
{
- lines = weechat_string_split (out, "\n", 0, 0, &num_lines);
+ lines = weechat_string_split (out, "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_lines);
if (lines)
{
diff_color = weechat_config_boolean (script_config_look_diff_color);
@@ -867,7 +871,11 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
}
else if (err)
{
- lines = weechat_string_split (err, "\n", 0, 0, &num_lines);
+ lines = weechat_string_split (err, "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_lines);
if (lines)
{
for (i = 0; i < num_lines; i++)
@@ -1173,7 +1181,11 @@ script_action_run ()
script_get_loaded_plugins ();
- actions = weechat_string_split (script_actions, "\n", 0, 0, &num_actions);
+ actions = weechat_string_split (script_actions, "\n",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_actions);
if (actions)
{
for (i = 0; i < num_actions; i++)
@@ -1202,8 +1214,23 @@ script_action_run ()
ptr_action++;
}
}
- argv = weechat_string_split (ptr_action, " ", 0, 0, &argc);
- argv_eol = weechat_string_split (ptr_action, " ", 1, 0, &argc);
+ argv = weechat_string_split (
+ ptr_action,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &argc);
+ argv_eol = weechat_string_split (
+ ptr_action,
+ " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
+ | WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0,
+ &argc);
if (argv && argv_eol)
{
if (weechat_strcasecmp (argv[0], "buffer") == 0)
diff --git a/src/plugins/script/script-completion.c b/src/plugins/script/script-completion.c
index 42476fc77..50334713f 100644
--- a/src/plugins/script/script-completion.c
+++ b/src/plugins/script/script-completion.c
@@ -256,8 +256,14 @@ script_completion_tags_cb (const void *pointer, void *data,
{
if (ptr_script->tags)
{
- list_tags = weechat_string_split (ptr_script->tags, ",", 0, 0,
- &num_tags);
+ list_tags = weechat_string_split (
+ ptr_script->tags,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_tags);
if (list_tags)
{
for (i = 0; i < num_tags; i++)
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index 67cccedc4..850255e8e 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -113,7 +113,11 @@ script_config_get_diff_command ()
result[0] = '\0';
if (dir_separator && path)
{
- paths = weechat_string_split (path, ":", 0, 0, &num_paths);
+ paths = weechat_string_split (path, ":",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_paths);
if (paths)
{
for (i = 0; i < num_paths; i++)
@@ -289,8 +293,14 @@ script_config_hold (const char *name_with_extension)
if (hold)
{
hold[0] = '\0';
- items = weechat_string_split (weechat_config_string (script_config_scripts_hold),
- ",", 0, 0, &num_items);
+ items = weechat_string_split (
+ weechat_config_string (script_config_scripts_hold),
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@@ -332,8 +342,14 @@ script_config_unhold (const char *name_with_extension)
if (hold)
{
hold[0] = '\0';
- items = weechat_string_split (weechat_config_string (script_config_scripts_hold),
- ",", 0, 0, &num_items);
+ items = weechat_string_split (
+ weechat_config_string (script_config_scripts_hold),
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index 272eef28e..833cd4f68 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -934,9 +934,16 @@ script_repo_match_filter (struct t_script_repo *script)
if (!script_repo_filter || strcmp (script_repo_filter, "*") == 0)
return 1;
- words = weechat_string_split (script_repo_filter, " ", 0, 0, &num_words);
- tags = weechat_string_split ((script->tags) ? script->tags : "", ",", 0, 0,
- &num_tags);
+ words = weechat_string_split (script_repo_filter, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_words);
+ tags = weechat_string_split ((script->tags) ? script->tags : "", ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_tags);
if (words)
{
for (i = 0; i < num_words; i++)
diff --git a/src/plugins/spell/spell-bar-item.c b/src/plugins/spell/spell-bar-item.c
index 0b9ef5453..c6a1ae885 100644
--- a/src/plugins/spell/spell-bar-item.c
+++ b/src/plugins/spell/spell-bar-item.c
@@ -101,7 +101,11 @@ spell_bar_item_suggest (const void *pointer, void *data,
if (!str_suggest)
return NULL;
- suggestions = weechat_string_split (pos, "/", 0, 0, &num_suggestions);
+ suggestions = weechat_string_split (pos, "/",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_suggestions);
if (!suggestions)
goto end;
@@ -119,8 +123,14 @@ spell_bar_item_suggest (const void *pointer, void *data,
weechat_config_string (
spell_config_look_suggestion_delimiter_dict));
}
- suggestions2 = weechat_string_split (suggestions[i], ",", 0, 0,
- &num_suggestions2);
+ suggestions2 = weechat_string_split (
+ suggestions[i],
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_suggestions2);
if (suggestions2)
{
for (j = 0; j < num_suggestions2; j++)
diff --git a/src/plugins/spell/spell-config.c b/src/plugins/spell/spell-config.c
index cc24efc35..a6c269b25 100644
--- a/src/plugins/spell/spell-config.c
+++ b/src/plugins/spell/spell-config.c
@@ -94,9 +94,14 @@ spell_config_change_commands (const void *pointer, void *data,
value = weechat_config_string (option);
if (value && value[0])
{
- spell_commands_to_check = weechat_string_split (value,
- ",", 0, 0,
- &spell_count_commands_to_check);
+ spell_commands_to_check = weechat_string_split (
+ value,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &spell_count_commands_to_check);
if (spell_count_commands_to_check > 0)
{
spell_length_commands_to_check = malloc (spell_count_commands_to_check *
diff --git a/src/plugins/spell/spell-speller.c b/src/plugins/spell/spell-speller.c
index 0b0ac5492..7250da39e 100644
--- a/src/plugins/spell/spell-speller.c
+++ b/src/plugins/spell/spell-speller.c
@@ -99,7 +99,11 @@ spell_speller_check_dictionaries (const char *dict_list)
if (dict_list)
{
- argv = weechat_string_split (dict_list, ",", 0, 0, &argc);
+ argv = weechat_string_split (dict_list, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (argv)
{
for (i = 0; i < argc; i++)
@@ -223,7 +227,11 @@ spell_speller_add_dicts_to_hash (struct t_hashtable *hashtable,
if (!dict || !dict[0])
return;
- dicts = weechat_string_split (dict, ",", 0, 0, &num_dicts);
+ dicts = weechat_string_split (dict, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_dicts);
if (dicts)
{
for (i = 0; i < num_dicts; i++)
@@ -375,7 +383,11 @@ spell_speller_buffer_new (struct t_gui_buffer *buffer)
buffer_dicts = spell_get_dict (buffer);
if (buffer_dicts)
{
- dicts = weechat_string_split (buffer_dicts, ",", 0, 0, &num_dicts);
+ dicts = weechat_string_split (buffer_dicts, ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_dicts);
if (dicts && (num_dicts > 0))
{
new_speller_buffer->spellers =
diff --git a/src/plugins/trigger/trigger-buffer.c b/src/plugins/trigger/trigger-buffer.c
index b14866d3d..523b0fa44 100644
--- a/src/plugins/trigger/trigger-buffer.c
+++ b/src/plugins/trigger/trigger-buffer.c
@@ -88,7 +88,14 @@ trigger_buffer_set_filter (const char *filter)
}
if (filter && filter[0])
- trigger_buffer_filters = weechat_string_split (filter, ",", 0, 0, NULL);
+ trigger_buffer_filters = weechat_string_split (
+ filter,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ NULL);
}
/*
diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c
index c6aeaffe3..7170dd344 100644
--- a/src/plugins/trigger/trigger-callback.c
+++ b/src/plugins/trigger/trigger-callback.c
@@ -733,7 +733,14 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
pos2++;
if (pos2[0])
{
- tags = weechat_string_split (pos2, ",", 0, 0, &num_tags);
+ tags = weechat_string_split (
+ pos2,
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_tags);
length = 1 + strlen (pos2) + 1 + 1;
str_tags = malloc (length);
if (str_tags)
@@ -817,8 +824,11 @@ trigger_callback_line_cb (const void *pointer, void *data,
weechat_hashtable_set (pointers, "buffer", buffer);
ptr_value = weechat_hashtable_get (line, "tags");
- tags = weechat_string_split ((ptr_value) ? ptr_value : "", ",", 0, 0,
- &num_tags);
+ tags = weechat_string_split ((ptr_value) ? ptr_value : "", ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_tags);
/* build string with tags and commas around: ",tag1,tag2,tag3," */
length = 1 + strlen ((ptr_value) ? ptr_value : "") + 1 + 1;
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c
index 9601c0297..2569b08ca 100644
--- a/src/plugins/trigger/trigger-command.c
+++ b/src/plugins/trigger/trigger-command.c
@@ -682,8 +682,11 @@ trigger_command_trigger (const void *pointer, void *data,
goto end;
}
}
- items = weechat_string_split (trigger_hook_default_rc[type], ",", 0, 0,
- &num_items);
+ items = weechat_string_split (trigger_hook_default_rc[type], ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &num_items);
snprintf (input, sizeof (input),
"/trigger add name %s \"%s\" \"%s\" \"%s\" \"%s\"%s%s%s",
trigger_hook_type_string[type],
diff --git a/src/plugins/trigger/trigger-completion.c b/src/plugins/trigger/trigger-completion.c
index d19fdcb0e..c3bad9fef 100644
--- a/src/plugins/trigger/trigger-completion.c
+++ b/src/plugins/trigger/trigger-completion.c
@@ -138,7 +138,11 @@ trigger_completion_option_value_cb (const void *pointer, void *data,
if (!args)
return WEECHAT_RC_OK;
- argv = weechat_string_split (args, " ", 0, 0, &argc);
+ argv = weechat_string_split (args, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return WEECHAT_RC_OK;
@@ -273,7 +277,11 @@ trigger_completion_add_default_for_hook (struct t_gui_completion *completion,
if (!args)
return;
- argv = weechat_string_split (args, " ", 0, 0, &argc);
+ argv = weechat_string_split (args, " ",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0, &argc);
if (!argv)
return;
@@ -284,8 +292,14 @@ trigger_completion_add_default_for_hook (struct t_gui_completion *completion,
{
if (default_strings[type][0] && split && split[0])
{
- items = weechat_string_split (default_strings[type], split,
- 0, 0, &num_items);
+ items = weechat_string_split (
+ default_strings[type],
+ split,
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_items);
if (items)
{
for (i = 0; i < num_items; i++)
diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c
index a0392afdf..2f477a249 100644
--- a/src/plugins/trigger/trigger.c
+++ b/src/plugins/trigger/trigger.c
@@ -273,10 +273,18 @@ trigger_hook (struct t_trigger *trigger)
trigger_unhook (trigger);
- argv = weechat_string_split (weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
- ";", -1, 0, &argc);
- argv_eol = weechat_string_split (weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
- ";", 1, 0, NULL);
+ argv = weechat_string_split (
+ weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
+ ";",
+ 0,
+ 0,
+ &argc);
+ argv_eol = weechat_string_split (
+ weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
+ ";",
+ WEECHAT_STRING_SPLIT_KEEP_EOL,
+ 0,
+ NULL);
switch (weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK]))
{
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index b802f1960..e7bb8a921 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 "20190228-01"
+#define WEECHAT_PLUGIN_API_VERSION "20190310-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -89,6 +89,12 @@ struct timeval;
#define WEECHAT_RC_OK_EAT 1
#define WEECHAT_RC_ERROR -1
+/* flags for string_split function */
+#define WEECHAT_STRING_SPLIT_STRIP_LEFT (1 << 0)
+#define WEECHAT_STRING_SPLIT_STRIP_RIGHT (1 << 1)
+#define WEECHAT_STRING_SPLIT_COLLAPSE_SEPS (1 << 2)
+#define WEECHAT_STRING_SPLIT_KEEP_EOL (1 << 3)
+
/* return codes for config read functions/callbacks */
#define WEECHAT_CONFIG_READ_OK 0
#define WEECHAT_CONFIG_READ_MEMORY_ERROR -1
@@ -316,7 +322,7 @@ struct t_weechat_plugin
const char *text),
void *callback_data);
char **(*string_split) (const char *string, const char *separators,
- int keep_eol, int num_items_max, int *num_items);
+ int flags, int num_items_max, int *num_items);
char **(*string_split_shell) (const char *string, int *num_items);
void (*string_free_split) (char **split_string);
char *(*string_build_with_split_string) (const char **split_string,
@@ -1213,9 +1219,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__reference_char, \
__callback, \
__callback_data)
-#define weechat_string_split(__string, __separator, __eol, __max, \
+#define weechat_string_split(__string, __separator, __flags, __max, \
__num_items) \
- (weechat_plugin->string_split)(__string, __separator, __eol, \
+ (weechat_plugin->string_split)(__string, __separator, __flags, \
__max, __num_items)
#define weechat_string_split_shell(__string, __num_items) \
(weechat_plugin->string_split_shell)(__string, __num_items)
diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c
index 12019731d..c186998fa 100644
--- a/src/plugins/xfer/xfer.c
+++ b/src/plugins/xfer/xfer.c
@@ -538,8 +538,14 @@ xfer_nick_auto_accepted (const char *server, const char *nick)
rc = 0;
- nicks = weechat_string_split (weechat_config_string (xfer_config_file_auto_accept_nicks),
- ",", 0, 0, &num_nicks);
+ nicks = weechat_string_split (
+ weechat_config_string (xfer_config_file_auto_accept_nicks),
+ ",",
+ WEECHAT_STRING_SPLIT_STRIP_LEFT
+ | WEECHAT_STRING_SPLIT_STRIP_RIGHT
+ | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
+ 0,
+ &num_nicks);
if (nicks)
{
for (i = 0; i < num_nicks; i++)