api: add function command_options (issue #928)

v2.8-utf8proc
Sébastien Helleu 2019-02-28 00:14:38 +01:00
parent 64043d5a6c
commit 80b980b2af
43 changed files with 693 additions and 165 deletions

View File

@ -21,6 +21,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add option "addreplace" in command /filter (issue #1055, issue #1312)
* api: add function command_options (issue #928)
* api: add function string_match_list
* spell: rename aspell plugin to spell (issue #1299)

View File

@ -604,7 +604,8 @@ Liste der Skript API Funktionen:
bar_remove
| Befehle |
command
command +
command_options
| Informationen |
info_get +

View File

@ -14375,6 +14375,63 @@ weechat.command(buffer, command)
rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode")
----
==== command_options
_WeeChat ≥ 2.5._
Execute a command or send text to buffer with options.
Prototype:
[source,C]
----
int weechat_command_options (struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options);
----
Arguments:
* _buffer_: buffer pointer (command is executed on this buffer, use NULL for
current buffer)
* _command_: command to execute (if beginning with a "/"), or text to send to
buffer
* _options_: a hashtable with some options (keys and values must be string)
(can be NULL):
** _commands_: a comma-separated list of commands allowed to be executed during
this call; see function <<_string_match_list,string_match_list>> for the
format
Return value:
* _WEECHAT_RC_OK_ if successful
* _WEECHAT_RC_ERROR_ if error
C example:
[source,C]
----
/* allow any command except /exec */
int rc;
struct t_hashtable *options = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options, "commands", "*,!exec");
rc = weechat_command_options (NULL, "/some_command arguments", options);
----
Script (Python):
[source,python]
----
# prototype
weechat.command_options(buffer, command, options)
# example: allow any command except /exec
rc = weechat.command("", "/some_command arguments", {"commands": "*,!exec"})
----
[[network]]
=== Network

View File

@ -591,7 +591,8 @@ List of functions in script API:
bar_remove
| commands |
command
command +
command_options
| infos |
info_get +

View File

@ -14691,6 +14691,63 @@ weechat.command(buffer, command)
rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode")
----
==== command_options
_WeeChat ≥ 2.5._
Exécuter une commande ou envoyer du texte au tampon avec des options.
Prototype :
[source,C]
----
int weechat_command_options (struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options);
----
Paramètres :
* _buffer_ : pointeur vers le tampon (la commande est exécutée sur ce tampon,
NULL pour le tampon courant)
* _command_ : commande à exécuter (si elle commence par "/"), ou texte à
envoyer au tampon
* _options_ : table de hachage avec des options (les clés et valeurs doivent
être des chaînes) (peut être NULL) :
** _commands_ : une liste de commandes autorisées pendant l'appel, séparées par
des virgules ; voir la fonction <<_string_match_list,string_match_list>>
pour le format
Valeur de retour :
* _WEECHAT_RC_OK_ si ok
* _WEECHAT_RC_ERROR_ si erreur
Exemple en C :
[source,C]
----
/* autoriser toute commande sauf /exec */
int rc;
struct t_hashtable *options = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options, "commands", "*,!exec");
rc = weechat_command_options (NULL, "/une_commande paramètres", options);
----
Script (Python) :
[source,python]
----
# prototype
weechat.command_options(buffer, command, options)
# exemple : autoriser toute commande sauf /exec
rc = weechat.command("", "/une_commande paramètres", {"commands": "*,!exec"})
----
[[network]]
=== Réseau

View File

@ -603,9 +603,10 @@ Liste des fonctions de l'API script :
bar_remove
| commandes |
command
command +
command_options
| infos |
| infos |
info_get +
info_get_hashtable

View File

@ -14953,6 +14953,67 @@ weechat.command(buffer, command)
rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode")
----
==== command_options
_WeeChat ≥ 2.5._
// TRANSLATION MISSING
Execute a command or send text to buffer with options.
Prototipo:
[source,C]
----
int weechat_command_options (struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options);
----
Argomenti:
* _buffer_: puntatore al buffer (il comando viene eseguito su questo buffer,
utilizzare NULL per il buffer corrente)
* _command_: comando da eseguire (se preceduto da "/"), oppure il testo
viene inviato sul buffer
// TRANSLATION MISSING
* _options_: a hashtable with some options (keys and values must be string)
(can be NULL):
** _commands_: a comma-separated list of commands allowed to be executed during
this call; see function <<_string_match_list,string_match_list>> for the
format
Valori restituiti:
* _WEECHAT_RC_OK_ se l'operazione ha successo
* _WEECHAT_RC_ERROR_ se c'è un errore
Esempio in C:
// TRANSLATION MISSING
[source,C]
----
/* allow any command except /exec */
int rc;
struct t_hashtable *options = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options, "commands", "*,!exec");
rc = weechat_command_options (NULL, "/some_command arguments", options);
----
Script (Python):
// TRANSLATION MISSING
[source,python]
----
# prototipo
weechat.command_options(buffer, command, options)
# example: allow any command except /exec
rc = weechat.command("", "/some_command arguments", {"commands": "*,!exec"})
----
[[network]]
=== Network

View File

@ -611,7 +611,8 @@ Elenco di funzioni nelle API per gli script:
bar_remove
| comandi |
comando
command +
command_options
| info |
info_get +

View File

@ -14335,6 +14335,67 @@ weechat.command(buffer, command)
rc = weechat.command(weechat.buffer_search("irc", "freenode.#weechat"), "/whois FlashCode")
----
==== command_options
_WeeChat ≥ 2.5._
// TRANSLATION MISSING
Execute a command or send text to buffer with options.
プロトタイプ:
[source,C]
----
int weechat_command_options (struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options);
----
引数:
* _buffer_: バッファへのポインタ
(コマンドは指定したバッファで実行されます、現在のバッファで実行するには NULL を指定してください)
* _command_: 実行するコマンド ("/"
で始まっている場合)、またはバッファに送信するテキスト
// TRANSLATION MISSING
* _options_: a hashtable with some options (keys and values must be string)
(can be NULL):
** _commands_: a comma-separated list of commands allowed to be executed during
this call; see function <<_string_match_list,string_match_list>> for the
format
戻り値:
* _WEECHAT_RC_OK_ 成功した場合
* _WEECHAT_RC_ERROR_ エラーが起きた場合
C 言語での使用例:
// TRANSLATION MISSING
[source,C]
----
/* allow any command except /exec */
int rc;
struct t_hashtable *options = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING,
NULL,
NULL);
weechat_hashtable_set (options, "commands", "*,!exec");
rc = weechat_command_options (NULL, "/some_command arguments", options);
----
スクリプト (Python) での使用例:
// TRANSLATION MISSING
[source,python]
----
# プロトタイプ
weechat.command_options(buffer, command, options)
# example: allow any command except /exec
rc = weechat.command("", "/some_command arguments", {"commands": "*,!exec"})
----
[[network]]
=== ネットワーク

