void trigger_command_list_default (int verbose) { int i, regex_count, commands_count; struct t_trigger_regex *regex; char **commands; regex_count = 0; regex = NULL; commands_count = 0; commands = NULL; weechat_printf_date_tags (NULL, 0, "no_trigger", ""); weechat_printf_date_tags (NULL, 0, "no_trigger", _("List of default triggers:")); for (i = 0; trigger_config_default_list[i][0]; i++) { if (trigger_regex_split (trigger_config_default_list[i][5], ®ex_count, ®ex) < 0) continue; trigger_split_command (trigger_config_default_list[i][6], &commands_count, &commands); trigger_command_display_trigger_internal ( trigger_config_default_list[i][0], weechat_config_string_to_boolean (trigger_config_default_list[i][1]), trigger_config_default_list[i][2], trigger_config_default_list[i][3], trigger_config_default_list[i][4], 0, 0, 0, regex_count, regex, commands_count, commands, trigger_search_return_code (trigger_config_default_list[i][7]), verbose); } trigger_regex_free (®ex_count, ®ex); if (commands) weechat_string_free_split (commands); }
void trigger_config_change_trigger_command (const void *pointer, void *data, struct t_config_option *option) { struct t_trigger *ptr_trigger; /* make C compiler happy */ (void) pointer; (void) data; ptr_trigger = trigger_search_with_option (option); if (!ptr_trigger) return; trigger_split_command (weechat_config_string (option), &ptr_trigger->commands_count, &ptr_trigger->commands); }
struct t_trigger * trigger_new_with_options (const char *name, struct t_config_option **options) { struct t_trigger *new_trigger; int i; new_trigger = trigger_alloc (name); if (!new_trigger) return NULL; for (i = 0; i < TRIGGER_NUM_OPTIONS; i++) { new_trigger->options[i] = options[i]; } trigger_add (new_trigger, &triggers, &last_trigger); triggers_count++; if (trigger_regex_split (weechat_config_string (new_trigger->options[TRIGGER_OPTION_REGEX]), &new_trigger->regex_count, &new_trigger->regex) < 0) { weechat_printf (NULL, _("%s%s: invalid regular expression in trigger " "\"%s\""), weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, name); } trigger_split_command (weechat_config_string (new_trigger->options[TRIGGER_OPTION_COMMAND]), &new_trigger->commands_count, &new_trigger->commands); if (weechat_config_boolean (new_trigger->options[TRIGGER_OPTION_ENABLED])) trigger_hook (new_trigger); return new_trigger; }