summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2020-11-14 09:32:24 +0100
committerSébastien Helleu <flashcode@flashtux.org>2020-11-14 09:32:24 +0100
commitb9c8569422e0c13d3dc51bffce6e72b7306cc23e (patch)
treed3b7869edb73f7d05f014c8219c098b5f5e695a3
parentb626df72fb7cdc9d9f23a0e5a81209faace87c0f (diff)
downloadweechat-b9c8569422e0c13d3dc51bffce6e72b7306cc23e.zip
trigger: add variable "${tg_trigger_name}" in command trigger evaluated strings (closes #1580)
${tg_trigger_name} is replaced by the trigger name in these command strings: - description - arguments - description of arguments - completion
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/de/includes/autogen_user_commands.de.adoc118
-rw-r--r--doc/en/includes/autogen_user_commands.en.adoc2
-rw-r--r--doc/fr/includes/autogen_user_commands.fr.adoc2
-rw-r--r--doc/it/includes/autogen_user_commands.it.adoc2
-rw-r--r--doc/ja/includes/autogen_user_commands.ja.adoc2
-rw-r--r--doc/pl/includes/autogen_user_commands.pl.adoc2
-rw-r--r--po/cs.po5
-rw-r--r--po/de.po6
-rw-r--r--po/es.po5
-rw-r--r--po/fr.po10
-rw-r--r--po/hu.po5
-rw-r--r--po/it.po5
-rw-r--r--po/ja.po5
-rw-r--r--po/pl.po5
-rw-r--r--po/pt.po5
-rw-r--r--po/pt_BR.po5
-rw-r--r--po/ru.po5
-rw-r--r--po/tr.po5
-rw-r--r--po/weechat.pot5
-rw-r--r--src/plugins/trigger/trigger-command.c3
-rw-r--r--src/plugins/trigger/trigger.c20
22 files changed, 126 insertions, 97 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index ceb11855b..2d77866a4 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -21,6 +21,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add evaluation of conditions in evaluation of expressions with "eval_cond:" (issue #1582)
+ * trigger: add variable "${tg_trigger_name}" in command trigger evaluated strings (issue #1580)
Bug fixes::
diff --git a/doc/de/includes/autogen_user_commands.de.adoc b/doc/de/includes/autogen_user_commands.de.adoc
index 57dbcc3b6..2589ad5d4 100644
--- a/doc/de/includes/autogen_user_commands.de.adoc
+++ b/doc/de/includes/autogen_user_commands.de.adoc
@@ -2936,70 +2936,70 @@ Ohne Angabe eines Argumentes listet dieser Befehl alle geladenen Skripten auf.
default -yes
monitor [<filter>]
- list: zeigt eine Liste aller Trigger (ohne Angabe von Argumente wird diese Liste standardmäßig ausgegeben)
- listfull: zeigt eine detaillierte Liste, mit zusätzlichen Informationen, aller Trigger an
-listdefault: zeigt die standardmäßig genutzten Trigger an
- add: fügt einen Trigger hinzu
- addoff: fügt einen Trigger hinzu (deaktiviert)
- addreplace: erzeugt neuen Trigger oder ersetzt einen schon existierenden Trigger
- name: Name des Trigger
+ list: list triggers (without argument, this list is displayed)
+ listfull: list triggers with detailed info for each trigger
+listdefault: list default triggers
+ add: add a trigger
+ addoff: add a trigger (disabled)
+ addreplace: add or replace an existing trigger
+ name: name of trigger
hook: signal, hsignal, modifier, line, print, command, command_run, timer, config, focus, info, info_hashtable
- arguments: Argumente für den Hook, abhängig vom genutzten Hook (getrennt durch Semikolon):
- signal: Name(en) des signals (erforderlich)
- hsignal: Name(en) des hsignal (erforderlich)
- modifier: Name(en) des modifier (erforderlich)
- line: Buffertyp ("formatted", "free" oder "*"), Liste von Buffermasken, Tags
- print: Buffer, Tags, Nachricht, Farben entfernen
- command: Befehl (erforderlich), Beschreibung, Argumente, Beschreibung der Argumente, Vervollständigung (Alle Argumente, außer dem Befehl werden ausgewertet, siehe /help eval)
- command_run: Befehl(e) (erforderlich)
- timer: Intervall (erforderlich), Anpassung an Sekunden (erforderlich), maximale Anzahl an Aufrufen
- config: Name der Einstellung (erforderlich)
- focus: Name(n) für sichtbaren Bereich (erforderlich) (z.B. "chat" für Chatbereich)
- info: Name(n) der Information (erforderlich)
- info_hashtable: Name(n) der Information (erforderlich)
- conditions: evaluierte Bedingungen für den Trigger
- regex: einer oder mehrere reguläre Ausdrücke um Zeichenketten in Variablen zu ersetzen
- command: Befehl welcher ausgeführt werden soll (mehrere Befehle müssen durch ";" voneinander getrennt werden)
-return_code: Rückgabewert für Callback (ok (standard), ok_eat, error)
-post_action: Aktion welche nach der Abarbeitung des Triggers ausgeführt werden soll (none (Standardwert), disable, delete)
- addinput: erstellt einen Trigger mit einer standardmäßigen Mustervorlage
- input: kopiert den kompletten Trigger-Befehl in die Eingabezeile
- output: schickt den Trigger-Befehl als Text in den Buffer
- recreate: wie "input", allerdings wird die Einstellung "addreplace" anstelle von "add" genutzt
- set: definiert, innerhalb eines Triggers, eine Einstellung neu
- option: Name einer Einstellung: name, hook, arguments, conditions, regex, command, return_code
- (um Hilfe über eine Einstellung zu erhalten: /help trigger.trigger.<name>.<option>)
- value: neuer Wert für Einstellung
- rename: benennt einen Trigger um
- copy: kopiert einen Trigger
- enable: aktiviert Trigger (ohne Angabe von Argumenten: aktiviert alle Trigger)
- disable: deaktiviert Trigger (ohne Angabe von Argumenten: deaktiviert alle Trigger)
- toggle: de-/aktiviert Trigger (ohne Angabe von Argumenten: de-/aktiviert alle Trigger)
- restart: startet Trigger neu (Hook(s) werden neu erstellt)
- show: zeigt detaillierte Informationen zu einem Trigger (inklusive einer kleinen Statistik)
- del: entfernt einen Trigger
- -all: führt eine Aktion aus, die alle Trigger beinhaltet
- restore: stellt Trigger mit Standardwerten wieder her (funktioniert nur bei vorgegebenen Triggern)
- default: stellt die standardmäßigen Trigger wieder her
- monitor: öffnet den Trigger Monitor-Buffer, mit optionaler Filterfunktion:
- Filter: zeigt Hooks/Trigger an (ein Hook muss mit "@" beginnen, zum Beispiel "@signal"), mehrere Filter können durch Kommata voneinander getrennt werden; Platzhalter "*" kann im Namen des Trigger verwendet werden
-
-Wenn ein Trigger-Callback aufgerufen wird, dann wird folgende Befehlskette ausgeführt:
- 1. Überprüfung von Bedingungen; falls unwahr, beenden
- 2. ersetze Text mittels einem oder mehreren erweiterten regulären POSIX Ausdrücken (sofern im Trigger definiert)
- 3. ein oder mehrere Befehle werden ausgeführt (sofern im Trigger definiert)
- 4. Beendigung mit einem Rückgabewert (ausgenommen sind modifiers, line, focus, info und info_hashtable)
- 5. Aktion welche nach der Abarbeitung des Triggers ausgeführt werden soll
-
-Beispiele (die standardmäßig verfügbaren Trigger kann man sich mit "/trigger listdefault" anzeigen lassen):
- fügt einer Nachricht die Textattribute *fett*, _unterstrichen_ und /kursiv/ hinzu:
+ arguments: arguments for the hook, depending on hook (separated by semicolons):
+ signal: name(s) of signal (required)
+ hsignal: name(s) of hsignal (required)
+ modifier: name(s) of modifier (required)
+ line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
+ print: buffer, tags, message, strip colors
+ command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, "${tg_trigger_name}" is replaced by the trigger name, see /help eval)
+ command_run: command(s) (required)
+ timer: interval (required), align on second, max calls
+ config: name(s) of option (required)
+ focus: name(s) of area (required)
+ info: name(s) of info (required)
+ info_hashtable: name(s) of info (required)
+ conditions: evaluated conditions for the trigger
+ regex: one or more regular expressions to replace strings in variables
+ command: command to execute (many commands can be separated by ";")
+return_code: return code in callback (ok (default), ok_eat, error)
+post_action: action to take after execution (none (default), disable, delete)
+ addinput: set input with default arguments to create a trigger
+ input: set input with the command used to create the trigger
+ output: send the command to create the trigger on the buffer
+ recreate: same as "input", with option "addreplace" instead of "add"
+ set: set an option in a trigger
+ option: name of option: name, hook, arguments, conditions, regex, command, return_code
+ (for help on option, you can type: /help trigger.trigger.<name>.<option>)
+ value: new value for the option
+ rename: rename a trigger
+ copy: copy a trigger
+ enable: enable trigger(s) (without arguments: enable triggers globally)
+ disable: disable trigger(s) (without arguments: disable triggers globally)
+ toggle: toggle trigger(s) (without arguments: toggle triggers globally)
+ restart: restart trigger(s) (recreate the hooks)
+ show: show detailed info on a trigger (with some stats)
+ del: delete a trigger
+ -all: do action on all triggers
+ restore: restore trigger(s) with the default values (works only for default triggers)
+ default: delete all triggers and restore default ones
+ monitor: open the trigger monitor buffer, with optional filter:
+ filter: filter hooks/triggers to display (a hook must start with "@", for example "@signal"), many filters can be separated by commas; wildcard "*" is allowed in each trigger name
+
+When a trigger callback is called, following actions are performed, in this order:
+ 1. check conditions; if false, exit
+ 2. replace text using POSIX extended regular expression(s) (if defined in trigger)
+ 3. execute command(s) (if defined in trigger)
+ 4. exit with a return code (except for modifier, line, focus, info and info_hashtable)
+ 5. perform post action
+
+Examples (you can also look at default triggers with /trigger listdefault):
+ add text attributes *bold*, _underline_ and /italic/ (only in user messages):
/trigger add effects modifier weechat_print "${tg_tag_nick}" "==\*([^ ]+)\*==*${color:bold}${re:1}${color:-bold}*== ==_([^ ]+)_==_${color:underline}${re:1}${color:-underline}_== ==/([^ ]+)/==/${color:italic}${re:1}${color:-italic}/"
- verbirgt die Nicklist auf kleineren Terminals:
+ hide nicklist bar on small terminals:
/trigger add resize_small signal signal_sigwinch "${info:term_width} < 100" "" "/bar hide nicklist"
/trigger add resize_big signal signal_sigwinch "${info:term_width} >= 100" "" "/bar show nicklist"
- speichert die Konfiguration jede Stunde ab:
+ silently save config each hour:
/trigger add cfgsave timer 3600000;0;0 "" "" "/mute /save"
- öffnet den Trigger Monitor und zeigt ausschließlich modifier und Trigger an, die mit "resize" im Namen beginnen:
+ open trigger monitor and show only modifiers and triggers whose name starts with "resize":
/trigger monitor @modifier,resize*
----
// end::trigger_commands[]
diff --git a/doc/en/includes/autogen_user_commands.en.adoc b/doc/en/includes/autogen_user_commands.en.adoc
index f8a44cdda..d6a3848a5 100644
--- a/doc/en/includes/autogen_user_commands.en.adoc
+++ b/doc/en/includes/autogen_user_commands.en.adoc
@@ -2950,7 +2950,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
- command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
+ command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, "${tg_trigger_name}" is replaced by the trigger name, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
diff --git a/doc/fr/includes/autogen_user_commands.fr.adoc b/doc/fr/includes/autogen_user_commands.fr.adoc
index a47c82bed..501efe6d5 100644
--- a/doc/fr/includes/autogen_user_commands.fr.adoc
+++ b/doc/fr/includes/autogen_user_commands.fr.adoc
@@ -2950,7 +2950,7 @@ listdefault : lister les triggers par défaut
modifier : nom(s) de modificateur (obligatoire)
line : type de tampon ("formatted", "free" ou "*"), liste de masques de tampons, étiquettes
print : tampon, étiquettes, message, suppression des couleurs (0/1)
- command : commande (obligatoire), description, paramètres, description des paramètres, complétion (tous les paramètres sauf la commande sont évalués, voir /help eval)
+ command : commande (obligatoire), description, paramètres, description des paramètres, complétion (tous les paramètres sauf la commande sont évalués, "${tg_trigger_name}" est remplacé par le nom du trigger, voir /help eval)
command_run : commande(s) (obligatoire)
timer : intervalle (obligatoire), alignement sur la seconde, nombre max d'appels
config : nom(s) de l'option (obligatoire)
diff --git a/doc/it/includes/autogen_user_commands.it.adoc b/doc/it/includes/autogen_user_commands.it.adoc
index 4a35cbbcb..168061754 100644
--- a/doc/it/includes/autogen_user_commands.it.adoc
+++ b/doc/it/includes/autogen_user_commands.it.adoc
@@ -2950,7 +2950,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
- command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
+ command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, "${tg_trigger_name}" is replaced by the trigger name, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
diff --git a/doc/ja/includes/autogen_user_commands.ja.adoc b/doc/ja/includes/autogen_user_commands.ja.adoc
index e7d0cbdf2..b54f5a864 100644
--- a/doc/ja/includes/autogen_user_commands.ja.adoc
+++ b/doc/ja/includes/autogen_user_commands.ja.adoc
@@ -2950,7 +2950,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
- command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
+ command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, "${tg_trigger_name}" is replaced by the trigger name, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
diff --git a/doc/pl/includes/autogen_user_commands.pl.adoc b/doc/pl/includes/autogen_user_commands.pl.adoc
index 73e8ee6f6..e1b910cce 100644
--- a/doc/pl/includes/autogen_user_commands.pl.adoc
+++ b/doc/pl/includes/autogen_user_commands.pl.adoc
@@ -2949,7 +2949,7 @@ listdefault: list default triggers
modifier: name(s) of modifier (required)
line: buffer type ("formatted", "free" or "*"), list of buffer masks, tags
print: buffer, tags, message, strip colors
- command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, see /help eval)
+ command: command (required), description, arguments, description of arguments, completion (all arguments except command are evaluated, "${tg_trigger_name}" is replaced by the trigger name, see /help eval)
command_run: command(s) (required)
timer: interval (required), align on second, max calls
config: name(s) of option (required)
diff --git a/po/cs.po b/po/cs.po
index 82d965cd9..5b4a919a7 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12495,7 +12495,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/de.po b/po/de.po
index 3e5fd2322..aeb4cb0eb 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-10-16 16:30+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -14634,6 +14634,7 @@ msgstr ""
"<name>|-all [<name>...] || show <name> || del <name>|-all [<name>...] || "
"restore <name> [<name>...] || default -yes || monitor [<filter>]"
+#, fuzzy
msgid ""
" list: list triggers (without argument, this list is displayed)\n"
" listfull: list triggers with detailed info for each trigger\n"
@@ -14654,7 +14655,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/es.po b/po/es.po
index af495752e..4b8dea9e4 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12773,7 +12773,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/fr.po b/po/fr.po
index 3f63469df..e2ee68ca5 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
-"PO-Revision-Date: 2020-11-14 09:22+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
+"PO-Revision-Date: 2020-11-14 09:30+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -14345,7 +14345,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
@@ -14440,7 +14441,8 @@ msgstr ""
"(0/1)\n"
" command : commande (obligatoire), description, paramètres, "
"description des paramètres, complétion (tous les paramètres sauf la commande "
-"sont évalués, voir /help eval)\n"
+"sont évalués, \"${tg_trigger_name}\" est remplacé par le nom du trigger, "
+"voir /help eval)\n"
" command_run : commande(s) (obligatoire)\n"
" timer : intervalle (obligatoire), alignement sur la seconde, "
"nombre max d'appels\n"
diff --git a/po/hu.po b/po/hu.po
index 784d7a8fa..b5d1bdaa3 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11738,7 +11738,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/it.po b/po/it.po
index 3a44a8164..3b7e75445 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -13003,7 +13003,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/ja.po b/po/ja.po
index 10b92cbca..848ef66f5 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -13725,7 +13725,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/pl.po b/po/pl.po
index 11fc51ced..250c5c7b0 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -13982,7 +13982,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/pt.po b/po/pt.po
index 08f0103a2..94a7461ca 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -13566,7 +13566,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 6b4fbbc12..16ac7670f 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-18 11:34+0200\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12227,7 +12227,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/ru.po b/po/ru.po
index 082f3e488..589c64067 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2020-04-28 16:40+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11773,7 +11773,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/tr.po b/po/tr.po
index 54ae58ca3..c0389185b 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2019-11-03 08:38+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10758,7 +10758,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index 49cd18503..374b74a19 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2020-11-14 09:19+0100\n"
+"POT-Creation-Date: 2020-11-14 09:30+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10595,7 +10595,8 @@ msgid ""
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command are "
-"evaluated, see /help eval)\n"
+"evaluated, \"${tg_trigger_name}\" is replaced by the trigger name, see /help "
+"eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c
index a97c73a52..f41fe2d2f 100644
--- a/src/plugins/trigger/trigger-command.c
+++ b/src/plugins/trigger/trigger-command.c
@@ -1193,7 +1193,8 @@ trigger_command_init ()
" print: buffer, tags, message, strip colors\n"
" command: command (required), description, arguments, "
"description of arguments, completion (all arguments except command "
- "are evaluated, see /help eval)\n"
+ "are evaluated, \"${tg_trigger_name}\" is replaced by the trigger "
+ "name, see /help eval)\n"
" command_run: command(s) (required)\n"
" timer: interval (required), align on second, max calls\n"
" config: name(s) of option (required)\n"
diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c
index 7a6efb381..0b9a44f77 100644
--- a/src/plugins/trigger/trigger.c
+++ b/src/plugins/trigger/trigger.c
@@ -268,6 +268,7 @@ trigger_hook (struct t_trigger *trigger)
char *eval_desc, *eval_args, *eval_desc_args, *eval_completion;
int i, argc, strip_colors;
long interval, align_second, max_calls;
+ struct t_hashtable *extra_vars;
if (!weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED]))
return;
@@ -400,15 +401,24 @@ trigger_hook (struct t_trigger *trigger)
trigger->hooks = malloc (sizeof (trigger->hooks[0]));
if (trigger->hooks)
{
+ extra_vars = weechat_hashtable_new (32,
+ WEECHAT_HASHTABLE_STRING,
+ WEECHAT_HASHTABLE_STRING,
+ NULL, NULL);
+ if (extra_vars)
+ {
+ weechat_hashtable_set (extra_vars, "tg_trigger_name",
+ trigger->name);
+ }
trigger->hooks_count = 1;
eval_desc = (argc > 1) ? weechat_string_eval_expression (
- argv[1], NULL, NULL, NULL) : NULL;
+ argv[1], NULL, extra_vars, NULL) : NULL;
eval_args = (argc > 2) ? weechat_string_eval_expression (
- argv[2], NULL, NULL, NULL) : NULL;
+ argv[2], NULL, extra_vars, NULL) : NULL;
eval_desc_args = (argc > 3) ? weechat_string_eval_expression (
- argv[3], NULL, NULL, NULL) : NULL;
+ argv[3], NULL, extra_vars, NULL) : NULL;
eval_completion = (argc > 4) ? weechat_string_eval_expression (
- argv[4], NULL, NULL, NULL) : NULL;
+ argv[4], NULL, extra_vars, NULL) : NULL;
trigger->hooks[0] = weechat_hook_command (
argv[0], /* command */
(eval_desc) ? eval_desc : "",
@@ -425,6 +435,8 @@ trigger_hook (struct t_trigger *trigger)
free (eval_desc_args);
if (eval_completion)
free (eval_completion);
+ if (extra_vars)
+ weechat_hashtable_free (extra_vars);
}
}
break;