diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2014-05-13 22:12:19 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2014-05-13 22:12:19 +0200 |
commit | 32edff0fa50551dee049cc808552757752ef81c3 (patch) | |
tree | 522b6d58bee75129e59a883c11a26015df9b2aa4 | |
parent | 4d70264ac68c1af9a94ac1290e4641422f4b4eee (diff) | |
download | weechat-32edff0fa50551dee049cc808552757752ef81c3.zip |
core: add option "-buffer" in command /command (closes #67)
-rw-r--r-- | ChangeLog.asciidoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/weechat_commands.txt | 7 | ||||
-rw-r--r-- | doc/en/autogen/user/weechat_commands.txt | 5 | ||||
-rw-r--r-- | doc/fr/autogen/user/weechat_commands.txt | 5 | ||||
-rw-r--r-- | doc/it/autogen/user/weechat_commands.txt | 7 | ||||
-rw-r--r-- | doc/ja/autogen/user/weechat_commands.txt | 7 | ||||
-rw-r--r-- | doc/pl/autogen/user/weechat_commands.txt | 7 | ||||
-rw-r--r-- | po/cs.po | 11 | ||||
-rw-r--r-- | po/de.po | 11 | ||||
-rw-r--r-- | po/es.po | 11 | ||||
-rw-r--r-- | po/fr.po | 18 | ||||
-rw-r--r-- | po/hu.po | 9 | ||||
-rw-r--r-- | po/it.po | 11 | ||||
-rw-r--r-- | po/ja.po | 11 | ||||
-rw-r--r-- | po/pl.po | 11 | ||||
-rw-r--r-- | po/pt_BR.po | 11 | ||||
-rw-r--r-- | po/ru.po | 9 | ||||
-rw-r--r-- | po/tr.po | 10 | ||||
-rw-r--r-- | po/weechat.pot | 9 | ||||
-rw-r--r-- | src/core/wee-command.c | 48 |
20 files changed, 152 insertions, 67 deletions
diff --git a/ChangeLog.asciidoc b/ChangeLog.asciidoc index 056cbf569..420cfedaf 100644 --- a/ChangeLog.asciidoc +++ b/ChangeLog.asciidoc @@ -15,6 +15,7 @@ http://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes] == Version 1.0 (under dev) +* core: add option "-buffer" in command /command (closes #67) * core: add support of negated tags in filters (with '!') (closes #72, closes #74) * core: fix restoration of core buffer properties after /upgrade diff --git a/doc/de/autogen/user/weechat_commands.txt b/doc/de/autogen/user/weechat_commands.txt index cbd346a2f..38a7ed5f6 100644 --- a/doc/de/autogen/user/weechat_commands.txt +++ b/doc/de/autogen/user/weechat_commands.txt @@ -167,10 +167,11 @@ Beispiele: [command]*`command`* führe explizit einen WeeChat Befehl oder eine Erweiterung aus:: ---- -/command <plugin> <command> +/command [-buffer <name>] <plugin> <command> - plugin: Name der Erweiterung ('core' für interne WeeChat Befehle) -command: auszuführender Befehl (es wird automatisch ein '/' vorangestellt, falls dieser nicht angegeben wurde) +-buffer: execute the command on this buffer + plugin: execute the command from this plugin; 'core' for a WeeChat command, '*' for automatic plugin (it depends on the buffer where the command is executed) +command: command to execute (a '/' is automatically added if not found at beginning of command) ---- [[command_weechat_cursor]] diff --git a/doc/en/autogen/user/weechat_commands.txt b/doc/en/autogen/user/weechat_commands.txt index 7f24cf0f3..1b5612c45 100644 --- a/doc/en/autogen/user/weechat_commands.txt +++ b/doc/en/autogen/user/weechat_commands.txt @@ -167,9 +167,10 @@ Examples: [command]*`command`* launch explicit WeeChat or plugin command:: ---- -/command <plugin> <command> +/command [-buffer <name>] <plugin> <command> - plugin: plugin name ('core' for WeeChat internal command) +-buffer: execute the command on this buffer + plugin: execute the command from this plugin; 'core' for a WeeChat command, '*' for automatic plugin (it depends on the buffer where the command is executed) command: command to execute (a '/' is automatically added if not found at beginning of command) ---- diff --git a/doc/fr/autogen/user/weechat_commands.txt b/doc/fr/autogen/user/weechat_commands.txt index af9484a62..a8badfa3e 100644 --- a/doc/fr/autogen/user/weechat_commands.txt +++ b/doc/fr/autogen/user/weechat_commands.txt @@ -167,9 +167,10 @@ Exemples : [command]*`command`* lancer explicitement une commande WeeChat ou d'une extension:: ---- -/command <extension> <commande> +/command [-buffer <nom>] <extension> <commande> -extension : nom de l'extension ('core' pour une commande interne WeeChat) + -buffer : exécuter la commande sur ce tampon +extension : exécuter la commande de cette extension ; 'core' pour une commande WeeChat, '*' pour une extension automatique (cela dépend sur quel tampon est exécutée la commande) commande : commande à exécuter (un '/' est automatiquement ajouté s'il n'est pas trouvé au début de la commande) ---- diff --git a/doc/it/autogen/user/weechat_commands.txt b/doc/it/autogen/user/weechat_commands.txt index 61fb893bc..1bc6d888f 100644 --- a/doc/it/autogen/user/weechat_commands.txt +++ b/doc/it/autogen/user/weechat_commands.txt @@ -167,10 +167,11 @@ Examples: [command]*`command`* esegui comando o plugin di WeeChat esplicito:: ---- -/command <plugin> <comando> +/command [-buffer <name>] <plugin> <command> - plugin: nome plugin ('core' per il comando interno di WeeChat) -comando: comando da eseguire (una '/' viene aggiunta automaticamente se non trovata all'inizio del comando) +-buffer: execute the command on this buffer + plugin: execute the command from this plugin; 'core' for a WeeChat command, '*' for automatic plugin (it depends on the buffer where the command is executed) +command: command to execute (a '/' is automatically added if not found at beginning of command) ---- [[command_weechat_cursor]] diff --git a/doc/ja/autogen/user/weechat_commands.txt b/doc/ja/autogen/user/weechat_commands.txt index 4f9106a09..ed9cc47c8 100644 --- a/doc/ja/autogen/user/weechat_commands.txt +++ b/doc/ja/autogen/user/weechat_commands.txt @@ -167,10 +167,11 @@ rgb2term: RGB 色をターミナル色 (0-255) に変換 [command]*`command`* WeeChat かプラグインのコマンドを起動:: ---- -/command <plugin> <command> +/command [-buffer <name>] <plugin> <command> - plugin: プラグインの名前 ('core' は WeeChat の内部コマンドを意味します) -command: 実行するコマンド (コマンドの最初に '/' が無い場合、'/' が自動的に追加されます) +-buffer: execute the command on this buffer + plugin: execute the command from this plugin; 'core' for a WeeChat command, '*' for automatic plugin (it depends on the buffer where the command is executed) +command: command to execute (a '/' is automatically added if not found at beginning of command) ---- [[command_weechat_cursor]] diff --git a/doc/pl/autogen/user/weechat_commands.txt b/doc/pl/autogen/user/weechat_commands.txt index ce51b05f3..8f2c08e2a 100644 --- a/doc/pl/autogen/user/weechat_commands.txt +++ b/doc/pl/autogen/user/weechat_commands.txt @@ -167,10 +167,11 @@ Examples: [command]*`command`* wywołaj wyraźnie komendę WeeChat lub wtyczki:: ---- -/command <wtyczka> <komenda> +/command [-buffer <name>] <plugin> <command> - wtyczka: nazwa wtyczki ('core' dla wewnętrznych komend WeeChat ) -komenda: komenda do wywołania ( '/' jest automatycznie dodawane jeśli nie występuje na początku komendy) +-buffer: execute the command on this buffer + plugin: execute the command from this plugin; 'core' for a WeeChat command, '*' for automatic plugin (it depends on the buffer where the command is executed) +command: command to execute (a '/' is automatically added if not found at beginning of command) ---- [[command_weechat_cursor]] @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1258,11 +1258,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "pustit uvedený WeeChat nebo plugin příkaz" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <příkaz>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-05-13 16:37+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <weechatter@arcor.de>\n" @@ -1300,11 +1300,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "führe explizit einen WeeChat Befehl oder eine Erweiterung aus" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <command>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1269,11 +1269,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "lanza explícitamente un comando de WeeChat o plugin" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <comando>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" -"PO-Revision-Date: 2014-05-12 23:07+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" +"PO-Revision-Date: 2014-05-13 21:40+0200\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -1279,15 +1279,21 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "lancer explicitement une commande WeeChat ou d'une extension" -msgid "<plugin> <command>" -msgstr "<extension> <commande>" +msgid "[-buffer <name>] <plugin> <command>" +msgstr "[-buffer <nom>] <extension> <commande>" msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" -"extension : nom de l'extension ('core' pour une commande interne WeeChat)\n" +" -buffer : exécuter la commande sur ce tampon\n" +"extension : exécuter la commande de cette extension ; 'core' pour une " +"commande WeeChat, '*' pour une extension automatique (cela dépend sur quel " +"tampon est exécutée la commande)\n" " commande : commande à exécuter (un '/' est automatiquement ajouté s'il " "n'est pas trouvé au début de la commande)" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1200,12 +1200,15 @@ msgid "launch explicit WeeChat or plugin command" msgstr "" #, fuzzy -msgid "<plugin> <command>" +msgid "[-buffer <name>] <plugin> <command>" msgstr "Modul parancsok:\n" #, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1247,11 +1247,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "esegui comando o plugin di WeeChat esplicito" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <comando>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-21 00:44+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/translation_ja>\n" @@ -1248,11 +1248,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "WeeChat かプラグインのコマンドを起動" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <command>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-19 13:08+0200\n" "Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1268,11 +1268,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "wywołaj wyraźnie komendę WeeChat lub wtyczki" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<wtyczka> <komenda>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" diff --git a/po/pt_BR.po b/po/pt_BR.po index 13f8924d7..919b3fdff 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-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1283,11 +1283,16 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "executar explicitamente um comando do WeeChat ou de um plugin" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<plugin> <comando>" +#, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-04-05 16:12+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1221,12 +1221,15 @@ msgid "launch explicit WeeChat or plugin command" msgstr "" #, fuzzy -msgid "<plugin> <command>" +msgid "[-buffer <name>] <plugin> <command>" msgstr "Команды Plugin'ов:\n" #, fuzzy msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2014-03-24 14:23+0100\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1065,11 +1065,15 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "" -msgid "<plugin> <command>" +#, fuzzy +msgid "[-buffer <name>] <plugin> <command>" msgstr "<eklenti> <komut>" msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" diff --git a/po/weechat.pot b/po/weechat.pot index 0007ddebb..43ea4466b 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat 0.4.1-dev\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2014-05-12 23:06+0200\n" +"POT-Creation-Date: 2014-05-13 21:39+0200\n" "PO-Revision-Date: 2013-02-14 18:20+0100\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -1071,11 +1071,14 @@ msgstr "" msgid "launch explicit WeeChat or plugin command" msgstr "" -msgid "<plugin> <command>" +msgid "[-buffer <name>] <plugin> <command>" msgstr "" msgid "" -" plugin: plugin name ('core' for WeeChat internal command)\n" +"-buffer: execute the command on this buffer\n" +" plugin: execute the command from this plugin; 'core' for a WeeChat command, " +"'*' for automatic plugin (it depends on the buffer where the command is " +"executed)\n" "command: command to execute (a '/' is automatically added if not found at " "beginning of command)" msgstr "" diff --git a/src/core/wee-command.c b/src/core/wee-command.c index f393ef099..92a256ba4 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -1491,9 +1491,10 @@ COMMAND_CALLBACK(color) COMMAND_CALLBACK(command) { - int length; + int length, index_args, any_plugin; char *command; struct t_weechat_plugin *ptr_plugin; + struct t_gui_buffer *ptr_buffer; /* make C compiler happy */ (void) data; @@ -1501,30 +1502,48 @@ COMMAND_CALLBACK(command) if (argc < 3) return WEECHAT_RC_ERROR; + ptr_buffer = buffer; + index_args = 1; + any_plugin = 0; ptr_plugin = NULL; - if (string_strcasecmp (argv[1], PLUGIN_CORE) != 0) + + if ((argc >= 5) && (string_strcasecmp (argv[1], "-buffer") == 0)) { - ptr_plugin = plugin_search (argv[1]); + ptr_buffer = gui_buffer_search_by_full_name (argv[2]); + if (!ptr_buffer) + ptr_buffer = buffer; + index_args = 3; + } + + if (strcmp (argv[index_args], "*") == 0) + { + any_plugin = 1; + ptr_plugin = ptr_buffer->plugin; + } + else if (string_strcasecmp (argv[index_args], PLUGIN_CORE) != 0) + { + ptr_plugin = plugin_search (argv[index_args]); if (!ptr_plugin) { gui_chat_printf (NULL, _("%sPlugin \"%s\" not found"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], - argv[1]); + argv[index_args]); return WEECHAT_RC_OK; } } - if (string_is_command_char (argv_eol[2])) + if (string_is_command_char (argv_eol[index_args + 1])) { - input_exec_command (buffer, 0, ptr_plugin, argv_eol[2]); + input_exec_command (ptr_buffer, any_plugin, ptr_plugin, + argv_eol[index_args + 1]); } else { - length = strlen (argv_eol[2]) + 2; + length = strlen (argv_eol[index_args + 1]) + 2; command = malloc (length); if (command) { - snprintf (command, length, "/%s", argv_eol[2]); - input_exec_command (buffer, 0, ptr_plugin, command); + snprintf (command, length, "/%s", argv_eol[index_args + 1]); + input_exec_command (ptr_buffer, any_plugin, ptr_plugin, command); free (command); } } @@ -6893,11 +6912,16 @@ command_init () hook_command ( NULL, "50000|command", N_("launch explicit WeeChat or plugin command"), - N_("<plugin> <command>"), - N_(" plugin: plugin name ('core' for WeeChat internal command)\n" + N_("[-buffer <name>] <plugin> <command>"), + N_("-buffer: execute the command on this buffer\n" + " plugin: execute the command from this plugin; 'core' for a " + "WeeChat command, '*' for automatic plugin (it depends on the " + "buffer where the command is executed)\n" "command: command to execute (a '/' is automatically added if not " "found at beginning of command)"), - "%(plugins_names)|" PLUGIN_CORE " %(plugins_commands)", + "-buffer %(buffers_plugins_names) " + "%(plugins_names)|" PLUGIN_CORE " %(plugins_commands)" + " || %(plugins_names)|" PLUGIN_CORE " %(plugins_commands)", &command_command, NULL); hook_command ( NULL, "cursor", |