View File

@ -570,7 +570,7 @@ link:weechat_plugin_api.ja.html[WeeChat プラグイン API リファレンス]
window_get_pointer +
window_set_title
| ニックネームリスト |
| ニックネームリスト |
nicklist_add_group +
nicklist_search_group +
nicklist_add_nick +
@ -599,7 +599,8 @@ link:weechat_plugin_api.ja.html[WeeChat プラグイン API リファレンス]
bar_remove
| コマンド |
command
command +
command_options
| インフォ |
info_get +

View File

@ -466,7 +466,7 @@ Lista funkcji w API skryptów:
list_remove_all +
list_free
| pliki konfiguracyjne|
| pliki konfiguracyjne |
config_new +
config_new_section +
config_search_section +
@ -504,7 +504,7 @@ Lista funkcji w API skryptów:
config_set_desc_plugin +
config_unset_plugin
| przypisania klawiszy|
| przypisania klawiszy |
key_bind +
key_unbind
@ -597,7 +597,8 @@ Lista funkcji w API skryptów:
bar_remove
| komendy |
command
command +
command_options
| informacje |
info_get +

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-01-29 21:01+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: cs\n"
@ -4130,6 +4130,10 @@ msgstr "%sChyba odesílání signálu %d na pid %d: %s"
msgid "%sYou can not write text in this buffer"
msgstr "%sDo tohoto bufferu nemůžete zapisovat text"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sBarva \"%s\" není definovávána v paletě"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sChyba: neznámý příkaz \"%s\" (napište /help pro nápovědu)"
@ -12680,13 +12684,3 @@ msgstr "%s%s: vypršel časový limit \"%s\" pro %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nemohu se připojit\" neočekávaná chyba (%d)"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr "%sChyba: buffer se stejným jménem (%s) už existuje"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell povolen"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell zakázán"

