diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-01 18:04:56 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-01 18:04:56 +0100 |
commit | 83444b9257bf9246ad3fe065b52a5146aaf1eaea (patch) | |
tree | 048cae26dc5041e067ba27651129f7866ef82259 /src/plugins/plugin-api.c | |
parent | 79f0cb9a5c9659d9b90252910a4d7780b99a56ea (diff) | |
download | weechat-83444b9257bf9246ad3fe065b52a5146aaf1eaea.zip |
Add infolist "plugin", with list of plugins
Diffstat (limited to 'src/plugins/plugin-api.c')
-rw-r--r-- | src/plugins/plugin-api.c | 38 |
1 files changed, 38 insertions, 0 deletions
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); } |