mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 16:53:14 +02:00
core: use type "enum" in options
This commit is contained in:
@@ -57,7 +57,7 @@ trigger_buffer_match_filters (struct t_trigger *trigger)
|
||||
{
|
||||
/* check if the hook matches the filter */
|
||||
if (weechat_strcasecmp (
|
||||
trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
trigger_hook_type_string[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
trigger_buffer_filters[i] + 1) == 0)
|
||||
{
|
||||
return 1;
|
||||
@@ -355,7 +355,7 @@ trigger_buffer_display_trigger (struct t_trigger *trigger,
|
||||
"--> %s%lu\t%s: %s%s %s(%s%s%s)%s",
|
||||
weechat_color (weechat_config_string (trigger_config_color_identifier)),
|
||||
context->id,
|
||||
trigger_hook_type_string[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
trigger_hook_type_string[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])],
|
||||
weechat_color ("chat_status_enabled"),
|
||||
trigger->name,
|
||||
weechat_color ("chat_delimiters"),
|
||||
|
||||
@@ -147,7 +147,7 @@ trigger_callback_set_common_vars (struct t_trigger *trigger,
|
||||
weechat_hashtable_set (
|
||||
hashtable, "tg_hook_type",
|
||||
trigger_hook_type_string[
|
||||
weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])]);
|
||||
weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])]);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -396,7 +396,7 @@ trigger_callback_regex (struct t_trigger *trigger,
|
||||
|
||||
ptr_key = (trigger->regex[i].variable) ?
|
||||
trigger->regex[i].variable :
|
||||
trigger_hook_regex_default_var[weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK])];
|
||||
trigger_hook_regex_default_var[weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK])];
|
||||
if (!ptr_key || !ptr_key[0])
|
||||
{
|
||||
if (trigger_buffer && display_monitor)
|
||||
|
||||
@@ -54,7 +54,7 @@ struct t_trigger_context
|
||||
trigger->hook_count_cb++; \
|
||||
trigger->hook_running = 1; \
|
||||
trigger_rc = trigger_return_code[ \
|
||||
weechat_config_integer ( \
|
||||
weechat_config_enum ( \
|
||||
trigger->options[TRIGGER_OPTION_RETURN_CODE])];
|
||||
|
||||
#define TRIGGER_CALLBACK_CB_NEW_POINTERS \
|
||||
@@ -88,7 +88,7 @@ struct t_trigger_context
|
||||
if (ctx.vars_updated) \
|
||||
weechat_list_free (ctx.vars_updated); \
|
||||
trigger->hook_running = 0; \
|
||||
switch (weechat_config_integer ( \
|
||||
switch (weechat_config_enum ( \
|
||||
trigger->options[TRIGGER_OPTION_POST_ACTION])) \
|
||||
{ \
|
||||
case TRIGGER_POST_ACTION_DISABLE: \
|
||||
|
||||
@@ -254,8 +254,8 @@ trigger_command_display_trigger (struct t_trigger *trigger, int verbose)
|
||||
trigger->regex,
|
||||
trigger->commands_count,
|
||||
trigger->commands,
|
||||
weechat_config_integer (trigger->options[TRIGGER_OPTION_RETURN_CODE]),
|
||||
weechat_config_integer (trigger->options[TRIGGER_OPTION_POST_ACTION]),
|
||||
weechat_config_enum (trigger->options[TRIGGER_OPTION_RETURN_CODE]),
|
||||
weechat_config_enum (trigger->options[TRIGGER_OPTION_POST_ACTION]),
|
||||
verbose);
|
||||
}
|
||||
|
||||
@@ -877,7 +877,7 @@ trigger_command_trigger (const void *pointer, void *data,
|
||||
argv[2]);
|
||||
goto end;
|
||||
}
|
||||
add_rc = trigger_hook_default_rc[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0];
|
||||
add_rc = trigger_hook_default_rc[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK])][0];
|
||||
arg_arguments = trigger_command_escape_argument (
|
||||
weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_ARGUMENTS]));
|
||||
arg_conditions = trigger_command_escape_argument (
|
||||
|
||||
@@ -375,7 +375,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
|
||||
case TRIGGER_OPTION_HOOK:
|
||||
ptr_option = weechat_config_new_option (
|
||||
trigger_config_file, trigger_config_section_trigger,
|
||||
option_name, "integer",
|
||||
option_name, "enum",
|
||||
N_("type of hook used"),
|
||||
trigger_hook_option_values,
|
||||
0, 0, value, NULL, 0,
|
||||
@@ -440,7 +440,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
|
||||
case TRIGGER_OPTION_RETURN_CODE:
|
||||
ptr_option = weechat_config_new_option (
|
||||
trigger_config_file, trigger_config_section_trigger,
|
||||
option_name, "integer",
|
||||
option_name, "enum",
|
||||
N_("return code for hook callback (see plugin API reference to "
|
||||
"know where ok_eat/error can be used efficiently)"),
|
||||
"ok|ok_eat|error", 0, 0, value, NULL, 0,
|
||||
@@ -449,7 +449,7 @@ trigger_config_create_trigger_option (const char *trigger_name, int index_option
|
||||
case TRIGGER_OPTION_POST_ACTION:
|
||||
ptr_option = weechat_config_new_option (
|
||||
trigger_config_file, trigger_config_section_trigger,
|
||||
option_name, "integer",
|
||||
option_name, "enum",
|
||||
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);
|
||||
|
||||
@@ -329,7 +329,7 @@ trigger_hook (struct t_trigger *trigger)
|
||||
0,
|
||||
NULL);
|
||||
|
||||
switch (weechat_config_integer (trigger->options[TRIGGER_OPTION_HOOK]))
|
||||
switch (weechat_config_enum (trigger->options[TRIGGER_OPTION_HOOK]))
|
||||
{
|
||||
case TRIGGER_HOOK_SIGNAL:
|
||||
if (argv && (argc >= 1))
|
||||
@@ -1290,8 +1290,8 @@ trigger_print_log ()
|
||||
weechat_log_printf (" enabled . . . . . . . . : %d",
|
||||
weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_ENABLED]));
|
||||
weechat_log_printf (" hook . . . . . . . . . : %d ('%s')",
|
||||
weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK]),
|
||||
trigger_hook_type_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_HOOK])]);
|
||||
weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK]),
|
||||
trigger_hook_type_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_HOOK])]);
|
||||
weechat_log_printf (" arguments . . . . . . . : '%s'",
|
||||
weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_ARGUMENTS]));
|
||||
weechat_log_printf (" conditions. . . . . . . : '%s'",
|
||||
@@ -1301,11 +1301,11 @@ trigger_print_log ()
|
||||
weechat_log_printf (" command . . . . . . . . : '%s'",
|
||||
weechat_config_string (ptr_trigger->options[TRIGGER_OPTION_COMMAND]));
|
||||
weechat_log_printf (" return_code . . . . . . : %d ('%s')",
|
||||
weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE]),
|
||||
trigger_return_code_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE])]);
|
||||
weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE]),
|
||||
trigger_return_code_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_RETURN_CODE])]);
|
||||
weechat_log_printf (" post_action . . . . . . : %d ('%s')",
|
||||
weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION]),
|
||||
trigger_post_action_string[weechat_config_integer (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION])]);
|
||||
weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION]),
|
||||
trigger_post_action_string[weechat_config_enum (ptr_trigger->options[TRIGGER_OPTION_POST_ACTION])]);
|
||||
weechat_log_printf (" hooks_count . . . . . . : %d", ptr_trigger->hooks_count);
|
||||
weechat_log_printf (" hooks . . . . . . . . . : 0x%lx", ptr_trigger->hooks);
|
||||
for (i = 0; i < ptr_trigger->hooks_count; i++)
|
||||
|
||||
Reference in New Issue
Block a user