summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-08-24 08:57:59 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-08-24 08:57:59 +0200
commitb009f29021a020c2544330992f76e1fc600705a1 (patch)
tree5c990956ad4bc770f2c4acc3593a6e7b60dadc3a /src/core
parent74d595498dec1c0b6572d7381b2d13f2ad5322dc (diff)
downloadweechat-b009f29021a020c2544330992f76e1fc600705a1.zip
Add some variables in infolist for config options
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-config-file.c45
-rw-r--r--src/core/wee-string.c19
2 files changed, 55 insertions, 9 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index ef5e2925d..fc136bc60 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -2119,7 +2119,7 @@ config_file_add_to_infolist (struct t_infolist *infolist,
struct t_config_option *ptr_option;
struct t_infolist_item *ptr_item;
int length;
- char *option_full_name, value[128];
+ char *option_full_name, value[128], *string_values;
if (!infolist)
return 0;
@@ -2180,6 +2180,49 @@ config_file_add_to_infolist (struct t_infolist *infolist,
free (option_full_name);
return 0;
}
+ if (!infolist_new_var_string (ptr_item,
+ "description",
+ (ptr_option->description
+ && ptr_option->description[0]) ?
+ _(ptr_option->description) : ""))
+ {
+ free (option_full_name);
+ return 0;
+ }
+ if (!infolist_new_var_string (ptr_item,
+ "description_en",
+ ptr_option->description))
+ {
+ free (option_full_name);
+ return 0;
+ }
+ string_values = string_build_with_exploded (ptr_option->string_values,
+ "|");
+ if (!infolist_new_var_string (ptr_item,
+ "string_values",
+ string_values))
+ {
+ if (string_values)
+ free (string_values);
+ free (option_full_name);
+ return 0;
+ }
+ if (string_values)
+ free (string_values);
+ if (!infolist_new_var_integer (ptr_item,
+ "min",
+ ptr_option->min))
+ {
+ free (option_full_name);
+ return 0;
+ }
+ if (!infolist_new_var_integer (ptr_item,
+ "max",
+ ptr_option->max))
+ {
+ free (option_full_name);
+ return 0;
+ }
switch (ptr_option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 15607d50f..b0b10b64a 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -859,11 +859,11 @@ string_build_with_exploded (char **exploded_string, const char *separator)
int i, length, length_separator;
char *result;
- if (!exploded_string || !separator)
+ if (!exploded_string)
return NULL;
length = 0;
- length_separator = strlen (separator);
+ length_separator = (separator) ? strlen (separator) : 0;
for (i = 0; exploded_string[i]; i++)
{
@@ -871,13 +871,16 @@ string_build_with_exploded (char **exploded_string, const char *separator)
}
result = malloc (length + 1);
- result[0] = '\0';
-
- for (i = 0; exploded_string[i]; i++)
+ if (result)
{
- strcat (result, exploded_string[i]);
- if (exploded_string[i + 1])
- strcat (result, separator);
+ result[0] = '\0';
+
+ for (i = 0; exploded_string[i]; i++)
+ {
+ strcat (result, exploded_string[i]);
+ if (separator && exploded_string[i + 1])
+ strcat (result, separator);
+ }
}
return result;