api: add modifier "eval_path_home" (issue #60)

v2.8-utf8proc
Sébastien Helleu 2019-10-06 08:57:32 +02:00
parent e921b9f432
commit 1a0ba4a9dc
6 changed files with 53 additions and 0 deletions

View File

@ -23,6 +23,7 @@ New features::
* core: add length of string (number of chars and on screen) in evaluation of expressions with "length:xxx" and "lengthscr:xxx"
* core: add calculation of expression in evaluation of expressions with "calc:xxx" (issue #997)
* api: add modifier "color_encode_ansi" (issue #528)
* api: add modifier "eval_path_home"
* irc: add "user" in output of irc_message_parse (issue #136)
* irc: add options irc.color.message_kick and irc.color.reason_kick (issue #683, issue #684)
* logger: add option logger.file.color_lines (issue #528, issue #621)

View File

@ -11381,6 +11381,13 @@ List of modifiers defined by WeeChat and plugins that can be used:
- |
Any string. |
String with WeeChat colors converted to ANSI colors.
| [[hook_modifier_eval_path_home]] eval_path_home +
_(WeeChat ≥ 2.7)_ |
- |
Any string. |
Evaluated path, result of the function
<<_string_eval_path_home,string_eval_path_home>>.
|===
C example:

View File

@ -11625,6 +11625,14 @@ utilisés :
- |
Toute chaîne. |
Chaîne avec les couleurs WeeChat converties en couleurs ANSI.
// TRANSLATION MISSING
| [[hook_modifier_eval_path_home]] eval_path_home +
_(WeeChat ≥ 2.7)_ |
- |
Toute chaîne. |
Chemin évalué, résultat de la fonction
<<_string_eval_path_home,string_eval_path_home>>.
|===
Exemple en C :

View File

@ -11842,6 +11842,14 @@ List of modifiers defined by WeeChat and plugins that can be used:
- |
Any string. |
String with WeeChat colors converted to ANSI colors.
// TRANSLATION MISSING
| [[hook_modifier_eval_path_home]] eval_path_home +
_(WeeChat ≥ 2.7)_ |
- |
Any string. |
Evaluated path, result of the function
<<_string_eval_path_home,string_eval_path_home>>.
|===
Esempio in C:

View File

@ -11354,6 +11354,14 @@ WeeChat とプラグインが定義する修飾子のリスト:
- |
任意の文字列 |
String with WeeChat colors converted to ANSI colors.
// TRANSLATION MISSING
| [[hook_modifier_eval_path_home]] eval_path_home +
_(WeeChat バージョン 2.7 以上で利用可)_ |
- |
Any string. |
Evaluated path, result of the function
<<_string_eval_path_home,string_eval_path_home>>.
|===
C 言語での使用例:

View File

@ -393,6 +393,25 @@ plugin_api_modifier_color_encode_ansi_cb (const void *pointer, void *data,
return gui_color_encode_ansi (string);
}
/*
* Modifier callback: evaluates a home path.
*/
char *
plugin_api_modifier_eval_path_home_cb (const void *pointer, void *data,
const char *modifier,
const char *modifier_data,
const char *string)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) modifier;
(void) modifier_data;
return string_eval_path_home (string, NULL, NULL, NULL);
}
/*
* Moves item pointer to next item in an infolist.
*
@ -544,6 +563,8 @@ plugin_api_init ()
&plugin_api_modifier_color_decode_ansi_cb, NULL, NULL);
hook_modifier (NULL, "color_encode_ansi",
&plugin_api_modifier_color_encode_ansi_cb, NULL, NULL);
hook_modifier (NULL, "eval_path_home",
&plugin_api_modifier_eval_path_home_cb, NULL, NULL);
/* WeeChat core info/infolist hooks */
plugin_api_info_init ();