doc: add callback pointer in doc of config functions (plugin API reference)

v2.8-utf8proc
Sébastien Helleu 2016-03-26 09:51:32 +01:00
parent 498662c777
commit eae12192c9
4 changed files with 610 additions and 333 deletions

View File

@ -4261,8 +4261,10 @@ Prototype:
[source,C]
----
struct t_config_file *weechat_config_new (const char *name,
int (*callback_reload)(void *data,
int (*callback_reload)(const void *pointer,
void *data,
struct t_config_file *config_file),
const void *callback_reload_pointer,
void *callback_reload_data);
----
@ -4271,14 +4273,19 @@ Arguments:
* 'name': name of configuration file (without path or extension)
* 'callback_reload': function called when configuration file is reloaded with
`/reload` (optional, can be NULL), arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** return value:
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_reload_data': pointer given to reload callback when it is called
by WeeChat
* 'callback_reload_pointer': pointer given to callback when it is called by
WeeChat
* 'callback_reload_data': pointer given to callback when it is called by
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the configuration file is
freed
Return value:
@ -4296,7 +4303,8 @@ C example:
[source,C]
----
int
my_config_reload_cb (void *data, struct t_config_file *config_file)
my_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
/* ... */
@ -4305,7 +4313,7 @@ my_config_reload_cb (void *data, struct t_config_file *config_file)
struct t_config_file *config_file = weechat_config_new ("test",
&my_config_reload_cb,
NULL);
NULL, NULL);
----
Script (Python):
@ -4336,30 +4344,40 @@ struct t_config_section *weechat_config_new_section (
const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
int (*callback_read)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_read_pointer,
void *callback_read_data,
int (*callback_write)(void *data,
int (*callback_write)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name),
const void *callback_write_pointer,
void *callback_write_data,
int (*callback_write_default)(void *data,
int (*callback_write_default)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name);
const char *section_name),
const void *callback_write_default_pointer,
void *callback_write_default_data,
int (*callback_create_option)(void *data,
int (*callback_create_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_create_option_pointer,
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
int (*callback_delete_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const void *callback_delete_option_pointer,
void *callback_delete_option_data);
----
@ -4374,6 +4392,7 @@ Arguments:
* 'callback_read': function called when an option in section is read from disk
(should be NULL in most cases, except if options in section need custom
function), arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** 'struct t_config_section *section': section pointer
@ -4383,10 +4402,15 @@ Arguments:
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_read_data': pointer given to callback when it is called by WeeChat
* 'callback_read_pointer': pointer given to callback when it is called by
WeeChat
* 'callback_read_data': pointer given to callback when it is called by WeeChat;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* 'callback_write': function called when section is written in file (should be
NULL for most cases, except if section needs to be written by a custom
function), arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** 'struct t_config_section *section': section pointer
@ -4395,9 +4419,14 @@ Arguments:
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* callback_write_data: pointer given to callback when it is called by WeeChat
* 'callback_write_pointer': pointer given to callback when it is called by
WeeChat
* 'callback_write_data': pointer given to callback when it is called by WeeChat;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* callback_write_default: function called when default values for section must
be written in file, arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** 'const char *section_name': name of section
@ -4405,11 +4434,15 @@ Arguments:
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* 'callback_write_default_pointer': pointer given to callback when it is called
by WeeChat
* 'callback_write_default_data': pointer given to callback when it is called by
WeeChat
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the section is freed
* 'callback_create_option': function called when a new option is created in
section (NULL if section does not allow new options to be created),
arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** 'struct t_config_section *section': section pointer
@ -4420,11 +4453,15 @@ Arguments:
*** 'WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE'
*** 'WEECHAT_CONFIG_OPTION_SET_ERROR'
*** 'WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND'
* 'callback_create_option_pointer': pointer given to callback when it is called
by WeeChat
* 'callback_create_option_data': pointer given to callback when it is called by
WeeChat
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the section is freed
* 'callback_delete_option': function called when an option is deleted in
section (NULL if section does not allow options to be deleted),
arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_file *config_file': configuration file pointer
** 'struct t_config_section *section': section pointer
@ -4434,8 +4471,11 @@ Arguments:
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_RESET'
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED'
*** 'WEECHAT_CONFIG_OPTION_UNSET_ERROR'
* 'callback_delete_option_pointer': pointer given to callback when it is called
by WeeChat
* 'callback_delete_option_data': pointer given to callback when it is called by
WeeChat
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the section is freed
Return value:
@ -4446,8 +4486,10 @@ C example:
[source,C]
----
int
my_section_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section, const char *option_name,
my_section_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
/* ... */
@ -4459,7 +4501,8 @@ my_section_read_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_cb (void *data, struct t_config_file *config_file,
my_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4469,7 +4512,8 @@ my_section_write_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_default_cb (void *data, struct t_config_file *config_file,
my_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4479,9 +4523,11 @@ my_section_write_default_cb (void *data, struct t_config_file *config_file,
}
int
my_section_create_option_cb (void *data, struct t_config_file *config_file,
my_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
const char *option_name,
const char *value)
{
/* ... */
@ -4490,7 +4536,8 @@ my_section_create_option_cb (void *data, struct t_config_file *config_file,
}
int
my_section_delete_option_cb (void *data, struct t_config_file *config_file,
my_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
@ -4503,21 +4550,21 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file,
/* standard section, user can not add/delete options */
struct t_config_section *new_section1 =
weechat_config_new_section (config_file, "section1", 0, 0,
NULL, NULL, /* read callback */
NULL, NULL, /* write callback */
NULL, NULL, /* write default callback */
NULL, NULL, /* create option callback */
NULL, NULL); /* delete option callback */
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* special section, user can add/delete options, and options need
callback to be read/written */
struct t_config_section *new_section2 =
weechat_config_new_section (config_file, "section2", 1, 1,
&my_section_read_cb, NULL,
&my_section_write_cb, NULL,
&my_section_write_default_cb, NULL,
&my_section_create_option_cb, NULL,
&my_section_delete_option_cb, NULL);
&my_section_read_cb, NULL, NULL,
&my_section_write_cb, NULL, NULL,
&my_section_write_default_cb, NULL, NULL,
&my_section_create_option_cb, NULL, NULL,
&my_section_delete_option_cb, NULL, NULL);
----
Script (Python):
@ -4625,15 +4672,21 @@ struct t_config_option *weechat_config_new_option (
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
int (*callback_check_value)(const void *pointer,
void *data,
struct t_config_option *option,
const char *value),
const void *callback_check_value_pointer,
void *callback_check_value_data,
void (*callback_change)(void *data,
void (*callback_change)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_change_pointer,
void *callback_change_data,
void (*callback_delete)(void *data,
void (*callback_delete)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_delete_pointer,
void *callback_delete_data);
----
@ -4661,26 +4714,38 @@ Arguments:
otherwise 0
* 'callback_check_value': function called to check new value for option
(optional), arguments and return value:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_option *option': option pointer
** 'const char *value': new value for option
** return value:
*** 1 if value is OK
*** 0 if value is invalid
* 'callback_check_value_data': pointer given to check_value callback when it
* 'callback_check_value_pointer': pointer given to check_value callback when it
is called by WeeChat
* 'callback_check_value_data': pointer given to callback when it is called by
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
* 'callback_change': function called when value of option has changed
(optional), arguments:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_option *option': option pointer
* 'callback_change_data': pointer given to change callback when it is called
* 'callback_change_pointer': pointer given to change callback when it is called
by WeeChat
* 'callback_change_data': pointer given to callback when it is called by
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
* 'callback_delete': function called when option will be deleted (optional),
arguments:
** 'const void *pointer': pointer
** 'void *data': pointer
** 'struct t_config_option *option': option pointer
* 'callback_delete_data': pointer given to delete callback when it is called
* 'callback_delete_pointer': pointer given to delete callback when it is called
by WeeChat
* 'callback_delete_data': pointer given to callback when it is called by
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
Return value:
@ -4693,67 +4758,67 @@ C example:
/* boolean */
struct t_config_option *option1 =
weechat_config_new_option (config_file, section, "option1", "boolean",
"My option, type boolean"
NULL, /* string values */
0, 0, /* min, max */
"on", /* default */
"on", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type boolean",
NULL,
0, 0,
"on",
"on",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* integer */
struct t_config_option *option2 =
weechat_config_new_option (config_file, section, "option2", "integer",
"My option, type integer"
NULL, /* string values */
0, 100, /* min, max */
"15", /* default */
"15", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type integer",
NULL,
0, 100,
"15",
"15",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* integer (with string values) */
struct t_config_option *option3 =
weechat_config_new_option (config_file, section, "option3", "integer",
"My option, type integer (with string values)"
"top|bottom|left|right", /* string values */
0, 0, /* min, max */
"bottom", /* default */
"bottom", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type integer (with string values)",
"top|bottom|left|right",
0, 0,
"bottom",
"bottom",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* string */
struct t_config_option *option4 =
weechat_config_new_option (config_file, section, "option4", "string",
"My option, type string"
NULL, /* string values */
0, 0, /* min, max */
"test", /* default */
"test", /* value */
1, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type string",
NULL,
0, 0,
"test",
"test",
1,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* color */
struct t_config_option *option5 =
weechat_config_new_option (config_file, section, "option5", "color",
"My option, type color"
NULL, /* string values */
0, 0, /* min, max */
"lightblue", /* default */
"lightblue", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type color",
NULL,
0, 0,
"lightblue",
"lightblue",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
----
Script (Python):

View File

@ -4330,8 +4330,10 @@ Prototype :
[source,C]
----
struct t_config_file *weechat_config_new (const char *name,
int (*callback_reload)(void *data,
int (*callback_reload)(const void *pointer,
void *data,
struct t_config_file *config_file),
const void *callback_reload_pointer,
void *callback_reload_data);
----
@ -4341,6 +4343,7 @@ Paramètres :
* 'callback_reload' : fonction appelée quand le fichier de configuration est
rechargé avec `/reload` (optionnel, peut être NULL), paramètres et valeur de
retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
@ -4348,8 +4351,12 @@ Paramètres :
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_reload_data' : pointeur donné au "callback" de rechargement
* 'callback_reload_pointer' : pointeur donné au "callback" de rechargement
lorsqu'il est appelé par WeeChat
* 'callback_reload_data' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une fonction
similaire) et sera automatiquement libéré (par free) lorsque le fichier de
configuration est libéré
Valeur de retour :
@ -4367,7 +4374,8 @@ Exemple en C :
[source,C]
----
int
my_config_reload_cb (void *data, struct t_config_file *config_file)
my_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
/* ... */
@ -4376,7 +4384,7 @@ my_config_reload_cb (void *data, struct t_config_file *config_file)
struct t_config_file *config_file = weechat_config_new ("test",
&my_config_reload_cb,
NULL);
NULL, NULL);
----
Script (Python) :
@ -4407,30 +4415,40 @@ struct t_config_section *weechat_config_new_section (
const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
int (*callback_read)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_read_pointer,
void *callback_read_data,
int (*callback_write)(void *data,
int (*callback_write)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name),
const void *callback_write_pointer,
void *callback_write_data,
int (*callback_write_default)(void *data,
int (*callback_write_default)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name);
const char *section_name),
const void *callback_write_default_pointer,
void *callback_write_default_data,
int (*callback_create_option)(void *data,
int (*callback_create_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_create_option_pointer,
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
int (*callback_delete_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const void *callback_delete_option_pointer,
void *callback_delete_option_data);
----
@ -4446,6 +4464,7 @@ Paramètres :
depuis le disque (devrait être NULL dans la plupart des cas, sauf si des
options de la section nécessitent une fonction personnalisée), paramètres et
valeur de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
@ -4456,12 +4475,17 @@ Paramètres :
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_read_data' : pointeur donné au "callback" quand il est appelé par
WeeChat
* 'callback_read_pointer' : pointeur donné au "callback" quand il est appelé
par WeeChat
* 'callback_read_data' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une fonction
similaire) et sera automatiquement libéré (par free) lorsque la section est
libérée
* 'callback_write' : fonction appelée lorsque la section est écrite dans le
fichier (devrait être NULL dans la plupart des cas, sauf si la section
nécessite d'être écrite par une fonction personnalisée), paramètres et valeur
de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
@ -4471,10 +4495,15 @@ Paramètres :
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* callback_write_data : pointeur donné au "callback" lorsqu'il est appelé par
WeeChat
* 'callback_write_pointer' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat
* 'callback_write_data' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une fonction
similaire) et sera automatiquement libéré (par free) lorsque la section est
libérée
* callback_write_default : fonction appelée lorsque les valeurs par défaut
doivent être écrites dans le fichier, paramètres et valeur de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
@ -4483,22 +4512,32 @@ Paramètres :
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* 'callback_write_default_data' : pointeur donné au "callback" lorsqu'il est
* 'callback_write_default_pointer' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat
* 'callback_write_default_data' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une
fonction similaire) et sera automatiquement libéré (par free) lorsque la
section est libérée
* 'callback_create_option' : fonction appelée lorsqu'une nouvelle option est
créée dans la section (NULL si la section n'autorise pas la création de
nouvelles options), paramètres et valeur de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
** 'struct t_config_section *section' : pointeur vers la section
** 'const char *option_name' : nom de l'option
** 'const char *value' : valeur
* 'callback_create_option_data' : pointeur donné au "callback" lorsqu'il est
* 'callback_create_option_pointer' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat
* 'callback_create_option_data' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une
fonction similaire) et sera automatiquement libéré (par free) lorsque la
section est libérée
* 'callback_delete_option' : fonction appelée lorsqu'une option est supprimée
de la section (NULL si la section n'autorise pas la suppression d'options),
paramètres et valeur de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_file *config_file' : pointeur vers le fichier de
configuration
@ -4509,8 +4548,12 @@ Paramètres :
*** 'WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE'
*** 'WEECHAT_CONFIG_OPTION_SET_ERROR'
*** 'WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND'
* 'callback_delete_option_data' : pointeur donné au "callback" lorsqu'il est
* 'callback_delete_option_pointer' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat
* 'callback_delete_option_data' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une
fonction similaire) et sera automatiquement libéré (par free) lorsque la
section est libérée
Valeur de retour :
@ -4522,8 +4565,10 @@ Exemple en C :
[source,C]
----
int
my_section_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section, const char *option_name,
my_section_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
/* ... */
@ -4535,7 +4580,8 @@ my_section_read_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_cb (void *data, struct t_config_file *config_file,
my_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4545,7 +4591,8 @@ my_section_write_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_default_cb (void *data, struct t_config_file *config_file,
my_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4555,9 +4602,11 @@ my_section_write_default_cb (void *data, struct t_config_file *config_file,
}
int
my_section_create_option_cb (void *data, struct t_config_file *config_file,
my_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
const char *option_name,
const char *value)
{
/* ... */
@ -4566,7 +4615,8 @@ my_section_create_option_cb (void *data, struct t_config_file *config_file,
}
int
my_section_delete_option_cb (void *data, struct t_config_file *config_file,
my_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
@ -4579,21 +4629,21 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file,
/* section standard, l'utilisateur ne peut pas ajouter/supprimer des options */
struct t_config_section *new_section1 =
weechat_config_new_section (config_file, "section1", 0, 0,
NULL, NULL, /* callback de lecture */
NULL, NULL, /* callback d'écriture */
NULL, NULL, /* callback d'écriture (valeurs par défaut) */
NULL, NULL, /* callback de création d'option */
NULL, NULL); /* callback de suppression d'option */
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* section spéciale, l'utilisateur peut ajouter/supprimer des options, et les
options nécessitent un callback pour la lecture/écriture */
struct t_config_section *new_section2 =
weechat_config_new_section (config_file, "section2", 1, 1,
&my_section_read_cb, NULL,
&my_section_write_cb, NULL,
&my_section_write_default_cb, NULL,
&my_section_create_option_cb, NULL,
&my_section_delete_option_cb, NULL);
&my_section_read_cb, NULL, NULL,
&my_section_write_cb, NULL, NULL,
&my_section_write_default_cb, NULL, NULL,
&my_section_create_option_cb, NULL, NULL,
&my_section_delete_option_cb, NULL, NULL);
----
Script (Python) :
@ -4701,15 +4751,21 @@ struct t_config_option *weechat_config_new_option (
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
int (*callback_check_value)(const void *pointer,
void *data,
struct t_config_option *option,
const char *value),
const void *callback_check_value_pointer,
void *callback_check_value_data,
void (*callback_change)(void *data,
void (*callback_change)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_change_pointer,
void *callback_change_data,
void (*callback_delete)(void *data,
void (*callback_delete)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_delete_pointer,
void *callback_delete_data);
----
@ -4738,26 +4794,41 @@ Paramètres :
l'option, sinon 0
* 'callback_check_value' : fonction appelée pour vérifier la nouvelle valeur
de l'option (optionnel), paramètres et valeur de retour :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_option *option' : pointeur vers l'option
** 'const char *value' : nouvelle valeur pour l'option
** valeur de retour :
*** 1 si la valeur est ok
*** 0 si la valeur est invalide
* 'callback_check_value_data' : pointeur donné au "callback" lorsqu'il est
* 'callback_check_value_pointer' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat
* 'callback_check_value_data' : pointeur donné au "callback" lorsqu'il est
appelé par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une
fonction similaire) et sera automatiquement libéré (par free) lorsque
l'option est libérée
* 'callback_change' : fonction appelée lorsque la valeur de l'option a changé
(optionnel), paramètres :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_option *option' : pointeur vers l'option
* 'callback_change_data' : pointeur donné au "callback" lorsqu'il est appelé
* 'callback_change_pointer' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat
* 'callback_change_data' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une fonction
similaire) et sera automatiquement libéré (par free) lorsque l'option est
libérée
* 'callback_delete' : fonction appelée lorsque l'option est supprimée
(optionnel), paramètres :
** 'const void *pointer' : pointeur
** 'void *data' : pointeur
** 'struct t_config_option *option' : pointeur vers l'option
* 'callback_delete_data' : pointeur donné au "callback" lorsqu'il est appelé
* 'callback_delete_pointer' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat
* 'callback_delete_data' : pointeur donné au "callback" lorsqu'il est appelé
par WeeChat; si non NULL, doit avoir été alloué par malloc (ou une fonction
similaire) et sera automatiquement libéré (par free) lorsque l'option est
libérée
Valeur de retour :
@ -4770,68 +4841,68 @@ Exemple en C :
/* booléen */
struct t_config_option *option1 =
weechat_config_new_option (config_file, section, "option1", "boolean",
"Mon option, type booléen"
NULL, /* valeurs sous forme de chaînes */
0, 0, /* min, max */
"on", /* défaut */
"on", /* valeur */
0, /* valeur null autorisée */
NULL, NULL, /* callback de vérification */
NULL, NULL, /* callback de changement de valeur */
NULL, NULL); /* callback de suppression de l'option */
"Mon option, type booléen",
NULL,
0, 0,
"on",
"on",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* entier */
struct t_config_option *option2 =
weechat_config_new_option (config_file, section, "option2", "integer",
"Mon option, type entier"
NULL, /* valeurs sous forme de chaînes */
0, 100, /* min, max */
"15", /* défaut */
"15", /* valeur */
0, /* valeur null autorisée */
NULL, NULL, /* callback de vérification */
NULL, NULL, /* callback de changement de valeur */
NULL, NULL); /* callback de suppression de l'option */
"Mon option, type entier",
NULL,
0, 100,
"15",
"15",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* entier (avec valeurs sous forme de chaînes) */
struct t_config_option *option3 =
weechat_config_new_option (config_file, section, "option3", "integer",
"Mon option, type entier "
"(avec valeurs sous forme de chaînes)"
"top|bottom|left|right", /* valeurs sous forme de chaînes */
0, 0, /* min, max */
"bottom", /* défaut */
"bottom", /* valeur */
0, /* valeur null autorisée */
NULL, NULL, /* callback de vérification */
NULL, NULL, /* callback de changement de valeur */
NULL, NULL); /* callback de suppression de l'option */
"(avec valeurs sous forme de chaînes)",
"top|bottom|left|right",
0, 0,
"bottom",
"bottom",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* chaîne */
struct t_config_option *option4 =
weechat_config_new_option (config_file, section, "option4", "string",
"Mon option, type chaîne"
NULL, /* valeurs sous forme de chaînes */
0, 0, /* min, max */
"test", /* défaut */
"test", /* valeur */
1, /* valeur null autorisée */
NULL, NULL, /* callback de vérification */
NULL, NULL, /* callback de changement de valeur */
NULL, NULL); /* callback de suppression de l'option */
"Mon option, type chaîne",
NULL,
0, 0,
"test",
"test",
1,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* couleur */
struct t_config_option *option5 =
weechat_config_new_option (config_file, section, "option5", "color",
"Mon option, type couleur"
NULL, /* valeurs sous forme de chaînes */
0, 0, /* min, max */
"lightblue", /* défaut */
"lightblue", /* valeur */
0, /* valeur null autorisée */
NULL, NULL, /* callback de vérification */
NULL, NULL, /* callback de changement de valeur */
NULL, NULL); /* callback de suppression de l'option */
"Mon option, type couleur",
NULL,
0, 0,
"lightblue",
"lightblue",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
----
Script (Python) :

View File

@ -4386,8 +4386,10 @@ Prototipo:
[source,C]
----
struct t_config_file *weechat_config_new (const char *name,
int (*callback_reload)(void *data,
int (*callback_reload)(const void *pointer,
void *data,
struct t_config_file *config_file),
const void *callback_reload_pointer,
void *callback_reload_data);
----
@ -4397,14 +4399,20 @@ Argomenti:
* 'callback_reload': funzione chiamata quando il file di configurazione viene
ricaricato con `/reload` (opzionale, può essere NULL), argomenti e valore
restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** valore restituito:
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_reload_data': puntatore fornito per ricaricare il callback
* 'callback_reload_pointer': puntatore fornito per ricaricare il callback
quando richiesto da WeeChat
// TRANSLATION MISSING
* 'callback_reload_data': puntatore fornito dalla callback quando chiamata da
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the configuration file is
freed
Valore restituito:
@ -4422,7 +4430,8 @@ Esempio in C:
[source,C]
----
int
my_config_reload_cb (void *data, struct t_config_file *config_file)
my_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
/* ... */
@ -4431,7 +4440,7 @@ my_config_reload_cb (void *data, struct t_config_file *config_file)
struct t_config_file *config_file = weechat_config_new ("test",
&my_config_reload_cb,
NULL);
NULL, NULL);
----
Script (Python):
@ -4462,30 +4471,40 @@ struct t_config_section *weechat_config_new_section (
const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
int (*callback_read)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_read_pointer,
void *callback_read_data,
int (*callback_write)(void *data,
int (*callback_write)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name),
const void *callback_write_pointer,
void *callback_write_data,
int (*callback_write_default)(void *data,
int (*callback_write_default)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name);
const char *section_name),
const void *callback_write_default_pointer,
void *callback_write_default_data,
int (*callback_create_option)(void *data,
int (*callback_create_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_create_option_pointer,
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
int (*callback_delete_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const void *callback_delete_option_pointer,
void *callback_delete_option_data);
----
@ -4500,6 +4519,7 @@ Argomenti:
* 'callback_read': funzione chiamata quando un'opzione nella sezione viene letta
da disco (dovrebbe essere NULL in molti casi, tranne se l'opzione nella sezione
necessita di una funzione personalizza), argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** 'struct t_config_section *section': puntatore alla sezione
@ -4509,10 +4529,16 @@ Argomenti:
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_read_data': puntatore fornito alla callback quando chiamata da WeeChat
* 'callback_read_pointer': puntatore fornito alla callback quando chiamata da
WeeChat
// TRANSLATION MISSING
* 'callback_read_data': puntatore fornito dalla callback quando chiamata da
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the section is freed
* 'callback_write': funzione chiamata quando la sezione è scritta nel file (dovrebbe
essere NULL in molti casi, tranne se la sezione necessita di una funzione
personalizzata), argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** 'struct t_config_section *section': puntatore alla sezione
@ -4521,9 +4547,15 @@ Argomenti:
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* callback_write_data: puntatore fornito alla callback quando chiamata da WeeChat
* 'callback_write_pointer': puntatore fornito alla callback quando chiamata da
WeeChat
// TRANSLATION MISSING
* 'callback_write_data': puntatore fornito dalla callback quando chiamata da
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the section is freed
* callback_write_default: funzione chiamata quando i valori predefiniti per la sezione
devono essere scritti in un file, argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** 'const char *section_name': nome della sezione
@ -4531,11 +4563,17 @@ Argomenti:
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* 'callback_write_default_data': puntatore fornito alla callback quando chiamata da
WeeChat
* 'callback_write_default_pointer': puntatore fornito alla callback quando
chiamata da WeeChat
// TRANSLATION MISSING
* 'callback_write_default_data': puntatore fornito dalla callback quando
chiamata da WeeChat; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the section is
freed
* 'callback_create_option': funzione chiamata quando viene creata una nuova
opzione nella sezione (NULL se la sezione non consente di creare nuove
opzioni), argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** 'struct t_config_section *section': puntatore alla sezione
@ -4546,11 +4584,17 @@ Argomenti:
*** 'WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE'
*** 'WEECHAT_CONFIG_OPTION_SET_ERROR'
*** 'WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND'
* 'callback_create_option_data': puntatore fornito alla callback quando chiamata
da WeeChat
* 'callback_create_option_pointer': puntatore fornito alla callback quando
chiamata da WeeChat
// TRANSLATION MISSING
* 'callback_create_option_data': puntatore fornito dalla callback quando
chiamata da WeeChat; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the section is
freed
* 'callback_delete_option': funzione chiamata quando un'opzione viene eliminata
nella sezione (NULL se la sezione non consente di eliminare delle opzioni),
argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_file *config_file': puntatore al file di configurazione
** 'struct t_config_section *section': puntatore alla sezione
@ -4560,8 +4604,13 @@ Argomenti:
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_RESET'
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED'
*** 'WEECHAT_CONFIG_OPTION_UNSET_ERROR'
* 'callback_delete_option_data': puntatore fornito alla callback quando chiamata
da WeeChat
* 'callback_delete_option_pointer': puntatore fornito alla callback quando
chiamata da WeeChat
// TRANSLATION MISSING
* 'callback_delete_option_data': puntatore fornito dalla callback quando
chiamata da WeeChat; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the section is
freed
Valore restituito:
@ -4572,8 +4621,10 @@ Esempio in C:
[source,C]
----
int
my_section_read_cb (void *data, struct t_config_file *config_file,
struct t_config_section *section, const char *option_name,
my_section_read_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value)
{
/* ... */
@ -4585,7 +4636,8 @@ my_section_read_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_cb (void *data, struct t_config_file *config_file,
my_section_write_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4595,7 +4647,8 @@ my_section_write_cb (void *data, struct t_config_file *config_file,
}
int
my_section_write_default_cb (void *data, struct t_config_file *config_file,
my_section_write_default_cb (const void *pointer, void *data,
struct t_config_file *config_file,
const char *section_name)
{
/* ... */
@ -4605,9 +4658,11 @@ my_section_write_default_cb (void *data, struct t_config_file *config_file,
}
int
my_section_create_option_cb (void *data, struct t_config_file *config_file,
my_section_create_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name, const char *value)
const char *option_name,
const char *value)
{
/* ... */
@ -4616,7 +4671,8 @@ my_section_create_option_cb (void *data, struct t_config_file *config_file,
}
int
my_section_delete_option_cb (void *data, struct t_config_file *config_file,
my_section_delete_option_cb (const void *pointer, void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option)
{
@ -4629,21 +4685,21 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file,
/* sezione standard, l'utente non può aggiungere/rimuovere opzioni */
struct t_config_section *new_section1 =
weechat_config_new_section (config_file, "section1", 0, 0,
NULL, NULL, /* read callback */
NULL, NULL, /* write callback */
NULL, NULL, /* write default callback */
NULL, NULL, /* create option callback */
NULL, NULL); /* delete option callback */
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* sezione speciale, l'utente può aggiungere/eliminare opzioni, e le
opzioni necessitano di un callback per essere lette/scritte */
struct t_config_section *new_section2 =
weechat_config_new_section (config_file, "section2", 1, 1,
&my_section_read_cb, NULL,
&my_section_write_cb, NULL,
&my_section_write_default_cb, NULL,
&my_section_create_option_cb, NULL,
&my_section_delete_option_cb, NULL);
&my_section_read_cb, NULL, NULL,
&my_section_write_cb, NULL, NULL,
&my_section_write_default_cb, NULL, NULL,
&my_section_create_option_cb, NULL, NULL,
&my_section_delete_option_cb, NULL, NULL);
----
Script (Python):
@ -4751,15 +4807,21 @@ struct t_config_option *weechat_config_new_option (
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
int (*callback_check_value)(const void *pointer,
void *data,
struct t_config_option *option,
const char *value),
const void *callback_check_value_pointer,
void *callback_check_value_data,
void (*callback_change)(void *data,
void (*callback_change)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_change_pointer,
void *callback_change_data,
void (*callback_delete)(void *data,
void (*callback_delete)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_delete_pointer,
void *callback_delete_data);
----
@ -4788,26 +4850,41 @@ Argomenti:
altrimenti 0
* 'callback_check_value': funzione chiamata per verificare il nuovo valore per
l'opzione (ozionale), argomenti e valore restituito:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_option *option': puntatore all'opzione
** 'const char *value': nuovo valore per l'opzione
** valore restituito:
*** 1 se il valore è corretto
*** 0 se il valore non è valido
* 'callback_check_value_data': puntatore fornito alla callback check_value
* 'callback_check_value_pointer': puntatore fornito alla callback check_value
quando chiamata da WeeChat
// TRANSLATION MISSING
* 'callback_check_value_data': puntatore fornito dalla callback quando chiamata
da WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
* 'callback_change': funzione chiamata quando il valore dell'opzione è stata
cambiata (opzionale), argomenti:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_option *option': puntatore all'opzione
* 'callback_change_data': puntatore fornito per cambiare alla callback quando
chiamato da WeeChat
* 'callback_change_pointer': puntatore fornito per cambiare alla callback
quando chiamato da WeeChat
// TRANSLATION MISSING
* 'callback_change_data': puntatore fornito dalla callback quando chiamata da
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
* 'callback_delete': funzione chiamata quando l'opzione verrà eliminata
(opzionale), argomenti:
** 'const void *pointer': puntatore
** 'void *data': puntatore
** 'struct t_config_option *option': puntatore all'opzione
* 'callback_delete_data': puntatore fornito per eiliminare alla callback quando
chiamato da WeeChat
* 'callback_delete_pointer': puntatore fornito per eiliminare alla callback
quando chiamato da WeeChat
// TRANSLATION MISSING
* 'callback_delete_data': puntatore fornito dalla callback quando chiamata da
WeeChat; if not NULL, it must have been allocated with malloc (or similar
function) and it will be automatically freed when the option is freed
Valore restituito:
@ -4820,67 +4897,67 @@ Esempio in C:
/* booleano */
struct t_config_option *option1 =
weechat_config_new_option (config_file, section, "option1", "boolean",
"My option, type boolean"
NULL, /* valori stringa */
0, 0, /* min, max */
"on", /* predefinito */
"on", /* valore */
0, /* null value allowed */
NULL, NULL, /* verifica callback */
NULL, NULL, /* modifica callback */
NULL, NULL); /* elimina callback */
"My option, type boolean",
NULL,
0, 0,
"on",
"on",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* intero */
struct t_config_option *option2 =
weechat_config_new_option (config_file, section, "option2", "integer",
"My option, type integer"
NULL, /* string values */
0, 100, /* min, max */
"15", /* default */
"15", /* value */
0, /* null value allowed */
NULL, NULL, /* verifica callback */
NULL, NULL, /* modifica callback */
NULL, NULL); /* elimina callback */
"My option, type integer",
NULL,
0, 100,
"15",
"15",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* intero (con valori stringa) */
struct t_config_option *option3 =
weechat_config_new_option (config_file, section, "option3", "integer",
"My option, type integer (with string values)"
"top|bottom|left|right", /* string values */
0, 0, /* min, max */
"bottom", /* predefinito */
"bottom", /* valoree */
0, /* null value allowed */
NULL, NULL, /* verifica callback */
NULL, NULL, /* modifica callback */
NULL, NULL); /* elimina callback */
"My option, type integer (with string values)",
"top|bottom|left|right",
0, 0,
"bottom",
"bottom",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* stringa */
struct t_config_option *option4 =
weechat_config_new_option (config_file, section, "option4", "string",
"My option, type string"
NULL, /* valori stringa */
0, 0, /* min, max */
"test", /* predefinito */
"test", /* valore */
1, /* valore null consentito */
NULL, NULL, /* verifica callback */
NULL, NULL, /* modifica callback */
NULL, NULL); /* elimina callback */
"My option, type string",
NULL,
0, 0,
"test",
"test",
1,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* colore */
struct t_config_option *option5 =
weechat_config_new_option (config_file, section, "option5", "color",
"My option, type color"
NULL, /* valori stringa */
0, 0, /* min, max */
"lightblue", /* predefinito */
"lightblue", /* valore */
0, /* valore null consentito */
NULL, NULL, /* verifica callback */
NULL, NULL, /* modifica callback */
NULL, NULL); /* elimina callback */
"My option, type color",
NULL,
0, 0,
"lightblue",
"lightblue",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
----
Script (Python):

View File

@ -4262,8 +4262,10 @@ weechat_hashtable_free (hashtable);
[source,C]
----
struct t_config_file *weechat_config_new (const char *name,
int (*callback_reload)(void *data,
int (*callback_reload)(const void *pointer,
void *data,
struct t_config_file *config_file),
const void *callback_reload_pointer,
void *callback_reload_data);
----
@ -4272,14 +4274,19 @@ struct t_config_file *weechat_config_new (const char *name,
* 'name': 設定ファイルの名前 (パスと拡張子は不要)
* 'callback_reload': `/reload` で設定ファイルを再読み込みする際に呼び出す関数
(任意、NULL でも可)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 戻り値:
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_reload_data': WeeChat が reload
* 'callback_reload_pointer': WeeChat が reload
コールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_reload_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the configuration file is freed
戻り値:
@ -4297,7 +4304,8 @@ C 言語での使用例:
[source,C]
----
int
my_config_reload_cb (void *data, struct t_config_file *config_file)
my_config_reload_cb (const void *pointer, void *data,
struct t_config_file *config_file)
{
/* ... */
@ -4306,7 +4314,7 @@ my_config_reload_cb (void *data, struct t_config_file *config_file)
struct t_config_file *config_file = weechat_config_new ("test",
&my_config_reload_cb,
NULL);
NULL, NULL);
----
スクリプト (Python) での使用例:
@ -4337,30 +4345,40 @@ struct t_config_section *weechat_config_new_section (
const char *name,
int user_can_add_options,
int user_can_delete_options,
int (*callback_read)(void *data,
int (*callback_read)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_read_pointer,
void *callback_read_data,
int (*callback_write)(void *data,
int (*callback_write)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name),
const void *callback_write_pointer,
void *callback_write_data,
int (*callback_write_default)(void *data,
int (*callback_write_default)(const void *pointer,
void *data,
struct t_config_file *config_file,
const char *section_name);
const char *section_name),
const void *callback_write_default_pointer,
void *callback_write_default_data,
int (*callback_create_option)(void *data,
int (*callback_create_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
const char *option_name,
const char *value),
const void *callback_create_option_pointer,
void *callback_create_option_data,
int (*callback_delete_option)(void *data,
int (*callback_delete_option)(const void *pointer,
void *data,
struct t_config_file *config_file,
struct t_config_section *section,
struct t_config_option *option),
const void *callback_delete_option_pointer,
void *callback_delete_option_data);
----
@ -4375,6 +4393,7 @@ struct t_config_section *weechat_config_new_section (
* 'callback_read': このセクションに含まれるオプションがディスクから読まれた際に呼び出す関数
(特別な関数を使ってセクションを読み出す必要がある場合を除いて、殆どの場合は
NULL を指定する)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 'struct t_config_section *section': セクションへのポインタ
@ -4384,10 +4403,15 @@ struct t_config_section *weechat_config_new_section (
*** 'WEECHAT_CONFIG_READ_OK'
*** 'WEECHAT_CONFIG_READ_MEMORY_ERROR'
*** 'WEECHAT_CONFIG_READ_FILE_NOT_FOUND'
* 'callback_read_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ
* 'callback_read_pointer': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_read_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* 'callback_write': セクションをファイルに書き込む際に呼び出す関数
(特別な関数を使ってセクションを書き込む必要がある場合を除いて、殆どの場合は
NULL を指定する)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 'struct t_config_section *section': セクションへのポインタ
@ -4396,9 +4420,14 @@ struct t_config_section *weechat_config_new_section (
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* callback_write_data: WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ
* 'callback_write_pointer': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_write_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* callback_write_default:
セクションのデフォルト値が必ずファイルに書き込まれる際に呼び出す関数、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 'const char *section_name': セクションの名前
@ -4406,11 +4435,16 @@ struct t_config_section *weechat_config_new_section (
*** 'WEECHAT_CONFIG_WRITE_OK'
*** 'WEECHAT_CONFIG_WRITE_ERROR'
*** 'WEECHAT_CONFIG_WRITE_MEMORY_ERROR'
* 'callback_write_default_data': WeeChat
* 'callback_write_default_pointer': WeeChat
がコールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_write_default_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* 'callback_create_option': セクションに新しいオプションを作成する際に呼び出す関数
(セクションに新しいオプションを作成することを禁止する場合は
NULL)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 'struct t_config_section *section': セクションへのポインタ
@ -4421,11 +4455,16 @@ struct t_config_section *weechat_config_new_section (
*** 'WEECHAT_CONFIG_OPTION_SET_OK_SAME_VALUE'
*** 'WEECHAT_CONFIG_OPTION_SET_ERROR'
*** 'WEECHAT_CONFIG_OPTION_SET_OPTION_NOT_FOUND'
* 'callback_create_option_data': WeeChat
* 'callback_create_option_pointer': WeeChat
がコールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_create_option_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
* 'callback_delete_option': セクションからオプションを削除する際に呼び出す関数
(セクションからオプションを削除することを禁止する場合は
NULL)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_file *config_file': 設定ファイルへのポインタ
** 'struct t_config_section *section': セクションへのポインタ
@ -4435,8 +4474,12 @@ struct t_config_section *weechat_config_new_section (
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_RESET'
*** 'WEECHAT_CONFIG_OPTION_UNSET_OK_REMOVED'
*** 'WEECHAT_CONFIG_OPTION_UNSET_ERROR'
* 'callback_delete_option_data': WeeChat
* 'callback_delete_option_pointer': WeeChat
がコールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_delete_option_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the section is freed
戻り値:
@ -4504,21 +4547,21 @@ my_section_delete_option_cb (void *data, struct t_config_file *config_file,
/* standard section, user can not add/delete options */
struct t_config_section *new_section1 =
weechat_config_new_section (config_file, "section1", 0, 0,
NULL, NULL, /* read callback */
NULL, NULL, /* write callback */
NULL, NULL, /* write default callback */
NULL, NULL, /* create option callback */
NULL, NULL); /* delete option callback */
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* special section, user can add/delete options, and options need
callback to be read/written */
struct t_config_section *new_section2 =
weechat_config_new_section (config_file, "section2", 1, 1,
&my_section_read_cb, NULL,
&my_section_write_cb, NULL,
&my_section_write_default_cb, NULL,
&my_section_create_option_cb, NULL,
&my_section_delete_option_cb, NULL);
&my_section_read_cb, NULL, NULL,
&my_section_write_cb, NULL, NULL,
&my_section_write_default_cb, NULL, NULL,
&my_section_create_option_cb, NULL, NULL,
&my_section_delete_option_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -4626,15 +4669,21 @@ struct t_config_option *weechat_config_new_option (
const char *default_value,
const char *value,
int null_value_allowed,
int (*callback_check_value)(void *data,
int (*callback_check_value)(const void *pointer,
void *data,
struct t_config_option *option,
const char *value),
const void *callback_check_value_pointer,
void *callback_check_value_data,
void (*callback_change)(void *data,
void (*callback_change)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_change_pointer,
void *callback_change_data,
void (*callback_delete)(void *data,
void (*callback_delete)(const void *pointer,
void *data,
struct t_config_option *option),
const void *callback_delete_pointer,
void *callback_delete_data);
----
@ -4662,26 +4711,41 @@ struct t_config_option *weechat_config_new_option (
を設定することを許可する場合に 1、禁止する場合は 0
* 'callback_check_value': オプションの新しい値をチェックする際に呼び出す関数
(任意)、引数と戻り値:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_option *option': オプションへのポインタ
** 'const char *value': オプションの新しい値
** 戻り値:
*** 値が有効の場合は 1
*** 値が無効の場合は 0
* 'callback_check_value_data': WeeChat が check_value
* 'callback_check_value_pointer': WeeChat が check_value
コールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_check_value_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the option is freed
* 'callback_change': オプションの値を変更した際に呼び出す関数
(任意)、引数:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_option *option': オプションへのポインタ
* 'callback_change_data': WeeChat が change
* 'callback_change_pointer': WeeChat が change
コールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_change_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the option is freed
* 'callback_delete': オプションを削除する前に際に呼び出す関数
(任意)、引数:
** 'const void *pointer': ポインタ
** 'void *data': ポインタ
** 'struct t_config_option *option': オプションへのポインタ
* 'callback_delete_data': WeeChat が delete
* 'callback_delete_pointer': WeeChat が delete
コールバックを呼び出す際にコールバックに渡すポインタ
// TRANSLATION MISSING
* 'callback_delete_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ;
if not NULL, it must have been allocated with malloc (or similar function)
and it will be automatically freed when the option is freed
戻り値:
@ -4694,67 +4758,67 @@ C 言語での使用例:
/* boolean */
struct t_config_option *option1 =
weechat_config_new_option (config_file, section, "option1", "boolean",
"My option, type boolean"
NULL, /* string values */
0, 0, /* min, max */
"on", /* default */
"on", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type boolean",
NULL,
0, 0,
"on",
"on",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* integer */
struct t_config_option *option2 =
weechat_config_new_option (config_file, section, "option2", "integer",
"My option, type integer"
NULL, /* string values */
0, 100, /* min, max */
"15", /* default */
"15", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type integer",
NULL,
0, 100,
"15",
"15",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* integer (with string values) */
struct t_config_option *option3 =
weechat_config_new_option (config_file, section, "option3", "integer",
"My option, type integer (with string values)"
"top|bottom|left|right", /* string values */
0, 0, /* min, max */
"bottom", /* default */
"bottom", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type integer (with string values)",
"top|bottom|left|right",
0, 0,
"bottom",
"bottom",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* string */
struct t_config_option *option4 =
weechat_config_new_option (config_file, section, "option4", "string",
"My option, type string"
NULL, /* string values */
0, 0, /* min, max */
"test", /* default */
"test", /* value */
1, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type string",
NULL,
0, 0,
"test",
"test",
1,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
/* color */
struct t_config_option *option5 =
weechat_config_new_option (config_file, section, "option5", "color",
"My option, type color"
NULL, /* string values */
0, 0, /* min, max */
"lightblue", /* default */
"lightblue", /* value */
0, /* null value allowed */
NULL, NULL, /* check callback */
NULL, NULL, /* change callback */
NULL, NULL); /* delete callback */
"My option, type color",
NULL,
0, 0,
"lightblue",
"lightblue",
0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
----
スクリプト (Python) での使用例: