summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/de/autogen/plugin_api/infolists.txt2
-rw-r--r--doc/en/autogen/plugin_api/infolists.txt2
-rw-r--r--doc/fr/autogen/plugin_api/infolists.txt2
-rw-r--r--doc/it/autogen/plugin_api/infolists.txt2
-rw-r--r--po/cs.po11
-rw-r--r--po/de.po11
-rw-r--r--po/es.po11
-rw-r--r--po/fr.po15
-rw-r--r--po/hu.po6
-rw-r--r--po/it.po11
-rw-r--r--po/pl.po11
-rw-r--r--po/pt_BR.po6
-rw-r--r--po/ru.po6
-rw-r--r--po/weechat.pot6
-rw-r--r--src/core/wee-hook.c49
-rw-r--r--src/core/wee-hook.h2
-rw-r--r--src/plugins/plugin-api.c3
17 files changed, 117 insertions, 39 deletions
diff --git a/doc/de/autogen/plugin_api/infolists.txt b/doc/de/autogen/plugin_api/infolists.txt
index e522e8b9c..905100af1 100644
--- a/doc/de/autogen/plugin_api/infolists.txt
+++ b/doc/de/autogen/plugin_api/infolists.txt
@@ -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 | - | -
diff --git a/doc/en/autogen/plugin_api/infolists.txt b/doc/en/autogen/plugin_api/infolists.txt
index 5fc908948..be5f18ce3 100644
--- a/doc/en/autogen/plugin_api/infolists.txt
+++ b/doc/en/autogen/plugin_api/infolists.txt
@@ -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 | - | -
diff --git a/doc/fr/autogen/plugin_api/infolists.txt b/doc/fr/autogen/plugin_api/infolists.txt
index 7003324e5..40094cf98 100644
--- a/doc/fr/autogen/plugin_api/infolists.txt
+++ b/doc/fr/autogen/plugin_api/infolists.txt
@@ -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 | - | -
diff --git a/doc/it/autogen/plugin_api/infolists.txt b/doc/it/autogen/plugin_api/infolists.txt
index b68b28570..2cb8489a9 100644
--- a/doc/it/autogen/plugin_api/infolists.txt
+++ b/doc/it/autogen/plugin_api/infolists.txt
@@ -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 | - | -
diff --git a/po/cs.po b/po/cs.po
index 540f6955c..fb5272e76 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -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"
diff --git a/po/de.po b/po/de.po
index f0fd752d3..b8972cb06 100644
--- a/po/de.po
+++ b/po/de.po
@@ -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"
diff --git a/po/es.po b/po/es.po
index b4df49c3f..aa6b6c540 100644
--- a/po/es.po
+++ b/po/es.po
@@ -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"
diff --git a/po/fr.po b/po/fr.po
index fdb17eb93..0b4c6f4f1 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -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)"
diff --git a/po/hu.po b/po/hu.po
index 3fc824bfc..056719d52 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -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
diff --git a/po/it.po b/po/it.po
index 54c433766..45c6bb012 100644
--- a/po/it.po
+++ b/po/it.po
@@ -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"
diff --git a/po/pl.po b/po/pl.po
index 9cc3594a7..2f647dcaa 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -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"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 8156b3a76..749ad89be 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -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"
diff --git a/po/ru.po b/po/ru.po
index a409ed2a6..18726a1c5 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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
diff --git a/po/weechat.pot b/po/weechat.pot
index c7031e4df..9bc80ba3e 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -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"
diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c
index 67478bd6d..87942064d 100644
--- a/src/core/wee-hook.c
+++ b/src/core/wee-hook.c
@@ -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;
}
diff --git a/src/core/wee-hook.h b/src/core/wee-hook.h
index 1c2e357d9..a3ae429e2 100644
--- a/src/core/wee-hook.h
+++ b/src/core/wee-hook.h
@@ -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 */
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 7c0b87057..853dafa2a 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -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,