From 65a8317153398e033a097e53c678401a4174382c Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 12 Aug 2010 12:54:25 +0200 Subject: [PATCH] Add hook priority in plugin API reference --- doc/en/weechat_plugin_api.en.txt | 41 ++++++++++++++++++++++++-- doc/fr/weechat_plugin_api.fr.txt | 42 +++++++++++++++++++++++++-- doc/it/weechat_plugin_api.it.txt | 50 ++++++++++++++++++++++++++++++-- 3 files changed, 127 insertions(+), 6 deletions(-) diff --git a/doc/en/weechat_plugin_api.en.txt b/doc/en/weechat_plugin_api.en.txt index 2136e5b2d..9e80d7c4e 100644 --- a/doc/en/weechat_plugin_api.en.txt +++ b/doc/en/weechat_plugin_api.en.txt @@ -5501,6 +5501,35 @@ Function is called "log_print" in scripts. Hooks ~~~~~ +[[hook_priority]] +[float] +Hook priority +^^^^^^^^^^^^^ + +_New in version 0.3.4._ + +In some hooks, you can set a priority. A hook with higher priority is at the +beginning of hooks list, so it will be found and executed before other hooks. +It's useful for modifiers, because execution order is important. + +To set a priority, you must use this syntax, for argument where priority is +allowed: "nnn|name" where "nnn" is nonnegative integer with priority and "name" +the name for argument (priority does not appear in name, it is automatically +removed from string). + +Default priority is 1000. + +C example: + +[source,C] +---------------------------------------- +/* hook modifier with priority = 2000 */ +weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL); +---------------------------------------- + +Following hook types allow priority: command, command_run, signal, config, +completion, modifier, info, infolist. + weechat_hook_command ^^^^^^^^^^^^^^^^^^^^ @@ -5526,6 +5555,7 @@ struct t_hook *weechat_hook_command (const char *command, Arguments: * 'command': command name + (priority allowed, see note about <>) * 'description': description for command (displayed with `/help command`) * 'args': arguments for command (displayed with `/help command`) * 'args_description': description of arguments (displayed with `/help command`) @@ -5648,6 +5678,7 @@ struct t_hook *weechat_hook_command_run (const char *command, Arguments: * 'command': command to hook, can start or end with "*" as wildcard + (priority allowed, see note about <>) * 'callback': function called when command is run, arguments: ** 'void *data': pointer ** 'struct t_gui_buffer *buffer': buffer where command is executed @@ -6173,7 +6204,8 @@ struct t_hook *weechat_hook_signal (const char *signal, Arguments: -* 'signal': signal to catch, can begin or end with "*": +* 'signal': signal to catch, can begin or end with "*" + (priority allowed, see note about <>): [width="100%",cols="^1,^3,^4,5",options="header"] |======================================== @@ -6484,6 +6516,7 @@ Arguments: * 'option': option, format is full name, as used with command `/set` (for example: `weechat.look.item_time_format`) + (priority allowed, see note about <>) * 'callback': function called when configuration option is changed, arguments: ** 'void *data': pointer ** 'const char *option': name of option @@ -6548,6 +6581,7 @@ Arguments: * 'completion_item': name of completion item, after you can use '%(name)' in a command hooked (argument 'completion') + (priority allowed, see note about <>) * 'description': description of completion * 'callback': function called when completion item is used (user is completing something using this item), arguments: @@ -6662,7 +6696,8 @@ struct t_hook *weechat_hook_modifier (const char *modifier, Arguments: -* 'modifier': modifier name, list of modifiers used by Weechat or plugins: +* 'modifier': modifier name, list of modifiers used by Weechat or plugins + (priority allowed, see note about <>): [width="100%",cols="^1,^2,3,4,4",options="header"] |======================================== @@ -6853,6 +6888,7 @@ struct t_hook *weechat_hook_info (const char *info_name, Arguments: * 'info_name': name of info + (priority allowed, see note about <>) * 'description': description * 'args_description': description of arguments (optional, can be NULL) * 'callback': function called when info is asked, arguments: @@ -6921,6 +6957,7 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name, Arguments: * 'infolist_name': name of infolist + (priority allowed, see note about <>) * 'description': description * 'pointer_description': description of pointer (optional, can be NULL) * 'args_description': description of arguments (optional, can be NULL) diff --git a/doc/fr/weechat_plugin_api.fr.txt b/doc/fr/weechat_plugin_api.fr.txt index 65bfb5135..e37799c82 100644 --- a/doc/fr/weechat_plugin_api.fr.txt +++ b/doc/fr/weechat_plugin_api.fr.txt @@ -5564,6 +5564,36 @@ La fonction s'appelle "log_print" dans les scripts. Hooks ~~~~~ +[[hook_priority]] +[float] +Hook priority +^^^^^^^^^^^^^ + +_Nouveau dans la version 0.3.4._ + +Pour certains "hooks", vous pouvez définir une priorité. Un "hook" avec une +priorité plus élevée sera au début de la liste des "hooks", et donc il sera +trouvé et exécuté avant les autres "hooks". Cela est pratique pour les +"modifieurs", car l'ordre d'exécution est important. + +Pour définir une priorité, vous devez utiliser cette syntaxe, pour un paramètre +où la priorité est autorisée : "nnn|nom" où "nnn" est un entier positif ou nul +avec la priorité et "nom" le nom pour le paramètre (la priorité n'apparaît pas +dans le nom, elle est automatiquement retirée de la chaîne). + +La priorité par défaut est 1000. + +Exemple en C : + +[source,C] +---------------------------------------- +/* accroche un modifieur avec priorité = 2000 */ +weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL); +---------------------------------------- + +Les types de "hooks" suivants autorisent une priorité : command, command_run, +signal, config, completion, modifier, info, infolist. + weechat_hook_command ^^^^^^^^^^^^^^^^^^^^ @@ -5589,6 +5619,7 @@ struct t_hook *weechat_hook_command (const char *command, Paramètres : * 'command' : nom de la commande + (priorité autorisée, voir la note sur la <>) * 'description' : description de la commande (affiché avec `/help command`) * 'args' : paramètres pour la commande (affichés avec `/help command`) * 'args_description' : description des paramètres (affichée avec @@ -5715,6 +5746,7 @@ Paramètres : * 'command' : commande à intercepter, peut commencer ou se terminer par le caractère joker "*" + (priorité autorisée, voir la note sur la <>) * 'callback' : fonction appelée lorsque la commande est exécutée, paramètres : ** 'void *data' : pointeur ** 'struct t_gui_buffer *buffer' : tampon où la command est exécutée @@ -6253,7 +6285,8 @@ struct t_hook *weechat_hook_signal (const char *signal, Paramètres : -* 'signal' : signal à intercepter, peut commencer ou se terminer par "*" : +* 'signal' : signal à intercepter, peut commencer ou se terminer par "*" + (priorité autorisée, voir la note sur la <>) : [width="100%",cols="^1,^3,^4,5",options="header"] |======================================== @@ -6565,6 +6598,7 @@ Paramètres : * 'option' : option, le format est le nom complet, celui utilisé avec la commande `/set` (par exemple : `weechat.look.item_time_format`) + (priorité autorisée, voir la note sur la <>) * 'callback' : fonction appelée lorsque l'option de configuration est modifiée, paramètres : ** 'void *data' : pointeur @@ -6631,6 +6665,7 @@ Paramètres : * 'completion_item' : nom de l'objet de complétion, après vous pouvez utiliser '%(nom)' dans une commande (paramètre 'completion') + (priorité autorisée, voir la note sur la <>) * 'description': description de la complétion * '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 @@ -6748,7 +6783,8 @@ struct t_hook *weechat_hook_modifier (const char *modifier, Paramètres : * 'modifier' : nom du "modifieur", liste des "modifieurs" utilisés par WeeChat - ou des extensions : + ou des extensions + (priorité autorisée, voir la note sur la <>) : [width="100%",cols="^1,^2,3,4,4",options="header"] |======================================== @@ -6946,6 +6982,7 @@ struct t_hook *weechat_hook_info (const char *info_name, Paramètres : * 'info_name' : nom de l'information + (priorité autorisée, voir la note sur la <>) * 'description' : description * 'args_description' : description des paramètres (optionnel, peut être NULL) * 'callback' : fonction appelée quand l'information est demandée, paramètres : @@ -7018,6 +7055,7 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name, Paramètres : * 'infolist_name' : nom de l'infolist + (priorité autorisée, voir la note sur la <>) * 'description' : description * 'pointer_description' : description du pointeur (optionnel, peut être NULL) * 'args_description' : description des paramètres (optionnel, peut être NULL) diff --git a/doc/it/weechat_plugin_api.it.txt b/doc/it/weechat_plugin_api.it.txt index f759fcc32..22489762c 100644 --- a/doc/it/weechat_plugin_api.it.txt +++ b/doc/it/weechat_plugin_api.it.txt @@ -5557,6 +5557,36 @@ La funzione è chiamata "log_print" negli script. Hook ~~~~ +// TRANSLATION MISSING +[[hook_priority]] +[float] +Hook priority +^^^^^^^^^^^^^ + +_Novità nella versione 0.3.4._ + +In some hooks, you can set a priority. A hook with higher priority is at the +beginning of hooks list, so it will be found and executed before other hooks. +It's useful for modifiers, because execution order is important. + +To set a priority, you must use this syntax, for argument where priority is +allowed: "nnn|name" where "nnn" is nonnegative integer with priority and "name" +the name for argument (priority does not appear in name, it is automatically +removed from string). + +Default priority is 1000. + +C example: + +[source,C] +---------------------------------------- +/* hook modifier with priority = 2000 */ +weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL); +---------------------------------------- + +Following hook types allow priority: command, command_run, signal, config, +completion, modifier, info, infolist. + weechat_hook_command ^^^^^^^^^^^^^^^^^^^^ @@ -5582,6 +5612,8 @@ struct t_hook *weechat_hook_command (const char *command, Argomenti: * 'command': nome del comando +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'description': descrizione per il comando (visualizzata con `/help comando`) * 'args': argomenti per il comando (visualizzati con `/help command`) * 'args_description': descrizione degli argomenti (visualizzata con `/help command`) @@ -5706,6 +5738,8 @@ struct t_hook *weechat_hook_command_run (const char *command, Argomenti: * 'command': comando su cui eseguire l'hook, può iniziare o terminare con "*" +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'callback': funzione chiamata quando il comando è in esecuzione, argomenti: ** 'void *data': puntatore ** 'struct t_gui_buffer *buffer': buffer dove viene eseguito il comando @@ -6235,7 +6269,9 @@ struct t_hook *weechat_hook_signal (const char *signal, Argomenti: -* 'signal': segnale da catturare, può iniziare o terminare con "*": +* 'signal': segnale da catturare, può iniziare o terminare con "*" +// TRANSLATION MISSING + (priority allowed, see note about <>): [width="100%",cols="^1,^3,^4,5",options="header"] |======================================== @@ -6552,6 +6588,8 @@ Argomenti: * 'option': opzione, il formato è il nome completo, come usato con il comando `/set` (ad esempio: `weechat.look.item_time_format`) +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'callback': function called when configuration option is changed, arguments: ** 'void *data': pointer ** 'const char *option': name of option @@ -6616,6 +6654,8 @@ Argomenti: * 'completion_item': nome dell'elemento del completamento, è possibile usare in seguito '%(name)' in un comando con un hook (argomento 'completion') +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'callback': funzione chiamata quando viene usato l'elemento completamento (l'utente sta completando qualcosa usando questo elemento), argomenti: ** 'void *data': puntatore @@ -6731,7 +6771,9 @@ struct t_hook *weechat_hook_modifier (const char *modifier, Argomenti: * 'modifier': nome modificatore, lista di modificatori utilizzati da - Weechat o dai plugin: + Weechat o dai plugin +// TRANSLATION MISSING + (priority allowed, see note about <>): [width="100%",cols="^1,^2,3,4,4",options="header"] |======================================== @@ -6927,6 +6969,8 @@ struct t_hook *weechat_hook_info (const char *info_name, Argomenti: * 'info_name': nome della info +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'description': descrizione * 'args_description': descrizione degli argomenti * 'callback': funzione chiamata alla richiesta di una info, argomenti: @@ -6996,6 +7040,8 @@ struct t_hook *weechat_hook_infolist (const char *infolist_name, Argomenti: * 'infolist_name': nome della lista info +// TRANSLATION MISSING + (priority allowed, see note about <>) * 'description': descrizione * 'pointer_description': descrizione del puntatore (opzionale, può essere NULL) * 'args_description': descrizione degli argomenti (opzionale, può essere NULL)