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

Move options weechat.color.nicklist_prefix to irc plugin

Options renamed or removed:
- weechat.color.nicklist_prefix1 renamed to irc.color.nick_prefix_op
- weechat.color.nicklist_prefix2 renamed to irc.color.nick_prefix_halfop
- weechat.color.nicklist_prefix3 renamed to irc.color.nick_prefix_voice
- weechat.color.nicklist_prefix4 renamed to irc.color.nick_prefix_user
- weechat.color.nicklist_prefix5 removed
This commit is contained in:
Sebastien Helleu
2010-06-04 12:35:25 +02:00
parent 4a61dc9633
commit ff0a798634
25 changed files with 418 additions and 316 deletions
+2 -5
View File
@@ -405,7 +405,7 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
struct t_irc_server *server;
struct t_irc_channel *channel;
struct t_irc_nick *ptr_nick;
char *buf, prefix[2], str_prefix_color[64], str_prefix[64];
char *buf, prefix[2], str_prefix[64];
int length, prefix_color;
/* make C compiler happy */
@@ -438,11 +438,8 @@ irc_bar_item_input_prompt (void *data, struct t_gui_bar_item *item,
&prefix[0], &prefix_color, NULL, NULL);
if (prefix[0] != ' ')
{
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
snprintf (str_prefix, sizeof (str_prefix), "%s%s",
weechat_color(weechat_config_string(weechat_config_get(str_prefix_color))),
weechat_color (weechat_config_string (weechat_config_get (irc_nick_get_prefix_color_name (prefix_color)))),
prefix);
}
}
+4 -5
View File
@@ -66,11 +66,10 @@
#define IRC_COLOR_CHAT_NICK_OTHER weechat_color("chat_nick_other")
#define IRC_COLOR_CHAT_SERVER weechat_color("chat_server")
#define IRC_COLOR_CHAT_VALUE weechat_color("chat_value")
#define IRC_COLOR_NICKLIST_PREFIX1 weechat_color("nicklist_prefix1")
#define IRC_COLOR_NICKLIST_PREFIX2 weechat_color("nicklist_prefix2")
#define IRC_COLOR_NICKLIST_PREFIX3 weechat_color("nicklist_prefix3")
#define IRC_COLOR_NICKLIST_PREFIX4 weechat_color("nicklist_prefix4")
#define IRC_COLOR_NICKLIST_PREFIX5 weechat_color("nicklist_prefix5")
#define IRC_COLOR_NICK_PREFIX_OP weechat_color(weechat_config_string(irc_config_color_nick_prefix_op))
#define IRC_COLOR_NICK_PREFIX_HALFOP weechat_color(weechat_config_string(irc_config_color_nick_prefix_halfop))
#define IRC_COLOR_NICK_PREFIX_VOICE weechat_color(weechat_config_string(irc_config_color_nick_prefix_voice))
#define IRC_COLOR_NICK_PREFIX_USER weechat_color(weechat_config_string(irc_config_color_nick_prefix_user))
#define IRC_COLOR_BAR_FG weechat_color("bar_fg")
#define IRC_COLOR_BAR_BG weechat_color("bar_bg")
#define IRC_COLOR_BAR_DELIM weechat_color("bar_delim")
+45
View File
@@ -85,6 +85,10 @@ struct t_config_option *irc_config_look_topic_strip_colors;
struct t_config_option *irc_config_color_message_join;
struct t_config_option *irc_config_color_message_quit;
struct t_config_option *irc_config_color_nick_prefix_op;
struct t_config_option *irc_config_color_nick_prefix_halfop;
struct t_config_option *irc_config_color_nick_prefix_voice;
struct t_config_option *irc_config_color_nick_prefix_user;
struct t_config_option *irc_config_color_notice;
struct t_config_option *irc_config_color_input_nick;
struct t_config_option *irc_config_color_item_away;
@@ -408,6 +412,23 @@ irc_config_change_color_item_buffer_name (void *data,
weechat_bar_item_update ("buffer_name");
}
/*
* irc_config_change_color_nick_prefix: called when the color of a nick prefix
* is changed
*/
void
irc_config_change_color_nick_prefix (void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) data;
(void) option;
weechat_bar_item_update ("input_prompt");
weechat_bar_item_update ("nicklist");
}
/*
* irc_config_change_network_away_check: called when away check is changed
*/
@@ -1647,6 +1668,30 @@ irc_config_init ()
N_("color for text in part/quit messages"),
NULL, -1, 0, "red", NULL, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
irc_config_color_nick_prefix_op = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefix_op", "color",
N_("color for prefix of nick which is op/admin/owner on channel"),
NULL, -1, 0, "lightgreen", NULL, 0, NULL, NULL,
&irc_config_change_color_nick_prefix, NULL, NULL, NULL);
irc_config_color_nick_prefix_halfop = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefix_halfop", "color",
N_("color for prefix of nick which is halfop on channel"),
NULL, -1, 0, "lightmagenta", NULL, 0, NULL, NULL,
&irc_config_change_color_nick_prefix, NULL, NULL, NULL);
irc_config_color_nick_prefix_voice = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefix_voice", "color",
N_("color for prefix of nick which has voice on channel"),
NULL, -1, 0, "yellow", NULL, 0, NULL, NULL,
&irc_config_change_color_nick_prefix, NULL, NULL, NULL);
irc_config_color_nick_prefix_user = weechat_config_new_option (
irc_config_file, ptr_section,
"nick_prefix_user", "color",
N_("color for prefix of nick which is user on channel"),
NULL, -1, 0, "blue", NULL, 0, NULL, NULL,
&irc_config_change_color_nick_prefix, NULL, NULL, NULL);
irc_config_color_notice = weechat_config_new_option (
irc_config_file, ptr_section,
"notice", "color",
+4
View File
@@ -102,6 +102,10 @@ extern struct t_config_option *irc_config_look_topic_strip_colors;
extern struct t_config_option *irc_config_color_message_join;
extern struct t_config_option *irc_config_color_message_quit;
extern struct t_config_option *irc_config_color_nick_prefix_op;
extern struct t_config_option *irc_config_color_nick_prefix_halfop;
extern struct t_config_option *irc_config_color_nick_prefix_voice;
extern struct t_config_option *irc_config_color_nick_prefix_user;
extern struct t_config_option *irc_config_color_notice;
extern struct t_config_option *irc_config_color_input_nick;
extern struct t_config_option *irc_config_color_item_away;
+43 -27
View File
@@ -210,6 +210,28 @@ irc_nick_get_gui_infos (struct t_irc_server *server,
}
}
/*
* irc_nick_get_prefix_color_name: return name of color with a prefix number
*/
const char *
irc_nick_get_prefix_color_name (int prefix_color)
{
static char *color_for_prefix[] = {
"chat",
"irc.color.nick_prefix_op",
"irc.color.nick_prefix_halfop",
"irc.color.nick_prefix_voice",
"irc.color.nick_prefix_user",
};
if ((prefix_color >= 0) && (prefix_color <= 4))
return color_for_prefix[prefix_color];
/* no color by default (should not happen) */
return color_for_prefix[0];
}
/*
* irc_nick_new: allocate a new nick for a channel and add it to the nick list
*/
@@ -221,7 +243,7 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
int is_chanuser, int is_away)
{
struct t_irc_nick *new_nick, *ptr_nick;
char prefix[2], str_prefix_color[64];
char prefix[2];
int prefix_color;
struct t_gui_nick_group *ptr_group;
@@ -252,14 +274,13 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
prefix[1] = '\0';
irc_nick_get_gui_infos (server, ptr_nick, prefix,
&prefix_color, channel->buffer, &ptr_group);
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
ptr_nick->name,
(is_away) ?
"weechat.color.nicklist_away" : "bar_fg",
prefix, str_prefix_color, 1);
prefix,
irc_nick_get_prefix_color_name (prefix_color),
1);
return ptr_nick;
}
@@ -303,14 +324,13 @@ irc_nick_new (struct t_irc_server *server, struct t_irc_channel *channel,
prefix[1] = '\0';
irc_nick_get_gui_infos (server, new_nick, prefix, &prefix_color,
channel->buffer, &ptr_group);
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
new_nick->name,
(is_away) ?
"weechat.color.nicklist_away" : "bar_fg",
prefix, str_prefix_color, 1);
prefix,
irc_nick_get_prefix_color_name (prefix_color),
1);
/* all is ok, return address of new nick */
return new_nick;
@@ -326,7 +346,7 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
{
int nick_is_me, prefix_color;
struct t_gui_nick_group *ptr_group;
char prefix[2], str_prefix_color[64];
char prefix[2];
/* remove nick from nicklist */
irc_nick_get_gui_infos (server, nick, prefix, &prefix_color,
@@ -355,14 +375,13 @@ irc_nick_change (struct t_irc_server *server, struct t_irc_channel *channel,
prefix[1] = '\0';
irc_nick_get_gui_infos (server, nick, prefix, &prefix_color,
channel->buffer, &ptr_group);
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
nick->name,
(nick->flags & IRC_NICK_AWAY) ?
"weechat.color.nicklist_away" : "bar_fg",
prefix, str_prefix_color, 1);
prefix,
irc_nick_get_prefix_color_name (prefix_color),
1);
}
/*
@@ -373,7 +392,7 @@ void
irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel,
struct t_irc_nick *nick, int set, int flag)
{
char prefix[2], str_prefix_color[64];
char prefix[2];
int prefix_color;
struct t_gui_nick_group *ptr_group;
@@ -393,14 +412,13 @@ irc_nick_set (struct t_irc_server *server, struct t_irc_channel *channel,
prefix[1] = '\0';
irc_nick_get_gui_infos (server, nick, prefix, &prefix_color,
channel->buffer, &ptr_group);
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
weechat_nicklist_add_nick (channel->buffer, ptr_group,
nick->name,
(nick->flags & IRC_NICK_AWAY) ?
"weechat.color.nicklist_away" : "bar_fg",
prefix, str_prefix_color, 1);
prefix,
irc_nick_get_prefix_color_name (prefix_color),
1);
if (strcmp (nick->name, server->nick) == 0)
weechat_bar_item_update ("input_prompt");
@@ -567,7 +585,8 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
const char *nickname, const char *force_color)
{
static char result[256];
char prefix[2], str_prefix_color[64];
char prefix[2];
const char *str_prefix_color;
int prefix_color;
prefix[0] = '\0';
@@ -581,22 +600,19 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
if ((prefix[0] == ' ')
&& !weechat_config_boolean (weechat_config_get ("weechat.look.nickmode_empty")))
prefix[0] = '\0';
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.nicklist_prefix%d",
prefix_color);
str_prefix_color = weechat_color (weechat_config_string (weechat_config_get (irc_nick_get_prefix_color_name (prefix_color))));
}
else
{
prefix[0] = (weechat_config_boolean (weechat_config_get ("weechat.look.nickmode_empty"))) ?
' ' : '\0';
snprintf (str_prefix_color, sizeof (str_prefix_color),
"weechat.color.chat");
str_prefix_color = IRC_COLOR_CHAT;
}
}
else
{
prefix[0] = '\0';
snprintf (str_prefix_color, sizeof (str_prefix_color), "chat");
str_prefix_color = IRC_COLOR_CHAT;
}
snprintf (result, sizeof (result), "%s%s%s%s%s%s%s%s\t",
@@ -606,7 +622,7 @@ irc_nick_as_prefix (struct t_irc_server *server, struct t_irc_nick *nick,
(weechat_config_string (irc_config_look_nick_prefix)
&& weechat_config_string (irc_config_look_nick_prefix)[0]) ?
weechat_config_string (irc_config_look_nick_prefix) : "",
weechat_color(weechat_config_string(weechat_config_get(str_prefix_color))),
str_prefix_color,
prefix,
(force_color) ? force_color : ((nick) ? nick->color : IRC_COLOR_CHAT_NICK),
(nick) ? nick->name : nickname,
+1
View File
@@ -75,6 +75,7 @@ extern void irc_nick_get_gui_infos (struct t_irc_server *server,
char *prefix, int *prefix_color,
struct t_gui_buffer *buffer,
struct t_gui_nick_group **group);
extern const char *irc_nick_get_prefix_color_name (int prefix_color);
extern struct t_irc_nick *irc_nick_new (struct t_irc_server *server,
struct t_irc_channel *channel,
const char *nickname,
+8 -8
View File
@@ -3406,35 +3406,35 @@ IRC_PROTOCOL_CALLBACK(353)
{
case '@': /* op */
is_op = 1;
color = IRC_COLOR_NICKLIST_PREFIX1;
color = IRC_COLOR_NICK_PREFIX_OP;
break;
case '~': /* channel owner */
is_chanowner = 1;
color = IRC_COLOR_NICKLIST_PREFIX1;
color = IRC_COLOR_NICK_PREFIX_OP;
break;
case '*': /* channel owner */
is_chanowner = 1;
color = IRC_COLOR_NICKLIST_PREFIX1;
color = IRC_COLOR_NICK_PREFIX_OP;
break;
case '&': /* channel admin */
is_chanadmin = 1;
color = IRC_COLOR_NICKLIST_PREFIX1;
color = IRC_COLOR_NICK_PREFIX_OP;
break;
case '!': /* channel admin (2) */
is_chanadmin2 = 1;
color = IRC_COLOR_NICKLIST_PREFIX1;
color = IRC_COLOR_NICK_PREFIX_OP;
break;
case '%': /* half-op */
is_halfop = 1;
color = IRC_COLOR_NICKLIST_PREFIX2;
color = IRC_COLOR_NICK_PREFIX_HALFOP;
break;
case '+': /* voice */
has_voice = 1;
color = IRC_COLOR_NICKLIST_PREFIX3;
color = IRC_COLOR_NICK_PREFIX_VOICE;
break;
case '-': /* channel user */
is_chanuser = 1;
color = IRC_COLOR_NICKLIST_PREFIX4;
color = IRC_COLOR_NICK_PREFIX_USER;
break;
default:
color = IRC_COLOR_CHAT;