1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

core: evaluate command given to /repeat with contextual variables (closes #2007)

This commit is contained in:
Sébastien Helleu
2023-08-27 08:03:40 +02:00
parent b0ed5b99e9
commit 9a268ec7cc
17 changed files with 391 additions and 195 deletions
+1
View File
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
New features::
* core: evaluate command given to `/repeat` with contextual variables (issue #2007)
* core: add option `callbacks` in command `/debug`
* core: add option type "enum" (issue #1973)
* core: add options weechat.buffer.* to save buffer properties set by user, add option `setauto` in command `/buffer` (issue #352)
+15 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2445,7 +2445,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+47 -121
View File
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-27 00:11+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -433,11 +433,9 @@ msgstr ""
"Der Inhalt des Buffers wurde im Rohformat in die Protokolldatei geschrieben"
#, c-format
#| msgid "Debug enabled for cursor mode (%s)"
msgid "Debug enabled for callbacks (threshold: %s)"
msgstr "Debug für callbacks aktiviert (Schwellenwert: %s)"
#| msgid "Debug disabled for \"%s\""
msgid "Debug disabled for callbacks"
msgstr "Debug für callbacks deaktiviert"
@@ -1628,10 +1626,6 @@ msgstr ""
msgid "debug functions"
msgstr "Debug-Funktionen"
#| msgid ""
#| "list || set <plugin> <level> || dump|hooks [<plugin>] || buffer|certs|"
#| "color|dirs|infolists|libs|memory|tags|term|windows || mouse|cursor "
#| "[verbose] || hdata [free] || time <command> || unicode <string>"
msgid ""
"list || set <plugin> <level> || dump|hooks [<plugin>] || buffer|certs|color|"
"dirs|infolists|libs|memory|tags|term|windows || callbacks <duration>[<unit>] "
@@ -1643,41 +1637,6 @@ msgstr ""
"|| mouse|cursor [verbose] || hdata [free] || time <command> || unicode "
"<string>"
#| msgid ""
#| " list: list plugins with debug levels\n"
#| " set: set debug level for plugin\n"
#| " plugin: name of plugin (\"core\" for WeeChat core)\n"
#| " level: debug level for plugin (0 = disable debug)\n"
#| " dump: save memory dump in WeeChat log file (same dump is written "
#| "when WeeChat crashes)\n"
#| " hooks: display infos about hooks (with a plugin: display detailed "
#| "info about hooks created by the plugin)\n"
#| " buffer: dump buffer content with hexadecimal values in log file\n"
#| " certs: display number of loaded trusted certificate authorities\n"
#| " color: display infos about current color pairs\n"
#| " cursor: toggle debug for cursor mode\n"
#| " dirs: display directories\n"
#| " hdata: display infos about hdata (with free: remove all hdata in "
#| "memory)\n"
#| "infolists: display infos about infolists\n"
#| " key: enable keyboard and mouse debug: display raw codes, expanded "
#| "key name and associated command ('q' to quit this mode)\n"
#| " libs: display infos about external libraries used\n"
#| " memory: display infos about memory usage\n"
#| " mouse: toggle debug for mouse\n"
#| " tags: display tags for lines\n"
#| " term: display infos about terminal\n"
#| " windows: display windows tree\n"
#| " time: measure time to execute a command or to send text to the "
#| "current buffer\n"
#| " unicode: display information about string and unicode chars (evaluated, "
#| "see /help eval)\n"
#| "\n"
#| "Examples:\n"
#| " /debug set irc 1\n"
#| " /debug mouse verbose\n"
#| " /debug time /filter toggle\n"
#| " /debug unicode ${chars:${\\u26C0}-${\\u26CF}}"
msgid ""
" list: list plugins with debug levels\n"
" set: set debug level for plugin\n"
@@ -1733,9 +1692,9 @@ msgstr ""
"wurden)\n"
" buffer: speichert den Bufferinhalt als hexadezimale Ausgabe in die "
"Protokolldatei\n"
"callbacks: schreibt Hook und Bar-Item Callbacks, welche länger als die"
" angegebene \"Dauer\", ausgeführt werden in die WeeChat Protokolldatei (0 ="
" deaktiviert), wobei dabei eine der optionalen Einheiten genutzt wird:\n"
"callbacks: schreibt Hook und Bar-Item Callbacks, welche länger als die "
"angegebene \"Dauer\", ausgeführt werden in die WeeChat Protokolldatei (0 = "
"deaktiviert), wobei dabei eine der optionalen Einheiten genutzt wird:\n"
" us: Mikrosekunden (default)\n"
" ms: Millisekunden\n"
" s: Sekunden\n"
@@ -3184,9 +3143,11 @@ msgstr "führt einen Befehl mehrfach aus"
msgid "[-interval <delay>[<unit>]] <count> <command>"
msgstr "[-interval <delay>[<unit>]] <count> <command>"
#, fuzzy
#| msgid ""
#| " delay: delay between execution of commands\n"
#| " delay: delay between execution of commands (minimum: 1 millisecond)\n"
#| " unit: optional, values are:\n"
#| " us: microseconds\n"
#| " ms: milliseconds\n"
#| " s: seconds (default)\n"
#| " m: minutes\n"
@@ -3211,7 +3172,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
@@ -3220,8 +3194,8 @@ msgid ""
" scroll 2 pages up:\n"
" /repeat 2 /window page_up"
msgstr ""
" delay: Verzögerung zwischen dem Ausführen der Befehle (Minimum: 1"
" Millisekunde)\n"
" delay: Verzögerung zwischen dem Ausführen der Befehle (Minimum: 1 "
"Millisekunde)\n"
" unit: mögliche, optionale, Werte):\n"
" us: Mikrosekunden\n"
" ms: Millisekunden\n"
@@ -3731,26 +3705,6 @@ msgstr "Terminiere einen Befehl der ausgeführt werden soll"
msgid "<number>[<unit>] <command>"
msgstr "<number>[<unit>] <command>"
#| msgid ""
#| " number: amount of time to wait (integer number)\n"
#| " unit: optional, values are:\n"
#| " ms: milliseconds\n"
#| " s: seconds (default)\n"
#| " m: minutes\n"
#| " h: hours\n"
#| "command: command to execute (or text to send to buffer if command does "
#| "not start with '/')\n"
#| "\n"
#| "Note: the command is executed on buffer where /wait was executed (if the "
#| "buffer does not exist any more, the command is not executed).\n"
#| "\n"
#| "Examples:\n"
#| " join channel in 10 seconds:\n"
#| " /wait 10 /join #test\n"
#| " set away in 15 minutes:\n"
#| " /wait 15m /away -all I'm away\n"
#| " say 'hello' in 2 minutes:\n"
#| " /wait 2m hello"
msgid ""
" number: amount of time to wait (minimum: 1 millisecond)\n"
" unit: optional, values are:\n"
@@ -4184,10 +4138,6 @@ msgstr ""
"%sWarnung: unbekannte Einstellung für Sektion \"%s\": %s (Wert: \"%s\")"
#, c-format
#| msgid ""
#| "set property \"%s\" on any buffer matching mask \"%s\"; content is "
#| "evaluated, see /help eval; ${buffer} is a pointer to the buffer being "
#| "opened"
msgid ""
"set property \"%s\" on any buffer matching mask \"%s\"; content is "
"evaluated, see /help eval; ${buffer} is a pointer to the buffer being "
@@ -4195,8 +4145,8 @@ msgid ""
msgstr ""
"Setze Eigenschaft „%s“ bei jedem Buffer, der mit der Maske „%s“ "
"übereinstimmt; Inhalt ist evaluiert, siehe /help eval; ${buffer} ist ein "
"Zeiger auf den Buffer, der geöffnet wird, ${property} ist der Name der"
" Eigenschaft, die festgelegt wird"
"Zeiger auf den Buffer, der geöffnet wird, ${property} ist der Name der "
"Eigenschaft, die festgelegt wird"
#, c-format
msgid "Option \"weechat.buffer.%s\" has been set to \"%s\""
@@ -5926,9 +5876,8 @@ msgid ""
"debug: long callback: hook %s (%s), plugin: %s, subplugin: %s, time elapsed: "
"%s"
msgstr ""
"Debug: langer Callback: Hook %s (%s), Erweiterung: %s, Untererweiterung: %s,"
" verstrichene Zeit: "
"%s"
"Debug: langer Callback: Hook %s (%s), Erweiterung: %s, Untererweiterung: %s, "
"verstrichene Zeit: %s"
#, c-format
msgid "%sError sending signal %d to pid %d: %s"
@@ -6461,8 +6410,8 @@ msgstr "Infobar \"%s\" aktualisiert"
#, c-format
msgid "debug: long callback: bar: %s, item: %s, plugin: %s, time elapsed: %s"
msgstr ""
"Debug: langer Callback: Bar: %s, Item: %s, Erweiterung: %s, verstrichene"
" Zeit: %s"
"Debug: langer Callback: Bar: %s, Item: %s, Erweiterung: %s, verstrichene "
"Zeit: %s"
#, c-format
msgid "%sPaste %d line? [ctrl-y] Yes [ctrl-n] No"
@@ -12211,39 +12160,29 @@ msgstr "Nicknamen des IRC-Hosts erhalten"
msgid "IRC host (like `:nick!name@server.com`)"
msgstr "IRC host (in der Form `:nick!name@server.com`)"
#| msgid ""
#| "get nick color code (nick is first converted to lower case, following the "
#| "value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the "
#| "server is not given)"
msgid ""
"get nick color code, ignoring case (this calls the info "
"\"nick_color_ignore_case\" with appropriate range, according to the value of "
"CASEMAPPING on the server, defaulting to \"rfc1459\" if the server is not "
"given)"
msgstr ""
"Hole den Farbcode des Nicks, Groß- und Kleinschreibung wird ignoriert (dies"
" ruft die Funktion"
"„nick_color_name_ignore_case“ mit entsprechendem Bereich auf, dabei wird der"
" Wert des CASEMAPPING auf dem Server"
"berücksichtigt, standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn der"
"Server nicht angegeben wurde)"
"Hole den Farbcode des Nicks, Groß- und Kleinschreibung wird ignoriert (dies "
"ruft die Funktion„nick_color_name_ignore_case“ mit entsprechendem Bereich "
"auf, dabei wird der Wert des CASEMAPPING auf dem Serverberücksichtigt, "
"standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn derServer nicht "
"angegeben wurde)"
#| msgid ""
#| "get nick color name (nick is first converted to lower case, following the "
#| "value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the "
#| "server is not given)"
msgid ""
"get nick color name, ignoring case (this calls the info "
"\"nick_color_name_ignore_case\" with appropriate range, according to the "
"value of CASEMAPPING on the server, defaulting to \"rfc1459\" if the server "
"is not given)"
msgstr ""
"Hole den Farbnamen des Nicks, Groß- und Kleinschreibung wird ignoriert (dies"
" ruft die Funktion"
"„nick_color_name_ignore_case“ mit entsprechendem Bereich auf, dabei wird der"
" Wert des CASEMAPPING auf dem Server"
"berücksichtigt, standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn der"
"Server nicht angegeben wurde)"
"Hole den Farbnamen des Nicks, Groß- und Kleinschreibung wird ignoriert (dies "
"ruft die Funktion„nick_color_name_ignore_case“ mit entsprechendem Bereich "
"auf, dabei wird der Wert des CASEMAPPING auf dem Serverberücksichtigt, "
"standardmäßig wird auf „rfc1459“ zurückgegriffen, wenn derServer nicht "
"angegeben wurde)"
msgid "get buffer pointer for an IRC server/channel/nick"
msgstr "holt Buffer Pointer für einen IRC Server/Kanal/Nick"
@@ -12799,8 +12738,6 @@ msgid "%sNicks %s%s%s: %s[%s%s%s]"
msgstr "%sNicks %s%s%s: %s[%s%s%s]"
#. TRANSLATORS: number of "regular" nicks on a channel (ie not op/halfop/voiced), for example: "56 regular"
#| msgid "%s%s%d%s regular"
#| msgid_plural "%s%s%d%s regular"
msgid "regular"
msgid_plural "regular"
msgstr[0] "regulär"
@@ -13958,16 +13895,10 @@ msgstr ""
msgid "get nick color name"
msgstr "zeigt Farbnamen des Nick"
#| msgid "get nick color code"
msgid "get nick color code, ignoring case"
msgstr ""
"hole Farbecode des Nick, dabei wird die Groß- und Kleinschreibung ignoriert"
#| msgid ""
#| "nickname;colors (colors is an optional comma-separated list of colors to "
#| "use; background is allowed for a color with format text:background; if "
#| "colors is present, WeeChat options with nick colors and forced nick "
#| "colors are ignored)"
msgid ""
"nickname;range;colors (range is a number of chars (see function "
"strcasecmp_range, 0 = convert to lower case without using a range), colors "
@@ -13975,16 +13906,13 @@ msgid ""
"for a color with format text:background; if colors is present, WeeChat "
"options with nick colors and forced nick colors are ignored)"
msgstr ""
"Nickname;Bereich;Farben (Bereich ist eine Anzahl von Zeichen (siehe Funktion)."
"strcasecmp_range, 0 = in Kleinbuchstaben konvertieren, ohne einen Bereich zu"
" verwenden), Farben"
"ist eine optionale, durch Kommas getrennte Liste der zu verwendenden Farben;"
" Hintergrundfarbe kann genutzt"
"werden mit Format Text:Hintergrund; wenn Farben vorhanden sind, werden die"
" WeeChat"
"Optionen für Nick-Farben und erzwungenen Nick-Farben ignoriert)"
"Nickname;Bereich;Farben (Bereich ist eine Anzahl von Zeichen (siehe "
"Funktion).strcasecmp_range, 0 = in Kleinbuchstaben konvertieren, ohne einen "
"Bereich zu verwenden), Farbenist eine optionale, durch Kommas getrennte "
"Liste der zu verwendenden Farben; Hintergrundfarbe kann genutztwerden mit "
"Format Text:Hintergrund; wenn Farben vorhanden sind, werden die "
"WeeChatOptionen für Nick-Farben und erzwungenen Nick-Farben ignoriert)"
#| msgid "get nick color name"
msgid "get nick color name, ignoring case"
msgstr ""
"hole Farbnamen des Nick, dabei wird die Groß- und Kleinschreibung ignoriert"
@@ -16459,8 +16387,7 @@ msgstr "verwaltet Trigger, das Schweizer Armeemesser für WeeChat"
msgid ""
"list [-o|-ol|-i|-il] || listfull || listdefault || add|addoff|addreplace "
"<name> <hook> "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<"
"return_code>\" [\"<post_action>\"]]]]]] "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<return_code>\" [\"<post_action>\"]]]]]] "
"|| addinput [<hook>] || input|output|recreate <name> || set <name> <option> "
"<value> || rename|copy <name> <new_name> || enable|disable|toggle [<name>|-"
"all [<name>...]] || restart <name>|-all [<name>...] || show <name> || del "
@@ -16469,8 +16396,7 @@ msgid ""
msgstr ""
"list [-o|-ol|-i|-il] || listfull || listdefault || add|addoff|addreplace "
"<name> <hook> "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<"
"return_code>\" [\"<post_action>\"]]]]]] "
"[\"<arguments>\" [\"<conditions>\" [\"<regex>\" [\"<command>\" [\"<return_code>\" [\"<post_action>\"]]]]]] "
"|| addinput [<hook>] || input|output|recreate <name> || set <name> <option> "
"<value> || rename|copy <name> <new_name> || enable|disable|toggle [<name>|-"
"all [<name>...]] || restart <name>|-all [<name>...] || show <name> || del "
+15 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2992,7 +2992,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+30 -4
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"PO-Revision-Date: 2023-08-26 20:04+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-27 07:57+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -3080,7 +3080,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
@@ -3098,7 +3111,20 @@ msgstr ""
" h : heures\n"
" nombre : nombre de fois que la commande sera exécutée\n"
"commande : commande à exécuter (ou texte à envoyer au tampon si la commande "
"ne commence pas par '/')\n"
"ne commence pas par '/'), évaluée et les variables suivantes sont définies à "
"chaque exécution de commande :\n"
" ${buffer} : pointeur vers le tampon\n"
" ${repeat_count} : nombre de fois que la commande est exécutée\n"
" ${repeat_index} : index courant (de 1 à \"nombre\")\n"
" ${repeat_index0} : index courant (de 0 à \"nombre\" - 1)\n"
" ${repeat_revindex} : index courant depuis la fin (de \"nombre\" "
"à 1)\n"
" ${repeat_revindex0} : index courant depuis la fin (de "
"\"nombre\" - 1 à 0)\n"
" ${repeat_first} : \"1\" pour la première exécution, \"0\" pour "
"les autres\n"
" ${repeat_last} : \"1\" pour la dernière exécution, \"0\" pour "
"les autres\n"
"\n"
"Note : la commande est exécutée sur le tampon où /repeat a été exécuté (si "
"le tampon n'existe plus, la commande n'est pas exécutée).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2210,7 +2210,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2590,7 +2590,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-08 07:13+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -3072,7 +3072,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-08 07:13+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -3539,7 +3539,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -3046,7 +3046,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-26 21:34+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2655,7 +2655,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-06-17 11:47+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -2234,7 +2234,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-08 07:14+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3171,7 +3171,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+0200\n"
"PO-Revision-Date: 2023-08-08 07:14+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3152,7 +3152,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+15 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-08-26 20:02+0200\n"
"POT-Creation-Date: 2023-08-27 07:57+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"
@@ -2050,7 +2050,20 @@ msgid ""
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command does not "
"start with '/')\n"
"start with '/'), evaluated and the following variables are set each time the "
"command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end (from \"count\" to "
"1)\n"
" ${repeat_revindex0}: current index from the end (from \"count\" - "
"1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, \"0\" for the "
"others\n"
" ${repeat_last}: \"1\" for the last execution, \"0\" for the "
"others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed (if the "
"buffer does not exist any more, the command is not executed).\n"
+123 -45
View File
@@ -5719,6 +5719,91 @@ COMMAND_CALLBACK(reload)
return WEECHAT_RC_OK;
}
/*
* Executes a repeated command.
*/
void
command_repeat_exec (struct t_command_repeat *command_repeat)
{
struct t_gui_buffer *ptr_buffer;
struct t_hashtable *pointers, *extra_vars;
char str_number[32], *cmd_eval;
if (!command_repeat || !command_repeat->buffer_name
|| !command_repeat->command)
{
return;
}
ptr_buffer = gui_buffer_search_by_full_name (command_repeat->buffer_name);
if (!ptr_buffer)
return;
pointers = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_POINTER,
NULL, NULL);
if (!pointers)
return;
extra_vars = hashtable_new (
32,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL, NULL);
if (!extra_vars)
{
hashtable_free (pointers);
return;
}
hashtable_set (pointers, "buffer", ptr_buffer);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count);
hashtable_set (extra_vars, "repeat_count", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->index);
hashtable_set (extra_vars, "repeat_index", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->index - 1);
hashtable_set (extra_vars, "repeat_index0", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count - command_repeat->index + 1);
hashtable_set (extra_vars, "repeat_revindex", str_number);
snprintf (str_number, sizeof (str_number), "%d", command_repeat->count - command_repeat->index);
hashtable_set (extra_vars, "repeat_revindex0", str_number);
hashtable_set (extra_vars, "repeat_first",
(command_repeat->index == 1) ? "1" : "0");
hashtable_set (extra_vars, "repeat_last",
(command_repeat->index >= command_repeat->count) ? "1" : "0");
cmd_eval = eval_expression (command_repeat->command,
pointers, extra_vars, NULL);
if (cmd_eval)
{
(void) input_data (ptr_buffer,
cmd_eval,
command_repeat->commands_allowed,
0); /* split_newline */
free (cmd_eval);
}
hashtable_free (pointers);
hashtable_free (extra_vars);
if (command_repeat->index < command_repeat->count)
{
/* increment index for next execution */
command_repeat->index++;
}
else
{
/* it was the last execution, free up memory */
free (command_repeat->buffer_name);
free (command_repeat->command);
if (command_repeat->commands_allowed)
free (command_repeat->commands_allowed);
free (command_repeat);
}
}
/*
* Callback for repeat timer.
*/
@@ -5726,35 +5811,11 @@ COMMAND_CALLBACK(reload)
int
command_repeat_timer_cb (const void *pointer, void *data, int remaining_calls)
{
char **repeat_args;
int i;
struct t_gui_buffer *ptr_buffer;
/* make C compiler happy */
(void) data;
(void) remaining_calls;
repeat_args = (char **)pointer;
if (!repeat_args)
return WEECHAT_RC_ERROR;
if (repeat_args[0] && repeat_args[1])
{
/* search buffer, fallback to core buffer if not found */
ptr_buffer = gui_buffer_search_by_full_name (repeat_args[0]);
if (ptr_buffer)
(void) input_data (ptr_buffer, repeat_args[1], repeat_args[2], 0);
}
if (remaining_calls == 0)
{
for (i = 0; i < 3; i++)
{
if (repeat_args[i])
free (repeat_args[i]);
}
free (repeat_args);
}
command_repeat_exec ((struct t_command_repeat *)pointer);
return WEECHAT_RC_OK;
}
@@ -5767,7 +5828,8 @@ COMMAND_CALLBACK(repeat)
{
int arg_count, count, i;
long long interval;
char *error, **repeat_args;
char *error;
struct t_command_repeat *cmd_repeat;
/* make C compiler happy */
(void) pointer;
@@ -5799,8 +5861,25 @@ COMMAND_CALLBACK(repeat)
return WEECHAT_RC_OK;
}
cmd_repeat = malloc (sizeof (*cmd_repeat));
if (!cmd_repeat)
{
gui_chat_printf (NULL,
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/repeat");
return WEECHAT_RC_OK;
}
cmd_repeat->buffer_name = strdup (buffer->full_name);
cmd_repeat->command = strdup (argv_eol[arg_count + 1]);
cmd_repeat->commands_allowed = (input_commands_allowed) ?
string_rebuild_split_string (
(const char **)input_commands_allowed, ",", 0, -1) : NULL;
cmd_repeat->count = count;
cmd_repeat->index = 1;
/* first execute command now */
(void) input_data (buffer, argv_eol[arg_count + 1], NULL, 0);
command_repeat_exec (cmd_repeat);
/* repeat execution of command */
if (count > 1)
@@ -5810,28 +5889,14 @@ COMMAND_CALLBACK(repeat)
/* execute command multiple times now */
for (i = 0; i < count - 1; i++)
{
(void) input_data (buffer, argv_eol[arg_count + 1], NULL, 0);
command_repeat_exec (cmd_repeat);
}
}
else
{
/* schedule execution of command in future */
repeat_args = malloc (3 * sizeof (*repeat_args));
if (!repeat_args)
{
gui_chat_printf (NULL,
_("%sNot enough memory (%s)"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
"/repeat");
return WEECHAT_RC_OK;
}
repeat_args[0] = strdup (buffer->full_name);
repeat_args[1] = strdup (argv_eol[arg_count + 1]);
repeat_args[2] = (input_commands_allowed) ?
string_rebuild_split_string (
(const char **)input_commands_allowed, ",", 0, -1) : NULL;
hook_timer (NULL, interval, 0, count - 1,
&command_repeat_timer_cb, repeat_args, NULL);
&command_repeat_timer_cb, cmd_repeat, NULL);
}
}
@@ -8932,7 +8997,20 @@ command_init ()
" h: hours\n"
" count: number of times to execute command\n"
"command: command to execute (or text to send to buffer if command "
"does not start with '/')\n"
"does not start with '/'), evaluated and the following variables "
"are set each time the command is executed:\n"
" ${buffer}: buffer pointer\n"
" ${repeat_count}: number of times the command is executed\n"
" ${repeat_index}: current index (from 1 to \"count\")\n"
" ${repeat_index0}: current index (from 0 to \"count\" - 1)\n"
" ${repeat_revindex}: current index from the end "
"(from \"count\" to 1)\n"
" ${repeat_revindex0}: current index from the end "
"(from \"count\" - 1 to 0)\n"
" ${repeat_first}: \"1\" for the first execution, "
"\"0\" for the others\n"
" ${repeat_last}: \"1\" for the last execution, "
"\"0\" for the others\n"
"\n"
"Note: the command is executed on buffer where /repeat was executed "
"(if the buffer does not exist any more, the command is not "
+10 -1
View File
@@ -21,6 +21,8 @@
#ifndef WEECHAT_COMMAND_H
#define WEECHAT_COMMAND_H
struct t_gui_buffer;
#define COMMAND_CALLBACK(__command) \
int \
command_##__command (const void *pointer, void *data, \
@@ -80,7 +82,14 @@
return WEECHAT_RC_ERROR; \
}
struct t_gui_buffer;
struct t_command_repeat
{
char *buffer_name; /* full buffer name */
char *command; /* cmd to exec (or text for buffer) */
char *commands_allowed; /* commands currently allowed */
int count; /* number of times the cmd is exec. */
int index; /* current index (starts at 1) */
};
extern const char *command_help_option_color_values ();
extern void command_version_display (struct t_gui_buffer *buffer,