1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-03 16:23:14 +02:00

Add infolist with commands history

This commit is contained in:
Sebastien Helleu
2009-06-10 19:13:38 +02:00
parent b67da8860c
commit d7ad1780ad
13 changed files with 99 additions and 10 deletions
+26
View File
@@ -45,6 +45,7 @@
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
#include "../gui/gui-history.h"
#include "../gui/gui-hotlist.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-line.h"
@@ -334,6 +335,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
struct t_gui_bar_window *ptr_bar_window;
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
struct t_gui_history *ptr_history;
struct t_gui_filter *ptr_filter;
struct t_gui_window *ptr_window;
struct t_gui_hotlist *ptr_hotlist;
@@ -567,6 +569,28 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
return ptr_infolist;
}
}
else if (string_strcasecmp (infolist_name, "history") == 0)
{
/* invalid buffer pointer ? */
if (pointer && (!gui_buffer_valid (pointer)))
return NULL;
ptr_infolist = infolist_new ();
if (ptr_infolist)
{
for (ptr_history = (pointer) ?
((struct t_gui_buffer *)pointer)->history : history_global;
ptr_history; ptr_history = ptr_history->next_history)
{
if (!gui_history_add_to_infolist (ptr_infolist, ptr_history))
{
infolist_free (ptr_infolist);
return NULL;
}
}
return ptr_infolist;
}
}
else if (string_strcasecmp (infolist_name, "hook") == 0)
{
ptr_infolist = infolist_new ();
@@ -918,6 +942,8 @@ plugin_api_init ()
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "filter", N_("list of filters"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "history", N_("history of commands"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", N_("list of hooks"),
&plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hotlist", N_("list of buffers in hotlist"),