diff --git a/doc/de/autogen/weechat_infos.xml b/doc/de/autogen/weechat_infos.xml
index 476a7d9fe..8c83f94aa 100644
--- a/doc/de/autogen/weechat_infos.xml
+++ b/doc/de/autogen/weechat_infos.xml
@@ -96,6 +96,11 @@
option
list of options
+
+ infolist
+ plugin
+ list of plugins
+
infolist
window
diff --git a/doc/en/autogen/weechat_infos.xml b/doc/en/autogen/weechat_infos.xml
index 476a7d9fe..8c83f94aa 100644
--- a/doc/en/autogen/weechat_infos.xml
+++ b/doc/en/autogen/weechat_infos.xml
@@ -96,6 +96,11 @@
option
list of options
+
+ infolist
+ plugin
+ list of plugins
+
infolist
window
diff --git a/doc/fr/autogen/weechat_infos.xml b/doc/fr/autogen/weechat_infos.xml
index 1cc620584..d86108a56 100644
--- a/doc/fr/autogen/weechat_infos.xml
+++ b/doc/fr/autogen/weechat_infos.xml
@@ -96,6 +96,11 @@
option
liste des options
+
+ infolist
+ plugin
+ list of plugins
+
infolist
window
diff --git a/po/cs.po b/po/cs.po
index 8d8c004e2..cabcb0199 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: 2008-09-17 16:19+0200\n"
"Last-Translator: Jiri Golembiovsky \n"
"Language-Team: weechat-dev \n"
@@ -4243,6 +4243,10 @@ msgstr "nastaví konfigurační možnosti"
msgid "list of hooks"
msgstr "Seznam pro aliasy:\n"
+#, fuzzy
+msgid "list of plugins"
+msgstr "nastaví konfigurační možnosti"
+
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s nemůžu načist plugin \"%s\": %s\n"
diff --git a/po/de.po b/po/de.po
index fe067b473..3e7687d48 100644
--- a/po/de.po
+++ b/po/de.po
@@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Thomas Schuetz \n"
"Language-Team: weechat-dev \n"
@@ -4218,6 +4218,10 @@ msgstr "Konfigurationsparameter setzen"
msgid "list of hooks"
msgstr "Liste der Aliases:\n"
+#, fuzzy
+msgid "list of plugins"
+msgstr "Konfigurationsparameter setzen"
+
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s kann Plugin \"%s\" nicht laden: %s\n"
diff --git a/po/es.po b/po/es.po
index 079a4741e..3ae467745 100644
--- a/po/es.po
+++ b/po/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
"Last-Translator: Roberto González Cardenete \n"
"Language-Team: weechat-dev \n"
@@ -4218,6 +4218,10 @@ msgstr "poner opciones de configuración"
msgid "list of hooks"
msgstr "Lista de alias:\n"
+#, fuzzy
+msgid "list of plugins"
+msgstr "poner opciones de configuración"
+
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s no ha sido posible cargar el plugin \"%s\": %s\n"
diff --git a/po/fr.po b/po/fr.po
index bb37fbb3f..858277ee8 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
-"PO-Revision-Date: 2008-10-31 12:59+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
+"PO-Revision-Date: 2008-11-01 17:55+0100\n"
"Last-Translator: FlashCode \n"
"Language-Team: weechat-dev \n"
"MIME-Version: 1.0\n"
@@ -4322,6 +4322,9 @@ msgstr "liste des options"
msgid "list of hooks"
msgstr "liste des hooks"
+msgid "list of plugins"
+msgstr "liste des extensions"
+
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%sErreur: impossible de charger l'extension \"%s\": %s"
diff --git a/po/hu.po b/po/hu.po
index 461da9d2f..02e3b4fd7 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
"Last-Translator: Andras Voroskoi \n"
"Language-Team: weechat-dev \n"
@@ -4246,6 +4246,10 @@ msgstr "konfigurációs paraméterek beállítása"
msgid "list of hooks"
msgstr "Aliaszok listája:\n"
+#, fuzzy
+msgid "list of plugins"
+msgstr "konfigurációs paraméterek beállítása"
+
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s nem sikerült a modult betölteni \"%s\": %s\n"
diff --git a/po/ru.po b/po/ru.po
index 320a17c4f..ddb23ae0c 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.2.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
"Last-Translator: Pavel Shevchuk \n"
"Language-Team: weechat-dev \n"
@@ -4233,6 +4233,10 @@ msgstr "настроить параметры конфигурации"
msgid "list of hooks"
msgstr "Список сокращений:\n"
+#, fuzzy
+msgid "list of plugins"
+msgstr "настроить параметры конфигурации"
+
#, fuzzy, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr "%s не могу загрузить plugin \"%s\": %s\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index 8a35ce2ab..a8a337fde 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: 2008-10-31 13:01+0100\n"
+"POT-Creation-Date: 2008-11-01 17:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
@@ -3658,6 +3658,9 @@ msgstr ""
msgid "list of hooks"
msgstr ""
+msgid "list of plugins"
+msgstr ""
+
#, c-format
msgid "%sError: unable to load plugin \"%s\": %s"
msgstr ""
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 4844052b2..73148a638 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -293,6 +293,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
struct t_gui_filter *ptr_filter;
struct t_gui_window *ptr_window;
struct t_gui_hotlist *ptr_hotlist;
+ struct t_weechat_plugin *ptr_plugin;
/* make C compiler happy */
(void) data;
@@ -492,6 +493,41 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
return ptr_infolist;
}
}
+ else if (string_strcasecmp (infolist_name, "plugin") == 0)
+ {
+ /* invalid plugin pointer ? */
+ if (pointer && (!plugin_valid (pointer)))
+ return NULL;
+
+ ptr_infolist = infolist_new ();
+ if (ptr_infolist)
+ {
+ if (pointer)
+ {
+ /* build list with only one plugin */
+ if (!plugin_add_to_infolist (ptr_infolist, pointer))
+ {
+ infolist_free (ptr_infolist);
+ return NULL;
+ }
+ return ptr_infolist;
+ }
+ else
+ {
+ /* build list with all plugins */
+ for (ptr_plugin = weechat_plugins; ptr_plugin;
+ ptr_plugin = ptr_plugin->next_plugin)
+ {
+ if (!plugin_add_to_infolist (ptr_infolist, ptr_plugin))
+ {
+ infolist_free (ptr_infolist);
+ return NULL;
+ }
+ }
+ return ptr_infolist;
+ }
+ }
+ }
/* infolist not found */
return NULL;
@@ -678,4 +714,6 @@ plugin_api_init ()
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", N_("list of hooks"),
&plugin_api_infolist_get_internal, NULL);
+ hook_infolist (NULL, "plugin", N_("list of plugins"),
+ &plugin_api_infolist_get_internal, NULL);
}
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 07df6adee..f433d7fb2 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -62,6 +62,31 @@ int plugin_argc; /* command line arguments (used only */
char **plugin_argv; /* first time loading plugin) */
+/*
+ * plugin_valid: check if a plugin pointer exists
+ * return 1 if plugin exists
+ * 0 if plugin is not found
+ */
+
+int
+plugin_valid (struct t_weechat_plugin *plugin)
+{
+ struct t_weechat_plugin *ptr_plugin;
+
+ if (!plugin)
+ return 0;
+
+ for (ptr_plugin = weechat_plugins; ptr_plugin;
+ ptr_plugin = ptr_plugin->next_plugin)
+ {
+ if (ptr_plugin == plugin)
+ return 1;
+ }
+
+ /* plugin not found */
+ return 0;
+}
+
/*
* plugin_search: search a plugin by name
*/
@@ -862,6 +887,46 @@ plugin_end ()
plugin_config_end ();
}
+/*
+ * plugin_add_to_infolist: add a plugin in an infolist
+ * return 1 if ok, 0 if error
+ */
+
+int
+plugin_add_to_infolist (struct t_infolist *infolist,
+ struct t_weechat_plugin *plugin)
+{
+ struct t_infolist_item *ptr_item;
+
+ if (!infolist || !plugin)
+ return 0;
+
+ ptr_item = infolist_new_item (infolist);
+ if (!ptr_item)
+ return 0;
+
+ if (!infolist_new_var_pointer (ptr_item, "pointer", plugin))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "filename", plugin->filename))
+ return 0;
+ if (!infolist_new_var_pointer (ptr_item, "handle", plugin->handle))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "description", plugin->description))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "author", plugin->author))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "version", plugin->version))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "weechat_version", plugin->weechat_version))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "license", plugin->license))
+ return 0;
+ if (!infolist_new_var_string (ptr_item, "charset", plugin->charset))
+ return 0;
+
+ return 1;
+}
+
/*
* plugin_print_log: print plugin infos in log (usually for crash dump)
*/
diff --git a/src/plugins/plugin.h b/src/plugins/plugin.h
index 57b6584ad..875f4288a 100644
--- a/src/plugins/plugin.h
+++ b/src/plugins/plugin.h
@@ -31,8 +31,7 @@ typedef int (t_weechat_end_func) (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *weechat_plugins;
extern struct t_weechat_plugin *last_weechat_plugin;
-//extern t_plugin_irc_color plugins_irc_colors[GUI_NUM_IRC_COLORS];
-
+extern int plugin_valid (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_search (const char *name);
extern char *plugin_get_name (struct t_weechat_plugin *plugin);
extern struct t_weechat_plugin *plugin_load (const char *filename);
@@ -44,6 +43,8 @@ extern void plugin_unload_all ();
extern void plugin_reload_name (const char *name);
extern void plugin_init (int auto_load, int argc, char *argv[]);
extern void plugin_end ();
+extern int plugin_add_to_infolist (struct t_infolist *infolist,
+ struct t_weechat_plugin *plugin);
extern void plugin_print_log ();
#endif /* plugin.h */