View File

@ -24,8 +24,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-02-23 23:18+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
"Language: de\n"
@ -4981,6 +4981,10 @@ msgstr "%sFehler beim Versenden des Signals %d an pid %d: %s"
msgid "%sYou can not write text in this buffer"
msgstr "%sIn diesen Buffer kann nicht geschrieben werden"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sBefehl \"/%s eval\" ist zur Zeit noch nicht implementiert"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr ""
@ -14801,12 +14805,3 @@ msgstr "%s%s: Zeitüberschreitung für \"%s\" mit %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr ""
"%s%s: Verbindung konnte nicht hergestellt werden: unerwarteter Fehler (%d)"
#~ msgid "a filter with same name already exists"
#~ msgstr "es existiert bereits ein Filter mit dem selben Namen"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell wurde aktiviert"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell wurde deaktiviert"

View File

@ -22,8 +22,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-01-29 21:02+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: es\n"
@ -4323,6 +4323,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr "%sNo es posible escribir texto en este buffer"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sColor \"%s\" no está definido en la paleta"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sError: comando \"%s\" desconocido (use /help para ver la ayuda)"
@ -12964,13 +12968,3 @@ msgstr "%s%s: tiempo de espera máximo para \"%s\" con %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: no es posible conectarse al transmisor"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr "%sError: un buffer con el mismo nombre (%s) ya existe"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell activado"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell desactivado"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-02-23 13:40+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -4852,6 +4852,10 @@ msgstr "%sErreur d'envoi du signal %d au pid %d : %s"
msgid "%sYou can not write text in this buffer"
msgstr "%sVous ne pouvez pas écrire de texte dans ce tampon"
#, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "debug : la commande \"%s\" n'est pas autorisée dans ce contexte"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sErreur : commande \"%s\" inconnue (tapez /help pour l'aide)"
@ -14499,12 +14503,3 @@ msgstr "%s%s : délai d'attente dépassé pour \"%s\" avec %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s : impossible de se connecter : erreur inattendue (%d)"
#~ msgid "a filter with same name already exists"
#~ msgstr "un filtre avec le même nom existe déjà"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell activé"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell désactivé"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: hu\n"
@ -3697,6 +3697,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr "%s az utolsó puffert nem lehet bezárni\n"
#, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr ""
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s a \"%s\" aliasz vagy parancs nem található\n"
@ -11951,16 +11955,3 @@ msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s DCC: nem sikerült kapcsolódni a küldőhöz\n"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr ""
#~ "%s nem sikerült a \"%s\" modult betölteni: már van ilyen nevű modul\n"
#, fuzzy
#~ msgid "Aspell enabled"
#~ msgstr "a felhasználók le lettek tiltva"
#, fuzzy
#~ msgid "Aspell disabled"
#~ msgstr "Nincs aliasz definiálva.\n"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-01-29 21:03+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: it\n"
@ -4438,6 +4438,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr "%sNon è possibile scrivere del testo in questo buffer"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sColore \"%s\" non definito nella tavolozza"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sErrore: comando \"%s\" sconosciuto (digita /help per l'aiuto)"
@ -13181,13 +13185,3 @@ msgstr "%s%s: timeout per \"%s\" con %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: impossibile connettersi al mittente"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr "%sErrore: un buffer con lo stesso nome (%s) esiste già"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell abilitato"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell disabilitato"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-02-03 19:01+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:18+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
"translation/ja_JP>\n"
@ -4642,6 +4642,10 @@ msgstr "%sシグナル %d を pid %d に送信中にエラー: %s"
msgid "%sYou can not write text in this buffer"
msgstr "%sこのバッファに書き込むことは出来ません"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sコマンド \"/%s eval\" はまだ実装されていません"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sエラー: 未定義のコマンド \"%s\" (ヘルプを見るには /help を入力)"
@ -13967,12 +13971,3 @@ msgstr "%s%s: \"%s\" のタイムアウト %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: 接続できません: 未定義のエラー (%d)"
#~ msgid "a filter with same name already exists"
#~ msgstr "同名のフィルタが既に存在します"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell が有効化されています"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell が無効化されています"

