1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 04:46:37 +02:00

core: move nick coloring from irc plugin to core (closes #262)

Options moved from irc.conf to weechat.conf:

* "irc.look.nick_color_force" moved to "weechat.look.nick_color_force"
* "irc.look.nick_color_hash" moved to "weechat.look.nick_color_hash"
* "irc.look.nick_color_stop_chars" moved to
  "weechat.look.nick_color_stop_chars"

New info (for API function "info_get"):

* "nick_color" (replaces "irc_nick_color")
* "nick_color_name" (replaced "irc_nick_color_name")

Info "irc_nick_color" and "irc_nick_color_name" are now deprecated.

And a bug has been fixed in nick coloring: stop chars are removed before
looking at a forced color.
This commit is contained in:
Sébastien Helleu
2016-04-05 07:56:43 +02:00
parent e80ff72b97
commit fabd48cc6c
49 changed files with 1196 additions and 869 deletions
+43
View File
@@ -59,6 +59,7 @@
#include "../gui/gui-key.h"
#include "../gui/gui-layout.h"
#include "../gui/gui-line.h"
#include "../gui/gui-nick.h"
#include "../gui/gui-nicklist.h"
#include "../gui/gui-window.h"
#include "plugin.h"
@@ -785,6 +786,40 @@ plugin_api_info_color_rgb2term_cb (const void *pointer, void *data,
return value;
}
/*
* Returns nick color code for a nickname.
*/
const char *
plugin_api_info_nick_color_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) info_name;
return gui_nick_find_color (arguments);
}
/*
* Returns nick color name for a nickname.
*/
const char *
plugin_api_info_nick_color_name_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) info_name;
return gui_nick_find_color_name (arguments);
}
/*
* Returns WeeChat infolist "bar".
*
@@ -1855,6 +1890,14 @@ plugin_api_init ()
N_("RGB color converted to terminal color (0-255)"),
N_("rgb,limit (limit is optional and is set to 256 by default)"),
&plugin_api_info_color_rgb2term_cb, NULL, NULL);
hook_info (NULL, "nick_color",
N_("get nick color code"),
N_("nickname"),
&plugin_api_info_nick_color_cb, NULL, NULL);
hook_info (NULL, "nick_color_name",
N_("get nick color name"),
N_("nickname"),
&plugin_api_info_nick_color_name_cb, NULL, NULL);
/* WeeChat core infolist hooks */
hook_infolist (NULL, "bar",