From e7e2da5a9c469aa4291d4630adb75d1e62cccbd5 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Fri, 2 Jan 2009 23:05:23 +0100 Subject: Add null values for options, new syntax for /set, reintroduce temporary IRC server feature, improve IRC server options, new functions in API --- doc/en/dev/plugin_c_api.en.xml | 303 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 302 insertions(+), 1 deletion(-) (limited to 'doc/en/dev/plugin_c_api.en.xml') diff --git a/doc/en/dev/plugin_c_api.en.xml b/doc/en/dev/plugin_c_api.en.xml index 6bf7f6b88..7e579789d 100644 --- a/doc/en/dev/plugin_c_api.en.xml +++ b/doc/en/dev/plugin_c_api.en.xml @@ -2944,6 +2944,7 @@ struct t_config_option *weechat_config_new_option ( int max, const chat *default_value, const char *value, + int null_value_allowed, int (*callback_check_value)(void *data, struct t_config_option *option, const char *value), @@ -3029,6 +3030,12 @@ struct t_config_option *weechat_config_new_option ( : value for option + + + : 1 if null (undefined value) + is allowed for option, otherwise 0 + + : callback called to check @@ -3159,6 +3166,7 @@ struct t_config_option *option1 = 0, 0, /* min, max */ "on", /* default */ "on", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3171,6 +3179,7 @@ struct t_config_option *option2 = 0, 100, /* min, max */ "15", /* default */ "15", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3183,6 +3192,7 @@ struct t_config_option *option3 = 0, 0, /* min, max */ "bottom", /* default */ "bottom", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3195,6 +3205,7 @@ struct t_config_option *option4 = 0, 0, /* min, max */ "test", /* default */ "test", /* value */ + 1, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3207,6 +3218,7 @@ struct t_config_option *option5 = 0, 0, /* min, max */ "lightblue", /* default */ "lightblue", /* value */ + 0, /* null value allowed */ NULL, NULL, /* check callback */ NULL, NULL, /* change callback */ NULL, NULL); /* delete callback */ @@ -3487,6 +3499,66 @@ switch (weechat_config_option_set (option, "new_value", 1)) +
+ weechat_config_option_set_null + + + Prototype: + +int weechat_config_option_set_null ( + struct t_config_option *option, + int run_callback); + + + + Set null (undefined value) for an option. + + + Arguments: + + + + : option pointer + + + + + : 1 for calling change callback if + option is changed (if it was not null), 0 otherwise + + + + + + + You can set value to null only if option allows null value + (see ). + + + + Return value: WEECHAT_CONFIG_OPTION_SET_OK_CHANGED if option value has + been reset, WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE if value was not + changed, WEECHAT_CONFIG_OPTION_SET_ERROR if an error occured. + + + Example: + +switch (weechat_config_option_set_null (option, 1)) +{ + case WEECHAT_CONFIG_OPTION_SET_OK_CHANGED: + /* .... */ + break; + case WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE: + /* .... */ + break; + case WEECHAT_CONFIG_OPTION_SET_ERROR: + /* .... */ + break; +} + + +
+
weechat_config_option_unset @@ -3677,6 +3749,9 @@ void *weechat_config_option_get_pointer ( + + Return value: pointer to property asked. + Example: @@ -3685,6 +3760,43 @@ char *description = weechat_config_option_get_pointer (option, "description");
+
+ weechat_config_option_is_null + + + Prototype: + +int weechat_config_option_is_null (struct t_config_option *option); + + + + Check if an option is null (undefined value). + + + Arguments: + + + + : option pointer + + + + + + Example: + +if (weechat_config_option_is_null (option)) +{ + /* value is null */ +} +else +{ + /* value is not null */ +} + + +
+
weechat_config_boolean @@ -3725,6 +3837,46 @@ else
+
+ weechat_config_boolean_default + + + Prototype: + +int weechat_config_boolean_default (struct t_config_option *option); + + + + Get default boolean value of option. + + + Arguments: + + + + : option pointer + + + + + + Return value: default boolean value of option (0 or 1). + + + Example: + +if (weechat_config_boolean_default (option)) +{ + /* true */ +} +else +{ + /* false */ +} + + +
+
weechat_config_integer @@ -3752,7 +3904,38 @@ int weechat_config_integer (struct t_config_option *option); Example: - int value = weechat_config_boolean (option); + int value = weechat_config_integer (option); + +
+ +
+ weechat_config_integer_default + + + Prototype: + +int weechat_config_integer_default (struct t_config_option *option); + + + + Get default integer value of option. + + + Arguments: + + + + : option pointer + + + + + + Return value: default integer value of option. + + + Example: + int value = weechat_config_integer (option);
@@ -3793,6 +3976,37 @@ const char *weechat_config_string (struct t_config_option *option); Prototype: +const char *weechat_config_string_default (struct t_config_option *option); + + + + Get default string value of option. + + + Arguments: + + + + : option pointer + + + + + + Return value: default string value of option. + + + Example: + char *value = weechat_config_string_default (option); + + + +
+ weechat_config_color + + + Prototype: + const char *weechat_config_color (struct t_config_option *option); @@ -3818,6 +4032,85 @@ const char *weechat_config_color (struct t_config_option *option);
+
+ weechat_config_color_default + + + Prototype: + +const char *weechat_config_color_default (struct t_config_option *option); + + + + Get default color value of option. + + + Arguments: + + + + : option pointer + + + + + + Return value: default color value of option (string with name of color). + + + Example: + char *color = weechat_config_color_default (option); + +
+ +
+ weechat_config_write_option + + + Prototype: + +void weechat_config_write_option ( + struct t_config_file *config_file, + struct t_config_option *option); + + + + Write a line in a configuration file with option and its value (this + function should be called only in "write" or "write_default" callbacks + for a section). + + + Arguments: + + + + : configuration file pointer + + + + + : option pointer + + + + + + Example: + +int +my_section_write_cb (void *data, struct t_config_file *config_file, + const char *section_name) +{ + weechat_config_write_line (config_file, "my_section", NULL); + + weechat_config_write_option (config_file, option); + + return WEECHAT_RC_OK; +} + + +
+
weechat_config_write_line @@ -3854,6 +4147,12 @@ void weechat_config_write_line ( + + + If value is NULL, then line with section name is written + (for example: "[section]"). + + Example: @@ -3861,6 +4160,8 @@ int my_section_write_cb (void *data, struct t_config_file *config_file, const char *section_name) { + weechat_config_write_line (config_file, "my_section", NULL); + weechat_config_write_line (config_file, "option", "%s;%d", "value", 123); -- cgit v1.2.3