diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 528f92f91..232d237ca 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -86,6 +86,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] print_date_tags, buffer_string_replace_local_var, command, infolist_new_item, infolist_new_var_integer, infolist_new_var_string, infolist_new_var_pointer, infolist_new_var_time, upgrade_write_object, upgrade_read, upgrade_close +* trigger: do not hook anything if the trigger is disabled (closes #405) == Version 1.1.1 (2015-01-25) diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index a07a6cd70..9faa77507 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -353,7 +353,6 @@ trigger_command_set_enabled (struct t_trigger *trigger, { if (weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED])) { - trigger_unhook (trigger); trigger_hook (trigger); weechat_printf_tags (NULL, "no_trigger", _("Trigger \"%s\" restarted"), diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index fb77c3f19..c0e435625 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -242,6 +242,9 @@ trigger_hook (struct t_trigger *trigger) int i, argc, strip_colors; long interval, align_second, max_calls; + if (!weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED])) + return; + trigger_unhook (trigger); argv = weechat_string_split (weechat_config_string (trigger->options[TRIGGER_OPTION_ARGUMENTS]), @@ -850,12 +853,12 @@ trigger_new_with_options (const char *name, struct t_config_option **options) 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); + trigger_hook (new_trigger); return new_trigger; }