Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
api: add function command_options (issue #928)
  • Loading branch information
flashcode committed Feb 28, 2019
1 parent 64043d5 commit 80b980b
Show file tree
Hide file tree
Showing 43 changed files with 686 additions and 158 deletions.
1 change: 1 addition & 0 deletions ChangeLog.adoc
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion doc/de/weechat_scripting.de.adoc
Expand Up @@ -604,7 +604,8 @@ Liste der Skript API Funktionen:
bar_remove

| Befehle |
command
command +
command_options

| Informationen |
info_get +
Expand Down
57 changes: 57 additions & 0 deletions doc/en/weechat_plugin_api.en.adoc
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion doc/en/weechat_scripting.en.adoc
Expand Up @@ -591,7 +591,8 @@ List of functions in script API:
bar_remove

| commands |
command
command +
command_options

| infos |
info_get +
Expand Down
57 changes: 57 additions & 0 deletions doc/fr/weechat_plugin_api.fr.adoc
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions doc/fr/weechat_scripting.fr.adoc
Expand Up @@ -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

Expand Down
61 changes: 61 additions & 0 deletions doc/it/weechat_plugin_api.it.adoc
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion doc/it/weechat_scripting.it.adoc
Expand Up @@ -611,7 +611,8 @@ Elenco di funzioni nelle API per gli script:
bar_remove

| comandi |
comando
command +
command_options

| info |
info_get +
Expand Down
61 changes: 61 additions & 0 deletions doc/ja/weechat_plugin_api.ja.adoc
Expand Up @@ -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]]
=== ネットワーク

Expand Down
5 changes: 3 additions & 2 deletions doc/ja/weechat_scripting.ja.adoc
Expand Up @@ -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 +
Expand Down Expand Up @@ -599,7 +599,8 @@ link:weechat_plugin_api.ja.html[WeeChat プラグイン API リファレンス]
bar_remove

| コマンド |
command
command +
command_options

| インフォ |
info_get +
Expand Down
7 changes: 4 additions & 3 deletions doc/pl/weechat_scripting.pl.adoc
Expand Up @@ -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 +
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -597,7 +597,8 @@ Lista funkcji w API skryptów:
bar_remove

| komendy |
command
command +
command_options

| informacje |
info_get +
Expand Down
18 changes: 6 additions & 12 deletions po/cs.po
Expand Up @@ -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"
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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"

0 comments on commit 80b980b

Please sign in to comment.