mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
Add hotlist infolist
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user