diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-29 10:18:23 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-04-29 10:18:23 +0200 |
commit | 40b75633e7a2a58b1693602444795c872b4e3bb3 (patch) | |
tree | 32e9bbd49cb19ee38cbce50541fd333dfe004b89 | |
parent | 81558fe7cb2c0a7d00b93eae9baebc62b49ba28a (diff) | |
download | weechat-40b75633e7a2a58b1693602444795c872b4e3bb3.zip |
Added "current" option for infolist "window", to retrieve infolist for current window
-rw-r--r-- | src/plugins/plugin-api.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index e335dde8c..facda3a10 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -989,18 +989,36 @@ plugin_api_infolist_get (char *name, void *pointer, char *arguments) } else { - /* build list with all windows */ - for (ptr_window = gui_windows; ptr_window; - ptr_window = ptr_window->next_window) + if (arguments && arguments[0]) { - if (!plugin_api_infolist_get_add_window (ptr_infolist, - ptr_window)) + if ((string_strcasecmp (arguments, "current") == 0) + && gui_current_window) { - plugin_infolist_free (ptr_infolist); - return NULL; + if (!plugin_api_infolist_get_add_window (ptr_infolist, + gui_current_window)) + { + plugin_infolist_free (ptr_infolist); + return NULL; + } + return ptr_infolist; } + return NULL; + } + else + { + /* build list with all windows */ + for (ptr_window = gui_windows; ptr_window; + ptr_window = ptr_window->next_window) + { + if (!plugin_api_infolist_get_add_window (ptr_infolist, + ptr_window)) + { + plugin_infolist_free (ptr_infolist); + return NULL; + } + } + return ptr_infolist; } - return ptr_infolist; } } } |