Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
trigger: allow creation of temporary variables with the regex
  • Loading branch information
flashcode committed Aug 16, 2018
1 parent 1a0087a commit 9105c3b
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 8 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -22,6 +22,7 @@ New features::

* core: allow partial buffer name in command /buffer close (issue #1226)
* api: add function hook_line
* trigger: allow creation of temporary variables with the regex

Bug fixes::

Expand Down
7 changes: 6 additions & 1 deletion doc/de/weechat_user.de.adoc
Expand Up @@ -3797,7 +3797,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
Reguläre Ausdrücke werden verwendet um Variablen in einem Callback Hashtable zu ändern.

Das Format ist: "/regex/replace" oder "/regex/replace/var" (wobei _var_ eine
Variable eines Hashtable darstellt). +
Variable eines Hashtable darstellt).

// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.

Sollte _var_ nicht näher spezifiziert sein, wird die Standard-Variable genutzt,
welche abhängig von dem genutzten Hook ist:

Expand Down
6 changes: 5 additions & 1 deletion doc/en/weechat_user.en.adoc
Expand Up @@ -3711,7 +3711,11 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
The regular expression is used to change variables in callback hashtable.

The format is: "/regex/replace" or "/regex/replace/var" (where _var_ is a
variable of the hashtable). +
variable of the hashtable).

If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.

If _var_ is not specified, the default variable is used, it depends on hook
type:

Expand Down
6 changes: 5 additions & 1 deletion doc/fr/weechat_user.fr.adoc
Expand Up @@ -3830,7 +3830,11 @@ L'expression régulière est utilisée pour modifier des variables dans la table
de hachage de la fonction de rappel.

Le format est : "/regex/remplacement" ou "/regex/remplacement/var" (où _var_ est
une variable de la table de hachage). +
une variable de la table de hachage).

Si _var_ n'existe pas dans la table de hachage, elle est automatiquement créée
avec une valeur vide. Cela permet de créer des variables temporaires.

Si _var_ n'est pas spécifiée, la variable par défaut est utilisée, elle dépend
du type de hook :

Expand Down
7 changes: 6 additions & 1 deletion doc/it/weechat_user.it.adoc
Expand Up @@ -3971,7 +3971,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
The regular expression is used to change variables in callback hashtable.

The format is: "/regex/replace" or "/regex/replace/var" (where _var_ is a
variable of the hashtable). +
variable of the hashtable).

// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.

If _var_ is not specified, the default variable is used, it depends on hook
type:

Expand Down
7 changes: 6 additions & 1 deletion doc/ja/weechat_user.ja.adoc
Expand Up @@ -3707,7 +3707,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
正規表現はコールバックハッシュテーブル内の変数を変更するために使われます。

書式: "/regex/replace" または "/regex/replace/var" (ここで
_var_ はハッシュテーブルの変数)。 +
_var_ はハッシュテーブルの変数)。

// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.

_var_
が指定されなかった場合、デフォルト変数を使います、これはフックの種類に依存します:

Expand Down
7 changes: 6 additions & 1 deletion doc/pl/weechat_user.pl.adoc
Expand Up @@ -3741,7 +3741,12 @@ ${tg_displayed} && (${tg_highlight} || ${tg_msg_pv})
Wyrażenia regularne są używane do zmiany zmiennych w tablicy hashy callbacka.

Format: "/wyrażenie/zamień" lub "/wyrażenie/zamień/zmienna" (gdzie _zmienna_ to
zmienna tablicy hashy). +
zmienna tablicy hashy).

// TRANSLATION MISSING
If _var_ does not exist in the hashtable, it is created automatically with an
empty value. This allows to create custom temporary variables.

Jeśli _zmienna_ nie zostanie podana, użyta zostanie domyślna zmienna, zależy ona
od typu uchwytu:

Expand Down
5 changes: 3 additions & 2 deletions src/plugins/trigger/trigger-callback.c
Expand Up @@ -277,9 +277,10 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
{
weechat_printf_date_tags (trigger_buffer, 0, "no_trigger",
"\t regex %d (%s): %s",
i + 1, ptr_key, _("empty variable"));
i + 1, ptr_key, _("creating variable"));
}
continue;
weechat_hashtable_set (extra_vars, ptr_key, "");
ptr_value = weechat_hashtable_get (extra_vars, ptr_key);
}

weechat_hashtable_set (pointers, "regex", trigger->regex[i].regex);
Expand Down

0 comments on commit 9105c3b

Please sign in to comment.