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

v2.8-utf8proc
Sébastien Helleu 2016-03-23 13:51:15 +01:00
parent b9d427fc1f
commit 293f758a3a
4 changed files with 546 additions and 236 deletions

View File

@ -205,7 +205,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin,
"message: message to display two times\n"
"command: command to execute two times",
NULL,
&command_double_cb, NULL);
&command_double_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
@ -7005,7 +7005,7 @@ C example:
[source,C]
----
/* hook modifier with priority = 2000 */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
----
Following hook types allow priority: command, command_run, signal, hsignal,
@ -7024,7 +7024,8 @@ struct t_hook *weechat_hook_command (const char *command,
const char *args,
const char *args_description,
const char *completion,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
int argc,
char **argv,
@ -7044,7 +7045,10 @@ Arguments:
argument, separated by "|". Many templates are possible for same command,
separated by "||".
* 'callback': function called when command is used, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': buffer where command is executed
** 'int argc': number of arguments given for command
** 'char **argv': arguments given for command
@ -7103,7 +7107,7 @@ struct t_hook *my_command_hook =
/* callback */
&my_command_cb,
/* callback_data */
NULL);
NULL, NULL);
----
For example, if command called is `/command abc def ghi`, then 'argv' and
@ -7156,7 +7160,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_command_run (const char *command,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
const char *command),
void *callback_data);
@ -7167,7 +7172,10 @@ Arguments:
* 'command': command to hook (wildcard "*" is allowed)
(priority allowed, see note about <<hook_priority,priority>>)
* 'callback': function called when command is run, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': buffer where command is executed
** 'const char *command': the command executed, with its arguments
** return value:
@ -7198,7 +7206,7 @@ my_command_run_cb (void *data, struct t_gui_buffer *buffer,
struct t_hook *my_command_run_hook =
weechat_hook_command_run ("/input complete*",
&my_command_run_cb, NULL);
&my_command_run_cb, NULL, NULL);
----
Script (Python):
@ -7227,7 +7235,8 @@ Prototype:
struct t_hook *weechat_hook_timer (long interval,
int align_second,
int max_calls,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int remaining_calls),
void *callback_data);
----
@ -7240,7 +7249,10 @@ Arguments:
called each minute when second is 0
* 'max_calls': number of calls to timer (if 0, then timer has no end)
* 'callback': function called when time is reached, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int remaining_calls': remaining calls (-1 if timer has no end)
** return value:
*** 'WEECHAT_RC_OK'
@ -7264,7 +7276,7 @@ my_timer_cb (void *data, int remaining_calls)
/* timer called each 20 seconds */
struct t_hook *my_timer_hook =
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL);
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL, NULL);
----
Script (Python):
@ -7297,7 +7309,8 @@ struct t_hook *weechat_hook_fd (int fd,
int flag_read,
int flag_write,
int flag_exception,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int fd),
void *callback_data);
----
@ -7311,7 +7324,10 @@ Arguments:
(_WeeChat ≥ 1.3_: this argument is ignored and not used any more)
* 'callback': function called a selected event occurs for file (or socket),
arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int fd': file descriptor
** return value:
*** 'WEECHAT_RC_OK'
@ -7336,7 +7352,7 @@ my_fd_cb (void *data, int fd)
int sock = socket (AF_INET, SOCK_STREAM, 0);
/* set socket options */
/* ... */
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL);
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL, NULL);
----
Script (Python):
@ -7374,7 +7390,8 @@ Prototype:
----
struct t_hook *weechat_hook_process (const char *command,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7391,7 +7408,10 @@ Arguments:
process is killed (0 means no timeout)
* 'callback': function called when data from child is available, or when child
has ended, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *command': command executed by child
** 'int return_code': return code:
*** '>= 0': child return code for a command, and for URL possible values are:
@ -7468,7 +7488,7 @@ my_process_cb (void *data, const char *command, int return_code,
}
struct t_hook *my_process_hook = weechat_hook_process ("ls", 5000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
----
Script (Python):
@ -7508,7 +7528,8 @@ Prototype:
struct t_hook *weechat_hook_process_hashtable (const char *command,
struct t_hashtable *options,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7618,7 +7639,7 @@ if (options)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("url:https://weechat.org/",
options,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options);
}
@ -7637,7 +7658,7 @@ if (options_cmd1)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command",
options_cmd1,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd1);
}
@ -7654,7 +7675,7 @@ if (options_cmd2)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("sh",
options_cmd2,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd2);
}
----
@ -7717,7 +7738,8 @@ struct t_hook *weechat_hook_connect (const char *proxy,
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int status,
int gnutls_rc,
int sock,
@ -7750,7 +7772,10 @@ Arguments:
* 'local_hostname': local hostname to use for connection (optional)
* 'callback': function called when connection is OK or failed, arguments and
return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int status': connection status:
*** 'WEECHAT_HOOK_CONNECT_OK': connection OK
*** 'WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND': address not found
@ -7828,7 +7853,7 @@ struct t_hook *my_connect_hook = weechat_hook_connect (NULL,
1, 0,
NULL, NULL, 0, /* GnuTLS */
NULL,
&my_connect_cb, NULL);
&my_connect_cb, NULL, NULL);
----
Script (Python):
@ -7883,7 +7908,8 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer,
const char *tags,
const char *message,
int strip_colors,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@ -7910,7 +7936,10 @@ Arguments:
calling callback
* 'callback': function called when a message is printed, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': buffer pointer
** 'time_t date': date
** 'int tags_count': number of tags for line
@ -7950,7 +7979,7 @@ my_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
/* catch all messages, on all buffers, without color */
struct t_hook *my_print_hook =
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL, NULL);
----
Script (Python):
@ -7979,7 +8008,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_signal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
const char *type_data,
void *signal_data),
@ -7993,7 +8023,10 @@ Arguments:
(see table below)
* 'callback': function called when signal is received, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': signal received
** 'const char *type_data': type of data sent with signal:
*** 'WEECHAT_HOOK_SIGNAL_STRING': string
@ -8665,7 +8698,7 @@ my_signal_cb (void *data, const char *signal, const char *type_data,
/* catch signal "quit" */
struct t_hook *my_signal_hook = weechat_hook_signal ("quit",
&my_signal_cb, NULL);
&my_signal_cb, NULL, NULL);
----
Script (Python):
@ -8893,7 +8926,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_hsignal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
struct t_hashtable *hashtable),
void *callback_data);
@ -8906,7 +8940,10 @@ Arguments:
(see table below)
* 'callback': function called when signal is received, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': signal received
** 'struct t_hashtable *hashtable': hashtable
** return value:
@ -8990,7 +9027,7 @@ my_hsignal_cb (void *data, const char *signal, struct t_hashtable *hashtable)
}
struct t_hook *my_hsignal_hook = weechat_hook_hsignal ("test",
&my_hsignal_cb, NULL);
&my_hsignal_cb, NULL, NULL);
----
Script (Python):
@ -9131,7 +9168,7 @@ test_whois_cb (void *data, const char *signal, struct t_hashtable *hashtable)
return WEECHAT_RC_OK;
}
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL);
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL, NULL);
struct t_hashtable *hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@ -9248,7 +9285,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_config (const char *option,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *option,
const char *value),
void *callback_data);
@ -9261,7 +9299,10 @@ Arguments:
(priority allowed, see note about <<hook_priority,priority>>)
* 'callback': function called when configuration option is changed, arguments
and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *option': name of option
** 'const char *value': new value for option
** return value:
@ -9286,7 +9327,7 @@ my_config_cb (void *data, const char *option, const char *value)
/* catch changes to option "weechat.look.item_time_format" */
struct t_hook *my_config_hook = weechat_hook_config ("weechat.look.item_time_format",
&my_config_cb, NULL);
&my_config_cb, NULL, NULL);
----
Script (Python):
@ -9315,7 +9356,8 @@ Prototype:
----
struct t_hook *weechat_hook_completion (const char *completion_item,
const char *description,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
@ -9330,7 +9372,10 @@ Arguments:
* 'description': description of completion
* 'callback': function called when completion item is used (user is completing
something using this item), arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *completion_item': name of completion item
** 'struct t_gui_buffer *buffer': buffer where completion is made
** 'struct t_gui_completion *completion': structure used to add words for
@ -9377,7 +9422,7 @@ my_completion_cb (void *data, const char *completion_item,
struct t_hook *my_completion_hook = weechat_hook_completion ("plugin_item",
"my custom completion!",
&my_completion_cb, NULL);
&my_completion_cb, NULL, NULL);
----
Script (Python):
@ -9499,7 +9544,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_modifier (const char *modifier,
char *(*callback)(void *data,
char *(*callback)(const void *pointer,
void *data,
const char *modifier,
const char *modifier_data,
const char *string),
@ -9512,7 +9558,10 @@ Arguments:
(priority allowed, see note about <<hook_priority,priority>>)
(see table below)
* 'callback': function called when modifier is used, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *modifier': name of modifier
** 'const char *modifier_data': data for modifier
** 'const char *string': string to modify
@ -9666,7 +9715,7 @@ my_modifier_cb (void *data, const char *modifier,
}
struct t_hook *my_modifier_hook = weechat_hook_modifier ("weechat_print",
&my_modifier_cb, NULL);
&my_modifier_cb, NULL, NULL);
----
Script (Python):
@ -9736,7 +9785,8 @@ Prototype:
struct t_hook *weechat_hook_info (const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *(*callback)(const void *pointer,
void *data,
const char *info_name,
const char *arguments),
void *callback_data);
@ -9749,7 +9799,10 @@ Arguments:
* 'description': description
* 'args_description': description of arguments (optional, can be NULL)
* 'callback': function called when info is asked, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': name of info
** 'const char *arguments': additional arguments, depending on info
** return value: value of info asked
@ -9774,7 +9827,7 @@ my_info_cb (void *data, const char *info_name, const char *arguments)
struct t_hook *my_info_hook = weechat_hook_info ("my_info",
"Some info",
"Info about arguments",
&my_info_cb, NULL);
&my_info_cb, NULL, NULL);
----
Script (Python):
@ -9806,7 +9859,8 @@ struct t_hook *weechat_hook_info_hashtable (const char *info_name,
const char *description,
const char *args_description,
const char *output_description,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
const char *info_name,
struct t_hashtable *hashtable),
void *callback_data);
@ -9821,7 +9875,10 @@ Arguments:
* 'output_description': description of hashtable returned by callback
(optional, can be NULL)
* 'callback': function called when info is asked, arguments and return value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': name of info
** 'struct t_hashtable *hashtable': hashtable, depending on info
** return value: hashtable asked
@ -9847,7 +9904,7 @@ struct t_hook *my_info_hook = weechat_hook_info_hashtable ("my_info_hashtable",
"Some info",
"Info about input hashtable",
"Info about output hashtable",
&my_info_hashtable_cb, NULL);
&my_info_hashtable_cb, NULL, NULL);
----
Script (Python):
@ -9880,7 +9937,8 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
struct t_infolist *(*callback)(const void *pointer,
void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
@ -9896,7 +9954,10 @@ Arguments:
* 'args_description': description of arguments (optional, can be NULL)
* 'callback': function called when infolist is asked, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *infolist_name': name of infolist
** 'void *pointer': pointer to an object that infolist must return (to get only
one item in infolist)
@ -9929,7 +9990,7 @@ struct t_hook *my_infolist = weechat_hook_infolist ("my_infolist",
"Infolist with some data",
"Info about pointer",
"Info about arguments",
&my_infolist_cb, NULL);
&my_infolist_cb, NULL, NULL);
----
Script (Python):
@ -9961,7 +10022,8 @@ Prototype:
----
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
struct t_hdata *(*callback)(const void *pointer,
void *data,
const char *hdata_name),
void *callback_data);
----
@ -9973,7 +10035,10 @@ Arguments:
* 'description': description
* 'callback': function called when hdata is asked, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *hdata_name': name of hdata
** return value: hdata asked
* 'callback_data': pointer given to callback when it is called by WeeChat
@ -10000,7 +10065,7 @@ my_hdata_cb (void *data, const char *hdata_name)
/* add hdata "my_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
"Hdata for my structure",
&my_hdata_cb, NULL);
&my_hdata_cb, NULL, NULL);
----
[NOTE]
@ -10016,7 +10081,8 @@ Prototype:
[source,C]
----
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
struct t_hashtable *info),
void *callback_data);
----
@ -10027,7 +10093,10 @@ Arguments:
(priority allowed, see note about <<hook_priority,priority>>)
* 'callback': function called when focus is made, arguments and return
value:
** 'void *data': pointer
** 'const void *pointer': pointer
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_hashtable *info': hashtable with info on focus and strings returned
by other calls to focus callbacks (with higher priority) (see table below)
** return value: either "info" pointer (hashtable completed), or pointer to a
@ -10185,7 +10254,7 @@ my_focus_nicklist_cb (void *data, struct t_hashtable *info)
/* add focus on nicklist */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
&my_focus_nicklist_cb, NULL, NULL);
----
Script (Python):
@ -10259,7 +10328,7 @@ C example:
struct t_hook *my_command_hook =
weechat_hook_command ("abcd", "description",
"args", "description args",
"", &my_command_cb, NULL);
"", &my_command_cb, NULL, NULL);
weechat_hook_set (my_command_hook, "subplugin", "test");
----

