From ae6113721631de178a3317c28cf567e093df9549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 30 Sep 2022 21:32:27 +0200 Subject: [PATCH] trigger: add variable `${tg_hook_type}` (closes #1765) --- ChangeLog.adoc | 1 + doc/de/weechat_user.de.adoc | 2 ++ doc/en/weechat_user.en.adoc | 1 + doc/fr/weechat_user.fr.adoc | 1 + doc/it/weechat_user.it.adoc | 1 + doc/ja/weechat_user.ja.adoc | 2 ++ doc/pl/weechat_user.pl.adoc | 2 ++ doc/sr/weechat_user.sr.adoc | 2 ++ src/plugins/trigger/trigger-callback.c | 4 ++++ 9 files changed, 16 insertions(+) diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 6aff9386f..e2f199e65 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -36,6 +36,7 @@ New features:: * logger: add options to rotate and compress log files: logger.file.rotation_compression_level, logger.file.rotation_compression_type and logger.file.rotation_size_max (issue #314) * spell: allow special dict value "-" to disable spell checking on a specific buffer (issue #1699) * trigger: add elapsed time for trigger execution on monitor buffer when trigger debug is set, add option trigger.color.identifier (issue #1806) + * trigger: add variable `${tg_hook_type}` (issue #1765) Bug fixes:: diff --git a/doc/de/weechat_user.de.adoc b/doc/de/weechat_user.de.adoc index 4a37a7018..a587800fc 100644 --- a/doc/de/weechat_user.de.adoc +++ b/doc/de/weechat_user.de.adoc @@ -5060,6 +5060,8 @@ Alle Callbacks setzen folgende Variablen in das hashtable: |=== | Variable | Typ | Beschreibung | tg_trigger_name | string | Name des Trigger. +// TRANSLATION MISSING +| tg_hook_type | string | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index 05cb89752..91106fad6 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -4941,6 +4941,7 @@ All callbacks set following variables in hashtable: |=== | Variable | Type | Description | tg_trigger_name | string | Name of trigger. +| tg_hook_type | string | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/fr/weechat_user.fr.adoc b/doc/fr/weechat_user.fr.adoc index dc9261d42..da4d56a05 100644 --- a/doc/fr/weechat_user.fr.adoc +++ b/doc/fr/weechat_user.fr.adoc @@ -5104,6 +5104,7 @@ de hachage : |=== | Variable | Type | Description | tg_trigger_name | chaîne | Nom du trigger. +| tg_hook_type | chaîne | Type de hook : "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/it/weechat_user.it.adoc b/doc/it/weechat_user.it.adoc index be7fd1648..b28e8e913 100644 --- a/doc/it/weechat_user.it.adoc +++ b/doc/it/weechat_user.it.adoc @@ -5286,6 +5286,7 @@ All callbacks set following variables in hashtable: |=== | Variable | Type | Description | tg_trigger_name | string | Name of trigger. +| tg_hook_type | string | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/ja/weechat_user.ja.adoc b/doc/ja/weechat_user.ja.adoc index d5d5fdca6..cc27b1a02 100644 --- a/doc/ja/weechat_user.ja.adoc +++ b/doc/ja/weechat_user.ja.adoc @@ -5099,6 +5099,8 @@ All callbacks set following variables in hashtable: | 変数 | 型 | 説明 // TRANSLATION MISSING | tg_trigger_name | string | Name of trigger. +// TRANSLATION MISSING +| tg_hook_type | string | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/pl/weechat_user.pl.adoc b/doc/pl/weechat_user.pl.adoc index 106e2e0ff..6e2fa32d0 100644 --- a/doc/pl/weechat_user.pl.adoc +++ b/doc/pl/weechat_user.pl.adoc @@ -5014,6 +5014,8 @@ Wszystkie callbacki ustawiają następujące zmienne w tablicy hashy: |=== | Zmienna | Typ | Opis | tg_trigger_name | ciąg | Nazwa triggera. +// TRANSLATION MISSING +| tg_hook_type | ciąg | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/doc/sr/weechat_user.sr.adoc b/doc/sr/weechat_user.sr.adoc index 58b3fff17..fb1dc3bb9 100644 --- a/doc/sr/weechat_user.sr.adoc +++ b/doc/sr/weechat_user.sr.adoc @@ -4655,6 +4655,8 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv}) |=== | Променљива | Тип | Опис | tg_trigger_name | стринг | Име окидача. +// TRANSLATION MISSING +| tg_hook_type | стринг | Hook type: "signal", "command", etc. |=== [[trigger_data_signal]] diff --git a/src/plugins/trigger/trigger-callback.c b/src/plugins/trigger/trigger-callback.c index 61f4fdfe1..8c4b1a7fa 100644 --- a/src/plugins/trigger/trigger-callback.c +++ b/src/plugins/trigger/trigger-callback.c @@ -144,6 +144,10 @@ trigger_callback_set_common_vars (struct t_trigger *trigger, return; weechat_hashtable_set (hashtable, "tg_trigger_name", trigger->name); + weechat_hashtable_set ( + hashtable, "tg_hook_type", + trigger_hook_type_string[ + weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])]); } /*