From a4a4e5126cfc7c5bee39c08403ea3a9b6d3f33dc Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Thu, 22 May 2008 12:55:37 +0200 Subject: [PATCH] Increase number of authorized calls to same command (recursive calls), from 1 to 5 (more than 5 is considered as looping) --- po/cs.po | 14 +++++++------- po/de.po | 14 +++++++------- po/es.po | 14 +++++++------- po/fr.po | 11 ++++------- po/hu.po | 14 +++++++------- po/ru.po | 14 +++++++------- po/weechat.pot | 4 ++-- src/core/wee-hook.c | 11 ++++++----- src/core/wee-hook.h | 5 +++++ src/core/wee-input.c | 3 ++- 10 files changed, 54 insertions(+), 50 deletions(-) diff --git a/po/cs.po b/po/cs.po index 6dee0b0fc..38e0a1ad5 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Jiri Golembiovsky \n" "Language-Team: weechat-dev \n" @@ -1576,8 +1576,8 @@ msgid " . description: %s\n" msgstr " . popis: %s\n" #, fuzzy, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%s příkaz \"%s\" selhal\n" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%s nekorektní hodnota pro volbu \"%s\"\n" #, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4570,6 +4570,10 @@ msgstr "%s DCC: nemohu nastavit 'neblokovaci' volbu na soket\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s chybí argument pro volbu \"%s\"\n" +#, fuzzy +#~ msgid "%sError: command \"%s\" is running" +#~ msgstr "%s příkaz \"%s\" selhal\n" + #, fuzzy #~ msgid "%s%s: cannot create pipe" #~ msgstr "%s nemohu vytvořit rouru\n" @@ -4892,10 +4896,6 @@ msgstr "%s chybí argument pro volbu \"%s\"\n" #~ msgid "name associated to IRC server (for display only)" #~ msgstr "jméno asociované k IRC serveru (pouze pro zobrazení)" -#, fuzzy -#~ msgid "%sError: incorrect value for option \"%s\"" -#~ msgstr "%s nekorektní hodnota pro volbu \"%s\"\n" - #, fuzzy #~ msgid "No plugin option found with \"%s\"" #~ msgstr "Nebyla nalezena žádná možnost pluginu s \"%s\"\n" diff --git a/po/de.po b/po/de.po index f6b26bdf9..36a9df8d0 100644 --- a/po/de.po +++ b/po/de.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Thomas Schuetz \n" "Language-Team: weechat-dev \n" @@ -1570,8 +1570,8 @@ msgid " . description: %s\n" msgstr " . Beschreibung: %s\n" #, fuzzy, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%s der Befehl \"%s\" schlug fehl\n" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%s ungültiger Wert für die Option \"%s\"\n" #, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4560,6 +4560,10 @@ msgstr "%s DCC: kann die 'nonblock'-Option für den Socket nicht festlegen\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" +#, fuzzy +#~ msgid "%sError: command \"%s\" is running" +#~ msgstr "%s der Befehl \"%s\" schlug fehl\n" + #, fuzzy #~ msgid "%s%s: cannot create pipe" #~ msgstr "%s Pipe konnte nicht angelegt werden\n" @@ -4884,10 +4888,6 @@ msgstr "%s fehlende Argumente für die \"--dir\"-Option\n" #~ msgid "name associated to IRC server (for display only)" #~ msgstr "mit dem IRC-Server assoziierter eindeutiger Name (nur zur Anzeige)" -#, fuzzy -#~ msgid "%sError: incorrect value for option \"%s\"" -#~ msgstr "%s ungültiger Wert für die Option \"%s\"\n" - #, fuzzy #~ msgid "No plugin option found with \"%s\"" #~ msgstr "Keine Plugin-Optionen mit \"%s\" gefunden\n" diff --git a/po/es.po b/po/es.po index 331d5f5b9..3031ba3df 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: 2007-09-19 12:09+0200\n" "Last-Translator: Roberto González Cardenete \n" "Language-Team: weechat-dev \n" @@ -1559,8 +1559,8 @@ msgid " . description: %s\n" msgstr " . descripción: %s\n" #, fuzzy, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%s el comando \"%s\" ha fallado\n" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%s valor incorrecto para la opción \"%s\"\n" #, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4568,6 +4568,10 @@ msgstr "%s no es posible crear el servidor\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s falta un argumento para la opción --dir\n" +#, fuzzy +#~ msgid "%sError: command \"%s\" is running" +#~ msgstr "%s el comando \"%s\" ha fallado\n" + #, fuzzy #~ msgid "%s%s: cannot create pipe" #~ msgstr "%s no ha sido posible crear la interconexión\n" @@ -4889,10 +4893,6 @@ msgstr "%s falta un argumento para la opción --dir\n" #~ msgid "name associated to IRC server (for display only)" #~ msgstr "nombre asociado al servidor IRC (para mostrar solamente)" -#, fuzzy -#~ msgid "%sError: incorrect value for option \"%s\"" -#~ msgstr "%s valor incorrecto para la opción \"%s\"\n" - #, fuzzy #~ msgid "No plugin option found with \"%s\"" #~ msgstr "Ninguna opción de plugin encontrada con \"%s\"\n" diff --git a/po/fr.po b/po/fr.po index 9005f0938..67f3ef08e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" -"PO-Revision-Date: 2008-05-20 10:07+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" +"PO-Revision-Date: 2008-05-22 12:52+0200\n" "Last-Translator: FlashCode \n" "Language-Team: weechat-dev \n" "MIME-Version: 1.0\n" @@ -1515,8 +1515,8 @@ msgid " . description: %s\n" msgstr " . description: %s\n" #, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%sErreur: la commande \"%s\" est en cours d'exécution" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%sErreur: trop d'appels à la commande \"%s\" (boucle)" #, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4503,6 +4503,3 @@ msgstr "%s%s: impossible de positionner l'option \"nonblock\" pour la socket" #, c-format msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s%s: délai d'attente dépassé pour \"%s\" avec %s" - -#~ msgid "%s%s: cannot create pipe" -#~ msgstr "%s%s: impossible de créer le tube" diff --git a/po/hu.po b/po/hu.po index 52addc898..3c9ab6d95 100644 --- a/po/hu.po +++ b/po/hu.po @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: 2007-10-10 18:07+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -1579,8 +1579,8 @@ msgid " . description: %s\n" msgstr " . leírás : %s\n" #, fuzzy, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%s a \"%s\" parancs végrehajtása sikertelen\n" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%s helytelen érték a \"%s\" paraméternek\n" #, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4574,6 +4574,10 @@ msgstr "%s DCC: nem sikerült 'nonblock' opciót beállítani a csatornán\n" msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" +#, fuzzy +#~ msgid "%sError: command \"%s\" is running" +#~ msgstr "%s a \"%s\" parancs végrehajtása sikertelen\n" + #, fuzzy #~ msgid "%s%s: cannot create pipe" #~ msgstr "%s nem sikerült a csövet(pipe) létrehozni\n" @@ -4897,10 +4901,6 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n" #~ msgid "name associated to IRC server (for display only)" #~ msgstr "az IRC szerverhez rendelt név (csak megjelenítéshez)" -#, fuzzy -#~ msgid "%sError: incorrect value for option \"%s\"" -#~ msgstr "%s helytelen érték a \"%s\" paraméternek\n" - #, fuzzy #~ msgid "No plugin option found with \"%s\"" #~ msgstr "A(z) \"%s\" kifejezéshez nem található modul opció\n" diff --git a/po/ru.po b/po/ru.po index 7bede41bb..06e577e5e 100644 --- a/po/ru.po +++ b/po/ru.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.2.7-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: 2007-09-06 12:44+0200\n" "Last-Translator: Pavel Shevchuk \n" "Language-Team: weechat-dev \n" @@ -1582,8 +1582,8 @@ msgid " . description: %s\n" msgstr " . описание: %s\n" #, fuzzy, c-format -msgid "%sError: command \"%s\" is running" -msgstr "%s команда \"%s\" не удалась\n" +msgid "%sError: too much calls to command \"%s\" (looping)" +msgstr "%s некорректное значение параметра \"%s\"\n" #, fuzzy, c-format msgid "%sError: unknown command \"%s\" (type /help for help)" @@ -4559,6 +4559,10 @@ msgstr "%s DCC: не могу установить неблокирующий р msgid "%s%s: timeout for \"%s\" with %s" msgstr "%s нет аргумента для параметра \"%s\"\n" +#, fuzzy +#~ msgid "%sError: command \"%s\" is running" +#~ msgstr "%s команда \"%s\" не удалась\n" + #, fuzzy #~ msgid "%s%s: cannot create pipe" #~ msgstr "%s не могу создать pipe\n" @@ -4882,10 +4886,6 @@ msgstr "%s нет аргумента для параметра \"%s\"\n" #~ msgid "name associated to IRC server (for display only)" #~ msgstr "имя IRC сервера (для внутреннего пользования)" -#, fuzzy -#~ msgid "%sError: incorrect value for option \"%s\"" -#~ msgstr "%s некорректное значение параметра \"%s\"\n" - #, fuzzy #~ msgid "No plugin option found with \"%s\"" #~ msgstr "Не найден параметр pluginа с \"%s\"\n" diff --git a/po/weechat.pot b/po/weechat.pot index e96958a0b..b0f41e109 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2008-05-20 10:06+0200\n" +"POT-Creation-Date: 2008-05-22 12:51+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1295,7 +1295,7 @@ msgid " . description: %s\n" msgstr "" #, c-format -msgid "%sError: command \"%s\" is running" +msgid "%sError: too much calls to command \"%s\" (looping)" msgstr "" #, c-format diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index 8de5b8eec..99034c7b2 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -417,9 +417,10 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin, && ((argv[0][0] == '/') && (string_strcasecmp (argv[0] + 1, HOOK_COMMAND(ptr_hook, command)) == 0))) { - if (ptr_hook->running) - command_is_running = 1; - else + if (ptr_hook->running > 0) + command_is_running = ptr_hook->running; + + if (ptr_hook->running < HOOK_COMMAND_MAX_CALLS) { if (ptr_hook->plugin == plugin) { @@ -452,10 +453,10 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin, if (ptr_hook) { - ptr_hook->running = 1; + ptr_hook->running++; rc = (int) (HOOK_COMMAND(ptr_hook, callback)) (ptr_hook->callback_data, buffer, argc, argv, argv_eol); - ptr_hook->running = 0; + ptr_hook->running--; if (rc == WEECHAT_RC_ERROR) rc = 0; else diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h index 7959f0232..22d7cf552 100644 --- a/src/core/wee-hook.h +++ b/src/core/wee-hook.h @@ -44,10 +44,15 @@ enum t_hook_type HOOK_NUM_TYPES, }; +/* max calls that can be done for a command (recursive calls) */ +#define HOOK_COMMAND_MAX_CALLS 5 + +/* flags for fd hooks */ #define HOOK_FD_FLAG_READ 1 #define HOOK_FD_FLAG_WRITE 2 #define HOOK_FD_FLAG_EXCEPTION 4 +/* macros to access hook specific data */ #define HOOK_COMMAND(hook, var) (((struct t_hook_command *)hook->hook_data)->var) #define HOOK_TIMER(hook, var) (((struct t_hook_timer *)hook->hook_data)->var) #define HOOK_FD(hook, var) (((struct t_hook_fd *)hook->hook_data)->var) diff --git a/src/core/wee-input.c b/src/core/wee-input.c index c0e938bc3..f2f3adc59 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -114,7 +114,8 @@ input_exec_command (struct t_gui_buffer *buffer, break; case -3: /* command is running */ gui_chat_printf (NULL, - _("%sError: command \"%s\" is running"), + _("%sError: too much calls to command \"%s\" " + "(looping)"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], command + 1); break;