From de7dc59c87bdcf43e347fde5bcf0d69c73aa2e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 9 Aug 2016 21:35:39 +0200 Subject: [PATCH] trigger: rename "once action" to "post action" --- doc/en/weechat_user.en.adoc | 13 ++++---- src/plugins/trigger/trigger-callback.h | 6 ++-- src/plugins/trigger/trigger-command.c | 40 ++++++++++++------------ src/plugins/trigger/trigger-completion.c | 21 +++++++------ src/plugins/trigger/trigger-config.c | 12 +++---- src/plugins/trigger/trigger-config.h | 2 +- src/plugins/trigger/trigger.c | 36 ++++++++++----------- src/plugins/trigger/trigger.h | 20 ++++++------ 8 files changed, 75 insertions(+), 75 deletions(-) diff --git a/doc/en/weechat_user.en.adoc b/doc/en/weechat_user.en.adoc index 878326d3f..1637803ca 100644 --- a/doc/en/weechat_user.en.adoc +++ b/doc/en/weechat_user.en.adoc @@ -2986,10 +2986,9 @@ A trigger has the following options (names are The return code of callback (default is `ok`, which should be used in almost all triggers, the other values are rarely used). -| once_action | `none`, `disable`, `delete` | - Action to take with the trigger after the trigger executes once (default is - `none` which should be used in almost all triggers, the other values are - rarely used). +| post_action | `none`, `disable`, `delete` | + Action to take on the trigger after execution (default is `none` which should + be used in almost all triggers, the other values are rarely used). |=== For example, the default _beep_ trigger has following options: @@ -3002,7 +3001,7 @@ trigger.trigger.beep.conditions = "${tg_highlight} || ${tg_msg_pv}" trigger.trigger.beep.regex = "" trigger.trigger.beep.command = "/print -beep" trigger.trigger.beep.return_code = ok -trigger.trigger.beep.once_action = none +trigger.trigger.beep.post_action = none ---- [[trigger_execution]] @@ -3014,8 +3013,8 @@ order, if triggers are globally enabled and if the trigger itself is enabled: . check trigger conditions: if false, exit . replace text in trigger using regular expression(s) . execute command(s) -. exit with a return code (except for hooks _modifier_ and _focus_). -. perform once action (when not `none`) +. exit with a return code (except for hooks _modifier_ and _focus_) +. perform post action (if different from `none`). [[trigger_hook_arguments]] ==== Hook arguments diff --git a/src/plugins/trigger/trigger-callback.h b/src/plugins/trigger/trigger-callback.h index 44d6c3694..e6bda1730 100644 --- a/src/plugins/trigger/trigger-callback.h +++ b/src/plugins/trigger/trigger-callback.h @@ -64,14 +64,14 @@ weechat_hashtable_free (extra_vars); \ trigger->hook_running = 0; \ switch (weechat_config_integer ( \ - trigger->options[TRIGGER_OPTION_ONCE_ACTION])) \ + trigger->options[TRIGGER_OPTION_POST_ACTION])) \ { \ - case TRIGGER_ONCE_DISABLE: \ + case TRIGGER_POST_ACTION_DISABLE: \ weechat_config_option_set ( \ trigger->options[TRIGGER_OPTION_ENABLED], \ "off", 1); \ break; \ - case TRIGGER_ONCE_DELETE: \ + case TRIGGER_POST_ACTION_DELETE: \ trigger_free (trigger); \ break; \ default: \ diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index b50d0665a..b633f799a 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -59,11 +59,11 @@ trigger_command_display_trigger_internal (const char *name, int commands_count, char **commands, int return_code, - int once_action, + int post_action, int verbose) { - char str_conditions[64], str_regex[64], str_command[64], str_rc[64], str_once[64]; - char spaces[256]; + char str_conditions[64], str_regex[64], str_command[64], str_rc[64]; + char str_post_action[64], spaces[256]; int i, length; if (verbose >= 1) @@ -158,15 +158,15 @@ trigger_command_display_trigger_internal (const char *name, weechat_color ("reset"), trigger_return_code_string[return_code]); } - if ((once_action >= 0) && (once_action != TRIGGER_ONCE_NONE)) + if ((post_action >= 0) && (post_action != TRIGGER_POST_ACTION_NONE)) { weechat_printf_date_tags ( NULL, 0, "no_trigger", "%s %s=1 %s%s", spaces, - weechat_color (weechat_config_string (trigger_config_color_flag_once_action)), + weechat_color (weechat_config_string (trigger_config_color_flag_post_action)), weechat_color ("reset"), - trigger_once_action_string[once_action]); + trigger_post_action_string[post_action]); } } else @@ -175,7 +175,7 @@ trigger_command_display_trigger_internal (const char *name, str_regex[0] = '\0'; str_command[0] = '\0'; str_rc[0] = '\0'; - str_once[0] = '\0'; + str_post_action[0] = '\0'; if (conditions && conditions[0]) { snprintf (str_conditions, sizeof (str_conditions), @@ -206,11 +206,11 @@ trigger_command_display_trigger_internal (const char *name, weechat_color (weechat_config_string (trigger_config_color_flag_return_code)), weechat_color ("reset")); } - if ((once_action >= 0) && (once_action != TRIGGER_ONCE_NONE)) + if ((post_action >= 0) && (post_action != TRIGGER_POST_ACTION_NONE)) { - snprintf (str_once, sizeof (str_once), + snprintf (str_post_action, sizeof (str_post_action), " %s=1%s", - weechat_color (weechat_config_string (trigger_config_color_flag_once_action)), + weechat_color (weechat_config_string (trigger_config_color_flag_post_action)), weechat_color ("reset")); } weechat_printf_date_tags ( @@ -233,7 +233,7 @@ trigger_command_display_trigger_internal (const char *name, str_regex, str_command, str_rc, - str_once); + str_post_action); } } @@ -258,7 +258,7 @@ trigger_command_display_trigger (struct t_trigger *trigger, int verbose) trigger->commands_count, trigger->commands, weechat_config_integer (trigger->options[TRIGGER_OPTION_RETURN_CODE]), - weechat_config_integer (trigger->options[TRIGGER_OPTION_ONCE_ACTION]), + weechat_config_integer (trigger->options[TRIGGER_OPTION_POST_ACTION]), verbose); } @@ -333,7 +333,7 @@ trigger_command_list_default (int verbose) commands_count, commands, trigger_search_return_code (trigger_config_default_list[i][7]), - trigger_search_once_action (trigger_config_default_list[i][8]), + trigger_search_post_action (trigger_config_default_list[i][8]), verbose); } @@ -593,10 +593,10 @@ trigger_command_trigger (const void *pointer, void *data, goto end; } if ((sargc > 7) && sargv[7][0] - && (trigger_search_once_action (sargv[7]) < 0)) + && (trigger_search_post_action (sargv[7]) < 0)) { weechat_printf_date_tags (NULL, 0, "no_trigger", - _("%s%s: invalid once action \"%s\""), + _("%s%s: invalid post action \"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, sargv[7]); @@ -648,7 +648,7 @@ trigger_command_trigger (const void *pointer, void *data, (sargc > 4) ? sargv[4] : "", /* regex */ (sargc > 5) ? sargv[5] : "", /* command */ (sargc > 6) ? sargv[6] : "", /* return code */ - (sargc > 7) ? sargv[7] : ""); /* once action */ + (sargc > 7) ? sargv[7] : ""); /* post action */ if (ptr_trigger) { weechat_printf_date_tags ( @@ -1050,7 +1050,7 @@ trigger_command_trigger (const void *pointer, void *data, trigger_config_default_list[j][5], /* regex */ trigger_config_default_list[j][6], /* command */ trigger_config_default_list[j][7], /* return code */ - trigger_config_default_list[j][8]); /* once action */ + trigger_config_default_list[j][8]); /* post action */ weechat_printf_date_tags (NULL, 0, "no_trigger", _("Trigger \"%s\" restored"), argv[i]); @@ -1135,7 +1135,7 @@ trigger_command_init () N_("list|listfull|listdefault" " || add|addoff|addreplace [\"\" " "[\"\" [\"\" [\"\" " - "[\"\" [\"\"]]]]]]" + "[\"\" [\"\"]]]]]]" " || addinput []" " || input|output|recreate " " || set