summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-09-02 11:56:38 +0200
committerSebastien Helleu <flashcode@flashtux.org>2008-09-02 11:56:38 +0200
commitb03393fd428a2cf78d2ce1cae81588f598b3d46c (patch)
tree8e4b250f47817376c512885e30b9077936e9065a /src
parent1b726d3c71316a93e461374543e58d9907e9c714 (diff)
downloadweechat-b03393fd428a2cf78d2ce1cae81588f598b3d46c.zip
Add hotlist infolist
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-hotlist.c24
-rw-r--r--src/plugins/plugin-api.c20
2 files changed, 44 insertions, 0 deletions
diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c
index 9bde8ae87..b1649118f 100644
--- a/src/gui/gui-hotlist.c
+++ b/src/gui/gui-hotlist.c
@@ -35,6 +35,7 @@
#include "../plugins/plugin.h"
#include "gui-hotlist.h"
#include "gui-buffer.h"
+#include "gui-color.h"
#include "gui-status.h"
#include "gui-window.h"
@@ -398,6 +399,29 @@ gui_hotlist_add_to_infolist (struct t_infolist *infolist,
if (!infolist_new_var_integer (ptr_item, "priority", hotlist->priority))
return 0;
+ switch (hotlist->priority)
+ {
+ case GUI_HOTLIST_LOW:
+ if (!infolist_new_var_string (ptr_item, "color",
+ gui_color_get_name (CONFIG_COLOR(config_color_status_data_other))))
+ return 0;
+ break;
+ case GUI_HOTLIST_MESSAGE:
+ if (!infolist_new_var_string (ptr_item, "color",
+ gui_color_get_name (CONFIG_COLOR(config_color_status_data_msg))))
+ return 0;
+ break;
+ case GUI_HOTLIST_PRIVATE:
+ if (!infolist_new_var_string (ptr_item, "color",
+ gui_color_get_name (CONFIG_COLOR(config_color_status_data_private))))
+ return 0;
+ break;
+ case GUI_HOTLIST_HIGHLIGHT:
+ if (!infolist_new_var_string (ptr_item, "color",
+ gui_color_get_name (CONFIG_COLOR(config_color_status_data_highlight))))
+ return 0;
+ break;
+ }
if (!infolist_new_var_buffer (ptr_item, "creation_time", &(hotlist->creation_time), sizeof (struct timeval)))
return 0;
if (!infolist_new_var_integer (ptr_item, "buffer_number", hotlist->buffer->number))
diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c
index 02978fc2f..95bbb039e 100644
--- a/src/plugins/plugin-api.c
+++ b/src/plugins/plugin-api.c
@@ -42,6 +42,7 @@
#include "../gui/gui-chat.h"
#include "../gui/gui-color.h"
#include "../gui/gui-filter.h"
+#include "../gui/gui-hotlist.h"
#include "../gui/gui-keyboard.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
@@ -345,6 +346,7 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
struct t_gui_buffer *ptr_buffer;
struct t_gui_line *ptr_line;
struct t_gui_window *ptr_window;
+ struct t_gui_hotlist *ptr_hotlist;
/* make C compiler happy */
(void) data;
@@ -484,6 +486,23 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name,
}
}
}
+ else if (string_strcasecmp (infolist_name, "hotlist") == 0)
+ {
+ ptr_infolist = infolist_new ();
+ if (ptr_infolist)
+ {
+ for (ptr_hotlist = gui_hotlist; ptr_hotlist;
+ ptr_hotlist = ptr_hotlist->next_hotlist)
+ {
+ if (!gui_hotlist_add_to_infolist (ptr_infolist, ptr_hotlist))
+ {
+ infolist_free (ptr_infolist);
+ return NULL;
+ }
+ }
+ return ptr_infolist;
+ }
+ }
else if (string_strcasecmp (infolist_name, "option") == 0)
{
ptr_infolist = infolist_new ();
@@ -674,6 +693,7 @@ plugin_api_init ()
hook_infolist (NULL, "buffer", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "nicklist", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "window", &plugin_api_infolist_get_internal, NULL);
+ hook_infolist (NULL, "hotlist", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "option", &plugin_api_infolist_get_internal, NULL);
hook_infolist (NULL, "hook", &plugin_api_infolist_get_internal, NULL);
}