1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 22:45:42 +02:00

trigger: rename "once action" to "post action"

This commit is contained in:
Sébastien Helleu
2016-08-09 21:35:39 +02:00
parent 810077fc12
commit de7dc59c87
8 changed files with 75 additions and 75 deletions
+6 -7
View File
@@ -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
+3 -3
View File
@@ -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: \
File diff suppressed because it is too large Load Diff
+11 -10
View File
@@ -434,14 +434,14 @@ trigger_completion_hook_rc_cb (const void *pointer, void *data,
}
/*
* Adds default once actions to completion list.
* Adds default post actions to completion list.
*/
int
trigger_completion_once_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
trigger_completion_post_action_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
int i;
@@ -451,10 +451,11 @@ trigger_completion_once_cb (const void *pointer, void *data,
(void) completion_item;
(void) buffer;
for (i = 0; i < TRIGGER_NUM_ONCE_ACTIONS; i++)
for (i = 0; i < TRIGGER_NUM_POST_ACTIONS; i++)
{
weechat_hook_completion_list_add (completion,
trigger_once_action_string[i], 0, WEECHAT_LIST_POS_END);
trigger_post_action_string[i],
0, WEECHAT_LIST_POS_END);
}
return WEECHAT_RC_OK;
@@ -501,7 +502,7 @@ trigger_completion_init ()
weechat_hook_completion ("trigger_hook_rc",
N_("default return codes for hook callback"),
&trigger_completion_hook_rc_cb, NULL, NULL);
weechat_hook_completion ("trigger_once",
N_("trigger once actions"),
&trigger_completion_once_cb, NULL, NULL);
weechat_hook_completion ("trigger_post_action",
N_("trigger post actions"),
&trigger_completion_post_action_cb, NULL, NULL);
}
+6 -6
View File
@@ -42,7 +42,7 @@ struct t_config_option *trigger_config_color_flag_command;
struct t_config_option *trigger_config_color_flag_conditions;
struct t_config_option *trigger_config_color_flag_regex;
struct t_config_option *trigger_config_color_flag_return_code;
struct t_config_option *trigger_config_color_flag_once_action;
struct t_config_option *trigger_config_color_flag_post_action;
struct t_config_option *trigger_config_color_regex;
struct t_config_option *trigger_config_color_replace;
struct t_config_option *trigger_config_color_trigger;
@@ -366,11 +366,11 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
"ok|ok_eat|error", 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
break;
case TRIGGER_OPTION_ONCE_ACTION:
case TRIGGER_OPTION_POST_ACTION:
ptr_option = weechat_config_new_option (
trigger_config_file, trigger_config_section_trigger,
option_name, "integer",
N_("action to take after execution"),
N_("action to take on the trigger after execution"),
"none|disable|delete", 0, 0, value, NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
break;
@@ -683,10 +683,10 @@ trigger_config_init ()
N_("text color for return code flag (in /trigger list)"),
NULL, 0, 0, "lightmagenta", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_flag_once_action = weechat_config_new_option (
trigger_config_color_flag_post_action = weechat_config_new_option (
trigger_config_file, ptr_section,
"flag_once_action", "color",
N_("text color for once action flag (in /trigger list)"),
"flag_post_action", "color",
N_("text color for post action flag (in /trigger list)"),
NULL, 0, 0, "lightblue", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
trigger_config_color_regex = weechat_config_new_option (
+1 -1
View File
@@ -33,7 +33,7 @@ extern struct t_config_option *trigger_config_color_flag_command;
extern struct t_config_option *trigger_config_color_flag_conditions;
extern struct t_config_option *trigger_config_color_flag_regex;
extern struct t_config_option *trigger_config_color_flag_return_code;
extern struct t_config_option *trigger_config_color_flag_once_action;
extern struct t_config_option *trigger_config_color_flag_post_action;
extern struct t_config_option *trigger_config_color_regex;
extern struct t_config_option *trigger_config_color_replace;
extern struct t_config_option *trigger_config_color_trigger;
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -38,7 +38,7 @@ enum t_trigger_option
TRIGGER_OPTION_REGEX, /* replace text with 1 or more regex */
TRIGGER_OPTION_COMMAND, /* command run if conditions are OK */
TRIGGER_OPTION_RETURN_CODE, /* return code for hook callback */
TRIGGER_OPTION_ONCE_ACTION, /* action to take after execution */
TRIGGER_OPTION_POST_ACTION, /* action to take after execution */
/* number of trigger options */
TRIGGER_NUM_OPTIONS,
};
@@ -67,13 +67,13 @@ enum t_trigger_return_code
TRIGGER_NUM_RETURN_CODES,
};
enum t_trigger_once_action
enum t_trigger_post_action
{
TRIGGER_ONCE_NONE = 0,
TRIGGER_ONCE_DISABLE,
TRIGGER_ONCE_DELETE,
/* number of once actions */
TRIGGER_NUM_ONCE_ACTIONS,
TRIGGER_POST_ACTION_NONE = 0,
TRIGGER_POST_ACTION_DISABLE,
TRIGGER_POST_ACTION_DELETE,
/* number of post actions */
TRIGGER_NUM_POST_ACTIONS,
};
struct t_trigger_regex
@@ -124,7 +124,7 @@ extern char *trigger_hook_default_rc[];
extern char *trigger_hook_regex_default_var[];
extern char *trigger_return_code_string[];
extern int trigger_return_code[];
extern char *trigger_once_action_string[];
extern char *trigger_post_action_string[];
extern struct t_trigger *triggers;
extern struct t_trigger *last_trigger;
extern int triggers_count;
@@ -135,7 +135,7 @@ extern int trigger_enabled;
extern int trigger_search_option (const char *option_name);
extern int trigger_search_hook_type (const char *type);
extern int trigger_search_return_code (const char *return_code);
extern int trigger_search_once_action (const char *once_action);
extern int trigger_search_post_action (const char *post_action);
extern struct t_trigger *trigger_search (const char *name);
extern struct t_trigger *trigger_search_with_option (struct t_config_option *option);
extern void trigger_regex_free (int *regex_count,
@@ -162,7 +162,7 @@ extern struct t_trigger *trigger_new (const char *name,
const char *replace,
const char *command,
const char *return_code,
const char *once_action);
const char *post_action);
extern void trigger_create_default ();
extern int trigger_rename (struct t_trigger *trigger, const char *name);
extern struct t_trigger *trigger_copy (struct t_trigger *trigger,