1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 17:53:13 +02:00

Added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)

This commit is contained in:
Sebastien Helleu
2005-02-15 20:03:35 +00:00
parent 0d21ca207d
commit 84f84823c9
22 changed files with 1536 additions and 1366 deletions
+19 -17
View File
@@ -73,29 +73,31 @@ irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
message_type, COLOR_WIN_CHAT_DARK, "<");
if (cfg_look_nickmode)
{
if (nick->is_op)
if (nick->is_chanowner)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_OP, "~");
else if (nick->is_chanadmin)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_OP, "&");
else if (nick->is_op)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_OP, "@");
else if (nick->is_halfop)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
else if (nick->has_voice)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
else
{
if (nick->is_halfop)
if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
else
{
if (nick->has_voice)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
else
if (cfg_look_nickmode_empty && !no_nickmode)
gui_printf_color_type (buffer,
message_type,
COLOR_WIN_CHAT, " ");
}
}
COLOR_WIN_CHAT, " ");
}
if (color_nick < 0)
gui_printf_color_type (buffer,
+11 -4
View File
@@ -64,8 +64,10 @@ nick_compare (t_irc_nick *nick1, t_irc_nick *nick2)
{
int score1, score2, comp;
score1 = - ( (nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2));
score2 = - ( (nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2));
score1 = - ( (nick1->is_chanowner * 32) + (nick1->is_chanadmin * 16) +
(nick1->is_op * 8) + (nick1->is_halfop * 4) + (nick1->has_voice * 2) );
score2 = - ( (nick2->is_chanowner * 32) + (nick2->is_chanadmin * 16) +
(nick2->is_op * 8) + (nick2->is_halfop * 4) + (nick2->has_voice * 2) );
comp = strcasecmp(nick1->nick, nick2->nick);
if (comp > 0)
@@ -149,7 +151,8 @@ nick_insert_sorted (t_irc_channel *channel, t_irc_nick *nick)
t_irc_nick *
nick_new (t_irc_channel *channel, char *nick_name,
int is_op, int is_halfop, int has_voice)
int is_chanowner, int is_chanadmin, int is_op, int is_halfop,
int has_voice)
{
t_irc_nick *new_nick;
@@ -157,6 +160,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
if ((new_nick = nick_search (channel, nick_name)))
{
/* update nick */
new_nick->is_chanowner = is_chanowner;
new_nick->is_chanadmin = is_chanadmin;
new_nick->is_op = is_op;
new_nick->is_halfop = is_halfop;
new_nick->has_voice = has_voice;
@@ -173,6 +178,8 @@ nick_new (t_irc_channel *channel, char *nick_name,
/* initialize new nick */
new_nick->nick = strdup (nick_name);
new_nick->is_chanowner = is_chanowner;
new_nick->is_chanadmin = is_chanadmin;
new_nick->is_op = is_op;
new_nick->is_halfop = is_halfop;
new_nick->has_voice = has_voice;
@@ -312,7 +319,7 @@ nick_count (t_irc_channel *channel, int *total, int *count_op,
ptr_nick = ptr_nick->next_nick)
{
(*total)++;
if (ptr_nick->is_op)
if ((ptr_nick->is_chanowner) || (ptr_nick->is_chanadmin) || (ptr_nick->is_op))
(*count_op)++;
else
{
+16 -3
View File
@@ -184,7 +184,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
_(" has joined "));
gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
(void) nick_new (ptr_channel, host, 0, 0, 0);
(void) nick_new (ptr_channel, host, 0, 0, 0, 0, 0);
gui_draw_buffer_nick (ptr_channel->buffer, 1);
return 0;
}
@@ -2826,7 +2826,7 @@ int
irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
{
char *pos, *pos_nick;
int is_op, is_halfop, has_voice;
int is_chanowner, is_chanadmin, is_op, is_halfop, has_voice;
t_irc_channel *ptr_channel;
/* make gcc happy */
@@ -2872,6 +2872,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
{
while (pos && pos[0])
{
is_chanowner = 0;
is_chanadmin = 0;
is_op = 0;
is_halfop = 0;
has_voice = 0;
@@ -2885,6 +2887,16 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
has_voice = 1;
pos++;
}
if (pos[0] == '~')
{
is_chanowner = 1;
pos++;
}
if (pos[0] == '&')
{
is_chanadmin = 1;
pos++;
}
pos_nick = pos;
pos = strchr (pos, ' ');
if (pos)
@@ -2892,7 +2904,8 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos[0] = '\0';
pos++;
}
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
if (!nick_new (ptr_channel, pos_nick, is_chanowner, is_chanadmin,
is_op, is_halfop, has_voice))
{
irc_display_prefix (server->buffer, PREFIX_ERROR);
gui_printf (server->buffer,
+3 -1
View File
@@ -77,6 +77,8 @@ typedef struct t_irc_nick t_irc_nick;
struct t_irc_nick
{
char *nick; /* nickname */
int is_chanowner; /* chan owner? (specific to unrealircd) */
int is_chanadmin; /* chan admin? (specific to unrealircd) */
int is_op; /* operator privileges? */
int is_halfop; /* half operaor privileges? */
int has_voice; /* nick has voice? */
@@ -257,7 +259,7 @@ extern void channel_set_away (t_irc_channel *, char *, int);
/* nick functions (irc-nick.c) */
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int);
extern t_irc_nick *nick_new (t_irc_channel *, char *, int, int, int, int, int);
extern void nick_resort (t_irc_channel *, t_irc_nick *);
extern void nick_change (t_irc_channel *, t_irc_nick *, char *);
extern void nick_free (t_irc_channel *, t_irc_nick *);