1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

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
+8 -5
View File
@@ -70,7 +70,7 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"/set +[^ ]*password[^ ]* +|"
"/secure +(passphrase|decrypt|set +[^ ]+) +)"
"(.*)"
"==$1$.*+",
"==${re:1}${hide:*,${re:+}}",
"",
"" },
/* hide password in IRC auth message displayed */
@@ -78,7 +78,8 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"modifier",
"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 */
@@ -86,7 +87,8 @@ char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] =
"modifier",
"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 },
@@ -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\"); "
"the separator \"/\" can be replaced by any char (one or "
"more identical chars); matching groups can be used in "
"replace: $0 to $99, $+ for last match and $.cN to replace "
"all chars of group N by char c"),
"replace: ${re:0} to ${re:99}, ${re:+} for last match and "
"${hide:c,${re:N}} to replace all chars of group N by "
"char 'c'"),
NULL, 0, 0, value, NULL, 0, NULL, NULL,
&trigger_config_change_trigger_regex, NULL, NULL, NULL);
break;