1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 07:46:38 +02:00

trigger: add variable "tg_argc" in data set by command trigger (closes #1576)

This commit is contained in:
Sébastien Helleu
2020-10-21 19:10:37 +02:00
parent 30e48336f4
commit 0ff08e54f5
8 changed files with 31 additions and 13 deletions
+1
View File
@@ -29,6 +29,7 @@ New features::
* irc: allow to send text on buffers with commands /allchan, /allpv and /allserv
* irc: evaluate command executed by commands /allchan, /allpv and /allserv (issue #1536)
* script: add option script.scripts.download_enabled (issue #1548)
* trigger: add variable "tg_argc" in data set by command trigger (issue #1576)
* trigger: add variable "tg_trigger_name" in data set by all triggers (issue #1567, issue #1568)
Bug fixes::
+6 -2
View File
@@ -4297,8 +4297,12 @@ Der Callback von "command" legt folgende Variablen in der Hashtable an:
|===
| Variable | Typ | Beschreibung
| buffer | pointer | Buffer.
| tg_argvN | string | Argument #N.
| tg_argv_eolN | string | von Argument #N bis zum Ende der Argumente.
// TRANSLATION MISSING
| tg_argc | string | The number of arguments (the command itself counts for one).
// TRANSLATION MISSING
| tg_argvN | string | Argument #N (`+tg_argv0+` is the command itself, the others are command arguments).
// TRANSLATION MISSING
| tg_argv_eolN | string | von Argument #N bis zum Ende der Argumente (`+tg_argv_eol0+` includes the command itself).
|===
[[trigger_data_command_run]]
+3 -2
View File
@@ -4205,8 +4205,9 @@ The "command" callback sets following variables in hashtable:
|===
| Variable | Type | Description
| buffer | pointer | Buffer.
| tg_argvN | string | Argument #N.
| tg_argv_eolN | string | From argument #N until end of arguments.
| tg_argc | string | The number of arguments (the command itself counts for one).
| tg_argvN | string | Argument #N (`+tg_argv0+` is the command itself, the others are command arguments).
| tg_argv_eolN | string | From argument #N until end of arguments (`+tg_argv_eol0+` includes the command itself).
|===
[[trigger_data_command_run]]
+3 -2
View File
@@ -4348,8 +4348,9 @@ de hachage :
|===
| Variable | Type | Description
| buffer | pointeur | Tampon.
| tg_argvN | chaîne | Paramètre n°N.
| tg_argv_eolN | chaîne | Depuis le paramètre n°N jusqu'à la fin des paramètres.
| tg_argc | chaîne | Nombre de paramètres (la commande elle-même compte pour un).
| tg_argvN | chaîne | Paramètre n°N (`+tg_argv0+` est la commande elle-même, les autres sont les paramètres de la commande).
| tg_argv_eolN | chaîne | Depuis le paramètre n°N jusqu'à la fin des paramètres (`+tg_argv_eol0+` inclut la commande elle-même).
|===
[[trigger_data_command_run]]
+3 -2
View File
@@ -4513,8 +4513,9 @@ The "command" callback sets following variables in hashtable:
|===
| Variable | Type | Description
| buffer | pointer | Buffer.
| tg_argvN | string | Argument #N.
| tg_argv_eolN | string | From argument #N until end of arguments.
| tg_argc | string | The number of arguments (the command itself counts for one).
| tg_argvN | string | Argument #N (`+tg_argv0+` is the command itself, the others are command arguments).
| tg_argv_eolN | string | From argument #N until end of arguments (`+tg_argv_eol0+` includes the command itself).
|===
[[trigger_data_command_run]]
+6 -2
View File
@@ -4248,8 +4248,12 @@ _weechat_print_ 修飾子では、メッセージタグを使う変数 (下の
|===
| 変数 | 型 | 説明
| buffer | pointer | バッファ
| tg_argvN | string | N 番目の引数
| tg_argv_eolN | string | N 番目の引数から最後の引数まで
// TRANSLATION MISSING
| tg_argc | string | The number of arguments (the command itself counts for one).
// TRANSLATION MISSING
| tg_argvN | string | N 番目の引数 (`+tg_argv0+` is the command itself, the others are command arguments).
// TRANSLATION MISSING
| tg_argv_eolN | string | N 番目の引数から最後の引数まで (`+tg_argv_eol0+` includes the command itself).
|===
[[trigger_data_command_run]]
+6 -2
View File
@@ -4244,8 +4244,12 @@ Callback "command" ustawia następujące zmienne w tablicy hashy:
|===
| Zmienna | Typ | Opis
| buffer | wskaźnik | Bufor.
| tg_argvN | ciąg | Argument #N.
| tg_argv_eolN | ciąg | Od argumentu #N do końca argumentów.
// TRANSLATION MISSING
| tg_argc | ciąg | The number of arguments (the command itself counts for one).
// TRANSLATION MISSING
| tg_argvN | ciąg | Argument #N (`+tg_argv0+` is the command itself, the others are command arguments).
// TRANSLATION MISSING
| tg_argv_eolN | ciąg | Od argumentu #N do końca argumentów (`+tg_argv_eol0+` includes the command itself).
|===
[[trigger_data_command_run]]
+3 -1
View File
@@ -1042,7 +1042,7 @@ trigger_callback_command_cb (const void *pointer, void *data,
struct t_gui_buffer *buffer,
int argc, char **argv, char **argv_eol)
{
char str_name[32];
char str_name[32], str_temp[128];
int i;
TRIGGER_CALLBACK_CB_INIT(WEECHAT_RC_OK);
@@ -1053,6 +1053,8 @@ trigger_callback_command_cb (const void *pointer, void *data,
/* add data in hashtables used for conditions/replace/command */
trigger_callback_set_common_vars (trigger, extra_vars);
weechat_hashtable_set (pointers, "buffer", buffer);
snprintf (str_temp, sizeof (str_temp), "%d", argc);
weechat_hashtable_set (extra_vars, "tg_argc", str_temp);
for (i = 0; i < argc; i++)
{
snprintf (str_name, sizeof (str_name), "tg_argv%d", i);