1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-30 23:06:38 +02:00

Added support of channel mode +u (channel user) (bug #20717)

This commit is contained in:
Sebastien Helleu
2007-08-09 09:35:17 +00:00
parent c246d44762
commit ec78674d4e
44 changed files with 4392 additions and 4240 deletions
+2 -1
View File
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-08-08
ChangeLog - 2007-08-09
Version 0.2.6 (under dev!):
* added support of channel mode +u (channel user) (bug #20717)
* improved /connect command to connect to a host by creating a temporary
server, added option to /server to create temporary server (task #7095)
* added "copy", "rename" and "keep" options to /server command
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Farbe des Voice-Symbols</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>Farbe</entry>
<entry>Curses- oder Gtk-Farben</entry>
<entry>'blue'</entry>
<entry>Color for user symbol</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>Farbe</entry>
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Color for voice symbol</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>color</entry>
<entry>Curses or Gtk color</entry>
<entry>'blue'</entry>
<entry>Color for user symbol</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>color</entry>
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Couleur pour le symbole voix</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>couleur</entry>
<entry>couleur Curses ou Gtk</entry>
<entry>'blue'</entry>
<entry>Couleur pour le symbole utilisateur</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>couleur</entry>
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+302 -293
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+291 -287
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1165,7 +1165,7 @@ session_load_nick (FILE *file)
/* allocate nick */
nick = irc_nick_new (session_current_server, session_current_channel,
nick_name, 0, 0, 0, 0, 0, 0);
nick_name, 0, 0, 0, 0, 0, 0, 0);
free (nick_name);
if (!nick)
{
+5
View File
@@ -341,6 +341,7 @@ int cfg_col_nick_chanadmin;
int cfg_col_nick_op;
int cfg_col_nick_halfop;
int cfg_col_nick_voice;
int cfg_col_nick_user;
int cfg_col_nick_more;
int cfg_col_nick_sep;
int cfg_col_nick_self;
@@ -563,6 +564,10 @@ t_config_option weechat_options_colors[] =
N_("color for voice symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color },
{ "col_nick_user", N_("color for user symbol"),
N_("color for user symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_nick_user, NULL, &config_change_color },
{ "col_nick_more", N_("color for '+' when scrolling nicks"),
N_("color for '+' when scrolling nicks"),
OPTION_TYPE_COLOR, 0, 0, 0,
+1
View File
@@ -183,6 +183,7 @@ extern int cfg_col_nick_chanadmin;
extern int cfg_col_nick_op;
extern int cfg_col_nick_halfop;
extern int cfg_col_nick_voice;
extern int cfg_col_nick_user;
extern int cfg_col_nick_more;
extern int cfg_col_nick_sep;
extern int cfg_col_nick_self;
+1
View File
@@ -536,6 +536,7 @@ gui_color_init_weechat ()
gui_color[COLOR_WIN_NICK_OP] = gui_color_build (COLOR_WIN_NICK_OP, cfg_col_nick_op, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_HALFOP] = gui_color_build (COLOR_WIN_NICK_HALFOP, cfg_col_nick_halfop, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_VOICE] = gui_color_build (COLOR_WIN_NICK_VOICE, cfg_col_nick_voice, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_CHANUSER] = gui_color_build (COLOR_WIN_NICK_CHANUSER, cfg_col_nick_user, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_MORE] = gui_color_build (COLOR_WIN_NICK_MORE, cfg_col_nick_more, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_SEP] = gui_color_build (COLOR_WIN_NICK_SEP, cfg_col_nick_sep, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_SELF] = gui_color_build (COLOR_WIN_NICK_SELF, cfg_col_nick_self, cfg_col_nick_bg);
+6
View File
@@ -216,6 +216,12 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, "+");
x++;
}
else if (ptr_nick->flags & NICK_CHANUSER)
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, COLOR_WIN_NICK_CHANUSER);
mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, "-");
x++;
}
else
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, COLOR_WIN_NICK);
+1
View File
@@ -90,6 +90,7 @@ enum t_weechat_color
COLOR_WIN_INPUT_SERVER,
COLOR_WIN_TITLE_MORE,
COLOR_WIN_INPUT_TEXT_NOT_FOUND,
COLOR_WIN_NICK_CHANUSER,
GUI_NUM_COLORS
};
+4 -1
View File
@@ -178,7 +178,7 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
if (nick && cfg_look_nickmode)
{
if (nick->flags & (NICK_CHANOWNER | NICK_CHANADMIN | NICK_CHANADMIN2 |
NICK_OP | NICK_HALFOP | NICK_VOICE))
NICK_OP | NICK_HALFOP | NICK_VOICE | NICK_CHANUSER))
length += 1;
else if (cfg_look_nickmode_empty && !no_nickmode)
length += 1;
@@ -235,6 +235,9 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
else if (nick->flags & NICK_VOICE)
gui_printf_type (buffer, type, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
else if (nick->flags & NICK_CHANUSER)
gui_printf_type (buffer, type, "%s-",
GUI_COLOR(COLOR_WIN_NICK_CHANUSER));
else if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_type (buffer, type, "%s ",
GUI_COLOR(COLOR_WIN_CHAT));
+14 -7
View File
@@ -119,21 +119,21 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
set_flag = irc_mode_channel_get_flag (modes, pos);
switch (pos[0])
{
case 'a': /* unrealircd specific flag */
case 'a': /* channel admin (unrealircd specific flag) */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '~'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANADMIN);
break;
case 'h':
case 'h': /* half-op */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '%'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_HALFOP);
break;
case 'k':
case 'k': /* channel key */
if (channel->key)
{
free (channel->key);
@@ -147,7 +147,7 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
channel->key = strdup (ptr_arg);
}
break;
case 'l':
case 'l': /* channel limit */
if (set_flag == '-')
channel->limit = 0;
if (set_flag == '+')
@@ -158,21 +158,28 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
channel->limit = atoi (ptr_arg);
}
break;
case 'o':
case 'o': /* op */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '@'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_OP);
break;
case 'q': /* unrealircd specific flag */
case 'q': /* channel owner (unrealircd specific flag) */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '~'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANOWNER);
break;
case 'v':
case 'u': /* channel user */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '-'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANUSER);
break;
case 'v': /* voice */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '+'))
+10 -6
View File
@@ -62,16 +62,18 @@ int
irc_nick_score_for_sort (t_irc_nick *nick)
{
if (nick->flags & NICK_CHANOWNER)
return -64;
return -128;
if (nick->flags & NICK_CHANADMIN)
return -32;
return -64;
if (nick->flags & NICK_CHANADMIN2)
return -16;
return -32;
if (nick->flags & NICK_OP)
return -8;
return -16;
if (nick->flags & NICK_HALFOP)
return -4;
return -8;
if (nick->flags & NICK_VOICE)
return -4;
if (nick->flags & NICK_CHANUSER)
return -2;
return 0;
}
@@ -195,7 +197,7 @@ irc_nick_resort (t_irc_channel *channel, t_irc_nick *nick)
t_irc_nick *
irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op,
int is_halfop, int has_voice)
int is_halfop, int has_voice, int is_chanuser)
{
t_irc_nick *new_nick;
@@ -209,6 +211,7 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
NICK_SET_FLAG(new_nick, is_chanuser, NICK_CHANUSER);
irc_nick_resort (channel, new_nick);
return new_nick;
}
@@ -227,6 +230,7 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
NICK_SET_FLAG(new_nick, is_chanuser, NICK_CHANUSER);
if (ascii_strcasecmp (new_nick->nick, server->nick) == 0)
new_nick->color = COLOR_WIN_NICK_SELF;
else
+75 -88
View File
@@ -502,7 +502,7 @@ irc_recv_cmd_join (t_irc_server *server, char *host, char *nick, char *arguments
}
/* add nick in channel */
ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0);
ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0, 0);
if (ptr_nick)
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
@@ -3234,6 +3234,7 @@ int
irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_channel, *pos;
int color;
/* make C compiler happy */
(void) host;
@@ -3265,37 +3266,41 @@ irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments)
GUI_COLOR(COLOR_WIN_CHAT));
while (pos_channel && pos_channel[0])
{
if (pos_channel[0] == '!')
if (irc_mode_nick_prefix_allowed (server, pos_channel[0]))
{
gui_printf (server->buffer, "%s!",
GUI_COLOR(COLOR_WIN_NICK_OP));
switch (pos_channel[0])
{
case '@': /* op */
color = COLOR_WIN_NICK_OP;
break;
case '%': /* half-op */
color = COLOR_WIN_NICK_HALFOP;
break;
case '+': /* voice */
color = COLOR_WIN_NICK_VOICE;
break;
case '~': /* channel owner */
color = COLOR_WIN_NICK_CHANOWNER;
break;
case '&': /* channel admin */
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '!': /* channel admin (2) */
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '-': /* channel user */
color = COLOR_WIN_NICK_CHANUSER;
break;
default:
color = COLOR_WIN_CHAT;
break;
}
gui_printf (server->buffer, "%s%c",
GUI_COLOR(COLOR_WIN_NICK_OP),
pos_channel[0]);
pos_channel++;
}
else
{
if (pos_channel[0] == '@')
{
gui_printf (server->buffer, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
pos_channel++;
}
else
{
if (pos_channel[0] == '%')
{
gui_printf (server->buffer, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
pos_channel++;
}
else
if (pos_channel[0] == '+')
{
gui_printf (server->buffer, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
pos_channel++;
}
}
}
pos = strchr (pos_channel, ' ');
if (pos)
{
@@ -4384,8 +4389,9 @@ int
irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos_nick;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice;
int prefix_found;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
int has_voice, is_chanuser;
int prefix_found, color;
t_irc_channel *ptr_channel;
t_gui_buffer *ptr_buffer;
@@ -4457,74 +4463,54 @@ irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
is_op = 0;
is_halfop = 0;
has_voice = 0;
is_chanuser = 0;
prefix_found = 1;
while (prefix_found)
{
prefix_found = 0;
switch (pos[0])
if (irc_mode_nick_prefix_allowed (server, pos[0]))
{
case '@': /* op */
if (irc_mode_nick_prefix_allowed (server, '@'))
{
prefix_found = 1;
prefix_found = 1;
switch (pos[0])
{
case '@': /* op */
is_op = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '%': /* half-op */
if (irc_mode_nick_prefix_allowed (server, '%'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_OP;
break;
case '%': /* half-op */
is_halfop = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
}
break;
case '+': /* voice */
if (irc_mode_nick_prefix_allowed (server, '+'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_HALFOP;
break;
case '+': /* voice */
has_voice = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
}
break;
case '~': /* channel owner */
if (irc_mode_nick_prefix_allowed (server, '~'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_VOICE;
break;
case '~': /* channel owner */
is_chanowner = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s~",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '&': /* channel admin */
if (irc_mode_nick_prefix_allowed (server, '&'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_CHANOWNER;
break;
case '&': /* channel admin */
is_chanadmin = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s&",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '!': /* channel admin (2) */
if (irc_mode_nick_prefix_allowed (server, '!'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '!': /* channel admin (2) */
is_chanadmin2 = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s!",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '-': /* channel user */
is_chanuser = 1;
color = COLOR_WIN_NICK_CHANUSER;
break;
default:
color = COLOR_WIN_CHAT;
break;
}
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s%c",
GUI_COLOR(color),
pos[0]);
}
if (prefix_found)
pos++;
@@ -4538,8 +4524,9 @@ irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
}
if (ptr_channel)
{
if (!irc_nick_new (server, ptr_channel, pos_nick, is_chanowner,
is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice))
if (!irc_nick_new (server, ptr_channel, pos_nick,
is_chanowner, is_chanadmin, is_chanadmin2,
is_op, is_halfop, has_voice, is_chanuser))
{
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
+2 -1
View File
@@ -63,6 +63,7 @@
#define NICK_VOICE 16
#define NICK_AWAY 32
#define NICK_CHANADMIN2 64
#define NICK_CHANUSER 128
#define NICK_SET_FLAG(nick, set, flag) \
if (set) \
nick->flags |= flag; \
@@ -429,7 +430,7 @@ extern void irc_channel_print_log (t_irc_channel *);
extern int irc_nick_find_color (t_irc_nick *);
extern t_irc_nick *irc_nick_new (t_irc_server *, t_irc_channel *, char *,
int, int, int, int, int, int);
int, int, int, int, int, int, int);
extern void irc_nick_resort (t_irc_channel *, t_irc_nick *);
extern void irc_nick_change (t_irc_channel *, t_irc_nick *, char *);
extern void irc_nick_free (t_irc_channel *, t_irc_nick *);
+2 -1
View File
@@ -1,10 +1,11 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-08-08
ChangeLog - 2007-08-09
Version 0.2.6 (under dev!):
* added support of channel mode +u (channel user) (bug #20717)
* improved /connect command to connect to a host by creating a temporary
server, added option to /server to create temporary server (task #7095)
* added "copy", "rename" and "keep" options to /server command
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Farbe des Voice-Symbols</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>Farbe</entry>
<entry>Curses- oder Gtk-Farben</entry>
<entry>'blue'</entry>
<entry>Color for user symbol</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>Farbe</entry>
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Color for voice symbol</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>color</entry>
<entry>Curses or Gtk color</entry>
<entry>'blue'</entry>
<entry>Color for user symbol</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>color</entry>
+7
View File
@@ -628,6 +628,13 @@
<entry>'yellow'</entry>
<entry>Couleur pour le symbole voix</entry>
</row>
<row>
<entry><option>col_nick_user</option></entry>
<entry>couleur</entry>
<entry>couleur Curses ou Gtk</entry>
<entry>'blue'</entry>
<entry>Couleur pour le symbole utilisateur</entry>
</row>
<row>
<entry><option>col_nick_more</option></entry>
<entry>couleur</entry>
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+302 -293
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+292 -287
View File
File diff suppressed because it is too large Load Diff
+291 -287
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1165,7 +1165,7 @@ session_load_nick (FILE *file)
/* allocate nick */
nick = irc_nick_new (session_current_server, session_current_channel,
nick_name, 0, 0, 0, 0, 0, 0);
nick_name, 0, 0, 0, 0, 0, 0, 0);
free (nick_name);
if (!nick)
{
+5
View File
@@ -341,6 +341,7 @@ int cfg_col_nick_chanadmin;
int cfg_col_nick_op;
int cfg_col_nick_halfop;
int cfg_col_nick_voice;
int cfg_col_nick_user;
int cfg_col_nick_more;
int cfg_col_nick_sep;
int cfg_col_nick_self;
@@ -563,6 +564,10 @@ t_config_option weechat_options_colors[] =
N_("color for voice symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"yellow", NULL, &cfg_col_nick_voice, NULL, &config_change_color },
{ "col_nick_user", N_("color for user symbol"),
N_("color for user symbol"),
OPTION_TYPE_COLOR, 0, 0, 0,
"blue", NULL, &cfg_col_nick_user, NULL, &config_change_color },
{ "col_nick_more", N_("color for '+' when scrolling nicks"),
N_("color for '+' when scrolling nicks"),
OPTION_TYPE_COLOR, 0, 0, 0,
+1
View File
@@ -183,6 +183,7 @@ extern int cfg_col_nick_chanadmin;
extern int cfg_col_nick_op;
extern int cfg_col_nick_halfop;
extern int cfg_col_nick_voice;
extern int cfg_col_nick_user;
extern int cfg_col_nick_more;
extern int cfg_col_nick_sep;
extern int cfg_col_nick_self;
@@ -536,6 +536,7 @@ gui_color_init_weechat ()
gui_color[COLOR_WIN_NICK_OP] = gui_color_build (COLOR_WIN_NICK_OP, cfg_col_nick_op, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_HALFOP] = gui_color_build (COLOR_WIN_NICK_HALFOP, cfg_col_nick_halfop, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_VOICE] = gui_color_build (COLOR_WIN_NICK_VOICE, cfg_col_nick_voice, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_CHANUSER] = gui_color_build (COLOR_WIN_NICK_CHANUSER, cfg_col_nick_user, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_MORE] = gui_color_build (COLOR_WIN_NICK_MORE, cfg_col_nick_more, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_SEP] = gui_color_build (COLOR_WIN_NICK_SEP, cfg_col_nick_sep, cfg_col_nick_bg);
gui_color[COLOR_WIN_NICK_SELF] = gui_color_build (COLOR_WIN_NICK_SELF, cfg_col_nick_self, cfg_col_nick_bg);
@@ -216,6 +216,12 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, "+");
x++;
}
else if (ptr_nick->flags & NICK_CHANUSER)
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, COLOR_WIN_NICK_CHANUSER);
mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, "-");
x++;
}
else
{
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, COLOR_WIN_NICK);
+1
View File
@@ -90,6 +90,7 @@ enum t_weechat_color
COLOR_WIN_INPUT_SERVER,
COLOR_WIN_TITLE_MORE,
COLOR_WIN_INPUT_TEXT_NOT_FOUND,
COLOR_WIN_NICK_CHANUSER,
GUI_NUM_COLORS
};
+4 -1
View File
@@ -178,7 +178,7 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
if (nick && cfg_look_nickmode)
{
if (nick->flags & (NICK_CHANOWNER | NICK_CHANADMIN | NICK_CHANADMIN2 |
NICK_OP | NICK_HALFOP | NICK_VOICE))
NICK_OP | NICK_HALFOP | NICK_VOICE | NICK_CHANUSER))
length += 1;
else if (cfg_look_nickmode_empty && !no_nickmode)
length += 1;
@@ -235,6 +235,9 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, char *nickname,
else if (nick->flags & NICK_VOICE)
gui_printf_type (buffer, type, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
else if (nick->flags & NICK_CHANUSER)
gui_printf_type (buffer, type, "%s-",
GUI_COLOR(COLOR_WIN_NICK_CHANUSER));
else if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_type (buffer, type, "%s ",
GUI_COLOR(COLOR_WIN_CHAT));
+14 -7
View File
@@ -119,21 +119,21 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
set_flag = irc_mode_channel_get_flag (modes, pos);
switch (pos[0])
{
case 'a': /* unrealircd specific flag */
case 'a': /* channel admin (unrealircd specific flag) */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '~'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANADMIN);
break;
case 'h':
case 'h': /* half-op */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '%'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_HALFOP);
break;
case 'k':
case 'k': /* channel key */
if (channel->key)
{
free (channel->key);
@@ -147,7 +147,7 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
channel->key = strdup (ptr_arg);
}
break;
case 'l':
case 'l': /* channel limit */
if (set_flag == '-')
channel->limit = 0;
if (set_flag == '+')
@@ -158,21 +158,28 @@ irc_mode_channel_set (t_irc_server *server, t_irc_channel *channel,
channel->limit = atoi (ptr_arg);
}
break;
case 'o':
case 'o': /* op */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '@'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_OP);
break;
case 'q': /* unrealircd specific flag */
case 'q': /* channel owner (unrealircd specific flag) */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '~'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANOWNER);
break;
case 'v':
case 'u': /* channel user */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '-'))
irc_mode_channel_set_nick (channel, ptr_arg,
set_flag, NICK_CHANUSER);
break;
case 'v': /* voice */
ptr_arg = ((argc > 0) && (current_arg >= 0)) ?
argv[current_arg--] : NULL;
if (irc_mode_nick_prefix_allowed (server, '+'))
+10 -6
View File
@@ -62,16 +62,18 @@ int
irc_nick_score_for_sort (t_irc_nick *nick)
{
if (nick->flags & NICK_CHANOWNER)
return -64;
return -128;
if (nick->flags & NICK_CHANADMIN)
return -32;
return -64;
if (nick->flags & NICK_CHANADMIN2)
return -16;
return -32;
if (nick->flags & NICK_OP)
return -8;
return -16;
if (nick->flags & NICK_HALFOP)
return -4;
return -8;
if (nick->flags & NICK_VOICE)
return -4;
if (nick->flags & NICK_CHANUSER)
return -2;
return 0;
}
@@ -195,7 +197,7 @@ irc_nick_resort (t_irc_channel *channel, t_irc_nick *nick)
t_irc_nick *
irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
int is_chanowner, int is_chanadmin, int is_chanadmin2, int is_op,
int is_halfop, int has_voice)
int is_halfop, int has_voice, int is_chanuser)
{
t_irc_nick *new_nick;
@@ -209,6 +211,7 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
NICK_SET_FLAG(new_nick, is_chanuser, NICK_CHANUSER);
irc_nick_resort (channel, new_nick);
return new_nick;
}
@@ -227,6 +230,7 @@ irc_nick_new (t_irc_server *server, t_irc_channel *channel, char *nick_name,
NICK_SET_FLAG(new_nick, is_op, NICK_OP);
NICK_SET_FLAG(new_nick, is_halfop, NICK_HALFOP);
NICK_SET_FLAG(new_nick, has_voice, NICK_VOICE);
NICK_SET_FLAG(new_nick, is_chanuser, NICK_CHANUSER);
if (ascii_strcasecmp (new_nick->nick, server->nick) == 0)
new_nick->color = COLOR_WIN_NICK_SELF;
else
+75 -88
View File
@@ -502,7 +502,7 @@ irc_recv_cmd_join (t_irc_server *server, char *host, char *nick, char *arguments
}
/* add nick in channel */
ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0);
ptr_nick = irc_nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0, 0, 0);
if (ptr_nick)
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
@@ -3234,6 +3234,7 @@ int
irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos_nick, *pos_channel, *pos;
int color;
/* make C compiler happy */
(void) host;
@@ -3265,37 +3266,41 @@ irc_recv_cmd_319 (t_irc_server *server, char *host, char *nick, char *arguments)
GUI_COLOR(COLOR_WIN_CHAT));
while (pos_channel && pos_channel[0])
{
if (pos_channel[0] == '!')
if (irc_mode_nick_prefix_allowed (server, pos_channel[0]))
{
gui_printf (server->buffer, "%s!",
GUI_COLOR(COLOR_WIN_NICK_OP));
switch (pos_channel[0])
{
case '@': /* op */
color = COLOR_WIN_NICK_OP;
break;
case '%': /* half-op */
color = COLOR_WIN_NICK_HALFOP;
break;
case '+': /* voice */
color = COLOR_WIN_NICK_VOICE;
break;
case '~': /* channel owner */
color = COLOR_WIN_NICK_CHANOWNER;
break;
case '&': /* channel admin */
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '!': /* channel admin (2) */
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '-': /* channel user */
color = COLOR_WIN_NICK_CHANUSER;
break;
default:
color = COLOR_WIN_CHAT;
break;
}
gui_printf (server->buffer, "%s%c",
GUI_COLOR(COLOR_WIN_NICK_OP),
pos_channel[0]);
pos_channel++;
}
else
{
if (pos_channel[0] == '@')
{
gui_printf (server->buffer, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
pos_channel++;
}
else
{
if (pos_channel[0] == '%')
{
gui_printf (server->buffer, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
pos_channel++;
}
else
if (pos_channel[0] == '+')
{
gui_printf (server->buffer, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
pos_channel++;
}
}
}
pos = strchr (pos_channel, ' ');
if (pos)
{
@@ -4384,8 +4389,9 @@ int
irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
{
char *pos, *pos_nick;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice;
int prefix_found;
int is_chanowner, is_chanadmin, is_chanadmin2, is_op, is_halfop;
int has_voice, is_chanuser;
int prefix_found, color;
t_irc_channel *ptr_channel;
t_gui_buffer *ptr_buffer;
@@ -4457,74 +4463,54 @@ irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
is_op = 0;
is_halfop = 0;
has_voice = 0;
is_chanuser = 0;
prefix_found = 1;
while (prefix_found)
{
prefix_found = 0;
switch (pos[0])
if (irc_mode_nick_prefix_allowed (server, pos[0]))
{
case '@': /* op */
if (irc_mode_nick_prefix_allowed (server, '@'))
{
prefix_found = 1;
prefix_found = 1;
switch (pos[0])
{
case '@': /* op */
is_op = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s@",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '%': /* half-op */
if (irc_mode_nick_prefix_allowed (server, '%'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_OP;
break;
case '%': /* half-op */
is_halfop = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s%%",
GUI_COLOR(COLOR_WIN_NICK_HALFOP));
}
break;
case '+': /* voice */
if (irc_mode_nick_prefix_allowed (server, '+'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_HALFOP;
break;
case '+': /* voice */
has_voice = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s+",
GUI_COLOR(COLOR_WIN_NICK_VOICE));
}
break;
case '~': /* channel owner */
if (irc_mode_nick_prefix_allowed (server, '~'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_VOICE;
break;
case '~': /* channel owner */
is_chanowner = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s~",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '&': /* channel admin */
if (irc_mode_nick_prefix_allowed (server, '&'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_CHANOWNER;
break;
case '&': /* channel admin */
is_chanadmin = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s&",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
case '!': /* channel admin (2) */
if (irc_mode_nick_prefix_allowed (server, '!'))
{
prefix_found = 1;
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '!': /* channel admin (2) */
is_chanadmin2 = 1;
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s!",
GUI_COLOR(COLOR_WIN_NICK_OP));
}
break;
color = COLOR_WIN_NICK_CHANADMIN;
break;
case '-': /* channel user */
is_chanuser = 1;
color = COLOR_WIN_NICK_CHANUSER;
break;
default:
color = COLOR_WIN_CHAT;
break;
}
if (!command_ignored && !ptr_channel)
gui_printf (ptr_buffer, "%s%c",
GUI_COLOR(color),
pos[0]);
}
if (prefix_found)
pos++;
@@ -4538,8 +4524,9 @@ irc_recv_cmd_353 (t_irc_server *server, char *host, char *nick, char *arguments)
}
if (ptr_channel)
{
if (!irc_nick_new (server, ptr_channel, pos_nick, is_chanowner,
is_chanadmin, is_chanadmin2, is_op, is_halfop, has_voice))
if (!irc_nick_new (server, ptr_channel, pos_nick,
is_chanowner, is_chanadmin, is_chanadmin2,
is_op, is_halfop, has_voice, is_chanuser))
{
irc_display_prefix (server, server->buffer, PREFIX_ERROR);
gui_printf_nolog (server->buffer,
+2 -1
View File
@@ -63,6 +63,7 @@
#define NICK_VOICE 16
#define NICK_AWAY 32
#define NICK_CHANADMIN2 64
#define NICK_CHANUSER 128
#define NICK_SET_FLAG(nick, set, flag) \
if (set) \
nick->flags |= flag; \
@@ -429,7 +430,7 @@ extern void irc_channel_print_log (t_irc_channel *);
extern int irc_nick_find_color (t_irc_nick *);
extern t_irc_nick *irc_nick_new (t_irc_server *, t_irc_channel *, char *,
int, int, int, int, int, int);
int, int, int, int, int, int, int);
extern void irc_nick_resort (t_irc_channel *, t_irc_nick *);
extern void irc_nick_change (t_irc_channel *, t_irc_nick *, char *);
extern void irc_nick_free (t_irc_channel *, t_irc_nick *);