Skip to content

Commit

Permalink
api: add modifier "eval_path_home" (issue #60)
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed Oct 6, 2019
1 parent e921b9f commit 1a0ba4a
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -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 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) * 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 "color_encode_ansi" (issue #528)
* api: add modifier "eval_path_home"
* irc: add "user" in output of irc_message_parse (issue #136) * 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) * 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) * logger: add option logger.file.color_lines (issue #528, issue #621)
Expand Down
7 changes: 7 additions & 0 deletions doc/en/weechat_plugin_api.en.adoc
Expand Up @@ -11381,6 +11381,13 @@ List of modifiers defined by WeeChat and plugins that can be used:
- | - |
Any string. | Any string. |
String with WeeChat colors converted to ANSI colors. 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: C example:
Expand Down
8 changes: 8 additions & 0 deletions doc/fr/weechat_plugin_api.fr.adoc
Expand Up @@ -11625,6 +11625,14 @@ utilisés :
- | - |
Toute chaîne. | Toute chaîne. |
Chaîne avec les couleurs WeeChat converties en couleurs ANSI. 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 : Exemple en C :
Expand Down
8 changes: 8 additions & 0 deletions doc/it/weechat_plugin_api.it.adoc
Expand Up @@ -11842,6 +11842,14 @@ List of modifiers defined by WeeChat and plugins that can be used:
- | - |
Any string. | Any string. |
String with WeeChat colors converted to ANSI colors. 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: Esempio in C:
Expand Down
8 changes: 8 additions & 0 deletions doc/ja/weechat_plugin_api.ja.adoc
Expand Up @@ -11354,6 +11354,14 @@ WeeChat とプラグインが定義する修飾子のリスト:
- | - |
任意の文字列 | 任意の文字列 |
String with WeeChat colors converted to ANSI colors. 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 言語での使用例: C 言語での使用例:
Expand Down
21 changes: 21 additions & 0 deletions src/plugins/plugin-api.c
Expand Up @@ -393,6 +393,25 @@ plugin_api_modifier_color_encode_ansi_cb (const void *pointer, void *data,
return gui_color_encode_ansi (string); 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. * Moves item pointer to next item in an infolist.
* *
Expand Down Expand Up @@ -544,6 +563,8 @@ plugin_api_init ()
&plugin_api_modifier_color_decode_ansi_cb, NULL, NULL); &plugin_api_modifier_color_decode_ansi_cb, NULL, NULL);
hook_modifier (NULL, "color_encode_ansi", hook_modifier (NULL, "color_encode_ansi",
&plugin_api_modifier_color_encode_ansi_cb, NULL, NULL); &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 */ /* WeeChat core info/infolist hooks */
plugin_api_info_init (); plugin_api_info_init ();
Expand Down

0 comments on commit 1a0ba4a

Please sign in to comment.