View File

@ -209,7 +209,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin,
"message : message à afficher deux fois\n"
"commande : commande à exécuter deux fois",
NULL,
&commande_double_cb, NULL);
&commande_double_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
@ -7119,7 +7119,7 @@ Exemple en C :
[source,C]
----
/* accroche un modificateur avec priorité = 2000 */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
----
Les types de "hooks" suivants autorisent une priorité : command, command_run,
@ -7139,7 +7139,8 @@ struct t_hook *weechat_hook_command (const char *command,
const char *args,
const char *args_description,
const char *completion,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
int argc,
char **argv,
@ -7162,7 +7163,10 @@ Paramètres :
"||".
* 'callback' : fonction appelée lorsque la commande est utilisée, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'struct t_gui_buffer *buffer' : tampon où la commande est exécutée
** 'int argc' : nombre de paramètres passés à la commande
** 'char **argv' : paramètres pour la commande
@ -7222,7 +7226,7 @@ struct t_hook *my_command_hook =
/* callback */
&my_command_cb,
/* callback_data */
NULL);
NULL, NULL);
----
Par exemple, si la commande appelée est `/command abc def ghi`, alors 'argv' et
@ -7275,7 +7279,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_command_run (const char *command,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
const char *command),
void *callback_data);
@ -7287,7 +7292,10 @@ Paramètres :
(priorité autorisée, voir la note sur la <<hook_priority,priorité>>)
* 'callback' : fonction appelée lorsque la commande est exécutée, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'struct t_gui_buffer *buffer' : tampon où la commande est exécutée
** 'const char *command' : la commande exécutée, avec ses paramètres
** valeur de retour :
@ -7318,7 +7326,7 @@ my_command_run_cb (void *data, struct t_gui_buffer *buffer, const char *command)
struct t_hook *my_command_run_hook =
weechat_hook_command_run ("/input complete*",
&my_command_run_cb, NULL);
&my_command_run_cb, NULL, NULL);
----
Script (Python) :
@ -7347,7 +7355,8 @@ Prototype :
struct t_hook *weechat_hook_timer (long interval,
int align_second,
int max_calls,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int remaining_calls),
void *callback_data);
----
@ -7363,7 +7372,10 @@ Paramètres :
de fin)
* 'callback' : fonction appelée quand le délai est atteint, paramètres et valeur
de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'int remaining_calls' : nombre d'appels restants (-1 si le minuteur n'a pas
de fin)
** valeur de retour :
@ -7389,7 +7401,7 @@ my_timer_cb (void *data, int remaining_calls)
/* minuteur appelé toutes les 20 secondes */
struct t_hook *my_timer_hook =
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL);
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL, NULL);
----
Script (Python) :
@ -7422,7 +7434,8 @@ struct t_hook *weechat_hook_fd (int fd,
int flag_read,
int flag_write,
int flag_exception,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int fd),
void *callback_data);
----
@ -7436,7 +7449,10 @@ Paramètres :
(_WeeChat ≥ 1.3_ : ce paramètre est ignoré et n'est plus utilisé)
* 'callback' : fonction appelée lorsqu'un des évènements sélectionnés se
produit pour le fichier (ou le socket), paramètres et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'int fd' : descripteur de fichier
** valeur de retour :
*** 'WEECHAT_RC_OK'
@ -7462,7 +7478,7 @@ my_fd_cb (void *data, int fd)
int sock = socket (AF_INET, SOCK_STREAM, 0);
/* définir les options du socket */
/* ... */
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL);
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL, NULL);
----
Script (Python) :
@ -7500,7 +7516,8 @@ Prototype :
----
struct t_hook *weechat_hook_process (const char *command,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7517,7 +7534,10 @@ Paramètres :
processus fils est tué (0 signifie pas de limite)
* 'callback' : fonction appelée quand des données du fils sont disponibles, or
ou quand le fils s'est terminé, paramètres et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *command' : commande exécutée par le fils
** 'int return_code' : code retour :
*** '>= 0' : code retour du fils pour une commande, et pour l'URL, les valeurs
@ -7601,7 +7621,7 @@ my_process_cb (void *data, const char *command, int return_code,
}
struct t_hook *my_process_hook = weechat_hook_process ("ls", 5000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
----
Script (Python) :
@ -7641,7 +7661,8 @@ Prototype :
struct t_hook *weechat_hook_process_hashtable (const char *command,
struct t_hashtable *options,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7756,7 +7777,7 @@ if (options)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("url:https://weechat.org/",
options,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options);
}
@ -7775,7 +7796,7 @@ if (options_cmd1)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command",
options_cmd1,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd1);
}
@ -7792,7 +7813,7 @@ if (options_cmd2)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("sh",
options_cmd2,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd2);
}
----
@ -7855,7 +7876,8 @@ struct t_hook *weechat_hook_connect (const char *proxy,
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int status,
int gnutls_rc,
int sock,
@ -7891,7 +7913,10 @@ Paramètres :
(optionnel)
* 'callback' : fonction appelée lorsque la connexion est ok ou a échoué,
paramètres et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'int status' : statut de connexion :
*** 'WEECHAT_HOOK_CONNECT_OK' : connexion ok
*** 'WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND' : adresse non trouvée
@ -7971,7 +7996,7 @@ struct t_hook *my_connect_hook = weechat_hook_connect (NULL,
1, 0,
NULL, NULL, 0, /* GnuTLS */
NULL,
&my_connect_cb, NULL);
&my_connect_cb, NULL, NULL);
----
Script (Python) :
@ -8026,7 +8051,8 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer,
const char *tags,
const char *message,
int strip_colors,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@ -8055,7 +8081,10 @@ Paramètres :
avant d'appeler le "callback"
* 'callback' : fonction appelée lorsqu'un message est affiché, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'struct t_gui_buffer *buffer' : pointeur vers le tampon
** 'time_t date' : date
** 'int tags_count' : nombre d'étiquettes de la ligne
@ -8097,7 +8126,7 @@ my_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
/* intercepter tous les messages, de tous les tampons, sans couleur */
struct t_hook *my_print_hook =
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL, NULL);
----
Script (Python) :
@ -8126,7 +8155,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_signal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
const char *type_data,
void *signal_data),
@ -8140,7 +8170,10 @@ Paramètres :
(voir le tableau ci-dessous)
* 'callback' : fonction appelée quand le signal est reçu, paramètres et valeur
de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *signal' : signal reçu
** 'const char *type_data' : type de donnée reçu avec le signal :
*** 'WEECHAT_HOOK_SIGNAL_STRING' : chaîne de caractères
@ -8817,7 +8850,7 @@ my_signal_cb (void *data, const char *signal, const char *type_data,
/* intercepter le signal "quit" */
struct t_hook *my_signal_hook = weechat_hook_signal ("quit",
&my_signal_cb, NULL);
&my_signal_cb, NULL, NULL);
----
Script (Python) :
@ -9051,7 +9084,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_hsignal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
struct t_hashtable *hashtable),
void *callback_data);
@ -9064,7 +9098,10 @@ Paramètres :
(voir le tableau ci-dessous)
* 'callback' : fonction appelée quand le signal est reçu, paramètres et valeur
de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *signal' : signal reçu
** 'struct t_hashtable *hashtable' : table de hachage
** valeur de retour :
@ -9149,7 +9186,7 @@ my_hsignal_cb (void *data, const char *signal, struct t_hashtable *hashtable)
}
struct t_hook *my_hsignal_hook = weechat_hook_hsignal ("test",
&my_hsignal_cb, NULL);
&my_hsignal_cb, NULL, NULL);
----
Script (Python) :
@ -9295,7 +9332,7 @@ test_whois_cb (void *data, const char *signal, struct t_hashtable *hashtable)
return WEECHAT_RC_OK;
}
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL);
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL, NULL);
struct t_hashtable *hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@ -9417,7 +9454,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_config (const char *option,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *option,
const char *value),
void *callback_data);
@ -9431,7 +9469,10 @@ Paramètres :
<<hook_priority,priorité>>)
* 'callback' : fonction appelée lorsque l'option de configuration est modifiée,
paramètres et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *option' : nom de l'option
** 'const char *value' : nouvelle valeur pour l'option
** valeur de retour :
@ -9457,7 +9498,7 @@ my_config_cb (void *data, const char *option, const char *value)
/* intercepter les changements de l'option "weechat.look.item_time_format" */
struct t_hook *my_config_hook = weechat_hook_config ("weechat.look.item_time_format",
&my_config_cb, NULL);
&my_config_cb, NULL, NULL);
----
Script (Python) :
@ -9486,7 +9527,8 @@ Prototype :
----
struct t_hook *weechat_hook_completion (const char *completion_item,
const char *description,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
@ -9502,7 +9544,10 @@ Paramètres :
* 'callback' : fonction appelée lorsque la complétion est utilisée
(l'utilisateur est en train de compléter quelque chose qui fait appel à cette
complétion), paramètres et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *completion_item' : nom de la complétion
** 'struct t_gui_buffer *buffer' : tampon où la complétion est effectuée
** 'struct t_gui_completion *completion' : structure utilisée pour ajouter
@ -9551,7 +9596,7 @@ my_completion_cb (void *data, const char *completion_item,
struct t_hook *my_completion_hook = weechat_hook_completion ("extension_item",
"ma complétion !",
&my_completion_cb, NULL);
&my_completion_cb, NULL, NULL);
----
Script (Python) :
@ -9673,7 +9718,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_modifier (const char *modifier,
char *(*callback)(void *data,
char *(*callback)(const void *pointer,
void *data,
const char *modifier,
const char *modifier_data,
const char *string),
@ -9688,7 +9734,10 @@ Paramètres :
(voir le tableau ci-dessous)
* 'callback' : fonction appelée lorsque le modificateur est utilisé, paramètres
et valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *modifier' : nom du modificateur
** 'const char *modifier_data' : données pour le modificateur
** 'const char *string' : chaîne à modifier
@ -9851,7 +9900,7 @@ my_modifier_cb (void *data, const char *modifier,
}
struct t_hook *my_modifier_hook = weechat_hook_modifier ("weechat_print",
&my_modifier_cb, NULL);
&my_modifier_cb, NULL, NULL);
----
Script (Python) :
@ -9921,7 +9970,8 @@ Prototype :
struct t_hook *weechat_hook_info (const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *(*callback)(const void *pointer,
void *data,
const char *info_name,
const char *arguments),
void *callback_data);
@ -9935,7 +9985,10 @@ Paramètres :
* 'args_description' : description des paramètres (optionnel, peut être NULL)
* 'callback' : fonction appelée quand l'information est demandée, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *info_name' : nom de l'information
** 'const char *arguments' : paramètres additionnels, dépendant de
l'information
@ -9962,7 +10015,7 @@ my_info_cb (void *data, const char *info_name, const char *arguments)
struct t_hook *my_info_hook = weechat_hook_info ("mon_info",
"Une information",
"Info sur les paramètres",
&my_info_cb, NULL);
&my_info_cb, NULL, NULL);
----
Script (Python) :
@ -9996,7 +10049,8 @@ struct t_hook *weechat_hook_info_hashtable (const char *info_name,
const char *description,
const char *args_description,
const char *output_description,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
const char *info_name,
struct t_hashtable *hashtable),
void *callback_data);
@ -10013,7 +10067,10 @@ Paramètres :
"callback" (optionnel, peut être NULL)
* 'callback' : fonction appelée quand l'information est demandée, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *info_name' : nom de l'information
** 'struct t_hashtable *hashtable' : table de hachage, dépendant de
l'information
@ -10041,7 +10098,7 @@ struct t_hook *my_info_hook = weechat_hook_info_hashtable ("mon_info_hashtable",
"Une information",
"Info sur la table de hachage en entrée",
"Info sur la table de hachage en sortie",
&my_info_hashtable_cb, NULL);
&my_info_hashtable_cb, NULL, NULL);
----
Script (Python) :
@ -10075,7 +10132,8 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
struct t_infolist *(*callback)(const void *pointer,
void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
@ -10091,7 +10149,10 @@ Paramètres :
* 'args_description' : description des paramètres (optionnel, peut être NULL)
* 'callback' : fonction appelée quand l'infolist est demandée, paramètres et
valeur de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *infolist_name' : nom de l'infolist
** 'void *pointer' : pointeur vers un objet que l'infolist doit retourner (pour
obtenir uniquement cet objet dans l'infolist)
@ -10125,7 +10186,7 @@ struct t_hook *my_infolist = weechat_hook_infolist ("mon_infolist",
"Mon infolist",
"Info sur le pointeur",
"Info sur les paramètres",
&my_infolist_cb, NULL);
&my_infolist_cb, NULL, NULL);
----
Script (Python) :
@ -10157,7 +10218,8 @@ Prototype :
----
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
struct t_hdata *(*callback)(const void *pointer,
void *data,
const char *hdata_name),
void *callback_data);
----
@ -10169,7 +10231,10 @@ Paramètres :
* 'description' : description
* 'callback' : fonction appelée quand le hdata est demandé, paramètres et valeur
de retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'const char *hdata_name' : nom du hdata
** valeur de retour : hdata demandé
* 'callback_data' : pointeur donné au "callback" lorsqu'il est appelé par
@ -10197,7 +10262,7 @@ my_hdata_cb (void *data, const char *hdata_name)
/* ajoute le hdata "mon_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("mon_hdata",
"Hdata pour ma structure",
&my_hdata_cb, NULL);
&my_hdata_cb, NULL, NULL);
----
[NOTE]
@ -10213,7 +10278,8 @@ Prototype :
[source,C]
----
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
struct t_hashtable *info),
void *callback_data);
----
@ -10224,7 +10290,10 @@ Paramètres :
(priorité autorisée, voir la note sur la <<hook_priority,priorité>>)
* 'callback' : fonction appelée quand le focus est fait, paramètres et valeur de
retour :
** 'void *data' : pointeur
** 'const void *pointer' : pointeur
** 'void *data' : pointeur ; si non NULL, doit avoir été alloué par malloc
(ou une fonction similaire) et sera automatiquement libéré (par free)
lorsque le "hook" est supprimé
** 'struct t_hashtable *info' : table de hachage avec les informations sur le
focus et les chaînes retournées par les autres appels aux "callbacks" de
focus (avec plus haute priorité) (voir le tableau ci-dessous)
@ -10387,7 +10456,7 @@ my_focus_nicklist_cb (void *data, struct t_hashtable *info)
/* ajoute le focus sur la liste des pseudos */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
&my_focus_nicklist_cb, NULL, NULL);
----
Script (Python) :
@ -10462,7 +10531,7 @@ Exemple en C :
struct t_hook *my_command_hook =
weechat_hook_command ("abcd", "description",
"args", "description args",
"", &my_command_cb, NULL);
"", &my_command_cb, NULL, NULL);
weechat_hook_set (my_command_hook, "subplugin", "test");
----

