Add hook priority in plugin API reference

v2.8-utf8proc
Sebastien Helleu 2010-08-12 12:54:25 +02:00
parent 0890179398
commit 65a8317153
3 changed files with 127 additions and 6 deletions

View File

@ -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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>):
[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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>):
[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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* 'description': description
* 'pointer_description': description of pointer (optional, can be NULL)
* 'args_description': description of arguments (optional, can be NULL)

View File

@ -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 <<hook_priority,priorité>>)
* '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 <<hook_priority,priorité>>)
* '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 <<hook_priority,priorité>>) :
[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 <<hook_priority,priorité>>)
* '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 <<hook_priority,priorité>>)
* '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 <<hook_priority,priorité>>) :
[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 <<hook_priority,priorité>>)
* '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 <<hook_priority,priorité>>)
* 'description' : description
* 'pointer_description' : description du pointeur (optionnel, peut être NULL)
* 'args_description' : description des paramètres (optionnel, peut être NULL)

View File

@ -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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>):
[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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>):
[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 <<hook_priority,priority>>)
* '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 <<hook_priority,priority>>)
* 'description': descrizione
* 'pointer_description': descrizione del puntatore (opzionale, può essere NULL)
* 'args_description': descrizione degli argomenti (opzionale, può essere NULL)