View File

@ -22,8 +22,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-02-09 21:00+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:19+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
"Language: pl\n"
@ -4750,6 +4750,10 @@ msgstr "%sBłąd wysyłania sygnału %d do pid %d: %s"
msgid "%sYou can not write text in this buffer"
msgstr "%s nie możesz nic pisać w tym buforze"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sKomenda \"/%s eval\" nie jest jeszcze zaimplementowana"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sBłąd: nieznana komenda \"%s\" (wpisz /help , aby uzyskać pomoc)"
@ -14187,12 +14191,3 @@ msgstr "%s%s: przekroczono czas na \"%s\" z %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nie można połączyć: niespodziewany błąd (%d)"
#~ msgid "a filter with same name already exists"
#~ msgstr "filtr o tej nazwie już istnieje"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell włączony"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell wyłączony"

View File

@ -20,8 +20,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-02-03 19:01+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:19+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
"Language: pt\n"
@ -4690,6 +4690,10 @@ msgstr "%sErro ao enviar o sinal %d ao pid %d: %s"
msgid "%sYou can not write text in this buffer"
msgstr "%sNão pode escrever texto neste buffer"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sA cor \"%s\" não está definida na paleta"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%sErro: comando desconhecido: \"%s\" (escreva /help para obter ajuda)"
@ -13846,12 +13850,3 @@ msgstr "%s%s: tempo limite de \"%s\" com %s"
#, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar: erro inesperado (%d)"
#~ msgid "a filter with same name already exists"
#~ msgstr "já existe um filtro com o mesmo nome"
#~ msgid "Aspell enabled"
#~ msgstr "Aspell ativado"
#~ msgid "Aspell disabled"
#~ msgstr "Aspell desativado"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2019-01-29 21:05+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:19+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: pt_BR\n"
@ -4320,6 +4320,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr ""
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sCor \"%s\" não está definida na palheta"
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr ""
@ -12418,15 +12422,3 @@ msgstr "%s%s: tempo esgotado para \"%s\" com %s"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar ao remetente"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr "%sErro: um buffer com o mesmo nome (%s) já existe"
#, fuzzy
#~ msgid "Aspell enabled"
#~ msgstr "Mouse habilitado"
#, fuzzy
#~ msgid "Aspell disabled"
#~ msgstr "Mouse desabilitado"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"PO-Revision-Date: 2018-11-17 10:36+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-02-28 20:19+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: ru\n"
@ -3726,6 +3726,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr "%s невозможно закрыть единственный буфер\n"
#, fuzzy, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr "%sЦвет \"%s\" не определён в палитре"
#, fuzzy, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr "%s сокращение или команда \"%s\" не найдены\n"
@ -11982,16 +11986,3 @@ msgstr "%s нет аргумента для параметра \"%s\"\n"
#, fuzzy, c-format
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s DCC: не могу соединиться с отправителем\n"
#, fuzzy
#~ msgid "a filter with same name already exists"
#~ msgstr ""
#~ "%s не могу загрузить plugin \"%s\": одноимённый plugin уже существует\n"
#, fuzzy
#~ msgid "Aspell enabled"
#~ msgstr "команда users отключена"
#, fuzzy
#~ msgid "Aspell disabled"
#~ msgstr "Сокращения не заданы.\n"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\n"
"PO-Revision-Date: 2019-01-29 21:05+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3353,6 +3353,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr ""
#, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr ""
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2019-02-23 13:36+0100\n"
"POT-Creation-Date: 2019-02-28 20:16+0100\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"
@ -3343,6 +3343,10 @@ msgstr ""
msgid "%sYou can not write text in this buffer"
msgstr ""
#, c-format
msgid "debug: command \"%s\" is not allowed in this context"
msgstr ""
#, c-format
msgid "%sError: unknown command \"%s\" (type /help for help)"
msgstr ""