View File

@ -220,7 +220,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin,
"messaggio: messaggio da visualizzare due volte\n"
"comando: comando da eseguire due volte",
NULL,
&command_double_cb, NULL);
&command_double_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
@ -7164,7 +7164,7 @@ Esempio in C:
[source,C]
----
/* hook per il modificatore con priorità = 2000 */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
----
I tipi di hook che seguono consentono la priorità: command, command_run,
@ -7184,7 +7184,8 @@ struct t_hook *weechat_hook_command (const char *command,
const char *args,
const char *args_description,
const char *completion,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
int argc,
char **argv,
@ -7205,7 +7206,11 @@ Argomenti:
lo stesso comando, separati da "||".
* 'callback': funzione chiamata quando viene utilizzato il comando, argomenti e
valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': buffer quando il comando viene eseguito
** 'int argc': numero di argomenti forniti per un comando
** 'char **argv': argomenti forniti per un comando
@ -7264,7 +7269,7 @@ struct t_hook *my_command_hook =
/* callback */
&my_command_cb,
/* callback_data */
NULL);
NULL, NULL);
----
Ad esempio, se il comando chiamato è `/comando abc def ghi`, allora
@ -7319,7 +7324,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_command_run (const char *command,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
const char *command),
void *callback_data);
@ -7333,7 +7339,11 @@ Argomenti:
<<hook_priority,priority>>)
* 'callback': funzione chiamata quando il comando è in esecuzione, argomenti e
valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': buffer dove viene eseguito il comando
** 'const char *command': il comando eseguito, con i propri argomenti
** valore restituito:
@ -7364,7 +7374,7 @@ my_command_run_cb (void *data, struct t_gui_buffer *buffer,
struct t_hook *my_command_run_hook =
weechat_hook_command_run ("/input complete*",
&my_command_run_cb, NULL);
&my_command_run_cb, NULL, NULL);
----
Script (Python):
@ -7393,7 +7403,8 @@ Prototipo:
struct t_hook *weechat_hook_timer (long interval,
int align_second,
int max_calls,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int remaining_calls),
void *callback_data);
----
@ -7410,7 +7421,11 @@ Argomenti:
// TRANSLATION MISSING
* 'callback': function called when time is reached, argomenti e valore
restituito:
** 'void *data': pointer
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': pointer; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int remaining_calls': remaining calls (-1 if timer has no end)
** valore restituito:
*** 'WEECHAT_RC_OK'
@ -7434,7 +7449,7 @@ my_timer_cb (void *data, int remaining_calls)
/* timer chiamato ogni 20 secondi */
struct t_hook *my_timer_hook =
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL);
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL, NULL);
----
Script (Python):
@ -7468,7 +7483,8 @@ struct t_hook *weechat_hook_fd (int fd,
int flag_read,
int flag_write,
int flag_exception,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int fd),
void *callback_data);
----
@ -7483,7 +7499,11 @@ Argomenti:
(_WeeChat ≥ 1.3_: this argument is ignored and not used any more)
* 'callback': funzione che chiama un evento selezionato che si verifica
per un file (o un socket), argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int fd': descrittore file
** valore restituito:
*** 'WEECHAT_RC_OK'
@ -7508,7 +7528,7 @@ my_fd_cb (void *data, int fd)
int sock = socket (AF_INET, SOCK_STREAM, 0);
/* imposta le opzioni del socket */
/* ... */
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL);
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL, NULL);
----
Script (Python):
@ -7546,7 +7566,8 @@ Prototipo:
----
struct t_hook *weechat_hook_process (const char *command,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7563,7 +7584,11 @@ Argomenti:
il processo figlio viene terminato (0 indica nessun timeout)
* 'callback': funzione chiamata quando i dati dal processo figlio sono disponibili,
oppure quando è terminato, argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *command': comando eseguito dal processo figlio
** 'int return_code': codice restituito:
*** '>= 0': codice ritorno figlio per un comando, e per un URL i valori
@ -7645,7 +7670,7 @@ my_process_cb (void *data, const char *command, int return_code,
}
struct t_hook *my_process_hook = weechat_hook_process ("ls", 5000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
----
Script (Python):
@ -7685,7 +7710,8 @@ Prototipo:
struct t_hook *weechat_hook_process_hashtable (const char *command,
struct t_hashtable *options,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7803,7 +7829,7 @@ if (options)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("url:https://weechat.org/",
options,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options);
}
@ -7822,7 +7848,7 @@ if (options_cmd1)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command",
options_cmd1,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd1);
}
@ -7839,7 +7865,7 @@ if (options_cmd2)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("sh",
options_cmd2,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd2);
}
----
@ -7902,7 +7928,8 @@ struct t_hook *weechat_hook_connect (const char *proxy,
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int status,
int gnutls_rc,
int sock,
@ -7939,7 +7966,11 @@ Argomenti:
(opzionale)
* 'callback': funzione chiamata quando la connessione è avvenuta con
successo oppure no, argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int status': stato della connessione:
*** 'WEECHAT_HOOK_CONNECT_OK': connessione avvenuta con successo
*** 'WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND': indirizzo non trovato
@ -8017,7 +8048,7 @@ struct t_hook *my_connect_hook = weechat_hook_connect (NULL,
1, 0,
NULL, NULL, 0, /* GnuTLS */
NULL,
&my_connect_cb, NULL);
&my_connect_cb, NULL, NULL);
----
Script (Python):
@ -8073,7 +8104,8 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer,
const char *tags,
const char *message,
int strip_colors,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@ -8104,7 +8136,11 @@ Argomenti:
di chiamare la callback
* 'callback': funzione chiamata quando viene stampato un messaggio, argomenti e
valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': puntatore al buffer
** 'time_t date': data
** 'int tags_count': numero di tag per riga
@ -8145,7 +8181,7 @@ my_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
/* cattura tutti i messaggi, su tutti i buffer, senza colore */
struct t_hook *my_print_hook =
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL, NULL);
----
Script (Python):
@ -8174,7 +8210,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_signal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
const char *type_data,
void *signal_data),
@ -8189,7 +8226,11 @@ Argomenti:
<<hook_priority,priority>>), see table below
* 'callback': funzione chiamata a segnale ricevuto, argomenti e valore
restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': segnale ricevuto
** 'const char *type_data': tipo di dati inviati con il segnale:
*** 'WEECHAT_HOOK_SIGNAL_STRING': stringa
@ -8937,7 +8978,7 @@ my_signal_cb (void *data, const char *signal, const char *type_data,
/* cattura il segnale "quit" */
struct t_hook *my_signal_hook = weechat_hook_signal ("quit",
&my_signal_cb, NULL);
&my_signal_cb, NULL, NULL);
----
Script (Python):
@ -9177,7 +9218,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_hsignal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
struct t_hashtable *hashtable),
void *callback_data);
@ -9191,7 +9233,11 @@ Argomenti:
see table below
* 'callback': funzione chiamata a segnale ricevuto, argomenti e valore
restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': segnale ricevuto
** 'struct t_hashtable *hashtable': tabella hash
** valore restituito:
@ -9283,7 +9329,7 @@ my_hsignal_cb (void *data, const char *signal, struct t_hashtable *hashtable)
}
struct t_hook *my_hsignal_hook = weechat_hook_hsignal ("test",
&my_hsignal_cb, NULL);
&my_hsignal_cb, NULL, NULL);
----
Script (Python):
@ -9429,7 +9475,7 @@ test_whois_cb (void *data, const char *signal, struct t_hashtable *hashtable)
return WEECHAT_RC_OK;
}
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL);
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL, NULL);
struct t_hashtable *hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@ -9547,7 +9593,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_config (const char *option,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *option,
const char *value),
void *callback_data);
@ -9562,7 +9609,11 @@ Argomenti:
<<hook_priority,priority>>)
* 'callback': funzione chiamata quando l'opzione di configurazione è cambiata,
argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *option': nome dell'opzione
** 'const char *value': nuovo valore per l'opzione
** valore restituito:
@ -9587,7 +9638,7 @@ my_config_cb (void *data, const char *option, const char *value)
/* cattura le modifiche dell'opzione "weechat.look.item_time_format" */
struct t_hook *my_config_hook = weechat_hook_config ("weechat.look.item_time_format",
&my_config_cb, NULL);
&my_config_cb, NULL, NULL);
----
Script (Python):
@ -9616,7 +9667,8 @@ Prototipo:
----
struct t_hook *weechat_hook_completion (const char *completion_item,
const char *description,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
@ -9632,7 +9684,11 @@ Argomenti:
* 'callback': funzione chiamata quando viene usato l'elemento completamento
(l'utente sta completando qualcosa usando questo elemento), argomenti e valore
restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *completion_item': nome dell'elemento del completamento
** 'struct t_gui_buffer *buffer': buffer dove viene eseguito il completamento
** 'struct t_gui_completion *completion': struttura usata per aggiungere
@ -9680,7 +9736,7 @@ my_completion_cb (void *data, const char *completion_item,
struct t_hook *my_completion_hook = weechat_hook_completion ("plugin_item",
"my custom completion!",
&my_completion_cb, NULL);
&my_completion_cb, NULL, NULL);
----
Script (Python):
@ -9803,7 +9859,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_modifier (const char *modifier,
char *(*callback)(void *data,
char *(*callback)(const void *pointer,
void *data,
const char *modifier,
const char *modifier_data,
const char *string),
@ -9819,7 +9876,11 @@ Argomenti:
<<hook_priority,priority>>), see table below
* 'callback': funzione chiamata quando viene usato il modificatore,
argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *modifier': nome del modificatore
** 'const char *modifier_data': dati per il modificatore
** 'const char *string': stringa da modificare
@ -9977,7 +10038,7 @@ my_modifier_cb (void *data, const char *modifier,
}
struct t_hook *my_modifier_hook = weechat_hook_modifier ("weechat_print",
&my_modifier_cb, NULL);
&my_modifier_cb, NULL, NULL);
----
Script (Python):
@ -10047,7 +10108,8 @@ Prototipo:
struct t_hook *weechat_hook_info (const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *(*callback)(const void *pointer,
void *data,
const char *info_name,
const char *arguments),
void *callback_data);
@ -10062,7 +10124,11 @@ Argomenti:
* 'args_description': descrizione degli argomenti
* 'callback': funzione chiamata alla richiesta di una info, argomenti e valore
restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': nome della info
** 'const char *arguments': argomenti addizionali, dipendono dalle info
** valore restituito: valore dell'info richiesta
@ -10087,7 +10153,7 @@ my_info_cb (void *data, const char *info_name, const char *arguments)
struct t_hook *my_info_hook = weechat_hook_info ("my_info",
"Some info",
"Info about arguments",
&my_info_cb, NULL);
&my_info_cb, NULL, NULL);
----
Script (Python):
@ -10119,7 +10185,8 @@ struct t_hook *weechat_hook_info_hashtable (const char *info_name,
const char *description,
const char *args_description,
const char *output_description,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
const char *info_name,
struct t_hashtable *hashtable),
void *callback_data);
@ -10137,7 +10204,11 @@ Argomenti:
callback (opzionale, può essere NULL)
* 'callback': funzione chiamata alla richiesta della info, argomenti e valore
restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': nome della info
** 'struct t_hashtable *hashtable': tabella hash, in base alla info
** valore restituito: tabella hash richiesta
@ -10163,7 +10234,7 @@ struct t_hook *my_info_hook = weechat_hook_info_hashtable ("my_info_hashtable",
"Some info",
"Info about input hashtable",
"Info about output hashtable",
&my_info_hashtable_cb, NULL);
&my_info_hashtable_cb, NULL, NULL);
----
Script (Python):
@ -10197,7 +10268,8 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
struct t_infolist *(*callback)(const void *pointer,
void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
@ -10214,7 +10286,11 @@ Argomenti:
* 'args_description': descrizione degli argomenti (opzionale, può essere NULL)
* 'callback': funzione chiamata alla richiesta della lista info, argomenti e
valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *infolist_name': nome della lista info
** 'void *pointer': puntatore ad un oggetto che la lista info deve restituire
(per ricevere un solo elemento della lista info)
@ -10247,7 +10323,7 @@ struct t_hook *my_infolist = weechat_hook_infolist ("my_infolist",
"Infolist with some data",
"Info about pointer",
"Info about arguments",
&my_infolist_cb, NULL);
&my_infolist_cb, NULL, NULL);
----
Script (Python):
@ -10279,7 +10355,8 @@ Prototipo:
----
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
struct t_hdata *(*callback)(const void *pointer,
void *data,
const char *hdata_name),
void *callback_data);
----
@ -10290,7 +10367,11 @@ Argomenti:
(priorità consentita, consultare la nota a proposito di <<hook_priority,priority>>)
* 'description': descrizione
* 'callback': funzione chiamata alla richiesta di hdata, argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *hdata_name': nome dell'hdata
** return value: hdata richiesto
* 'callback_data': puntatore fornito alla callback quando chiamata da WeeChat
@ -10317,7 +10398,7 @@ my_hdata_cb (void *data, const char *hdata_name)
/* add hdata "my_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
"Hdata for my structure",
&my_hdata_cb, NULL);
&my_hdata_cb, NULL, NULL);
----
[NOTE]
@ -10333,7 +10414,8 @@ Prototipo:
[source,C]
----
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
struct t_hashtable *info),
void *callback_data);
----
@ -10343,7 +10425,11 @@ Argomenti:
* 'area': "chat" per la zona di chat, o il nome di un elemento barra
(priorità consentita, consultare la nota a riguardo di <<hook_priority,priority>>)
* 'callback': funzione chiamata al momento del focus, argomenti e valore restituito:
** 'void *data': puntatore
** 'const void *pointer': puntatore
// TRANSLATION MISSING
** 'void *data': puntatore; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_hashtable *info': tabella hash con informazioni sul focus e
stringhe restituite da altre chiamate alle callback sul focus (con la
priorità più alta) (consultare la tabella in basso)
@ -10504,7 +10590,7 @@ my_focus_nicklist_cb (void *data, struct t_hashtable *info)
/* add focus on nicklist */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
&my_focus_nicklist_cb, NULL, NULL);
----
Script (Python):
@ -10590,7 +10676,7 @@ Esempio in C:
struct t_hook *my_command_hook =
weechat_hook_command ("abcd", "description",
"args", "description args",
"", &my_command_cb, NULL);
"", &my_command_cb, NULL, NULL);
weechat_hook_set (my_command_hook, "subplugin", "test");
----

