trigger: evaluate and replace regex groups at same time, new format for regex option in triggers (incompatible with version 1.0) (closes #224)

This commit is contained in:
Sébastien Helleu 2014-10-26 12:30:13 +01:00
parent a012eefb77
commit 3f5a810254
22 changed files with 238 additions and 161 deletions

View File

@ -30,6 +30,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* irc: disable creation of temporary servers by default with command /connect, * irc: disable creation of temporary servers by default with command /connect,
new option irc.look.temporary_servers new option irc.look.temporary_servers
* relay: add host in sender for IRC backlog PRIVMSG messages sent to clients * relay: add host in sender for IRC backlog PRIVMSG messages sent to clients
* trigger: evaluate and replace regex groups at same time, new format for regex
option in triggers (incompatible with version 1.0) (closes #224)
* trigger: add `${tg_displayed}` in conditions of default trigger "beep" * trigger: add `${tg_displayed}` in conditions of default trigger "beep"
* trigger: add option "restore" in command /trigger * trigger: add option "restore" in command /trigger

View File

@ -17,6 +17,45 @@ http://weechat.org/files/changelog/ChangeLog-devel.html[ChangeLog]
== Version 1.1 (under dev) == Version 1.1 (under dev)
=== New format for regex replacement in triggers
A new format is used in regex replacement to use regex groups, this format
is incompatible with version 1.0.
The existing triggers are *NOT automatically updated*.
[width="50%",cols="1,1,3",options="header"]
|===
| Old format | New format | Examples (new format)
| `$0` ... `$99` | `${re:0}` ... `${re:99}` | `${re:1}`
| `$+` | `${re:+}` | `${re:+}`
| `$.*N` | `${hide:*,${re:N}}` | `${hide:*,${re:2}}` +
`${hide:-,${re:+}}`
|===
Moreover, default triggers used to hide passwords have been fixed for *BSD
operating systems.
You can restore them with the following command:
----
/trigger restore cmd_pass msg_auth server_pass
----
If you added triggers with the old regex replacement format, you must update
them manually.
=== Default "beep" trigger
The command of "beep" trigger is now executed only if the message is displayed
(not filtered with /filter).
You can restore the default "beep" trigger with the following command:
----
/trigger restore beep
----
=== Relay option relay.irc.backlog_tags === Relay option relay.irc.backlog_tags
The option 'relay.irc.backlog_tags' is now a list separated by commas The option 'relay.irc.backlog_tags' is now a list separated by commas
@ -54,27 +93,6 @@ instead of milliseconds:
* function 'util_timeval_add': the argument 'interval' is now expressed in * function 'util_timeval_add': the argument 'interval' is now expressed in
microseconds. microseconds.
=== Default "beep" trigger
The command of "beep" trigger is now executed only if the message is displayed
(not filtered with /filter).
You can restore the default "beep" trigger with the following command:
----
/trigger restore beep
----
=== Default triggers for hiding passwords
Triggers used to hide passwords have been fixed for *BSD operating systems.
You can restore them with the following command:
----
/trigger restore cmd_pass msg_auth server_pass
----
== Version 1.0.1 (2014-09-28) == Version 1.0.1 (2014-09-28)
Bug fix and maintenance release. Bug fix and maintenance release.

View File

@ -3138,15 +3138,17 @@ oder mehrere identische Zeichen).
Matching groups können in "replace" genutzt werden: Matching groups können in "replace" genutzt werden:
* `$0` bis `$99`: `$0` um alles zu matchen, `$1` bis `$99` um Gruppen zu fangen * `${re:0}` bis `${re:99}`: `${re:0}` um alles zu matchen, `${re:1}` bis
* `$+`: der letzte match (mit der höchsten Nummer) `${re:99}` um Gruppen zu fangen
* `$.cN`: match "N" mit allen Zeichen die durch "c" ersetzt wurden (Beispiel: `$.*2` ist die group * `${re:+}`: der letzte match (mit der höchsten Nummer)
#2 mit allen Zeichen die durch `*` ersetzt wurden). * `${hide:c,${re:N}}`: match "N" mit allen Zeichen die durch "c" ersetzt wurden
(Beispiel: `${hide:*,${re:2}}` ist die group #2 mit allen Zeichen die durch
`*` ersetzt wurden).
Beispiel: nutzte Fettschrift zwischen dem Zeichen "*": Beispiel: nutzte Fettschrift zwischen dem Zeichen "*":
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
Beispiel: der Standard-Trigger 'server_pass' nutzt folgenden regulären Ausdruck Beispiel: der Standard-Trigger 'server_pass' nutzt folgenden regulären Ausdruck
@ -3154,7 +3156,7 @@ um ein Passwort in den Befehlen `/server` und `/connect` zu verbergen (die
einzelnen Zeichen des Passwortes werden durch `*` ersetzt): einzelnen Zeichen des Passwortes werden durch `*` ersetzt):
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -3062,15 +3062,17 @@ The char "/" can be replaced by any char (one or more identical chars).
Matching groups can be used in "replace": Matching groups can be used in "replace":
* `$0` to `$99`: `$0` is the whole match, `$1` to `$99` are groups captured * `${re:0}` to `${re:99}`: `${re:0}` is the whole match, `${re:1}` to
* `$+`: the last match (with highest number) `${re:99}` are groups captured
* `$.cN`: match "N" with all chars replaced by "c" (example: `$.*2` is the group * `${re:+}`: the last match (with highest number)
#2 with all chars replaced by `*`). * `${hide:c,${re:N}}`: match "N" with all chars replaced by "c"
(example: `${hide:*,${re:2}}` is the group #2 with all chars replaced by
`*`).
Example: use bold for words between "*": Example: use bold for words between "*":
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
Example: default trigger 'server_pass' uses this regular expression to hide Example: default trigger 'server_pass' uses this regular expression to hide
@ -3078,7 +3080,7 @@ password in commands `/server` and `/connect` (chars in passwords are replaced
by `*`): by `*`):
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -3161,17 +3161,17 @@ caractères identiques).
Les groupes de correspondance peuvent être utilisés dans le "remplacement" : Les groupes de correspondance peuvent être utilisés dans le "remplacement" :
* `$0` à `$99` : `$0` est la correspondance complète, `$1` à `$99` sont les * `${re:0}` à `${re:99}` : `${re:0}` est la correspondance complète, `${re:1}`
groupes capturés à `${re:99}` sont les groupes capturés
* `$+` : la dernière correspondance (avec le numéro le plus élevé) * `${re:+}` : la dernière correspondance (avec le numéro le plus élevé)
* `$.cN` : la correspondance "N" avec tous les caractères remplacés par "c" * `${hide:c,${re:N}}` : la correspondance "N" avec tous les caractères
(exemple : `$.*2` est le groupe n°2 avec tous les caractères remplacés par remplacés par "c" (exemple : `${hide:*,${re:2}}` est le groupe n°2 avec tous
`*`). les caractères remplacés par `*`).
Exemple : utiliser du gras pour les mots entre "*" : Exemple : utiliser du gras pour les mots entre "*" :
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
Exemple : le trigger par défaut 'server_pass' utilise cette expression régulière Exemple : le trigger par défaut 'server_pass' utilise cette expression régulière
@ -3179,7 +3179,7 @@ pour cacher le mot de passe dans les commandes `/server` et `/connect` (les
caractères des mots de passe sont remplacés par `*`) : caractères des mots de passe sont remplacés par `*`) :
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -3204,15 +3204,17 @@ The char "/" can be replaced by any char (one or more identical chars).
Matching groups can be used in "replace": Matching groups can be used in "replace":
* `$0` to `$99`: `$0` is the whole match, `$1` to `$99` are groups captured * `${re:0}` to `${re:99}`: `${re:0}` is the whole match, `${re:1}` to
* `$+`: the last match (with highest number) `${re:99}` are groups captured
* `$.cN`: match "N" with all chars replaced by "c" (example: `$.*2` is the group * `${re:+}`: the last match (with highest number)
#2 with all chars replaced by `*`). * `${hide:c,${re:N}}`: match "N" with all chars replaced by "c"
(example: `${hide:*,${re:2}}` is the group #2 with all chars replaced by
`*`).
Example: use bold for words between "*": Example: use bold for words between "*":
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
Example: default trigger 'server_pass' uses this regular expression to hide Example: default trigger 'server_pass' uses this regular expression to hide
@ -3220,7 +3222,7 @@ password in commands `/server` and `/connect` (chars in passwords are replaced
by `*`): by `*`):
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -3060,15 +3060,16 @@ ${tg_highlight} || ${tg_msg_pv}
マッチグループを "replace" の中で利用できます: マッチグループを "replace" の中で利用できます:
* `$0` から `$99`: `$0` はマッチ部分の全体、`$1` から `$99` はグループ化されたマッチ部分 * `${re:0}` から `${re:99}`: `${re:0}` はマッチ部分の全体、`${re:1}` から
* `$+`: 最後のマッチ部分 (最大のグループ番号を持つ) `${re:99}` はグループ化されたマッチ部分
* `$.cN`: マッチグループ "N" のすべての文字を "c" で置換した文字列 (例: `$.*2` はグループ * `${re:+}`: 最後のマッチ部分 (最大のグループ番号を持つ)
#2 のすべての文字を `*` で置換した文字列). * `${hide:c,${re:N}}`: マッチグループ "N" のすべての文字を "c" で置換した文字列
(例: `${hide:*,${re:2}}` はグループ #2 のすべての文字を `*` で置換した文字列).
例: "*" で囲まれた文字を太字にする: 例: "*" で囲まれた文字を太字にする:
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
例: デフォルトトリガ 'server_pass' はこの正規表現を使って、`/server` 例: デフォルトトリガ 'server_pass' はこの正規表現を使って、`/server`
@ -3076,7 +3077,7 @@ ${tg_highlight} || ${tg_msg_pv}
`*` で置換しています): `*` で置換しています):
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -3089,22 +3089,23 @@ identycznymi znakami).
Dopasowane grupy, które mogą zostać użyte w "zamień": Dopasowane grupy, które mogą zostać użyte w "zamień":
* `$0` to `$99`: `$0` to pełne dopasowanie, `$1` do `$99` to przechwycone grupy * `${re:0}` to `${re:99}`: `${re:0}` to pełne dopasowanie, `${re:1}` do
* `$+`: ostatnie dopasowanie (z najwyższym numerem) `${re:99}` to przechwycone grupy
* `$.cN`: dopasowanie "N" z wszystkimi znakami zastąpionymi "c" (przykład: `$.*2` * `${re:+}`: ostatnie dopasowanie (z najwyższym numerem)
to grupa #2 ze znakami zastąpionymi `*`). * `${hide:c,${re:N}}`: dopasowanie "N" z wszystkimi znakami zastąpionymi "c"
(przykład: `${hide:*,${re:2}}` to grupa #2 ze znakami zastąpionymi `*`).
Przykład: użyj pogrubienia dla słów pomiędzy "*": Przykład: użyj pogrubienia dla słów pomiędzy "*":
---- ----
/\*(\S+)\*/*${color:bold}$1${color:-bold}*/ /\*(\S+)\*/*${color:bold}${re:1}${color:-bold}*/
---- ----
Przykład: domyślny trigger 'server_pass' używa tego wyrażenia do ukrycia hasła Przykład: domyślny trigger 'server_pass' używa tego wyrażenia do ukrycia hasła
w komendach `/server` i `/connect` (znaki haseł są zastępowane przez `*`): w komendach `/server` i `/connect` (znaki haseł są zastępowane przez `*`):
---- ----
==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==$1$.*4$5 ==^(/(server|connect) .*-(sasl_)?password=)(\S+)(.*)==${re:1}${hide:*,${re:4}}${re:5}
---- ----
[NOTE] [NOTE]

View File

@ -20,7 +20,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10313,8 +10313,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-10-25 08:36+0100\n" "PO-Revision-Date: 2014-10-25 08:36+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n"
@ -11667,6 +11667,7 @@ msgstr ""
"(Hinweis: Inhalt ist evaluiert wenn der Trigger ausgeführt wird, siehe /help " "(Hinweis: Inhalt ist evaluiert wenn der Trigger ausgeführt wird, siehe /help "
"eval)" "eval)"
#, fuzzy
msgid "" msgid ""
"replace text with a POSIX extended regular expression (it is done only if " "replace text with a POSIX extended regular expression (it is done only if "
"conditions are OK, and before running the command) (note: content is " "conditions are OK, and before running the command) (note: content is "
@ -11675,8 +11676,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
"ersetzt Text mittels erweitertem regulären POSIX Ausdruck (dies passiert nur " "ersetzt Text mittels erweitertem regulären POSIX Ausdruck (dies passiert nur "
"falls die Bedingungen erfüllt werden und bevor der Befehl ausgeführt wird) " "falls die Bedingungen erfüllt werden und bevor der Befehl ausgeführt wird) "

View File

@ -22,7 +22,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10589,8 +10589,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -21,8 +21,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-10-16 20:44+0200\n" "PO-Revision-Date: 2014-10-26 11:00+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n" "Language: fr\n"
@ -11416,8 +11416,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
"remplacer du texte avec une expression régulière POSIX étendue (cela est " "remplacer du texte avec une expression régulière POSIX étendue (cela est "
"fait seulement si les conditions sont OK, et avant d'exécuter la commande) " "fait seulement si les conditions sont OK, et avant d'exécuter la commande) "
@ -11429,8 +11430,9 @@ msgstr ""
"interprétés dans l'expression régulière (par exemple \"\\n\") ; le " "interprétés dans l'expression régulière (par exemple \"\\n\") ; le "
"séparateur \"/\" peut être remplacé par n'importe quel caractère (un ou " "séparateur \"/\" peut être remplacé par n'importe quel caractère (un ou "
"plusieurs identiques) ; les groupes de correspondance peuvent être utilisés " "plusieurs identiques) ; les groupes de correspondance peuvent être utilisés "
"dans le remplacement : $0 à $99, $+ pour le dernier groupe et $.cN pour " "dans le remplacement : ${re:0} à ${re:99}, ${re:+} pour le dernier groupe et "
"remplacer tous les caractères du groupe N par c" "${hide:c,${re:N}} pour remplacer tous les caractères du groupe N par le "
"caractère 'c'"
msgid "" msgid ""
"command(s) to run if conditions are OK, after regex replacements (many " "command(s) to run if conditions are OK, after regex replacements (many "

View File

@ -20,7 +20,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9683,8 +9683,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -10767,8 +10767,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-10-25 08:29+0900\n" "PO-Revision-Date: 2014-10-25 08:29+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n"
@ -40,11 +40,11 @@ msgid "max chars"
msgstr "最大文字数" msgstr "最大文字数"
msgid "" msgid ""
"a WeeChat color name (default, black, (dark)gray, white, (light)red, (light)" "a WeeChat color name (default, black, (dark)gray, white, (light)red, "
"green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a terminal " "(light)green, brown, yellow, (light)blue, (light)magenta, (light)cyan), a "
"color number or an alias; attributes are allowed before color (for text " "terminal color number or an alias; attributes are allowed before color (for "
"color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" for " "text color only, not background): \"*\" for bold, \"!\" for reverse, \"/\" "
"italic, \"_\" for underline" "for italic, \"_\" for underline"
msgstr "" msgstr ""
"WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、" "WeeChat の色名 (default、black、(dark)gray、white、(light)red、(light)green、"
"brown、yellow、(light)blue、(light)magenta、(light)cyan) 、ターミナル色番号ま" "brown、yellow、(light)blue、(light)magenta、(light)cyan) 、ターミナル色番号ま"
@ -5918,8 +5918,8 @@ msgstr ""
" - 内部サーバ名 (/server add で作成されたもの、利用推奨)\n" " - 内部サーバ名 (/server add で作成されたもの、利用推奨)\n"
" - ホスト名/ポート番号又は IP アドレス/ポート番号、デフォルトの" " - ホスト名/ポート番号又は IP アドレス/ポート番号、デフォルトの"
"ポート番号は 6667\n" "ポート番号は 6667\n"
" - 次のフォーマットに従う URL: irc[6][s]://[nickname[:password]@]" " - 次のフォーマットに従う URL: irc[6][s]://[nickname[:"
"irc.example.org[:port][/#channel1][,#channel2[...]]\n" "password]@]irc.example.org[:port][/#channel1][,#channel2[...]]\n"
" 注意: アドレス/IP/URL を指定した場合、サーバを一時的に作ります " " 注意: アドレス/IP/URL を指定した場合、サーバを一時的に作ります "
"(保存しません)、/help irc.look.temporary_servers を参照してください。\n" "(保存しません)、/help irc.look.temporary_servers を参照してください。\n"
" option: サーバに関するオプション (ブール型オプションでは、value は無視さ" " option: サーバに関するオプション (ブール型オプションでは、value は無視さ"
@ -10826,8 +10826,8 @@ msgid ""
"Examples (you can also look at default triggers with /trigger listdefault):\n" "Examples (you can also look at default triggers with /trigger listdefault):\n"
" add text attributes *bold*, _underline_ and /italic/ (only in user " " add text attributes *bold*, _underline_ and /italic/ (only in user "
"messages):\n" "messages):\n"
" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*" " /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"=="
"(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" "\\*(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:"
"underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-" "underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-"
"italic}/\"\n" "italic}/\"\n"
" hide nicklist bar on small terminals:\n" " hide nicklist bar on small terminals:\n"
@ -10903,8 +10903,8 @@ msgstr ""
"\n" "\n"
"例 (/trigger listdefault でデフォルトトリガを見ることができます):\n" "例 (/trigger listdefault でデフォルトトリガを見ることができます):\n"
" テキスト属性 *太字*、_下線_、/イタリック/ を追加 (ユーザメッセージのみ):\n" " テキスト属性 *太字*、_下線_、/イタリック/ を追加 (ユーザメッセージのみ):\n"
" /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"==\\*" " /trigger add effects modifier weechat_print \"${tg_tag_nick}\" \"=="
"(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:" "\\*(\\S+)\\*==*${color:bold}$1${color:-bold}*== ==_(\\S+)_==_${color:"
"underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-" "underline}$1${color:-underline}_== ==/(\\S+)/==/${color:italic}$1${color:-"
"italic}/\"\n" "italic}/\"\n"
" 狭い端末ではニックネームリストバーを隠す:\n" " 狭い端末ではニックネームリストバーを隠す:\n"
@ -10984,6 +10984,7 @@ msgstr ""
"コマンドを実行する条件 (フックコールバック内で確認されます) (注意: 内容はトリ" "コマンドを実行する条件 (フックコールバック内で確認されます) (注意: 内容はトリ"
"ガの実行時に評価されます、/help eval を参照)" "ガの実行時に評価されます、/help eval を参照)"
#, fuzzy
msgid "" msgid ""
"replace text with a POSIX extended regular expression (it is done only if " "replace text with a POSIX extended regular expression (it is done only if "
"conditions are OK, and before running the command) (note: content is " "conditions are OK, and before running the command) (note: content is "
@ -10992,8 +10993,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
"POSIX 拡張正規表現で置換するテキスト (条件が満足され、コマンドが実行される前" "POSIX 拡張正規表現で置換するテキスト (条件が満足され、コマンドが実行される前"
"に置換されます) (注意: 内容はトリガの実行時に評価されます、/help eval を参" "に置換されます) (注意: 内容はトリガの実行時に評価されます、/help eval を参"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-09-14 00:18+0100\n" "PO-Revision-Date: 2014-09-14 00:18+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -11188,6 +11188,7 @@ msgstr ""
"(uwaga: zawartość jest przetwarzana, podczas wykonania triggera, zobacz /" "(uwaga: zawartość jest przetwarzana, podczas wykonania triggera, zobacz /"
"help eval)" "help eval)"
#, fuzzy
msgid "" msgid ""
"replace text with a POSIX extended regular expression (it is done only if " "replace text with a POSIX extended regular expression (it is done only if "
"conditions are OK, and before running the command) (note: content is " "conditions are OK, and before running the command) (note: content is "
@ -11196,8 +11197,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
"zastępuje tekst za pomocą rozszerzonego wyrażenia regularnego POSIX " "zastępuje tekst za pomocą rozszerzonego wyrażenia regularnego POSIX "
"(następuje to tylko wtedy, jeśli warunki są spełnione i przed wykonaniem " "(następuje to tylko wtedy, jeśli warunki są spełnione i przed wykonaniem "

View File

@ -21,7 +21,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9958,8 +9958,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 11:46+0200\n" "PO-Revision-Date: 2014-08-16 11:46+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -9708,8 +9708,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-07-25 07:50+0200\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8767,8 +8767,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: WeeChat\n" "Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2014-10-16 20:40+0200\n" "POT-Creation-Date: 2014-10-26 11:00+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -8691,8 +8691,9 @@ msgid ""
"can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/" "can be separated by a space, for example: \"/regex1/replace1/var1 /regex2/"
"replace2/var2\"; escaped chars are interpreted in the regex (for example " "replace2/var2\"; escaped chars are interpreted in the regex (for example "
"\"\\n\"); the separator \"/\" can be replaced by any char (one or more " "\"\\n\"); the separator \"/\" can be replaced by any char (one or more "
"identical chars); matching groups can be used in replace: $0 to $99, $+ for " "identical chars); matching groups can be used in replace: ${re:0} to "
"last match and $.cN to replace all chars of group N by char c" "${re:99}, ${re:+} for last match and ${hide:c,${re:N}} to replace all chars "
"of group N by char 'c'"
msgstr "" msgstr ""
msgid "" msgid ""

View File

@ -30,8 +30,11 @@
#include "trigger-buffer.h" #include "trigger-buffer.h"
/* one hashtable by hook, used in callback to evaluate "conditions" */ /* hashtable used to evaluate "conditions" */
struct t_hashtable *trigger_callback_hashtable_options = NULL; struct t_hashtable *trigger_callback_hashtable_options_conditions = NULL;
/* hashtable used to replace with regex */
struct t_hashtable *trigger_callback_hashtable_options_regex = NULL;
/* /*
@ -148,10 +151,11 @@ trigger_callback_check_conditions (struct t_trigger *trigger,
if (!conditions || !conditions[0]) if (!conditions || !conditions[0])
return 1; return 1;
value = weechat_string_eval_expression (conditions, value = weechat_string_eval_expression (
pointers, conditions,
extra_vars, pointers,
trigger_callback_hashtable_options); extra_vars,
trigger_callback_hashtable_options_conditions);
rc = (value && (strcmp (value, "1") == 0)); rc = (value && (strcmp (value, "1") == 0));
if (value) if (value)
free (value); free (value);
@ -169,13 +173,27 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
struct t_hashtable *extra_vars, struct t_hashtable *extra_vars,
int display_monitor) int display_monitor)
{ {
char *value, *replace_eval; char *value;
const char *ptr_key, *ptr_value; const char *ptr_key, *ptr_value;
int i; int i, pointers_allocated;
pointers_allocated = 0;
if (trigger->regex_count == 0) if (trigger->regex_count == 0)
return; return;
if (!pointers)
{
pointers = weechat_hashtable_new (32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL,
NULL);
if (!pointers)
return;
pointers_allocated = 1;
}
for (i = 0; i < trigger->regex_count; i++) for (i = 0; i < trigger->regex_count; i++)
{ {
/* if regex is not set (invalid), skip it */ /* if regex is not set (invalid), skip it */
@ -208,43 +226,45 @@ trigger_callback_replace_regex (struct t_trigger *trigger,
continue; continue;
} }
replace_eval = weechat_string_eval_expression ( weechat_hashtable_set (pointers, "regex", trigger->regex[i].regex);
trigger->regex[i].replace_escaped, weechat_hashtable_set (trigger_callback_hashtable_options_regex,
"regex_replace",
trigger->regex[i].replace_escaped);
value = weechat_string_eval_expression (
ptr_value,
pointers, pointers,
extra_vars, extra_vars,
NULL); trigger_callback_hashtable_options_regex);
if (replace_eval)
if (value)
{ {
value = weechat_string_replace_regex (ptr_value, /* display debug info on trigger buffer */
trigger->regex[i].regex, if (trigger_buffer && display_monitor)
replace_eval,
'$',
NULL, NULL);
if (value)
{ {
/* display debug info on trigger buffer */ weechat_printf_tags (trigger_buffer, "no_trigger",
if (trigger_buffer && display_monitor) "\t regex %d %s(%s%s%s)%s: "
{ "%s\"%s%s%s\"",
weechat_printf_tags (trigger_buffer, "no_trigger", i + 1,
"\t regex %d %s(%s%s%s)%s: " weechat_color ("chat_delimiters"),
"%s\"%s%s%s\"", weechat_color ("reset"),
i + 1, ptr_key,
weechat_color ("chat_delimiters"), weechat_color ("chat_delimiters"),
weechat_color ("reset"), weechat_color ("reset"),
ptr_key, weechat_color ("chat_delimiters"),
weechat_color ("chat_delimiters"), weechat_color ("reset"),
weechat_color ("reset"), value,
weechat_color ("chat_delimiters"), weechat_color ("chat_delimiters"));
weechat_color ("reset"),
value,
weechat_color ("chat_delimiters"));
}
weechat_hashtable_set (extra_vars, ptr_key, value);
free (value);
} }
free (replace_eval); weechat_hashtable_set (extra_vars, ptr_key, value);
free (value);
} }
} }
if (pointers_allocated)
weechat_hashtable_free (pointers);
else
weechat_hashtable_remove (pointers, "regex");
} }
/* /*
@ -912,16 +932,24 @@ end:
void void
trigger_callback_init () trigger_callback_init ()
{ {
trigger_callback_hashtable_options = weechat_hashtable_new (32, trigger_callback_hashtable_options_conditions = weechat_hashtable_new (
WEECHAT_HASHTABLE_STRING, 32,
WEECHAT_HASHTABLE_STRING, WEECHAT_HASHTABLE_STRING,
NULL, WEECHAT_HASHTABLE_STRING,
NULL); NULL,
if (trigger_callback_hashtable_options) NULL);
if (trigger_callback_hashtable_options_conditions)
{ {
weechat_hashtable_set (trigger_callback_hashtable_options, weechat_hashtable_set (trigger_callback_hashtable_options_conditions,
"type", "condition"); "type", "condition");
} }
trigger_callback_hashtable_options_regex = weechat_hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
} }
/* /*
@ -931,6 +959,8 @@ trigger_callback_init ()
void void
trigger_callback_end () trigger_callback_end ()
{ {
if (trigger_callback_hashtable_options) if (trigger_callback_hashtable_options_conditions)
weechat_hashtable_free (trigger_callback_hashtable_options); weechat_hashtable_free (trigger_callback_hashtable_options_conditions);
if (trigger_callback_hashtable_options_regex)
weechat_hashtable_free (trigger_callback_hashtable_options_regex);
} }

View File

@ -70,7 +70,7 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"/set +[^ ]*password[^ ]* +|" "/set +[^ ]*password[^ ]* +|"
"/secure +(passphrase|decrypt|set +[^ ]+) +)" "/secure +(passphrase|decrypt|set +[^ ]+) +)"
"(.*)" "(.*)"
"==$1$.*+", "==${re:1}${hide:*,${re:+}}",
"", "",
"" }, "" },
/* hide password in IRC auth message displayed */ /* hide password in IRC auth message displayed */
@ -78,7 +78,8 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"modifier", "modifier",
"5000|irc_message_auth", "5000|irc_message_auth",
"", "",
"==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)==$1$.*+", "==^(.*(id|identify|register|ghost +[^ ]+|release +[^ ]+) +)(.*)"
"==${re:1}${hide:*,${re:+}}",
"", "",
"" }, "" },
/* hide server password in commands /server and /connect */ /* hide server password in commands /server and /connect */
@ -86,7 +87,8 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"modifier", "modifier",
"5000|input_text_display;5000|history_add", "5000|input_text_display;5000|history_add",
"", "",
"==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)==$1$.*4$5" "==^(/(server|connect) .*-(sasl_)?password=)([^ ]+)(.*)"
"==${re:1}${hide:*,${re:4}}${re:5}"
"", "",
"" }, "" },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },
@ -314,8 +316,9 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
"chars are interpreted in the regex (for example \"\\n\"); " "chars are interpreted in the regex (for example \"\\n\"); "
"the separator \"/\" can be replaced by any char (one or " "the separator \"/\" can be replaced by any char (one or "
"more identical chars); matching groups can be used in " "more identical chars); matching groups can be used in "
"replace: $0 to $99, $+ for last match and $.cN to replace " "replace: ${re:0} to ${re:99}, ${re:+} for last match and "
"all chars of group N by char c"), "${hide:c,${re:N}} to replace all chars of group N by "
"char 'c'"),
NULL, 0, 0, value, NULL, 0, NULL, NULL, NULL, 0, 0, value, NULL, 0, NULL, NULL,
&trigger_config_change_trigger_regex, NULL, NULL, NULL); &trigger_config_change_trigger_regex, NULL, NULL, NULL);
break; break;