api: add argument "strip_items" in function string_split

v2.8-utf8proc
Sébastien Helleu 2019-06-15 20:47:14 +02:00
parent 866a29c7e6
commit 9178156354
78 changed files with 473 additions and 195 deletions

View File

@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* api: add argument "strip_items" in function string_split
* exec: evaluate option exec.command.shell, change default value to "${env:SHELL}" (issue #1356)
Bug fixes::

View File

@ -1483,7 +1483,7 @@ This function is not available in scripting API.
==== string_split
_Updated in 2.5._
_Updated in 2.5, 2.6._
Split a string according to one or more delimiter(s).
@ -1492,13 +1492,16 @@ Prototype:
[source,C]
----
char **weechat_string_split (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
----
Arguments:
* _string_: string to split
* _separators_: delimiters used for split
* _strip_items_: chars to strip from returned items (left/right);
optional, can be NULL
* _flags_: combination values to change the default behavior; if the value is 0,
the default behavior is used (no strip of separators at beginning/end of string,
multiple separators are kept as-is so empty strings can be returned);
@ -1536,7 +1539,7 @@ C example:
char **argv;
int argc;
argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
argv = weechat_string_split ("abc de fghi ", " ", NULL, 0, 0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] == ""
@ -1547,7 +1550,7 @@ argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1560,7 +1563,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1574,7 +1577,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,
@ -1586,6 +1589,19 @@ argv = weechat_string_split ("abc de fghi ", " ",
argc == 3
*/
weechat_string_free_split (argv);
argv = weechat_string_split (" abc, de,, fghi ", ",", " ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] == "fghi"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]

View File

@ -1509,7 +1509,7 @@ Cette fonction n'est pas disponible dans l'API script.
==== string_split
_Mis à jour dans la 2.5._
_Mis à jour dans la 2.5, 2.6._
Découper une chaîne à l'aide de délimiteur(s).
@ -1518,13 +1518,16 @@ Prototype :
[source,C]
----
char **weechat_string_split (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
----
Paramètres :
* _string_ : chaîne à découper
* _separators_ : délimiteurs utilisés pour le découpage
* _strip_items_ : caractères à supprimer des chaînes retournées (gauche/droite) ;
optionnel, peut être NULL
* _flags_ : combinaison de valeurs pour changer le comportement par défaut ;
si la valeur est 0, le comportement par défaut est utilisé (pas de suppression
des séparateurs en début/fin de chaîne, plusieurs séparateurs consécutifs
@ -1564,7 +1567,7 @@ Exemples en C :
char **argv;
int argc;
argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
argv = weechat_string_split ("abc de fghi ", " ", NULL, 0, 0, &argc);
/* résultat : argv[0] == "abc"
argv[1] == "de"
argv[2] == ""
@ -1575,7 +1578,7 @@ argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1588,7 +1591,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1602,7 +1605,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,
@ -1614,6 +1617,19 @@ argv = weechat_string_split ("abc de fghi ", " ",
argc == 3
*/
weechat_string_free_split (argv);
argv = weechat_string_split (" abc, de,, fghi ", ",", " ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
/* résultat : argv[0] == "abc"
argv[1] == "de"
argv[2] == "fghi"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]

View File

@ -1555,7 +1555,7 @@ Questa funzione non è disponibile nelle API per lo scripting.
==== string_split
// TRANSLATION MISSING
_Updated in 2.5._
_Updated in 2.5, 2.6._
Divide una stringa in base a uno o più delimitatori.
@ -1564,13 +1564,17 @@ Prototipo:
[source,C]
----
char **weechat_string_split (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
----
Argomenti:
* _string_: stringa da dividere
* _separators_: delimitatori usati per dividere
// TRANSLATION MISSING
* _strip_items_: chars to strip from returned items (left/right);
optional, can be NULL
* _flags_: combination values to change the default behavior; if the value is 0,
the default behavior is used (no strip of separators at beginning/end of string,
multiple separators are kept as-is so empty strings can be returned);
@ -1609,7 +1613,7 @@ Esempi:
char **argv;
int argc;
argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
argv = weechat_string_split ("abc de fghi ", " ", NULL, 0, 0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] = ""
@ -1620,7 +1624,7 @@ argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1633,7 +1637,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1647,7 +1651,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,
@ -1659,6 +1663,19 @@ argv = weechat_string_split ("abc de fghi ", " ",
argc == 3
*/
weechat_string_free_split (argv);
argv = weechat_string_split (" abc, de,, fghi ", ",", " ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] == "fghi"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]

View File

@ -1489,7 +1489,7 @@ if (weechat_string_regcomp (&my_regex, "([0-9]{4})-([0-9]{2})-([0-9]{2})",
==== string_split
_WeeChat バージョン 2.5 で更新。_
_WeeChat バージョン 2.5、2.6 で更新。_
1 つ以上の区切り文字に従って文字列を分割。
@ -1498,13 +1498,17 @@ _WeeChat バージョン 2.5 で更新。_
[source,C]
----
char **weechat_string_split (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
----
引数:
* _string_: 分割する文字列
* _separators_: 分割に使う区切り文字
// TRANSLATION MISSING
* _strip_items_: chars to strip from returned items (left/right);
optional, can be NULL
* _flags_:
デフォルト動作を変更するビットフラグの組合せ値; 値が 0 の場合、デフォルト動作
(文字列の先頭と末尾にある区切り文字を削除しない、連続する区切り文字を 1 つにまとめない)
@ -1542,7 +1546,7 @@ C 言語での使用例:
char **argv;
int argc;
argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
argv = weechat_string_split ("abc de fghi ", " ", NULL, 0, 0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] == ""
@ -1553,7 +1557,7 @@ argv = weechat_string_split ("abc de fghi ", " ", 0, 0, &argc);
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1566,7 +1570,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1580,7 +1584,7 @@ argv = weechat_string_split ("abc de fghi ", " ",
*/
weechat_string_free_split (argv);
argv = weechat_string_split ("abc de fghi ", " ",
argv = weechat_string_split ("abc de fghi ", " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,
@ -1592,6 +1596,19 @@ argv = weechat_string_split ("abc de fghi ", " ",
argc == 3
*/
weechat_string_free_split (argv);
argv = weechat_string_split (" abc, de,, fghi ", ",", " ",
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
/* result: argv[0] == "abc"
argv[1] == "de"
argv[2] == "fghi"
argv[3] == NULL
argc == 3
*/
weechat_string_free_split (argv);
----
[NOTE]

View File

@ -174,6 +174,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
hook_command->cplt_template_args[i] = string_split (
hook_command->cplt_templates[i],
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -218,6 +219,7 @@ hook_command_build_completion (struct t_hook_command *hook_command)
items = string_split (
hook_command->cplt_template_args[j][i],
"|",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -349,7 +351,7 @@ 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, " ",
argv = string_split (string, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -359,7 +361,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin,
string_free_split (argv);
return HOOK_COMMAND_EXEC_NOT_FOUND;
}
argv_eol = string_split (string, " ",
argv_eol = string_split (string, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -233,7 +233,7 @@ hook_focus_get_data (struct t_hashtable *hashtable_focus1,
keys = hashtable_get_string (hashtable1, "keys");
if (keys)
{
list_keys = string_split (keys, ",",
list_keys = string_split (keys, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -79,6 +79,7 @@ hook_line (struct t_weechat_plugin *plugin, const char *buffer_type,
new_hook_line->buffers = string_split (
(buffer_name && buffer_name[0]) ? buffer_name : "*",
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -4554,7 +4554,7 @@ COMMAND_CALLBACK(plugin)
{
if (argc > 2)
{
plugin_argv = string_split (argv_eol[2], " ",
plugin_argv = string_split (argv_eol[2], " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -4573,7 +4573,7 @@ COMMAND_CALLBACK(plugin)
plugin_argc = 0;
if (argc > 3)
{
plugin_argv = string_split (argv_eol[3], " ",
plugin_argv = string_split (argv_eol[3], " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -4595,7 +4595,7 @@ COMMAND_CALLBACK(plugin)
if (argc > 3)
{
plugin_argv = string_split (
argv_eol[3], " ",
argv_eol[3], " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -964,7 +964,7 @@ completion_list_add_plugins_commands_cb (const void *pointer, void *data,
if (!completion->args)
return WEECHAT_RC_OK;
argv = string_split (completion->args, " ",
argv = string_split (completion->args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1653,7 +1653,7 @@ completion_list_add_env_value_cb (const void *pointer, void *data,
if (completion->args)
{
argv = string_split (completion->args, " ",
argv = string_split (completion->args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -649,6 +649,7 @@ config_file_new_option (struct t_config_file *config_file,
new_option->string_values = string_split (
string_values,
"|",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -443,7 +443,7 @@ config_set_word_chars (const char *str_word_chars,
if (!str_word_chars || !str_word_chars[0])
return;
items = string_split (str_word_chars, ",",
items = string_split (str_word_chars, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -718,6 +718,7 @@ config_set_nick_colors ()
config_nick_colors = string_split (
CONFIG_STRING(config_color_chat_nick_colors),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -753,11 +754,14 @@ config_change_look_nick_color_force (const void *pointer, void *data,
hashtable_remove_all (config_hashtable_nick_color_force);
}
items = string_split (CONFIG_STRING(config_look_nick_color_force), ";",
items = string_split (CONFIG_STRING(config_look_nick_color_force),
";",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_items);
0,
&num_items);
if (items)
{
for (i = 0; i < num_items; i++)
@ -1245,6 +1249,7 @@ config_change_completion_partial_completion_templates (const void *pointer,
items = string_split (
CONFIG_STRING(config_completion_partial_completion_templates),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1329,6 +1334,7 @@ config_change_plugin_extension (const void *pointer, void *data,
config_plugin_extensions = string_split (
CONFIG_STRING(config_plugin_extension),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1974,7 +1980,7 @@ config_weechat_layout_read_cb (const void *pointer, void *data,
if (string_strcasecmp (ptr_option_name, "buffer") == 0)
{
argv = string_split (value, ";",
argv = string_split (value, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1993,7 +1999,7 @@ config_weechat_layout_read_cb (const void *pointer, void *data,
}
else if (string_strcasecmp (ptr_option_name, "window") == 0)
{
argv = string_split (value, ";",
argv = string_split (value, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -2307,12 +2313,12 @@ config_weechat_filter_read_cb (const void *pointer, void *data,
if (option_name && value && value[0])
{
argv = string_split (value, ";",
argv = string_split (value, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
argv_eol = string_split (value, ";",
argv_eol = string_split (value, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -107,6 +107,7 @@ input_exec_command (struct t_gui_buffer *buffer,
new_commands_allowed = string_split (
commands_allowed,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -456,6 +456,7 @@ secure_decrypt_data_not_decrypted (const char *passphrase)
keys = string_split (hashtable_get_string (secure_hashtable_data_encrypted,
"keys"),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1794,6 +1794,20 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* This function must not be called directly (call string_split or
* string_split_shared instead).
*
* Arguments:
* string: the string to split
* separators: the separators to split on (commonly just one char like " "
* or ",")
* strip_items: chars to strip from extracted items (left/right),
* for example " " when "separators" does not contain a space;
* this argument can be NULL (nothing is stripped)
* flags: combination of flags (see below)
* num_items_max: the max number of items to return (0 = no limit)
* num_items: if not NULL, the variable is set with the number of items
* returned
* shared: 1 if the strings are "shared strings" (created with the function
* string_share_get), otherwise 0 for allocated strings
*
* The flags is a combination of flags:
* - WEECHAT_STRING_SPLIT_STRIP_LEFT: strip separators on the left
* (beginning of string)
@ -1804,7 +1818,8 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* - WEECHAT_STRING_SPLIT_KEEP_EOL: keep end of line for each value
*
* Examples:
* string_split ("abc de fghi ", " ", 0, 0, &argc)
*
* string_split ("abc de fghi ", " ", NULL, 0, 0, &argc)
* ==> array[0] == "abc"
* array[1] == "de"
* array[2] == ""
@ -1812,7 +1827,8 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* array[4] == ""
* array[5] == NULL
* argc == 5
* string_split ("abc de fghi ", " ",
*
* string_split ("abc de fghi ", " ", NULL,
* WEECHAT_STRING_SPLIT_STRIP_LEFT
* | WEECHAT_STRING_SPLIT_STRIP_RIGHT
* | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1822,7 +1838,8 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* array[2] == "fghi"
* array[3] == NULL
* argc == 3
* string_split ("abc de fghi ", " ",
*
* string_split ("abc de fghi ", " ", NULL,
* WEECHAT_STRING_SPLIT_STRIP_LEFT
* | WEECHAT_STRING_SPLIT_STRIP_RIGHT
* | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1833,7 +1850,8 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* array[2] == "fghi"
* array[3] == NULL
* argc == 3
* string_split ("abc de fghi ", " ",
*
* string_split ("abc de fghi ", " ", NULL,
* WEECHAT_STRING_SPLIT_STRIP_LEFT
* | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
* | WEECHAT_STRING_SPLIT_KEEP_EOL,
@ -1843,15 +1861,38 @@ string_replace_regex (const char *string, void *regex, const char *replace,
* array[2] == "fghi "
* array[3] == NULL
* argc == 3
*
* string_split (",abc , de , fghi,", ",", NULL,
* WEECHAT_STRING_SPLIT_STRIP_LEFT
* | WEECHAT_STRING_SPLIT_STRIP_RIGHT
* | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
* | WEECHAT_STRING_SPLIT_KEEP_EOL,
* 0, &argc)
* ==> array[0] == "abc "
* array[1] == " de "
* array[2] == " fghi "
* array[3] == NULL
* argc == 3
*
* string_split (",abc ,, de , fghi,", ",", " ",
* WEECHAT_STRING_SPLIT_STRIP_LEFT
* | WEECHAT_STRING_SPLIT_STRIP_RIGHT
* | WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
* 0, &argc)
* ==> array[0] == "abc"
* array[1] == "de"
* array[2] == "fghi"
* array[3] == NULL
* argc == 3
*/
char **
string_split_internal (const char *string, const char *separators, int flags,
string_split_internal (const char *string, const char *separators,
const char *strip_items, int flags,
int num_items_max, int *num_items, int shared)
{
int i, j, count_items;
char *string2, **array;
char *ptr, *ptr1, *ptr2;
char *string2, **array, *temp_str, *ptr, *ptr1, *ptr2;
const char *str_shared;
if (num_items)
@ -1952,7 +1993,27 @@ string_split_internal (const char *string, const char *separators, int flags,
{
if (flags & WEECHAT_STRING_SPLIT_KEEP_EOL)
{
array[i] = (shared) ? (char *)string_shared_get (ptr1) : strdup (ptr1);
if (shared)
{
if (strip_items && strip_items[0])
{
temp_str = string_strip (ptr1, 1, 1, strip_items);
if (!temp_str)
goto error;
array[i] = (char *)string_shared_get (temp_str);
free (temp_str);
}
else
{
array[i] = (char *)string_shared_get (ptr1);
}
}
else
{
array[i] = (strip_items && strip_items[0]) ?
string_strip (ptr1, 1, 1, strip_items) :
strdup (ptr1);
}
if (!array[i])
goto error;
}
@ -1963,6 +2024,14 @@ string_split_internal (const char *string, const char *separators, int flags,
goto error;
strncpy (array[i], ptr1, ptr2 - ptr1);
array[i][ptr2 - ptr1] = '\0';
if (strip_items && strip_items[0])
{
temp_str = string_strip (array[i], 1, 1, strip_items);
if (!temp_str)
goto error;
free (array[i]);
array[i] = temp_str;
}
if (shared)
{
str_shared = string_shared_get (array[i]);
@ -2019,10 +2088,11 @@ error:
*/
char **
string_split (const char *string, const char *separators, int flags,
string_split (const char *string, const char *separators,
const char *strip_items, int flags,
int num_items_max, int *num_items)
{
return string_split_internal (string, separators, flags,
return string_split_internal (string, separators, strip_items, flags,
num_items_max, num_items, 0);
}
@ -2034,10 +2104,11 @@ string_split (const char *string, const char *separators, int flags,
*/
char **
string_split_shared (const char *string, const char *separators, int flags,
string_split_shared (const char *string, const char *separators,
const char *strip_items, int flags,
int num_items_max, int *num_items)
{
return string_split_internal (string, separators, flags,
return string_split_internal (string, separators, strip_items, flags,
num_items_max, num_items, 1);
}
@ -2445,7 +2516,7 @@ string_split_tags (const char *tags, int *num_tags)
if (tags)
{
tags_array_temp = string_split (tags, ",",
tags_array_temp = string_split (tags, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -2458,7 +2529,8 @@ string_split_tags (const char *tags, int *num_tags)
for (i = 0; i < tags_count; i++)
{
tags_array[i] = string_split_shared (tags_array_temp[i],
"+", 0, 0,
"+", NULL,
0, 0,
NULL);
}
tags_array[tags_count] = NULL;

View File

@ -87,10 +87,11 @@ extern char *string_replace_regex (const char *string, void *regex,
char *(*callback)(void *data, const char *text),
void *callback_data);
extern char **string_split (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
extern char **string_split_shared (const char *string, const char *separators,
int flags, int num_items_max,
int *num_items);
const char *strip_items, int flags,
int num_items_max, int *num_items);
extern char **string_split_shell (const char *string, int *num_items);
extern void string_free_split (char **split_string);
extern void string_free_split_shared (char **split_string);

View File

@ -291,7 +291,7 @@ upgrade_file_write_object (struct t_upgrade_file *upgrade_file, int object_id,
fields = infolist_fields (infolist);
if (fields)
{
argv = string_split (fields, ",",
argv = string_split (fields, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -867,7 +867,7 @@ weeurl_get_mask_value (struct t_url_constant *constants,
mask = 0;
items = string_split (string_mask, "+",
items = string_split (string_mask, "+", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1019,7 +1019,7 @@ weeurl_option_map_cb (void *data,
}
break;
case URL_TYPE_LIST:
items = string_split (value, "\n",
items = string_split (value, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -206,7 +206,7 @@ util_setrlimit ()
int num_items, i;
long number;
items = string_split (CONFIG_STRING(config_startup_sys_rlimit), ",",
items = string_split (CONFIG_STRING(config_startup_sys_rlimit), ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -937,7 +937,7 @@ util_version_number (const char *version)
int num_items, i, version_int[4], index_buf;
long number;
items = string_split (version, ".",
items = string_split (version, ".", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -487,7 +487,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
}
}
items = string_split (content, "\n",
items = string_split (content, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -936,6 +936,7 @@ gui_color_buffer_display ()
_("Nick colors:"));
items = string_split (CONFIG_STRING(config_color_chat_nick_colors),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1345,7 +1346,7 @@ gui_color_palette_new (int number, const char *value)
str_alias = NULL;
str_rgb = NULL;
items = string_split (value, ";",
items = string_split (value, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -843,6 +843,7 @@ gui_bar_window_content_get_with_filling (struct t_gui_bar_window *bar_window,
split_items[i][sub] = string_split (
ptr_content,
"\n",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -704,7 +704,7 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
if (items && items[0])
{
tmp_array = string_split (items, ",",
tmp_array = string_split (items, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -723,6 +723,7 @@ gui_bar_set_items_array (struct t_gui_bar *bar, const char *items)
bar->items_array[i] = string_split (
tmp_array[i],
"+",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1019,7 +1019,7 @@ gui_buffer_match_list (struct t_gui_buffer *buffer, const char *string)
match = 0;
buffers = string_split (string, ",",
buffers = string_split (string, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1492,12 +1492,12 @@ gui_buffer_add_highlight_words (struct t_gui_buffer *buffer,
if (!list)
return;
current_words = string_split (buffer->highlight_words, ",",
current_words = string_split (buffer->highlight_words, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &current_count);
add_words = string_split (words_to_add, ",",
add_words = string_split (words_to_add, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1543,12 +1543,12 @@ gui_buffer_remove_highlight_words (struct t_gui_buffer *buffer,
if (!list)
return;
current_words = string_split (buffer->highlight_words, ",",
current_words = string_split (buffer->highlight_words, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &current_count);
remove_words = string_split (words_to_remove, ",",
remove_words = string_split (words_to_remove, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1713,7 +1713,7 @@ gui_buffer_set_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
if (new_hotlist_max_level_nicks && new_hotlist_max_level_nicks[0])
{
nicks = string_split (new_hotlist_max_level_nicks, ",",
nicks = string_split (new_hotlist_max_level_nicks, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1756,7 +1756,7 @@ gui_buffer_add_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
if (!buffer || !nicks_to_add)
return;
nicks = string_split (nicks_to_add, ",",
nicks = string_split (nicks_to_add, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1797,7 +1797,7 @@ gui_buffer_remove_hotlist_max_level_nicks (struct t_gui_buffer *buffer,
if (!buffer || !nicks_to_remove)
return;
nicks = string_split (nicks_to_remove, ",",
nicks = string_split (nicks_to_remove, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -910,7 +910,7 @@ gui_chat_print_lines_waiting_buffer (FILE *f)
if (gui_chat_lines_waiting_buffer)
{
lines = string_split (*gui_chat_lines_waiting_buffer, "\n",
lines = string_split (*gui_chat_lines_waiting_buffer, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -798,7 +798,7 @@ gui_color_decode_ansi_cb (void *data, const char *text)
if (!text2)
goto end;
items = string_split (text2, ";",
items = string_split (text2, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -562,6 +562,7 @@ gui_completion_get_matching_template (struct t_gui_completion *completion,
{
items = string_split (HOOK_COMMAND(hook_command, cplt_templates_static)[i],
"|",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -398,6 +398,7 @@ gui_filter_new (int enabled, const char *name, const char *buffer_name,
new_filter->buffers = string_split (
new_filter->buffer_name,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -98,7 +98,7 @@ gui_line_tags_alloc (struct t_gui_line_data *line_data, const char *tags)
{
if (tags)
{
line_data->tags_array = string_split_shared (tags, ",", 0, 0,
line_data->tags_array = string_split_shared (tags, ",", NULL, 0, 0,
&line_data->tags_count);
}
else

View File

@ -79,7 +79,7 @@ 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, " ",
argv = weechat_string_split (args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -190,7 +190,7 @@ 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, " ",
argv = weechat_string_split (user_args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -165,7 +165,7 @@ buflist_config_hook_signals_refresh ()
BUFLIST_CONFIG_SIGNALS_REFRESH_NICK_PREFIX);
}
signals = weechat_string_split (*all_signals, ",",
signals = weechat_string_split (*all_signals, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -257,6 +257,7 @@ buflist_config_change_sort (const void *pointer, void *data,
buflist_config_sort_fields = weechat_string_split (
weechat_config_string (buflist_config_look_sort),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -87,7 +87,7 @@ 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, ",",
list_keys = weechat_string_split (keys, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -53,12 +53,12 @@ exec_buffer_input_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
argv = weechat_string_split (input_data, " ",
argv = weechat_string_split (input_data, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
argv_eol = weechat_string_split (input_data, " ",
argv_eol = weechat_string_split (input_data, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -64,6 +64,7 @@ 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),
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -782,7 +782,7 @@ fset_buffer_display_option_eval (struct t_fset_option *fset_option)
NULL);
if (line)
{
lines = weechat_string_split (line, "\r\n",
lines = weechat_string_split (line, "\r\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -469,7 +469,7 @@ fset_command_run_set_cb (const void *pointer, void *data,
rc = WEECHAT_RC_OK;
argv = weechat_string_split (command, " ",
argv = weechat_string_split (command, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -82,6 +82,7 @@ fset_completion_option_cb (const void *pointer, void *data,
words = weechat_string_split (
weechat_config_option_get_string (ptr_option, "name"),
"_",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -154,6 +154,7 @@ fset_config_change_sort_cb (const void *pointer, void *data,
fset_config_sort_fields = weechat_string_split (
weechat_config_string (fset_config_look_sort),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -511,7 +511,7 @@ irc_color_decode_ansi_cb (void *data, const char *text)
if (!text2)
goto end;
items = weechat_string_split (text2, ";",
items = weechat_string_split (text2, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -419,7 +419,7 @@ irc_command_exec_all_channels (struct t_irc_server *server,
return;
channels = (str_channels && str_channels[0]) ?
weechat_string_split (str_channels, ",",
weechat_string_split (str_channels, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -678,7 +678,7 @@ 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, ",",
weechat_string_split (str_servers, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1108,12 +1108,12 @@ irc_command_run_away (const void *pointer, void *data,
int argc;
char **argv, **argv_eol;
argv = weechat_string_split (command, " ",
argv = weechat_string_split (command, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
argv_eol = weechat_string_split (command, " ",
argv_eol = weechat_string_split (command, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
@ -1586,7 +1586,7 @@ IRC_COMMAND_CALLBACK(ctcp)
IRC_COMMAND_CHECK_SERVER("ctcp", 1);
targets = weechat_string_split (argv[arg_target], ",",
targets = weechat_string_split (argv[arg_target], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1696,7 +1696,7 @@ IRC_COMMAND_CALLBACK(cycle)
{
channel_name = argv[1];
pos_args = argv_eol[2];
channels = weechat_string_split (channel_name, ",",
channels = weechat_string_split (channel_name, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -2548,7 +2548,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
pos_keys++;
}
if (pos_keys[0])
keys = weechat_string_split (pos_keys, ",",
keys = weechat_string_split (pos_keys, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -2559,7 +2559,7 @@ irc_command_join_server (struct t_irc_server *server, const char *arguments,
if (new_args)
{
channels = weechat_string_split (new_args, ",",
channels = weechat_string_split (new_args, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -3311,7 +3311,7 @@ IRC_COMMAND_CALLBACK(msg)
IRC_COMMAND_CHECK_SERVER("msg", 1);
targets = weechat_string_split (argv[arg_target], ",",
targets = weechat_string_split (argv[arg_target], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -4110,7 +4110,7 @@ IRC_COMMAND_CALLBACK(query)
IRC_COMMAND_CHECK_SERVER("query", 1);
nicks = weechat_string_split (argv[arg_nick], ",",
nicks = weechat_string_split (argv[arg_nick], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -360,6 +360,7 @@ 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),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -589,6 +590,7 @@ irc_config_change_look_nicks_hide_password (const void *pointer, void *data,
irc_config_nicks_hide_password = weechat_string_split (
nicks_hide_password,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -721,6 +723,7 @@ irc_config_change_color_mirc_remap (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (irc_config_color_mirc_remap),
";",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -773,6 +776,7 @@ irc_config_change_color_nick_prefixes (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (irc_config_color_nick_prefixes),
";",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1043,7 +1047,7 @@ irc_config_check_autojoin (const char *autojoin)
if (strstr (string, ", ") || strstr (string, " ,"))
goto end;
items = weechat_string_split (string, " ",
items = weechat_string_split (string, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1051,14 +1055,14 @@ irc_config_check_autojoin (const char *autojoin)
if (!items || (num_items < 1) || (num_items > 2))
goto end;
channels = weechat_string_split (items[0], ",",
channels = weechat_string_split (items[0], ",", NULL,
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], ",",
keys = weechat_string_split (items[1], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1512,6 +1516,7 @@ irc_config_ignore_read_cb (const void *pointer, void *data,
argv = weechat_string_split (
value,
";",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1520,6 +1525,7 @@ irc_config_ignore_read_cb (const void *pointer, void *data,
argv_eol = weechat_string_split (
value,
";",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -526,7 +526,7 @@ irc_info_infolist_irc_channel_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
argv = weechat_string_split (arguments, ",",
argv = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -618,7 +618,7 @@ irc_info_infolist_irc_modelist_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
argv = weechat_string_split (arguments, ",",
argv = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -719,7 +719,7 @@ irc_info_infolist_irc_modelist_item_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
argv = weechat_string_split (arguments, ",",
argv = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -831,7 +831,7 @@ irc_info_infolist_irc_nick_cb (const void *pointer, void *data,
ptr_server = NULL;
ptr_channel = NULL;
argv = weechat_string_split (arguments, ",",
argv = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -364,6 +364,7 @@ irc_input_send_cb (const void *pointer, void *data,
list_options = weechat_string_split (
options,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -779,7 +779,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
str = weechat_strndup (arguments, pos - arguments);
if (!str)
return 0;
channels = weechat_string_split (str, ",",
channels = weechat_string_split (str, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -790,7 +790,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
pos++;
}
if (pos[0])
keys = weechat_string_split (pos, ",",
keys = weechat_string_split (pos, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -798,7 +798,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
}
else
{
channels = weechat_string_split (arguments, ",",
channels = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1054,12 +1054,12 @@ irc_message_split (struct t_irc_server *server, const char *message)
}
}
argv = weechat_string_split (message, " ",
argv = weechat_string_split (message, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
argv_eol = weechat_string_split (message, " ",
argv_eol = weechat_string_split (message, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,

View File

@ -47,7 +47,7 @@ irc_mode_get_arguments (const char *arguments)
if (!arguments || !arguments[0])
return strdup ("");
argv = weechat_string_split (arguments, " ",
argv = weechat_string_split (arguments, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -173,7 +173,7 @@ irc_mode_channel_update (struct t_irc_server *server,
pos_args++;
while (pos_args[0] == ' ')
pos_args++;
argv = weechat_string_split (pos_args, " ",
argv = weechat_string_split (pos_args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -386,7 +386,7 @@ irc_mode_channel_set (struct t_irc_server *server,
argv = NULL;
if (modes_arguments)
{
argv = weechat_string_split (modes_arguments, " ",
argv = weechat_string_split (modes_arguments, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -373,7 +373,7 @@ irc_notify_new_for_server (struct t_irc_server *server)
if (!notify || !notify[0])
return;
items = weechat_string_split (notify, ",",
items = weechat_string_split (notify, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -395,6 +395,7 @@ irc_notify_new_for_server (struct t_irc_server *server)
params = weechat_string_split (
pos_params,
"/",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -840,6 +841,7 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
messages = weechat_string_split (
output,
"\n",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -850,6 +852,7 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
nicks_sent = weechat_string_split (
ptr_args,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -883,6 +886,7 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
nicks_recv = weechat_string_split (
pos,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -952,6 +956,7 @@ irc_notify_hsignal_cb (const void *pointer, void *data, const char *signal,
messages = weechat_string_split (
output,
"\n",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -398,6 +398,7 @@ irc_protocol_cap_sync (struct t_irc_server *server, int sasl)
caps_requested = weechat_string_split (
cap_option,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -515,6 +516,7 @@ IRC_PROTOCOL_CALLBACK(cap)
caps_supported = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -597,6 +599,7 @@ IRC_PROTOCOL_CALLBACK(cap)
caps_enabled = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -658,6 +661,7 @@ IRC_PROTOCOL_CALLBACK(cap)
caps_supported = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -770,6 +774,7 @@ IRC_PROTOCOL_CALLBACK(cap)
caps_added = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -816,6 +821,7 @@ IRC_PROTOCOL_CALLBACK(cap)
caps_removed = weechat_string_split (
ptr_caps,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -5891,6 +5897,7 @@ IRC_PROTOCOL_CALLBACK(730)
nicks = weechat_string_split ((argv_eol[3][0] == ':') ?
argv_eol[3] + 1 : argv_eol[3],
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -5934,6 +5941,7 @@ IRC_PROTOCOL_CALLBACK(731)
nicks = weechat_string_split ((argv_eol[3][0] == ':') ?
argv_eol[3] + 1 : argv_eol[3],
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -6178,7 +6186,7 @@ irc_protocol_get_message_tags (const char *tags)
if (!hashtable)
return NULL;
items = weechat_string_split (tags, ";",
items = weechat_string_split (tags, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -6596,7 +6604,7 @@ irc_protocol_recv_command (struct t_irc_server *server,
}
else
message_colors_decoded = NULL;
argv = weechat_string_split (message_colors_decoded, " ",
argv = weechat_string_split (message_colors_decoded, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -6606,8 +6614,8 @@ irc_protocol_recv_command (struct t_irc_server *server,
| 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);
argv_eol = weechat_string_split (message_colors_decoded, " ", NULL,
flags, 0, NULL);
return_code = (int) (cmd_recv_func) (server,
date, nick, address_color,

View File

@ -422,25 +422,25 @@ irc_redirect_new_with_commands (struct t_irc_server *server,
items[i] = NULL;
}
if (cmd_start)
items[0] = weechat_string_split (cmd_start, ",",
items[0] = weechat_string_split (cmd_start, ",", NULL,
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, ",",
items[1] = weechat_string_split (cmd_stop, ",", NULL,
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, ",",
items[2] = weechat_string_split (cmd_extra, ",", NULL,
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, ",",
items[3] = weechat_string_split (cmd_filter, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -812,6 +812,7 @@ irc_redirect_message (struct t_irc_server *server, const char *message,
arguments_argv = weechat_string_split (
arguments,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -425,7 +425,7 @@ irc_server_eval_fingerprint (struct t_irc_server *server)
}
/* split fingerprint */
fingerprints = weechat_string_split (fingerprint_eval, ",",
fingerprints = weechat_string_split (fingerprint_eval, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -616,6 +616,7 @@ irc_server_set_addresses (struct t_irc_server *server, const char *addresses)
server->addresses_array = weechat_string_split (
addresses_eval,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -716,6 +717,7 @@ irc_server_set_nicks (struct t_irc_server *server, const char *nicks)
server->nicks_array = weechat_string_split (
(nicks2) ? nicks2 : IRC_SERVER_DEFAULT_NICKS,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -2683,7 +2685,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
}
rc = 1;
items = weechat_string_split (vbuffer, "\n",
items = weechat_string_split (vbuffer, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -4284,7 +4286,7 @@ irc_server_check_certificate_fingerprint (struct t_irc_server *server,
}
/* split good_fingerprints */
fingerprints = weechat_string_split (good_fingerprints, ",",
fingerprints = weechat_string_split (good_fingerprints, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -5210,6 +5212,7 @@ irc_server_autojoin_create_buffers (struct t_irc_server *server)
channels = weechat_string_split (
autojoin2,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -555,6 +555,7 @@ irc_upgrade_read_cb (const void *pointer, void *data,
items = weechat_string_split (
str,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -617,6 +618,7 @@ irc_upgrade_read_cb (const void *pointer, void *data,
nicks = weechat_string_split (
str,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -684,7 +684,7 @@ plugin_api_info_totp_generate_cb (const void *pointer, void *data,
if (!arguments || !arguments[0])
goto error;
argv = string_split (arguments, ",",
argv = string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -756,7 +756,7 @@ plugin_api_info_totp_validate_cb (const void *pointer, void *data,
if (!arguments || !arguments[0])
goto error;
argv = string_split (arguments, ",",
argv = string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -64,7 +64,7 @@ plugin_script_api_string_match_list (struct t_weechat_plugin *weechat_plugin,
int match;
list_masks = (masks && masks[0]) ?
weechat_string_split (masks, ",",
weechat_string_split (masks, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1251,7 +1251,7 @@ plugin_script_action_install (struct t_weechat_plugin *weechat_plugin,
}
}
argv = weechat_string_split (ptr_list, ",",
argv = weechat_string_split (ptr_list, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1400,7 +1400,7 @@ plugin_script_action_remove (struct t_weechat_plugin *weechat_plugin,
ptr_list += 3;
}
argv = weechat_string_split (ptr_list, ",",
argv = weechat_string_split (ptr_list, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1474,7 +1474,7 @@ plugin_script_action_autoload (struct t_weechat_plugin *weechat_plugin,
}
}
argv = weechat_string_split (ptr_list, ",",
argv = weechat_string_split (ptr_list, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1007,6 +1007,7 @@ plugin_auto_load (char *force_plugin_autoload,
plugin_autoload_array = string_split (
ptr_plugin_autoload,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -155,7 +155,7 @@ weechat_python_get_python2_bin ()
if (dir_separator && path)
{
paths = weechat_string_split (path, ":",
paths = weechat_string_split (path, ":", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -337,7 +337,7 @@ relay_irc_tag_relay_client_id (const char *tags)
if (tags && tags[0])
{
argv = weechat_string_split (tags, ",",
argv = weechat_string_split (tags, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -565,7 +565,7 @@ relay_irc_hsignal_irc_redir_cb (const void *pointer, void *data,
if (!output)
return WEECHAT_RC_OK;
messages = weechat_string_split (output, "\n",
messages = weechat_string_split (output, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1359,6 +1359,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
irc_argv = weechat_string_split (
irc_args,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1367,6 +1368,7 @@ relay_irc_recv (struct t_relay_client *client, const char *data)
irc_argv_eol = weechat_string_split (
irc_args,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -339,7 +339,7 @@ relay_client_recv_text (struct t_relay_client *client, const char *data)
pos[0] = '\0';
lines = weechat_string_split (client->partial_message, "\n",
lines = weechat_string_split (client->partial_message, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -411,7 +411,7 @@ relay_config_check_irc_backlog_tags (const void *pointer, void *data,
return rc;
/* split tags and check them */
tags = weechat_string_split (value, ",",
tags = weechat_string_split (value, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -462,6 +462,7 @@ relay_config_change_irc_backlog_tags (const void *pointer, void *data,
items = weechat_string_split (
weechat_config_string (relay_config_irc_backlog_tags),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -53,7 +53,7 @@ relay_info_info_relay_client_count_cb (const void *pointer, void *data,
protocol = -1;
status = -1;
items = weechat_string_split (arguments, ",",
items = weechat_string_split (arguments, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -583,7 +583,7 @@ relay_weechat_msg_add_hdata (struct t_relay_weechat_msg *msg,
goto end;
/* split path */
list_path = weechat_string_split (pos + 1, "/",
list_path = weechat_string_split (pos + 1, "/", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -653,7 +653,7 @@ 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, ",",
list_keys = weechat_string_split (keys, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -793,6 +793,7 @@ relay_weechat_msg_add_infolist (struct t_relay_weechat_msg *msg,
list_fields = weechat_string_split (
fields,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1030,18 +1030,21 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(sync)
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",",
buffers = weechat_string_split ((argc > 0) ? argv[0] : "*",
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_buffers);
0,
&num_buffers);
if (buffers)
{
add_flags = RELAY_WEECHAT_PROTOCOL_SYNC_ALL;
if (argc > 1)
{
add_flags = 0;
flags = weechat_string_split (argv[1], ",",
flags = weechat_string_split (argv[1], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1116,18 +1119,21 @@ RELAY_WEECHAT_PROTOCOL_CALLBACK(desync)
RELAY_WEECHAT_PROTOCOL_MIN_ARGS(0);
buffers = weechat_string_split ((argc > 0) ? argv[0] : "*", ",",
buffers = weechat_string_split ((argc > 0) ? argv[0] : "*",
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_buffers);
0,
&num_buffers);
if (buffers)
{
sub_flags = RELAY_WEECHAT_PROTOCOL_SYNC_ALL;
if (argc > 1)
{
sub_flags = 0;
flags = weechat_string_split (argv[1], ",",
flags = weechat_string_split (argv[1], ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1402,12 +1408,12 @@ relay_weechat_protocol_recv (struct t_relay_client *client, const char *data)
{
pos++;
}
argv = weechat_string_split (pos, " ",
argv = weechat_string_split (pos, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &argc);
argv_eol = weechat_string_split (pos, " ",
argv_eol = weechat_string_split (pos, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL,

View File

@ -832,7 +832,7 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
{
if (out)
{
lines = weechat_string_split (out, "\n",
lines = weechat_string_split (out, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -871,7 +871,7 @@ script_action_show_diff_process_cb (const void *pointer, void *data,
}
else if (err)
{
lines = weechat_string_split (err, "\n",
lines = weechat_string_split (err, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1181,7 +1181,7 @@ script_action_run ()
script_get_loaded_plugins ();
actions = weechat_string_split (script_actions, "\n",
actions = weechat_string_split (script_actions, "\n", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1217,6 +1217,7 @@ script_action_run ()
argv = weechat_string_split (
ptr_action,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -1225,6 +1226,7 @@ script_action_run ()
argv_eol = weechat_string_split (
ptr_action,
" ",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS

View File

@ -261,6 +261,7 @@ script_completion_tags_cb (const void *pointer, void *data,
list_tags = weechat_string_split (
ptr_script->tags,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -114,7 +114,7 @@ script_config_get_diff_command ()
result[0] = '\0';
if (dir_separator && path)
{
paths = weechat_string_split (path, ":",
paths = weechat_string_split (path, ":", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -299,6 +299,7 @@ script_config_hold (const char *name_with_extension)
items = weechat_string_split (
weechat_config_string (script_config_scripts_hold),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -348,6 +349,7 @@ script_config_unhold (const char *name_with_extension)
items = weechat_string_split (
weechat_config_string (script_config_scripts_hold),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -943,16 +943,19 @@ 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, " ",
words = weechat_string_split (script_repo_filter, " ", NULL,
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 : "", ",",
tags = weechat_string_split ((script->tags) ? script->tags : "",
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_tags);
0,
&num_tags);
if (words)
{
for (i = 0; i < num_words; i++)

View File

@ -101,7 +101,7 @@ spell_bar_item_suggest (const void *pointer, void *data,
if (!str_suggest)
return NULL;
suggestions = weechat_string_split (pos, "/",
suggestions = weechat_string_split (pos, "/", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -126,6 +126,7 @@ spell_bar_item_suggest (const void *pointer, void *data,
suggestions2 = weechat_string_split (
suggestions[i],
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -97,6 +97,7 @@ spell_config_change_commands (const void *pointer, void *data,
spell_commands_to_check = weechat_string_split (
value,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -99,7 +99,7 @@ spell_speller_check_dictionaries (const char *dict_list)
if (dict_list)
{
argv = weechat_string_split (dict_list, ",",
argv = weechat_string_split (dict_list, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -227,7 +227,7 @@ spell_speller_add_dicts_to_hash (struct t_hashtable *hashtable,
if (!dict || !dict[0])
return;
dicts = weechat_string_split (dict, ",",
dicts = weechat_string_split (dict, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -383,7 +383,7 @@ spell_speller_buffer_new (struct t_gui_buffer *buffer)
buffer_dicts = spell_get_dict (buffer);
if (buffer_dicts)
{
dicts = weechat_string_split (buffer_dicts, ",",
dicts = weechat_string_split (buffer_dicts, ",", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -91,6 +91,7 @@ trigger_buffer_set_filter (const char *filter)
trigger_buffer_filters = weechat_string_split (
filter,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -736,6 +736,7 @@ trigger_callback_modifier_cb (const void *pointer, void *data,
tags = weechat_string_split (
pos2,
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -824,11 +825,14 @@ 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 : "", ",",
tags = weechat_string_split ((ptr_value) ? ptr_value : "",
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_tags);
0,
&num_tags);
/* build string with tags and commas around: ",tag1,tag2,tag3," */
length = 1 + strlen ((ptr_value) ? ptr_value : "") + 1 + 1;

View File

@ -682,11 +682,14 @@ trigger_command_trigger (const void *pointer, void *data,
goto end;
}
}
items = weechat_string_split (trigger_hook_default_rc[type], ",",
items = weechat_string_split (trigger_hook_default_rc[type],
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
0, &num_items);
0,
&num_items);
snprintf (input, sizeof (input),
"/trigger add name %s \"%s\" \"%s\" \"%s\" \"%s\"%s%s%s",
trigger_hook_type_string[type],

View File

@ -138,7 +138,7 @@ trigger_completion_option_value_cb (const void *pointer, void *data,
if (!args)
return WEECHAT_RC_OK;
argv = weechat_string_split (args, " ",
argv = weechat_string_split (args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -277,7 +277,7 @@ trigger_completion_add_default_for_hook (struct t_gui_completion *completion,
if (!args)
return;
argv = weechat_string_split (args, " ",
argv = weechat_string_split (args, " ", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
@ -295,6 +295,7 @@ trigger_completion_add_default_for_hook (struct t_gui_completion *completion,
items = weechat_string_split (
default_strings[type],
split,
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -276,12 +276,14 @@ trigger_hook (struct t_trigger *trigger)
argv = weechat_string_split (
weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
";",
NULL,
0,
0,
&argc);
argv_eol = weechat_string_split (
weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]),
";",
NULL,
WEECHAT_STRING_SPLIT_KEEP_EOL,
0,
NULL);

View File

@ -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 "20190413-01"
#define WEECHAT_PLUGIN_API_VERSION "20190615-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -322,7 +322,8 @@ struct t_weechat_plugin
const char *text),
void *callback_data);
char **(*string_split) (const char *string, const char *separators,
int flags, int num_items_max, int *num_items);
const char *strip_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,
@ -1218,9 +1219,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
__reference_char, \
__callback, \
__callback_data)
#define weechat_string_split(__string, __separator, __flags, __max, \
__num_items) \
(weechat_plugin->string_split)(__string, __separator, __flags, \
#define weechat_string_split(__string, __separators, __strip_items, \
__flags, __max, __num_items) \
(weechat_plugin->string_split)(__string, __separators, \
__strip_items, __flags, \
__max, __num_items)
#define weechat_string_split_shell(__string, __num_items) \
(weechat_plugin->string_split_shell)(__string, __num_items)

View File

@ -541,6 +541,7 @@ xfer_nick_auto_accepted (const char *server, const char *nick)
nicks = weechat_string_split (
weechat_config_string (xfer_config_file_auto_accept_nicks),
",",
NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -183,7 +183,7 @@ test_modifier_cb (const void *pointer, void *data,
(void) modifier;
/* split modifier_data, which is: "plugin;name;tags" */
items = string_split (modifier_data, ";",
items = string_split (modifier_data, ";", NULL,
WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,

View File

@ -1011,29 +1011,29 @@ TEST(CoreString, Split)
char **argv;
int argc, flags;
POINTERS_EQUAL(NULL, string_split (NULL, NULL, 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split (NULL, "", 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split ("", NULL, 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split ("", "", 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split (NULL, NULL, NULL, 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split (NULL, "", NULL, 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split ("", NULL, NULL, 0, 0, NULL));
POINTERS_EQUAL(NULL, string_split ("", "", NULL, 0, 0, NULL));
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
POINTERS_EQUAL(NULL, string_split (NULL, NULL, flags, 0, &argc));
POINTERS_EQUAL(NULL, string_split (NULL, NULL, NULL, flags, 0, &argc));
LONGS_EQUAL(0, argc);
argc = -1;
POINTERS_EQUAL(NULL, string_split (NULL, "", flags, 0, &argc));
POINTERS_EQUAL(NULL, string_split (NULL, "", NULL, flags, 0, &argc));
LONGS_EQUAL(0, argc);
argc = -1;
POINTERS_EQUAL(NULL, string_split ("", NULL, flags, 0, &argc));
POINTERS_EQUAL(NULL, string_split ("", NULL, NULL, flags, 0, &argc));
LONGS_EQUAL(0, argc);
argc = -1;
POINTERS_EQUAL(NULL, string_split ("", "", flags, 0, &argc));
POINTERS_EQUAL(NULL, string_split ("", "", NULL, flags, 0, &argc));
LONGS_EQUAL(0, argc);
argc = -1;
POINTERS_EQUAL(NULL, string_split (" ", " ", flags, 0, &argc));
POINTERS_EQUAL(NULL, string_split (" ", " ", NULL, flags, 0, &argc));
LONGS_EQUAL(0, argc);
/* free split with NULL */
@ -1044,7 +1044,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split ("abc de fghi", " ", flags, 0, &argc);
argv = string_split ("abc de fghi", " ", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1058,7 +1058,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 0, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1072,7 +1072,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 2, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 2, &argc);
LONGS_EQUAL(2, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1086,7 +1086,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 0, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc de fghi", argv[0]);
@ -1101,7 +1101,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 2, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 2, &argc);
LONGS_EQUAL(2, argc);
CHECK(argv);
STRCMP_EQUAL("abc de fghi", argv[0]);
@ -1114,7 +1114,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 0, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc de fghi ", argv[0]);
@ -1128,7 +1128,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS
| WEECHAT_STRING_SPLIT_KEEP_EOL;
argc = -1;
argv = string_split (" abc de fghi ", " ", flags, 2, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 2, &argc);
LONGS_EQUAL(2, argc);
CHECK(argv);
STRCMP_EQUAL("abc de fghi ", argv[0]);
@ -1141,7 +1141,7 @@ TEST(CoreString, Split)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split ("abc,de,fghi", ",", flags, 0, &argc);
argv = string_split ("abc,de,fghi", ",", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1150,12 +1150,64 @@ TEST(CoreString, Split)
POINTERS_EQUAL(NULL, argv[3]);
string_free_split (argv);
/*
* standard split with comma separator,
* strip_items set to empty string (ignored)
*/
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split (" abc ,, de ,fghi ,,", ",", "", flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL(" abc ", argv[0]);
STRCMP_EQUAL(" de ", argv[1]);
STRCMP_EQUAL("fghi ", argv[2]);
POINTERS_EQUAL(NULL, argv[3]);
string_free_split (argv);
/*
* standard split with comma separator,
* strip spaces in items (left/right)
*/
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split (" abc ,, de ,fghi ,,", ",", " ", flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
STRCMP_EQUAL("de", argv[1]);
STRCMP_EQUAL("fghi", argv[2]);
POINTERS_EQUAL(NULL, argv[3]);
string_free_split (argv);
/*
* standard split with comma separator,
* strip spaces and parentheses in items (left/right)
*/
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split (" abc ,, (de) ,(f(g)hi) ,,", ",", " ()",
flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
STRCMP_EQUAL("de", argv[1]);
STRCMP_EQUAL("f(g)hi", argv[2]);
POINTERS_EQUAL(NULL, argv[3]);
string_free_split (argv);
/* standard split with comma separator and empty item (ignore this item) */
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argc = -1;
argv = string_split ("abc,,fghi", ",", flags, 0, &argc);
argv = string_split ("abc,,fghi", ",", NULL, flags, 0, &argc);
LONGS_EQUAL(2, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1166,7 +1218,7 @@ TEST(CoreString, Split)
/* standard split with comma separtor and empty item (keep this item) */
flags = 0;
argc = -1;
argv = string_split ("abc,,fghi", ",", flags, 0, &argc);
argv = string_split ("abc,,fghi", ",", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1178,7 +1230,7 @@ TEST(CoreString, Split)
/* standard split with comma separtor and empty items (keep them) */
flags = 0;
argc = -1;
argv = string_split (",abc,,fghi,", ",", flags, 0, &argc);
argv = string_split (",abc,,fghi,", ",", NULL, flags, 0, &argc);
LONGS_EQUAL(5, argc);
CHECK(argv);
STRCMP_EQUAL("", argv[0]);
@ -1195,7 +1247,7 @@ TEST(CoreString, Split)
*/
flags = 0;
argc = -1;
argv = string_split (",abc,,fghi,", ",", flags, 2, &argc);
argv = string_split (",abc,,fghi,", ",", NULL, flags, 2, &argc);
LONGS_EQUAL(2, argc);
CHECK(argv);
STRCMP_EQUAL("", argv[0]);
@ -1209,7 +1261,7 @@ TEST(CoreString, Split)
*/
flags = 0;
argc = -1;
argv = string_split (",abc,,fghi,", ",", flags, 3, &argc);
argv = string_split (",abc,,fghi,", ",", NULL, flags, 3, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("", argv[0]);
@ -1224,7 +1276,7 @@ TEST(CoreString, Split)
*/
flags = 0;
argc = -1;
argv = string_split (",abc,,fghi,", ",", flags, 4, &argc);
argv = string_split (",abc,,fghi,", ",", NULL, flags, 4, &argc);
LONGS_EQUAL(4, argc);
CHECK(argv);
STRCMP_EQUAL("", argv[0]);
@ -1250,15 +1302,19 @@ TEST(CoreString, SplitShared)
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
POINTERS_EQUAL(NULL, string_split_shared (NULL, NULL, flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared (NULL, "", flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared ("", NULL, flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared ("", "", flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared (NULL, NULL, NULL,
flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared (NULL, "", NULL,
flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared ("", NULL, NULL,
flags, 0, NULL));
POINTERS_EQUAL(NULL, string_split_shared ("", "", NULL,
flags, 0, NULL));
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argv = string_split_shared (" abc de abc ", " ", flags, 0, &argc);
argv = string_split_shared (" abc de abc ", " ", NULL, flags, 0, &argc);
LONGS_EQUAL(3, argc);
CHECK(argv);
STRCMP_EQUAL("abc", argv[0]);
@ -1441,7 +1497,7 @@ TEST(CoreString, SplitBuildWithSplitString)
flags = WEECHAT_STRING_SPLIT_STRIP_LEFT
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS;
argv = string_split (" abc de fghi ", " ", flags, 0, &argc);
argv = string_split (" abc de fghi ", " ", NULL, flags, 0, &argc);
str = string_build_with_split_string ((const char **)argv, NULL);
STRCMP_EQUAL("abcdefghi", str);