summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2005-02-15 20:03:35 +0000
committerSebastien Helleu <flashcode@flashtux.org>2005-02-15 20:03:35 +0000
commit84f84823c9e6889072cdc6b3d7c0dbf1fb3dc00f (patch)
treecea5ed15f4b0b69cda69d598db420254aa6f26d1 /src/irc
parent0d21ca207d05ffa06f071677067b634f512c07a9 (diff)
downloadweechat-84f84823c9e6889072cdc6b3d7c0dbf1fb3dc00f.zip
Added support for UnrealIrcd ("~" for chan owner, "&" for chan admin)
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/irc-display.c36
-rw-r--r--src/irc/irc-nick.c15
-rw-r--r--src/irc/irc-recv.c19
-rw-r--r--src/irc/irc.h4
4 files changed, 49 insertions, 25 deletions
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 312d62fbe..e231027f7 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -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,
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c
index 6e1d4c498..5228325ed 100644
--- a/src/irc/irc-nick.c
+++ b/src/irc/irc-nick.c
@@ -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
{
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 85f43188e..09feddf7e 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -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,
diff --git a/src/irc/irc.h b/src/irc/irc.h
index cb079c406..d0aef2aac 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -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 *);