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
This commit is contained in:
Sébastien Helleu 2020-11-14 09:32:24 +01:00
parent b626df72fb
commit b9c8569422
22 changed files with 124 additions and 95 deletions

View File

@ -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::

View File

@ -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
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
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
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
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:
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[]

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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;