* api: rename function string_build_with_split_string to string_rebuild_split_string, add arguments "index_start" and "index_end"
* api: add info "uptime_current"
* api: add function crypto_hash_file
+ * api: add support of priority in function hook_line (issue #1821)
* buflist: add variable `${hotlist_priority_number}` (integer version of `${hotlist_priority}`)
* irc: display SETNAME command in channels and private buffers, add options irc.color.message_setname and irc.look.smart_filter_setname (issue #1805)
* irc: add option irc.look.display_pv_nick_change
[source,c]
----
/* hook modifier with priority = 2000 */
+/* high priority: called before other modifier calbacks */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
/* hook two signals with priority = 3000 */
+/* high priority: called before other signal callbacks */
weechat_hook_signal ("3000|quit;upgrade", &signal_cb, NULL, NULL);
+
+/* hook lines printed in formatted buffers with priority = 500 */
+/* low priority: called after other line callbacks */
+weechat_hook_line ("500|formatted", "*", NULL, &line_cb, NULL, NULL);
----
Following hook types allow priority:
* <<_hook_command,command>>
* <<_hook_completion,completion>>
* <<_hook_command_run,command_run>>
+* <<_hook_line,line>>
* <<_hook_signal,signal>>
* <<_hook_hsignal,hsignal>>
* <<_hook_config,config>>
==== hook_line
-_WeeChat ≥ 2.3._
+_WeeChat ≥ 2.3, updated in 3.7._
Hook a line to be printed in a buffer.
Arguments:
* _buffer_type_: catch lines on the given buffer type (if NULL or empty string,
- _formatted_ is the default):
+ _formatted_ is the default)
+ (a priority is allowed before the buffer type, see note about <<hook_priority,priority>>):
** _formatted_: catch lines on formatted buffers only (default)
** _free_: catch lines on buffers with free content only
** _*_: catch lines on all buffer types
[source,c]
----
/* accrocher un modificateur avec priorité = 2000 */
+/* haute priorité : appelé avant les autres fonctions de rappel "modifier" */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
/* accrocher deux signaux avec priorité = 3000 */
+/* haute priorité : appelé avant les autres fonctions de rappel "signal" */
weechat_hook_signal ("3000|quit;upgrade", &signal_cb, NULL, NULL);
+
+/* accrocher les lignes affichées dans les tampons formatés avec priorité = 500 */
+/* basse priorité : appelé après les autres fonctions de rappel "line" */
+weechat_hook_line ("500|formatted", "*", NULL, &line_cb, NULL, NULL);
----
Les types de "hooks" suivants autorisent une priorité :
* <<_hook_command,command>>
* <<_hook_completion,completion>>
* <<_hook_command_run,command_run>>
+* <<_hook_line,line>>
* <<_hook_signal,signal>>
* <<_hook_hsignal,hsignal>>
* <<_hook_config,config>>
==== hook_line
-_WeeChat ≥ 2.3._
+_WeeChat ≥ 2.3, mis à jour dans la 3.7._
Intercepter une ligne sur le point d'être affichée dans un tampon.
"hook").
[NOTE]
-The "line" hook is the only one among these three hooks that can work on
-buffers with free content.
+Le "hook" "line" est le seul parmi ces trois "hooks" qui peut fonctionner sur
+un tampon avec contenu libre.
Prototype :
Paramètres :
* _buffer_type_ : intercepter les lignes affichées sur ce type de tampon
- (si NULL ou chaîne vide, _formatted_ est utilisé par défaut) :
+ (si NULL ou chaîne vide, _formatted_ est utilisé par défaut)
+ (une priorité est autorisée avant le type de tampon, voir la note sur la <<hook_priority,priorité>>) :
** _formatted_ : intercepter les lignes sur un tampon avec contenu formaté
seulement (par défaut)
** _free_ : intercepter les lignes sur un tampon avec contenu libre seulement
[source,c]
----
/* hook per il modificatore con priorità = 2000 */
+/* high priority: called before other modifier calbacks */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
/* hook two signals with priority = 3000 */
+/* high priority: called before other signal callbacks */
weechat_hook_signal ("3000|quit;upgrade", &signal_cb, NULL, NULL);
+
+/* hook lines printed in formatted buffers with priority = 500 */
+/* low priority: called after other line callbacks */
+weechat_hook_line ("500|formatted", "*", NULL, &line_cb, NULL, NULL);
----
I tipi di hook che seguono consentono la priorità:
* <<_hook_command,command>>
* <<_hook_completion,completion>>
* <<_hook_command_run,command_run>>
+* <<_hook_line,line>>
* <<_hook_signal,signal>>
* <<_hook_hsignal,hsignal>>
* <<_hook_config,config>>
// TRANSLATION MISSING
==== hook_line
-_WeeChat ≥ 2.3._
+_WeeChat ≥ 2.3, updated in 3.7._
Hook a line to be printed in a buffer.
Argomenti:
* _buffer_type_: catch lines on the given buffer type (if NULL or empty string,
- _formatted_ is the default):
+ _formatted_ is the default)
+ (a priority is allowed before the buffer type, see note about <<hook_priority,priority>>):
** _formatted_: catch lines on formatted buffers only (default)
** _free_: catch lines on buffers with free content only
** _*_: catch lines on all buffer types
[source,c]
----
/* hook modifier with priority = 2000 */
+/* high priority: called before other modifier calbacks */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
/* hook two signals with priority = 3000 */
+/* high priority: called before other signal callbacks */
weechat_hook_signal ("3000|quit;upgrade", &signal_cb, NULL, NULL);
+
+/* hook lines printed in formatted buffers with priority = 500 */
+/* low priority: called after other line callbacks */
+weechat_hook_line ("500|formatted", "*", NULL, &line_cb, NULL, NULL);
----
以下のフック型に対して優先度を設定できます:
* <<_hook_command,command>>
* <<_hook_completion,completion>>
* <<_hook_command_run,command_run>>
+* <<_hook_line,line>>
* <<_hook_signal,signal>>
* <<_hook_hsignal,hsignal>>
* <<_hook_config,config>>
==== hook_line
-_WeeChat バージョン 2.3 以上で利用可_
+// TRANSLATION MISSING
+_WeeChat ≥ 2.3, updated in 3.7._
バッファに対する行表示をフックする。
引数:
* _buffer_type_: ここで指定したバッファ型の行をフックします (NULL または空文字列の場合、
- _formatted_ を指定したことになります):
+ _formatted_ を指定したことになります)
+ (a priority is allowed before the buffer type, see note about <<hook_priority,priority>>):
** _formatted_: フォーマット済み内容バッファの行のみをフックします (デフォルト)
** _free_: 自由内容バッファの行のみをフックします
** _*_: すべてのバッファの行をフックします
[source,c]
----
/* модификатор кука са приоритетом = 2000 */
+/* high priority: called before other modifier calbacks */
weechat_hook_modifier ("2000|input_text_display", &modifier_cb, NULL, NULL);
/* hook two signals with priority = 3000 */
+/* high priority: called before other signal callbacks */
weechat_hook_signal ("3000|quit;upgrade", &signal_cb, NULL, NULL);
+
+/* hook lines printed in formatted buffers with priority = 500 */
+/* low priority: called after other line callbacks */
+weechat_hook_line ("500|formatted", "*", NULL, &line_cb, NULL, NULL);
----
Приоритет дозвољавају следећи типови кука:
* <<_hook_command,command>>
* <<_hook_completion,completion>>
* <<_hook_command_run,command_run>>
+* <<_hook_line,line>>
* <<_hook_signal,signal>>
* <<_hook_hsignal,hsignal>>
* <<_hook_config,config>>
==== hook_line
-_WeeChat ≥ 2.3._
+// TRANSLATION MISSING
+_WeeChat ≥ 2.3, updated in 3.7._
Качи се на линију која треба да се испише у бафер.
Аргументи:
-* _buffer_type_: хвата линије у наведеном типу бафера (ако је NULL или празан стринг, подразумева се _formatted_):
+// TRANSLATION MISSING
+* _buffer_type_: хвата линије у наведеном типу бафера (ако је NULL или празан стринг, подразумева се _formatted_)
+ (a priority is allowed before the buffer type, see note about <<hook_priority,приоритетима>>):
** _formatted_: хвата линије само у форматираним баферима (подразумевано)
** _free_: хвата линије само у баферима са слободним садржајем
** _*_: хвата линије у баферима свих типова
{
struct t_hook *new_hook;
struct t_hook_line *new_hook_line;
+ int priority;
+ const char *ptr_buffer_type;
if (!callback)
return NULL;
return NULL;
}
- hook_init_data (new_hook, plugin, HOOK_TYPE_LINE, HOOK_PRIORITY_DEFAULT,
+ hook_get_priority_and_name (buffer_type, &priority, &ptr_buffer_type);
+ hook_init_data (new_hook, plugin, HOOK_TYPE_LINE, priority,
callback_pointer, callback_data);
new_hook->hook_data = new_hook_line;
new_hook_line->callback = callback;
- if (!buffer_type || !buffer_type[0])
+ if (!ptr_buffer_type || !ptr_buffer_type[0])
new_hook_line->buffer_type = GUI_BUFFER_TYPE_DEFAULT;
- else if (strcmp (buffer_type, "*") == 0)
+ else if (strcmp (ptr_buffer_type, "*") == 0)
new_hook_line->buffer_type = -1;
else
- new_hook_line->buffer_type = gui_buffer_search_type (buffer_type);
+ new_hook_line->buffer_type = gui_buffer_search_type (ptr_buffer_type);
new_hook_line->buffers = string_split (
(buffer_name && buffer_name[0]) ? buffer_name : "*",
",",
if (name)
*name = string;
+ if (!string)
+ return;
+
pos = strchr (string, '|');
if (pos)
{