View File

@ -210,7 +210,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin,
"message: message to display two times\n"
"command: command to execute two times",
NULL,
&command_double_cb, NULL);
&command_double_cb, NULL, NULL);
return WEECHAT_RC_OK;
}
@ -7004,7 +7004,7 @@ C 言語での使用例:
[source,C]
----
/* hook modifier with priority = 2000 */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL);
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
----
以下のフック型に対して優先度を設定できます:
@ -7023,7 +7023,8 @@ struct t_hook *weechat_hook_command (const char *command,
const char *args,
const char *args_description,
const char *completion,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
int argc,
char **argv,
@ -7043,7 +7044,11 @@ struct t_hook *weechat_hook_command (const char *command,
で区切ってください。1 つのコマンドに対して複数のテンプレートを設定するにはテンプレート同士を
"||" で区切ってください。
* 'callback': コマンドが使用された際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': コマンドを実行するバッファ
** 'int argc': コマンドに渡す引数の個数
** 'char **argv': コマンドに渡す引数
@ -7102,7 +7107,7 @@ struct t_hook *my_command_hook =
/* callback */
&my_command_cb,
/* callback_data */
NULL);
NULL, NULL);
----
例えば、コマンドが `/command abc def ghi`
@ -7155,7 +7160,8 @@ WeeChat がコマンドを実行する際にこれをフック。
[source,C]
----
struct t_hook *weechat_hook_command_run (const char *command,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
const char *command),
void *callback_data);
@ -7166,7 +7172,11 @@ struct t_hook *weechat_hook_command_run (const char *command,
* 'command': フックするコマンド (ワイルドカード "*" を使うことができます)
(優先度の設定が可能、<<hook_priority,優先度>>に関する注意を参照)
* 'callback': コマンドが実行される際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': コマンドを実行するバッファ
** 'const char *command': 実行するコマンド、引数付き
** 戻り値:
@ -7197,7 +7207,7 @@ my_command_run_cb (void *data, struct t_gui_buffer *buffer,
struct t_hook *my_command_run_hook =
weechat_hook_command_run ("/input complete*",
&my_command_run_cb, NULL);
&my_command_run_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7226,7 +7236,8 @@ hook = weechat.hook_command_run("/input complete*", "my_command_run_cb", "")
struct t_hook *weechat_hook_timer (long interval,
int align_second,
int max_calls,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int remaining_calls),
void *callback_data);
----
@ -7239,7 +7250,11 @@ struct t_hook *weechat_hook_timer (long interval,
の場合、毎分 0 秒時にタイマを呼び出す
* 'max_calls': タイマを呼び出す回数 (0 の場合、タイマを無限に呼び出す)
* 'callback': 時間が来たら呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int remaining_calls': 呼び出し残り回数 (タイマを無限に呼び出す場合は -1)
** 戻り値:
*** 'WEECHAT_RC_OK'
@ -7263,7 +7278,7 @@ my_timer_cb (void *data, int remaining_calls)
/* timer called each 20 seconds */
struct t_hook *my_timer_hook =
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL);
weechat_hook_timer (20 * 1000, 0, 0, &my_timer_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7296,7 +7311,8 @@ struct t_hook *weechat_hook_fd (int fd,
int flag_read,
int flag_write,
int flag_exception,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int fd),
void *callback_data);
----
@ -7310,7 +7326,11 @@ struct t_hook *weechat_hook_fd (int fd,
(_WeeChat バージョン 1.3 以上の場合_: この引数は無視され、使われません)
* 'callback': ファイル (またはソケット) に対してキャッチしたいイベントが発生した場合に実行する関数、
引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int fd': ファイルディスクリプタ
** 戻り値:
*** 'WEECHAT_RC_OK'
@ -7335,7 +7355,7 @@ my_fd_cb (void *data, int fd)
int sock = socket (AF_INET, SOCK_STREAM, 0);
/* set socket options */
/* ... */
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL);
struct t_hook *my_fd_hook = weechat_hook_fd (sock, 1, 0, 0, &my_fd_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7373,7 +7393,8 @@ hook = weechat.hook_fd(sock, 1, 0, 0, "my_fd_cb", "")
----
struct t_hook *weechat_hook_process (const char *command,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7390,7 +7411,11 @@ struct t_hook *weechat_hook_process (const char *command,
このタイムアウトを過ぎたら、子プロセスを kill します (タイムアウトさせない場合は 0)
* 'callback':
子プロセスからのデータが利用可能になるか、子プロセスが終了したら呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *command': 子プロセスが実行するコマンド
** 'int return_code': リターンコード:
*** '>= 0': コマンドを実行した子プロセスのまたは URL に対するリターンコード。URL の場合取取り得る値は:
@ -7467,7 +7492,7 @@ my_process_cb (void *data, const char *command, int return_code,
}
struct t_hook *my_process_hook = weechat_hook_process ("ls", 5000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7507,7 +7532,8 @@ _WeeChat バージョン 0.3.7 以上で利用可。_
struct t_hook *weechat_hook_process_hashtable (const char *command,
struct t_hashtable *options,
int timeout,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *command,
int return_code,
const char *out,
@ -7617,7 +7643,7 @@ if (options)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("url:https://weechat.org/",
options,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options);
}
@ -7636,7 +7662,7 @@ if (options_cmd1)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("my-notify-command",
options_cmd1,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd1);
}
@ -7653,7 +7679,7 @@ if (options_cmd2)
struct t_hook *my_process_hook = weechat_hook_process_hashtable ("sh",
options_cmd2,
20000,
&my_process_cb, NULL);
&my_process_cb, NULL, NULL);
weechat_hashtable_free (options_cmd2);
}
----
@ -7716,7 +7742,8 @@ struct t_hook *weechat_hook_connect (const char *proxy,
int gnutls_dhkey_size,
const char *gnutls_priorities,
const char *local_hostname,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
int status,
int gnutls_rc,
int sock,
@ -7749,7 +7776,11 @@ struct t_hook *weechat_hook_connect (const char *proxy,
* 'local_hostname': 接続に使うローカルのホスト名前 (任意)
* 'callback':
接続に成功および失敗した際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'int status': 接続状態:
*** 'WEECHAT_HOOK_CONNECT_OK': 接続成功
*** 'WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND': アドレスが見つかりません
@ -7827,7 +7858,7 @@ struct t_hook *my_connect_hook = weechat_hook_connect (NULL,
1, 0,
NULL, NULL, 0, /* GnuTLS */
NULL,
&my_connect_cb, NULL);
&my_connect_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7882,7 +7913,8 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer,
const char *tags,
const char *message,
int strip_colors,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
struct t_gui_buffer *buffer,
time_t date,
int tags_count,
@ -7909,7 +7941,11 @@ struct t_hook *weechat_hook_print (struct t_gui_buffer *buffer,
の場合、表示されるメッセージから色を削除する、コールバックを呼ぶ前
* 'callback':
メッセージが表示される際に呼び出すコールバック、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_gui_buffer *buffer': バッファへのポインタ
** 'time_t date': 日付
** 'int tags_count': 行に付けられたタグの個数
@ -7949,7 +7985,7 @@ my_print_cb (void *data, struct t_gui_buffer *buffer, time_t date,
/* catch all messages, on all buffers, without color */
struct t_hook *my_print_hook =
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL);
weechat_hook_print (NULL, NULL, NULL, 1, &my_print_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -7978,7 +8014,8 @@ hook = weechat.hook_print("", "", "", 1, "my_print_cb", "")
[source,C]
----
struct t_hook *weechat_hook_signal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
const char *type_data,
void *signal_data),
@ -7992,7 +8029,11 @@ struct t_hook *weechat_hook_signal (const char *signal,
(以下の表を参照)
* 'callback':
シグナルを受信した際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': 受信したシグナル
** 'const char *type_data': シグナルが送信したデータの型
*** 'WEECHAT_HOOK_SIGNAL_STRING': 文字列
@ -8664,7 +8705,7 @@ my_signal_cb (void *data, const char *signal, const char *type_data,
/* catch signal "quit" */
struct t_hook *my_signal_hook = weechat_hook_signal ("quit",
&my_signal_cb, NULL);
&my_signal_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -8892,7 +8933,8 @@ hsignal (ハッシュテーブルを持つシグナル) をフック。
[source,C]
----
struct t_hook *weechat_hook_hsignal (const char *signal,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *signal,
struct t_hashtable *hashtable),
void *callback_data);
@ -8905,7 +8947,11 @@ Arguments:
(以下の表を参照)
* 'callback':
シグナルを受信した際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *signal': 受信したシグナル
** 'struct t_hashtable *hashtable': ハッシュテーブル
** 戻り値:
@ -8989,7 +9035,7 @@ my_hsignal_cb (void *data, const char *signal, struct t_hashtable *hashtable)
}
struct t_hook *my_hsignal_hook = weechat_hook_hsignal ("test",
&my_hsignal_cb, NULL);
&my_hsignal_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9130,7 +9176,7 @@ test_whois_cb (void *data, const char *signal, struct t_hashtable *hashtable)
return WEECHAT_RC_OK;
}
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL);
weechat_hook_hsignal ("irc_redirection_test_whois", &test_whois_cb, NULL, NULL);
struct t_hashtable *hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
@ -9247,7 +9293,8 @@ weechat.hook_hsignal_send("irc_redirect_pattern",
[source,C]
----
struct t_hook *weechat_hook_config (const char *option,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *option,
const char *value),
void *callback_data);
@ -9260,7 +9307,11 @@ struct t_hook *weechat_hook_config (const char *option,
(優先度の設定が可能、<<hook_priority,優先度>>に関する注意を参照)
* 'callback':
設定オプションが変更されたら呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *option': オプションの名前
** 'const char *value': オプションの新しい値
** 戻り値:
@ -9285,7 +9336,7 @@ my_config_cb (void *data, const char *option, const char *value)
/* catch changes to option "weechat.look.item_time_format" */
struct t_hook *my_config_hook = weechat_hook_config ("weechat.look.item_time_format",
&my_config_cb, NULL);
&my_config_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9314,7 +9365,8 @@ hook = weechat.hook_config("weechat.look.item_time_format", "my_config_cb", "")
----
struct t_hook *weechat_hook_completion (const char *completion_item,
const char *description,
int (*callback)(void *data,
int (*callback)(const void *pointer,
void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion),
@ -9329,7 +9381,11 @@ struct t_hook *weechat_hook_completion (const char *completion_item,
* 'description': 補完の説明
* 'callback': 補完要素 (ユーザはこの要素を使って何かを補完している)
が使われた場合に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *completion_item': 補完要素の名前
** 'struct t_gui_buffer *buffer': 補完が行われたバッファ
** 'struct t_gui_completion *completion':
@ -9376,7 +9432,7 @@ my_completion_cb (void *data, const char *completion_item,
struct t_hook *my_completion_hook = weechat_hook_completion ("plugin_item",
"my custom completion!",
&my_completion_cb, NULL);
&my_completion_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9498,7 +9554,8 @@ weechat.hook_completion_list_add(completion, word, nick_completion, where)
[source,C]
----
struct t_hook *weechat_hook_modifier (const char *modifier,
char *(*callback)(void *data,
char *(*callback)(const void *pointer,
void *data,
const char *modifier,
const char *modifier_data,
const char *string),
@ -9511,7 +9568,11 @@ struct t_hook *weechat_hook_modifier (const char *modifier,
(優先度の設定が可能、<<hook_priority,優先度>>に関する注意を参照)
(以下の表を参照)
* 'callback': 修飾子が使われた際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *modifier': 修飾子の名前
** 'const char *modifier_data': 修飾子に渡すデータ
** 'const char *string': 修飾子に渡す文字列
@ -9663,7 +9724,7 @@ my_modifier_cb (void *data, const char *modifier,
}
struct t_hook *my_modifier_hook = weechat_hook_modifier ("weechat_print",
&my_modifier_cb, NULL);
&my_modifier_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9733,7 +9794,8 @@ weechat.hook_modifier_exec("my_modifier", my_data, my_string)
struct t_hook *weechat_hook_info (const char *info_name,
const char *description,
const char *args_description,
const char *(*callback)(void *data,
const char *(*callback)(const void *pointer,
void *data,
const char *info_name,
const char *arguments),
void *callback_data);
@ -9746,7 +9808,11 @@ struct t_hook *weechat_hook_info (const char *info_name,
* 'description': 説明
* 'args_description': 引数の説明 (任意、NULL にすることも可)
* 'callback': 情報が要求されたら呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': 情報の名前
** 'const char *arguments': 追加の引数、情報に依存
** 戻り値: 要求された情報の値
@ -9771,7 +9837,7 @@ my_info_cb (void *data, const char *info_name, const char *arguments)
struct t_hook *my_info_hook = weechat_hook_info ("my_info",
"Some info",
"Info about arguments",
&my_info_cb, NULL);
&my_info_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9803,7 +9869,8 @@ struct t_hook *weechat_hook_info_hashtable (const char *info_name,
const char *description,
const char *args_description,
const char *output_description,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
const char *info_name,
struct t_hashtable *hashtable),
void *callback_data);
@ -9818,7 +9885,11 @@ struct t_hook *weechat_hook_info_hashtable (const char *info_name,
* 'output_description': コールバックが返すハッシュテーブルの説明
(任意、NULL でも可)
* 'callback': 情報を要求する際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *info_name': 情報の名前
** 'struct t_hashtable *hashtable': ハッシュテーブル、情報に依存
** 戻り値: 要求したハッシュテーブル
@ -9844,7 +9915,7 @@ struct t_hook *my_info_hook = weechat_hook_info_hashtable ("my_info_hashtable",
"Some info",
"Info about input hashtable",
"Info about output hashtable",
&my_info_hashtable_cb, NULL);
&my_info_hashtable_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9877,7 +9948,8 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name,
const char *description,
const char *pointer_description,
const char *args_description,
struct t_infolist *(*callback)(void *data,
struct t_infolist *(*callback)(const void *pointer,
void *data,
const char *infolist_name,
void *pointer,
const char *arguments),
@ -9893,7 +9965,11 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name,
* 'args_description': 引数の説明 (任意、NULL でも可)
* 'callback':
インフォリストが要求された際に呼び出すコールバック、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *infolist_name': インフォリストの名前
** 'void *pointer': インフォリストが返すオブジェクトへのポインタ
(インフォリストの要素を 1 つだけ返す)
@ -9926,7 +10002,7 @@ struct t_hook *my_infolist = weechat_hook_infolist ("my_infolist",
"Infolist with some data",
"Info about pointer",
"Info about arguments",
&my_infolist_cb, NULL);
&my_infolist_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -9958,7 +10034,8 @@ hdata をフック: コールバックは要求した hdata へのポインタ
----
struct t_hook *weechat_hook_hdata (const char *hdata_name,
const char *description,
struct t_hdata *(*callback)(void *data,
struct t_hdata *(*callback)(const void *pointer,
void *data,
const char *hdata_name),
void *callback_data);
----
@ -9970,7 +10047,11 @@ struct t_hook *weechat_hook_hdata (const char *hdata_name,
* 'description': 説明
* 'callback':
hdata が要求された際に呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'const char *hdata_name': hdata の名前
** 戻り値: 要求された hdata
* 'callback_data': WeeChat がコールバックを呼び出す際にコールバックに渡すポインタ
@ -9997,7 +10078,7 @@ my_hdata_cb (void *data, const char *hdata_name)
/* add hdata "my_hdata" */
struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
"Hdata for my structure",
&my_hdata_cb, NULL);
&my_hdata_cb, NULL, NULL);
----
[NOTE]
@ -10013,7 +10094,8 @@ struct t_hook *my_hdata = weechat_hook_hdata ("my_hdata",
[source,C]
----
struct t_hook *weechat_hook_focus (const char *area,
struct t_hashtable *(*callback)(void *data,
struct t_hashtable *(*callback)(const void *pointer,
void *data,
struct t_hashtable *info),
void *callback_data);
----
@ -10024,7 +10106,11 @@ struct t_hook *weechat_hook_focus (const char *area,
(優先度の設定が可能、<<hook_priority,優先度>>に関する注意を参照)
* 'callback':
フォーカスが当たったら呼び出す関数、引数と戻り値:
** 'void *data': ポインタ
** 'const void *pointer': ポインタ
// TRANSLATION MISSING
** 'void *data': ポインタ; if not NULL, it must have been allocated with malloc
(or similar function) and it will be automatically freed when the hook is
deleted
** 'struct t_hashtable *info': フォーカスの情報を含むハッシュテーブルと、他の
(より高い優先度を持つ) フォーカスコールバックを呼び出して返された文字列 (以下のテーブルを参照)
** 戻り値: "info" ポインタ (完全なハッシュテーブル)
@ -10182,7 +10268,7 @@ my_focus_nicklist_cb (void *data, struct t_hashtable *info)
/* add focus on nicklist */
struct t_hook *my_focus = weechat_hook_focus ("buffer_nicklist",
&my_focus_nicklist_cb, NULL);
&my_focus_nicklist_cb, NULL, NULL);
----
スクリプト (Python) での使用例:
@ -10256,7 +10342,7 @@ C 言語での使用例:
struct t_hook *my_command_hook =
weechat_hook_command ("abcd", "description",
"args", "description args",
"", &my_command_cb, NULL);
"", &my_command_cb, NULL, NULL);
weechat_hook_set (my_command_hook, "subplugin", "test");
----