Add optional command name for infolist_get on command hooks

This commit is contained in:
Sebastien Helleu 2011-02-25 23:16:45 +01:00
parent 3b38b7d433
commit aeaa0dfb7c
17 changed files with 117 additions and 39 deletions

View File

@ -44,7 +44,7 @@
| weechat | history | Verlaufspeicher der Befehle | Buffer Pointer (falls nicht gesetzt, wird der globale Verlauf zurückgegeben) (optional) | -
| weechat | hook | Auflistung der Hooks | - | hook Type: command, timer, .. (optional)
| weechat | hook | Auflistung der Hooks | - | type,arguments (type is command/timer/.., arguments to get only some hooks, both are optional)
| weechat | hotlist | Liste der Buffer in Hotlist | - | -

View File

@ -44,7 +44,7 @@
| weechat | history | history of commands | buffer pointer (if not set, return global history) (optional) | -
| weechat | hook | list of hooks | - | hook type: command, timer, .. (optional)
| weechat | hook | list of hooks | - | type,arguments (type is command/timer/.., arguments to get only some hooks, both are optional)
| weechat | hotlist | list of buffers in hotlist | - | -

View File

@ -44,7 +44,7 @@
| weechat | history | historique des commandes | pointeur vers le tampon (si non défini, retourne l'historique global) (optionnel) | -
| weechat | hook | liste des hooks | - | type de hook: command, timer, .. (optionnel)
| weechat | hook | liste des hooks | - | type,paramètres (le type est command/timer/.., paramètres pour avoir seulement quelques hooks, les deux sont optionnels)
| weechat | hotlist | liste des tampons dans la hotlist | - | -

View File

@ -44,7 +44,7 @@
| weechat | history | cronologia dei comandi | puntatore al buffer (se non impostato, restituisce la cronologia globale) (opzionale) | -
| weechat | hook | elenco di hook | - | tipo hook: comando, timer, ... (opzionale)
| weechat | hook | elenco di hook | - | type,arguments (type is command/timer/.., arguments to get only some hooks, both are optional)
| weechat | hotlist | elenco dei buffer nella hotlist | - | -

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:29+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6340,8 +6340,10 @@ msgstr ""
msgid "list of hooks"
msgstr "seznam napojení"
msgid "hook type: command, timer, .. (optional)"
msgstr "typ napojení: příkaz, časovač, .. (volitelné)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"
msgstr "seznam bufferů v hotlistu"
@ -7432,6 +7434,9 @@ msgstr ""
msgid "Pointer"
msgstr "Ukazatel"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "typ napojení: příkaz, časovač, .. (volitelné)"
#~ msgid "a color name"
#~ msgstr "jméno barvy"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-25 19:09+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-24 19:23+0100\n"
"Last-Translator: Nils G.\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6601,8 +6601,10 @@ msgstr ""
msgid "list of hooks"
msgstr "Auflistung der Hooks"
msgid "hook type: command, timer, .. (optional)"
msgstr "hook Type: command, timer, .. (optional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"
msgstr "Liste der Buffer in Hotlist"
@ -7747,5 +7749,8 @@ msgstr "Hashtable (Ausgabe)"
msgid "Pointer"
msgstr "Pointer"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "hook Type: command, timer, .. (optional)"
#~ msgid "a color name"
#~ msgstr "ein Farbname"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:29+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6478,8 +6478,10 @@ msgstr ""
msgid "list of hooks"
msgstr "lista de enganches"
msgid "hook type: command, timer, .. (optional)"
msgstr "tipo de enganche: comando, temporizador, .. (opcional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"
msgstr "lista de buffers en la lista de actividad"
@ -7614,6 +7616,9 @@ msgstr "Tabla hash (salida)"
msgid "Pointer"
msgstr "Puntero"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "tipo de enganche: comando, temporizador, .. (opcional)"
#~ msgid "a color name"
#~ msgstr "nombre de un color"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"PO-Revision-Date: 2011-02-24 09:49+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-25 23:14+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@ -6470,8 +6470,12 @@ msgstr ""
msgid "list of hooks"
msgstr "liste des hooks"
msgid "hook type: command, timer, .. (optional)"
msgstr "type de hook: command, timer, .. (optionnel)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
"type,paramètres (le type est command/timer/.., paramètres pour avoir "
"seulement quelques hooks, les deux sont optionnels)"
msgid "list of buffers in hotlist"
msgstr "liste des tampons dans la hotlist"
@ -7608,3 +7612,6 @@ msgstr "Hashtable (sortie)"
msgid "Pointer"
msgstr "Pointeur"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "type de hook: command, timer, .. (optionnel)"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:29+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5968,7 +5968,9 @@ msgstr ""
msgid "list of hooks"
msgstr "Aliaszok listája:\n"
msgid "hook type: command, timer, .. (optional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
#, fuzzy

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-22 19:26+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6396,8 +6396,10 @@ msgstr ""
msgid "list of hooks"
msgstr "elenco di hook"
msgid "hook type: command, timer, .. (optional)"
msgstr "tipo hook: comando, timer, ... (opzionale)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"
msgstr "elenco dei buffer nella hotlist"
@ -7517,6 +7519,9 @@ msgstr "Tabella hash (output)"
msgid "Pointer"
msgstr "Puntatore"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "tipo hook: comando, timer, ... (opzionale)"
#~ msgid "a color name"
#~ msgstr "un nome colore"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:29+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -6429,8 +6429,10 @@ msgstr ""
msgid "list of hooks"
msgstr "lista powiązań"
msgid "hook type: command, timer, .. (optional)"
msgstr "typ uchwytu: komenda, timer, .. (opcjonalne)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"
msgstr "lista buforów w hotliście"
@ -7536,6 +7538,9 @@ msgstr "Hashtable (wyjście)"
msgid "Pointer"
msgstr "Wskaźnik"
#~ msgid "hook type: command, timer, .. (optional)"
#~ msgstr "typ uchwytu: komenda, timer, .. (opcjonalne)"
#~ msgid "a color name"
#~ msgstr "nazwa koloru"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:30+0100\n"
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5710,7 +5710,9 @@ msgstr ""
msgid "list of hooks"
msgstr ""
msgid "hook type: command, timer, .. (optional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.5-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: 2011-02-07 17:30+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -5983,7 +5983,9 @@ msgstr ""
msgid "list of hooks"
msgstr "Список сокращений:\n"
msgid "hook type: command, timer, .. (optional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
#, fuzzy

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2011-02-24 09:48+0100\n"
"POT-Creation-Date: 2011-02-25 23:15+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -5177,7 +5177,9 @@ msgstr ""
msgid "list of hooks"
msgstr ""
msgid "hook type: command, timer, .. (optional)"
msgid ""
"type,arguments (type is command/timer/.., arguments to get only some hooks, "
"both are optional)"
msgstr ""
msgid "list of buffers in hotlist"

View File

@ -2847,16 +2847,33 @@ unhook_all ()
*/
int
hook_add_to_infolist_type (struct t_infolist *infolist,
int type)
hook_add_to_infolist_type (struct t_infolist *infolist, int type,
const char *arguments)
{
struct t_hook *ptr_hook;
struct t_infolist_item *ptr_item;
char value[64];
int match;
for (ptr_hook = weechat_hooks[type]; ptr_hook;
ptr_hook = ptr_hook->next_hook)
{
match = 1;
if (arguments && !ptr_hook->deleted)
{
switch (ptr_hook->type)
{
case HOOK_TYPE_COMMAND:
match = (strcmp (HOOK_COMMAND(ptr_hook, command), arguments) == 0);
break;
default:
break;
}
}
if (!match)
continue;
ptr_item = infolist_new_item (infolist);
if (!ptr_item)
return 0;
@ -3190,27 +3207,47 @@ hook_add_to_infolist_type (struct t_infolist *infolist,
/*
* hook_add_to_infolist: add hooks in an infolist
* if type == NULL or is not found, all types are returned
* arguments can be a hook type with optional comma +
* name after
* return 1 if ok, 0 if error
*/
int
hook_add_to_infolist (struct t_infolist *infolist,
const char *type)
hook_add_to_infolist (struct t_infolist *infolist, const char *arguments)
{
const char *pos_arguments;
char *type;
int i, type_int;
if (!infolist)
return 0;
type = NULL;
pos_arguments = NULL;
if (arguments)
{
pos_arguments = strchr (arguments, ',');
if (pos_arguments)
{
type = string_strndup (arguments, pos_arguments - arguments);
pos_arguments++;
}
else
type = strdup (arguments);
}
type_int = (type) ? hook_search_type (type) : -1;
for (i = 0; i < HOOK_NUM_TYPES; i++)
{
if ((type_int < 0) || (type_int == i))
hook_add_to_infolist_type (infolist, i);
hook_add_to_infolist_type (infolist, i, pos_arguments);
}
if (type)
free (type);
return 1;
}

View File

@ -498,7 +498,7 @@ extern void unhook (struct t_hook *hook);
extern void unhook_all_plugin (struct t_weechat_plugin *plugin);
extern void unhook_all ();
extern int hook_add_to_infolist (struct t_infolist *infolist,
const char *type);
const char *arguments);
extern void hook_print_log ();
#endif /* __WEECHAT_HOOK_H */

View File

@ -1004,7 +1004,8 @@ plugin_api_init ()
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", N_("list of hooks"),
NULL,
N_("hook type: command, timer, .. (optional)"),
N_("type,arguments (type is command/timer/.., arguments to "
"get only some hooks, both are optional)"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hotlist", N_("list of buffers in hotlist"),
NULL,