View File

@ -39,6 +39,9 @@
#include "../plugins/plugin.h"
char **input_commands_allowed = NULL;
/*
* Sends data to buffer input callback.
*/
@ -103,8 +106,25 @@ input_exec_command (struct t_gui_buffer *buffer,
return WEECHAT_RC_ERROR;
}
/* execute command */
rc = WEECHAT_RC_OK;
/* check if command is allowed */
if (input_commands_allowed
&& !string_match_list (command_name + 1,
(const char **)input_commands_allowed, 0))
{
if (weechat_debug_core >= 1)
{
gui_chat_printf_date_tags (NULL, 0, GUI_FILTER_TAG_NO_FILTER,
_("debug: command \"%s\" is not "
"allowed in this context"),
command_name);
}
rc = WEECHAT_RC_ERROR;
goto end;
}
/* execute command */
switch (hook_command_exec (buffer, any_plugin, plugin, command))
{
case HOOK_COMMAND_EXEC_OK:
@ -171,6 +191,7 @@ input_exec_command (struct t_gui_buffer *buffer,
break;
}
end:
free (command);
free (command_name);

View File

@ -23,6 +23,8 @@
struct t_gui_buffer;
struct t_weechat_plugin;
extern char **input_commands_allowed;
extern int input_exec_command (struct t_gui_buffer *buffer,
int any_plugin,
struct t_weechat_plugin *plugin,

View File

@ -4076,6 +4076,34 @@ weechat_guile_api_command (SCM buffer, SCM command)
API_RETURN_INT(rc);
}
SCM
weechat_guile_api_command_options (SCM buffer, SCM command, SCM options)
{
struct t_hashtable *c_options;
int rc;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
if (!scm_is_string (buffer) || !scm_is_string (command)
|| !scm_list_p (options))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
c_options = weechat_guile_alist_to_hashtable (options,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_guile_plugin,
guile_current_script,
API_STR2PTR(API_SCM_TO_STRING(buffer)),
API_SCM_TO_STRING(command),
c_options);
if (c_options)
weechat_hashtable_free (c_options);
API_RETURN_INT(rc);
}
SCM
weechat_guile_api_info_get (SCM info_name, SCM arguments)
{
@ -5016,6 +5044,7 @@ weechat_guile_api_module_init (void *data)
API_DEF_FUNC(bar_update, 1);
API_DEF_FUNC(bar_remove, 1);
API_DEF_FUNC(command, 2);
API_DEF_FUNC(command_options, 3);
API_DEF_FUNC(info_get, 2);
API_DEF_FUNC(info_get_hashtable, 2);
API_DEF_FUNC(infolist_new, 0);

View File

@ -3976,6 +3976,33 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
API_FUNC(command_options)
{
struct t_hashtable *options;
int rc;
API_INIT_FUNC(1, "command_options", "ssh", API_RETURN_INT(WEECHAT_RC_ERROR));
v8::String::Utf8Value buffer(args[0]);
v8::String::Utf8Value command(args[1]);
options = weechat_js_object_to_hashtable (
args[2]->ToObject(),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_js_plugin,
js_current_script,
(struct t_gui_buffer *)API_STR2PTR(*buffer),
*command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(rc);
}
API_FUNC(info_get)
{
const char *result;
@ -4967,6 +4994,7 @@ WeechatJsV8::loadLibs()
API_DEF_FUNC(bar_update);
API_DEF_FUNC(bar_remove);
API_DEF_FUNC(command);
API_DEF_FUNC(command_options);
API_DEF_FUNC(info_get);
API_DEF_FUNC(info_get_hashtable);
API_DEF_FUNC(infolist_new);

View File

@ -4312,6 +4312,35 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
API_FUNC(command_options)
{
const char *buffer, *command;
struct t_hashtable *options;
int rc;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
if (lua_gettop (L) < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
buffer = lua_tostring (L, -3);
command = lua_tostring (L, -2);
options = weechat_lua_tohashtable (L, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_lua_plugin,
lua_current_script,
API_STR2PTR(buffer),
command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(rc);
}
API_FUNC(info_get)
{
const char *info_name, *arguments, *result;
@ -5318,6 +5347,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(bar_update),
API_DEF_FUNC(bar_remove),
API_DEF_FUNC(command),
API_DEF_FUNC(command_options),
API_DEF_FUNC(info_get),
API_DEF_FUNC(info_get_hashtable),
API_DEF_FUNC(infolist_new),

View File

@ -4233,6 +4233,35 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
API_FUNC(command_options)
{
char *buffer, *command;
struct t_hashtable *options;
int rc;
dXSARGS;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
buffer = SvPV_nolen (ST (0));
command = SvPV_nolen (ST (1));
options = weechat_perl_hash_to_hashtable (ST (2),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_perl_plugin,
perl_current_script,
API_STR2PTR(buffer),
command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(rc);
}
API_FUNC(info_get)
{
char *info_name, *arguments;
@ -5277,6 +5306,7 @@ weechat_perl_api_init (pTHX)
API_DEF_FUNC(bar_update);
API_DEF_FUNC(bar_remove);
API_DEF_FUNC(command);
API_DEF_FUNC(command_options);
API_DEF_FUNC(info_get);
API_DEF_FUNC(info_get_hashtable);
API_DEF_FUNC(infolist_new);

View File

@ -4144,6 +4144,40 @@ API_FUNC(command)
API_RETURN_INT(result);
}
API_FUNC(command_options)
{
zend_string *z_buffer, *z_command;
zval *z_options;
struct t_gui_buffer *buffer;
char *command;
struct t_hashtable *options;
int result;
API_INIT_FUNC(1, "command", API_RETURN_INT(WEECHAT_RC_ERROR));
if (zend_parse_parameters (ZEND_NUM_ARGS(), "SSa", &z_buffer,
&z_command, &z_options) == FAILURE)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
buffer = (struct t_gui_buffer *)API_STR2PTR(ZSTR_VAL(z_buffer));
command = ZSTR_VAL(z_command);
options = weechat_php_array_to_hashtable (
z_options,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
result = plugin_script_api_command_options (weechat_php_plugin,
php_current_script,
buffer,
(const char *)command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(result);
}
API_FUNC(info_get)
{
zend_string *z_info_name, *z_arguments;

View File

@ -197,6 +197,7 @@ PHP_FUNCTION(weechat_bar_set);
PHP_FUNCTION(weechat_bar_update);
PHP_FUNCTION(weechat_bar_remove);
PHP_FUNCTION(weechat_command);
PHP_FUNCTION(weechat_command_options);
PHP_FUNCTION(weechat_info_get);
PHP_FUNCTION(weechat_info_get_hashtable);
PHP_FUNCTION(weechat_infolist_new);

View File

@ -251,6 +251,7 @@ const zend_function_entry weechat_functions[] = {
PHP_FE(weechat_bar_update, NULL)
PHP_FE(weechat_bar_remove, NULL)
PHP_FE(weechat_command, NULL)
PHP_FE(weechat_command_options, NULL)
PHP_FE(weechat_info_get, NULL)
PHP_FE(weechat_info_get_hashtable, NULL)
PHP_FE(weechat_infolist_new, NULL)

View File

@ -28,6 +28,7 @@
#include "../core/weechat.h"
#include "../core/wee-config.h"
#include "../core/wee-hashtable.h"
#include "../core/wee-hook.h"
#include "../core/wee-infolist.h"
#include "../core/wee-input.h"
@ -294,19 +295,35 @@ plugin_api_color (const char *color_name)
}
/*
* Executes a command on a buffer (simulates user entry).
* Executes a command on a buffer (simulates user entry) with options.
*/
int
plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command)
plugin_api_command_options (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options)
{
char *command2;
char *command2, **old_commands_allowed, **new_commands_allowed;
const char *ptr_commands;
int rc;
if (!plugin || !command)
return WEECHAT_RC_ERROR;
old_commands_allowed = input_commands_allowed;
new_commands_allowed = NULL;
if (options)
{
ptr_commands = hashtable_get (options, "commands");
if (ptr_commands)
{
new_commands_allowed = string_split (ptr_commands, ",", 0, 0,
NULL);
input_commands_allowed = new_commands_allowed;
}
}
command2 = string_iconv_to_internal (plugin->charset, command);
if (!buffer)
buffer = gui_current_window->buffer;
@ -314,9 +331,24 @@ plugin_api_command (struct t_weechat_plugin *plugin,
if (command2)
free (command2);
if (new_commands_allowed)
string_free_split (new_commands_allowed);
input_commands_allowed = old_commands_allowed;
return rc;
}
/*
* Executes a command on a buffer (simulates user entry).
*/
int
plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command)
{
return plugin_api_command_options (plugin, buffer, command, NULL);
}
/*
* Modifier to decode ANSI colors.
*/

View File

@ -54,6 +54,10 @@ extern const char *plugin_api_prefix (const char *prefix);
extern const char *plugin_api_color (const char *color_name);
/* command */
extern int plugin_api_command_options (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
const char *command,
struct t_hashtable *options);
extern int plugin_api_command (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
const char *command);

View File

@ -1278,6 +1278,33 @@ plugin_script_api_bar_item_new (struct t_weechat_plugin *weechat_plugin,
return new_item;
}
/*
* Executes a command on a buffer (simulates user entry) with options.
*/
int
plugin_script_api_command_options (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
const char *command,
struct t_hashtable *options)
{
char *command2;
int rc;
command2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, command) : NULL;
rc = weechat_command_options (buffer,
(command2) ? command2 : command,
options);
if (command2)
free (command2);
return rc;
}
/*
* Executes a command on a buffer (simulates user entry).
*/
@ -1287,18 +1314,8 @@ plugin_script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer, const char *command)
{
char *command2;
int rc;
command2 = (script && script->charset && script->charset[0]) ?
weechat_iconv_to_internal (script->charset, command) : NULL;
rc = weechat_command (buffer, (command2) ? command2 : command);
if (command2)
free (command2);
return rc;
return plugin_script_api_command_options (weechat_plugin, script, buffer,
command, NULL);
}
/*

View File

@ -353,6 +353,11 @@ extern struct t_gui_bar_item *plugin_script_api_bar_item_new (struct t_weechat_p
struct t_hashtable *extra_info),
const char *function,
const char *data);
extern int plugin_script_api_command_options (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
const char *command,
struct t_hashtable *options);
extern int plugin_script_api_command (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,

View File

@ -828,6 +828,7 @@ plugin_load (const char *filename, int init_plugin, int argc, char **argv)
new_plugin->bar_remove = &gui_bar_free;
new_plugin->command = &plugin_api_command;
new_plugin->command_options = &plugin_api_command_options;
new_plugin->network_pass_proxy = &network_pass_proxy;
new_plugin->network_connect_to = &network_connect_to;

View File

@ -4247,6 +4247,35 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
API_FUNC(command_options)
{
char *buffer, *command;
struct t_hashtable *options;
int rc;
PyObject *dict;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
buffer = NULL;
command = NULL;
options = NULL;
if (!PyArg_ParseTuple (args, "ssO", &buffer, &command, &dict))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
options = weechat_python_dict_to_hashtable (dict,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_python_plugin,
python_current_script,
API_STR2PTR(buffer),
command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(rc);
}
API_FUNC(info_get)
{
char *info_name, *arguments;
@ -5227,6 +5256,7 @@ PyMethodDef weechat_python_funcs[] =
API_DEF_FUNC(bar_update),
API_DEF_FUNC(bar_remove),
API_DEF_FUNC(command),
API_DEF_FUNC(command_options),
API_DEF_FUNC(info_get),
API_DEF_FUNC(info_get_hashtable),
API_DEF_FUNC(infolist_new),

View File

@ -5118,6 +5118,41 @@ weechat_ruby_api_command (VALUE class, VALUE buffer, VALUE command)
API_RETURN_INT(rc);
}
static VALUE
weechat_ruby_api_command_options (VALUE class, VALUE buffer, VALUE command,
VALUE options)
{
char *c_buffer, *c_command;
struct t_hashtable *c_options;
int rc;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
if (NIL_P (buffer) || NIL_P (command) || NIL_P (options))
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
Check_Type (buffer, T_STRING);
Check_Type (command, T_STRING);
Check_Type (options, T_HASH);
c_buffer = StringValuePtr (buffer);
c_command = StringValuePtr (command);
c_options = weechat_ruby_hash_to_hashtable (options,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_ruby_plugin,
ruby_current_script,
API_STR2PTR(c_buffer),
c_command,
c_options);
if (c_options)
weechat_hashtable_free (c_options);
API_RETURN_INT(rc);
}
static VALUE
weechat_ruby_api_info_get (VALUE class, VALUE info_name, VALUE arguments)
{
@ -6388,6 +6423,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(bar_update, 1);
API_DEF_FUNC(bar_remove, 1);
API_DEF_FUNC(command, 2);
API_DEF_FUNC(command_options, 3);
API_DEF_FUNC(info_get, 2);
API_DEF_FUNC(info_get_hashtable, 2);
API_DEF_FUNC(infolist_new, 0);

View File

@ -4598,6 +4598,36 @@ API_FUNC(command)
API_RETURN_INT(rc);
}
API_FUNC(command_options)
{
Tcl_Obj *objp;
char *buffer, *command;
struct t_hashtable *options;
int i, rc;
API_INIT_FUNC(1, "command_options", API_RETURN_INT(WEECHAT_RC_ERROR));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(WEECHAT_RC_ERROR));
buffer = Tcl_GetStringFromObj (objv[1], &i);
command = Tcl_GetStringFromObj (objv[2], &i);
options = weechat_tcl_dict_to_hashtable (interp, objv[3],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE,
WEECHAT_HASHTABLE_STRING,
WEECHAT_HASHTABLE_STRING);
rc = plugin_script_api_command_options (weechat_tcl_plugin,
tcl_current_script,
API_STR2PTR(buffer),
command,
options);
if (options)
weechat_hashtable_free (options);
API_RETURN_INT(rc);
}
API_FUNC(info_get)
{
Tcl_Obj *objp;
@ -5753,6 +5783,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
API_DEF_FUNC(bar_update);
API_DEF_FUNC(bar_remove);
API_DEF_FUNC(command);
API_DEF_FUNC(command_options);
API_DEF_FUNC(info_get);
API_DEF_FUNC(info_get_hashtable);
API_DEF_FUNC(infolist_new);

View File

@ -67,7 +67,7 @@ struct timeval;
* please change the date with current one; for a second change at same
* date, increment the 01, otherwise please keep 01.
*/
#define WEECHAT_PLUGIN_API_VERSION "20190226-01"
#define WEECHAT_PLUGIN_API_VERSION "20190228-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@ -985,6 +985,9 @@ struct t_weechat_plugin
/* command */
int (*command) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command);
int (*command_options) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer, const char *command,
struct t_hashtable *options);
/* network */
int (*network_pass_proxy) (const char *proxy, int sock,
@ -1899,6 +1902,9 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
/* command */
#define weechat_command(__buffer, __command) \
(weechat_plugin->command)(weechat_plugin, __buffer, __command)
#define weechat_command_options(__buffer, __command, __options) \
(weechat_plugin->command_options)(weechat_plugin, __buffer, \
__command, __options)
/* network */
#define weechat_network_pass_proxy(__proxy, __sock, __address, __port) \

View File

@ -200,6 +200,13 @@ def test_hooks():
weechat.unhook(hook_cmplt)
def test_command():
"""Test command functions."""
check(weechat.command('', '/mute') == 0)
check(weechat.command_options('', '/mute', {'commands': '*,!print'}) == 0)
check(weechat.command_options('', '/mute', {'commands': '*,!mute'}) == -1)
def infolist_cb(data, infolist_name, pointer, arguments):
"""Infolist callback."""
infolist = weechat.infolist_new()
@ -244,6 +251,7 @@ def cmd_test_cb(data, buf, args):
test_key()
test_display()
test_hooks()
test_command()
test_infolist()
weechat.prnt('', ' > TESTS END')
return weechat.WEECHAT_RC_OK