1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 05:16:38 +02:00

trigger: do not allow any changes on a trigger when it is currently running (closes #189)

(cherry picked from commit d1b4281d20)
This commit is contained in:
Sébastien Helleu
2014-09-20 14:51:09 +02:00
parent b9ec938fab
commit ed133e51a4
14 changed files with 175 additions and 23 deletions
+2
View File
@@ -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)
+7 -1
View File
@@ -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 <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\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"
+7 -1
View File
@@ -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 <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+10 -2
View File
@@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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é"
+7 -1
View File
@@ -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 <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\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\" が再開されました"
+7 -1
View File
@@ -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 <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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"
+7 -1
View File
@@ -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 <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\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 ""
+86 -10
View File
@@ -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
{