diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index fba4e418f..29a7cc3f3 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -31,6 +31,8 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] * perl: fix detection of Perl >= 5.20 with autotools * script: fix crash on "/script update" if a script detail is displayed in buffer (closes #177) +* trigger: do not allow any changes on a trigger when it is currently running + (closes #189) * trigger: fix regex used in default triggers to hide passwords ("\S" is not supported on *BSD) (closes #172) diff --git a/po/cs.po b/po/cs.po index ceda7e087..4f21236ad 100644 --- a/po/cs.po +++ b/po/cs.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -9981,6 +9981,12 @@ msgstr "Žádné rmodifikátory nejsou definovány" msgid "List of default triggers:" msgstr "Seznam aliasů:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Pole \"%s\" vytvořeno" diff --git a/po/de.po b/po/de.po index 892c96fa2..da6e5d438 100644 --- a/po/de.po +++ b/po/de.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-08-23 21:15+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German \n" @@ -11224,6 +11224,12 @@ msgstr "Kein Trigger definiert" msgid "List of default triggers:" msgstr "Liste der standardmäßigen Trigger:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, c-format msgid "Trigger \"%s\" restarted" msgstr "Trigger \"%s\" neu gestartet" diff --git a/po/es.po b/po/es.po index 077e926b6..acb59b32b 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Elián Hanisch \n" "Language-Team: weechat-dev \n" @@ -10256,6 +10256,12 @@ msgstr "Ningún modificador regular definido" msgid "List of default triggers:" msgstr "Lista de alias:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Barra \"%s\" creada" diff --git a/po/fr.po b/po/fr.po index 2e0c6a6e3..e2df8fb4f 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" -"PO-Revision-Date: 2014-08-23 21:11+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" +"PO-Revision-Date: 2014-09-20 14:57+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -10976,6 +10976,14 @@ msgstr "Pas de trigger défini" msgid "List of default triggers:" msgstr "Liste des triggers par défaut :" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" +"%s%s : l'action \"%s\" ne peut pas être exécutée sur le trigger \"%s\" car " +"il est actuellement en cours d'exécution" + #, c-format msgid "Trigger \"%s\" restarted" msgstr "Trigger \"%s\" redémarré" diff --git a/po/hu.po b/po/hu.po index 2c56981e9..67dc85820 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -9356,6 +9356,12 @@ msgstr "Nincs aliasz definiálva.\n" msgid "List of default triggers:" msgstr "Aliaszok listája:\n" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "A \"%s\" => \"%s\" aliasz elkészült\n" diff --git a/po/it.po b/po/it.po index 776e02a07..bf351e051 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:49+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -10434,6 +10434,12 @@ msgstr "Nessun rmodifier definito" msgid "List of default triggers:" msgstr "Elenco degli alias:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Barra \"%s\" creata" diff --git a/po/ja.po b/po/ja.po index e960af40e..9029504c9 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-08-03 00:32+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" @@ -10570,6 +10570,12 @@ msgstr "トリガは定義されていません" msgid "List of default triggers:" msgstr "デフォルトトリガのリスト:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, c-format msgid "Trigger \"%s\" restarted" msgstr "トリガ \"%s\" が再開されました" diff --git a/po/pl.po b/po/pl.po index 9d1921b47..06ca59650 100644 --- a/po/pl.po +++ b/po/pl.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-08-13 21:27+0100\n" "Last-Translator: Krzysztof Korościk \n" "Language-Team: weechat-dev \n" @@ -10763,6 +10763,12 @@ msgstr "Nie zdefiniowano triggerów" msgid "List of default triggers:" msgstr "Lista domyślnych triggerów:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, c-format msgid "Trigger \"%s\" restarted" msgstr "Trigger \"%s\" został zrestartowany" diff --git a/po/pt_BR.po b/po/pt_BR.po index 97e98754e..81b0a4312 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-14 18:44+0200\n" "Last-Translator: Sergio Durigan Junior \n" "Language-Team: weechat-dev \n" @@ -9626,6 +9626,12 @@ msgstr "Nenhuma rmodifier definido" msgid "List of default triggers:" msgstr "Lista de atalhos:" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Barra \"%s\" criada" diff --git a/po/ru.po b/po/ru.po index 107495f4f..96691b42e 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -9382,6 +9382,12 @@ msgstr "Сокращения не заданы.\n" msgid "List of default triggers:" msgstr "Список сокращений:\n" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Сокращение \"%s\" => \"%s\" создано\n" diff --git a/po/tr.po b/po/tr.po index e65191318..8a4864aaa 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-07-25 07:50+0200\n" "Last-Translator: Hasan Kiran \n" "Language-Team: weechat-dev \n" @@ -8443,6 +8443,12 @@ msgstr "" msgid "List of default triggers:" msgstr "filtrelerin listesi" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, fuzzy, c-format msgid "Trigger \"%s\" restarted" msgstr "Filtre \"%s\" etkin" diff --git a/po/weechat.pot b/po/weechat.pot index d8b3fcbc3..b61dffc8f 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-08-23 21:09+0200\n" +"POT-Creation-Date: 2014-09-20 14:54+0200\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -8376,6 +8376,12 @@ msgstr "" msgid "List of default triggers:" msgstr "" +#, c-format +msgid "" +"%s%s: action \"%s\" can not be executed on trigger \"%s\" because it is " +"currently running" +msgstr "" + #, c-format msgid "Trigger \"%s\" restarted" msgstr "" diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 56954bdc8..748f84aa3 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -314,6 +314,20 @@ trigger_command_list_default (int verbose) weechat_string_free_split (commands); } +/* + * Displays an error if a trigger is running. + */ + +void +trigger_command_error_running (struct t_trigger *trigger, const char *action) +{ + weechat_printf_tags (NULL, "no_trigger", + _("%s%s: action \"%s\" can not be executed on " + "trigger \"%s\" because it is currently running"), + weechat_prefix ("error"), TRIGGER_PLUGIN_NAME, + action, trigger->name); +} + /* * Set "enabled" value in a trigger. * @@ -325,9 +339,16 @@ trigger_command_list_default (int verbose) */ void -trigger_command_set_enabled (struct t_trigger *trigger, int enable, +trigger_command_set_enabled (struct t_trigger *trigger, + int enable, const char *enable_string, int display_error) { + if (trigger->hook_running) + { + trigger_command_error_running (trigger, enable_string); + return; + } + if (enable == 2) { if (weechat_config_boolean (trigger->options[TRIGGER_OPTION_ENABLED])) @@ -539,7 +560,14 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[1], "addreplace") == 0) { if (ptr_trigger) + { + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + goto end; + } trigger_free (ptr_trigger); + } } else { @@ -680,6 +708,11 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, argv[2]); goto end; } + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + goto end; + } if (weechat_strcasecmp (argv[3], "name") == 0) { trigger_command_rename (ptr_trigger, argv[4]); @@ -724,6 +757,11 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, argv[2]); goto end; } + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + goto end; + } trigger_command_rename (ptr_trigger, argv[3]); goto end; } @@ -814,7 +852,7 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, for (ptr_trigger = triggers; ptr_trigger; ptr_trigger = ptr_trigger->next_trigger) { - trigger_command_set_enabled (ptr_trigger, enable, 0); + trigger_command_set_enabled (ptr_trigger, enable, argv[1], 0); } } else @@ -823,7 +861,8 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, { ptr_trigger = trigger_search (argv[i]); if (ptr_trigger) - trigger_command_set_enabled (ptr_trigger, enable, 1); + trigger_command_set_enabled (ptr_trigger, enable, argv[1], + 1); else { weechat_printf_tags (NULL, "no_trigger", @@ -843,7 +882,21 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, if (weechat_strcasecmp (argv[2], "-all") == 0) { count = triggers_count; - trigger_free_all (); + ptr_trigger = triggers; + while (ptr_trigger) + { + ptr_trigger2 = ptr_trigger->next_trigger; + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + } + else + { + trigger_free (ptr_trigger); + } + ptr_trigger = ptr_trigger2; + } + count = count - triggers_count; if (count > 0) weechat_printf_tags (NULL, "no_trigger", _("%d triggers removed"), count); @@ -855,9 +908,16 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, ptr_trigger = trigger_search (argv[i]); if (ptr_trigger) { - trigger_free (ptr_trigger); - weechat_printf_tags (NULL, "no_trigger", - _("Trigger \"%s\" removed"), argv[i]); + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + } + else + { + trigger_free (ptr_trigger); + weechat_printf_tags (NULL, "no_trigger", + _("Trigger \"%s\" removed"), argv[i]); + } } else { @@ -895,9 +955,25 @@ trigger_command_trigger (void *data, struct t_gui_buffer *buffer, int argc, { if ((argc >= 3) && (weechat_strcasecmp (argv[2], "-yes") == 0)) { - trigger_free_all (); - trigger_create_default (); - trigger_command_list (_("Default triggers restored:"), 0); + ptr_trigger = triggers; + while (ptr_trigger) + { + ptr_trigger2 = ptr_trigger->next_trigger; + if (ptr_trigger->hook_running) + { + trigger_command_error_running (ptr_trigger, argv[1]); + } + else + { + trigger_free (ptr_trigger); + } + ptr_trigger = ptr_trigger2; + } + if (triggers_count == 0) + { + trigger_create_default (); + trigger_command_list (_("Default triggers restored:"), 0); + } } else {