trigger: add variables "tg_prefix_nocolor" and "tg_message_nocolor" in line trigger

v2.8-utf8proc
Sébastien Helleu 2018-08-17 07:59:20 +02:00
parent e7096810c4
commit 968d7ede29
7 changed files with 106 additions and 80 deletions

View File

@ -3994,19 +3994,21 @@ Der Callback von "line" legt folgende Variablen in der Hashtable an:
// TRANSLATION MISSING
[width="100%",cols="3m,2,14",options="header"]
|===
| Variable | Typ | Beschreibung
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| message | string | Message.
| Variable | Typ | Beschreibung
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| tg_prefix_nocolor | string | Prefix without color codes.
| message | string | Message.
| tg_message_nocolor | string | Message without color codes.
|===
// TRANSLATION MISSING

View File

@ -3899,19 +3899,21 @@ The "line" callback sets following variables in hashtable:
[width="100%",cols="3m,2,14",options="header"]
|===
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| message | string | Message.
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| tg_prefix_nocolor | string | Prefix without color codes.
| message | string | Message.
| tg_message_nocolor | string | Message without color codes.
|===
Variables set using tags in message (they are also set in _print_ callback and

View File

@ -4030,19 +4030,21 @@ de hachage :
[width="100%",cols="3m,2,14",options="header"]
|===
| Variable | Type | Description
| buffer | pointeur | Tampon.
| buffer_name | chaîne | Nom du tampon.
| buffer_type | chaîne | Type de tampon ("formatted" ou "free").
| y | chaîne | Numéro de ligne pour un tampon avec contenu libre (≥ 0), -1 pour un tampon avec contenu formaté.
| date | chaîne | Date de la ligne (horodatage).
| date_printed | chaîne | Date d'affichage de la ligne (horodatage).
| str_time | chaîne | Date pour l'affichage. Elle peut contenir des codes couleur.
| displayed | chaîne | "1" si affichée, "0" si la ligne est filtrée.
| notify_level | chaîne | "0" = niveau bas, "1" = message, "2" = message privé, "3" = highlight
| highlight | chaîne | "1" si highlight, sinon "0".
| prefix | chaîne | Préfixe.
| message | chaîne | Message.
| Variable | Type | Description
| buffer | pointeur | Tampon.
| buffer_name | chaîne | Nom du tampon.
| buffer_type | chaîne | Type de tampon ("formatted" ou "free").
| y | chaîne | Numéro de ligne pour un tampon avec contenu libre (≥ 0), -1 pour un tampon avec contenu formaté.
| date | chaîne | Date de la ligne (horodatage).
| date_printed | chaîne | Date d'affichage de la ligne (horodatage).
| str_time | chaîne | Date pour l'affichage. Elle peut contenir des codes couleur.
| displayed | chaîne | "1" si affichée, "0" si la ligne est filtrée.
| notify_level | chaîne | "0" = niveau bas, "1" = message, "2" = message privé, "3" = highlight
| highlight | chaîne | "1" si highlight, sinon "0".
| prefix | chaîne | Préfixe.
| tg_prefix_nocolor | chaîne | Préfixe sans les codes couleur.
| message | chaîne | Message.
| tg_message_nocolor | chaîne | Message sans les codes couleur.
|===
Variables définies avec les étiquettes du message (elles sont définies aussi

View File

@ -4160,19 +4160,21 @@ The "line" callback sets following variables in hashtable:
[width="100%",cols="3m,2,14",options="header"]
|===
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| message | string | Message.
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| tg_prefix_nocolor | string | Prefix without color codes.
| message | string | Message.
| tg_message_nocolor | string | Message without color codes.
|===
Variables set using tags in message (they are also set in _print_ callback and

View File

@ -3897,20 +3897,22 @@ _weechat_print_ 修飾子では、メッセージタグを使う変数 (下の
// TRANSLATION MISSING
[width="100%",cols="3m,2,14",options="header"]
|===
| 変数 | 型 | 説明
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| message | string | Message.
| 変数 | 型 | 説明
| Variable | Type | Description
| buffer | pointer | Buffer.
| buffer_name | string | Buffer name.
| buffer_type | string | Buffer type ("formatted" or "free").
| y | string | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | string | Line date (timestamp).
| date_printed | string | Date when line was displayed (timestamp).
| str_time | string | Date for display. It may contain color codes.
| displayed | string | "1" if displayed, "0" if line filtered.
| notify_level | string | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | string | "1" if highlight, otherwise "0".
| prefix | string | Prefix.
| tg_prefix_nocolor | string | Prefix without color codes.
| message | string | Message.
| tg_message_nocolor | string | Message without color codes.
|===
// TRANSLATION MISSING

View File

@ -3931,19 +3931,21 @@ Callback "line" ustawia następujące zmienne w tablicy hashy:
// TRANSLATION MISSING
[width="100%",cols="3m,2,14",options="header"]
|===
| Zmienna | Typ | Opis
| buffer | wskaźnik | Buffer.
| buffer_name | ciąg | Buffer name.
| buffer_type | ciąg | Buffer type ("formatted" or "free").
| y | ciąg | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | ciąg | Line date (timestamp).
| date_printed | ciąg | Date when line was displayed (timestamp).
| str_time | ciąg | Date for display. It may contain color codes.
| displayed | ciąg | "1" if displayed, "0" if line filtered.
| notify_level | ciąg | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | ciąg | "1" if highlight, otherwise "0".
| prefix | ciąg | Prefix.
| message | ciąg | Message.
| Zmienna | Typ | Opis
| buffer | wskaźnik | Buffer.
| buffer_name | ciąg | Buffer name.
| buffer_type | ciąg | Buffer type ("formatted" or "free").
| y | ciąg | Line number for a buffer with free content (≥ 0), -1 for a buffer with formatted content.
| date | ciąg | Line date (timestamp).
| date_printed | ciąg | Date when line was displayed (timestamp).
| str_time | ciąg | Date for display. It may contain color codes.
| displayed | ciąg | "1" if displayed, "0" if line filtered.
| notify_level | ciąg | "0" = low level, "1" = message, "2" = private message, "3" = highlight
| highlight | ciąg | "1" if highlight, otherwise "0".
| prefix | ciąg | Prefiks.
| tg_prefix_nocolor | ciag | Prefiks bez kodów kolorów.
| message | ciąg | Wiadomość.
| tg_message_nocolor | ciag | Wiadomość bez kodów kolorów.
|===
// TRANSLATION MISSING

View File

@ -789,7 +789,7 @@ trigger_callback_line_cb (const void *pointer, void *data,
struct t_weelist_item *ptr_item;
long unsigned int value;
const char *ptr_key, *ptr_value;
char **tags, *str_tags;
char **tags, *str_tags, *string_no_color;
int rc, num_tags, length;
TRIGGER_CALLBACK_CB_INIT(NULL);
@ -831,6 +831,20 @@ trigger_callback_line_cb (const void *pointer, void *data,
free (str_tags);
}
/* build prefix without colors */
ptr_value = weechat_hashtable_get (line, "prefix");
string_no_color = weechat_string_remove_color (ptr_value, NULL);
weechat_hashtable_set (extra_vars, "tg_prefix_nocolor", string_no_color);
if (string_no_color)
free (string_no_color);
/* build message without colors */
ptr_value = weechat_hashtable_get (line, "message");
string_no_color = weechat_string_remove_color (ptr_value, NULL);
weechat_hashtable_set (extra_vars, "tg_message_nocolor", string_no_color);
if (string_no_color)
free (string_no_color);
if (!trigger_callback_set_tags (buffer, (const char **)tags, num_tags,
extra_vars))
{