From f08020571b6e0efb91213396b436146c7cb8a41f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 23 Mar 2004 19:14:49 +0000 Subject: [PATCH] fixed channel->chanop git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3230 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/irc/core/modes.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/irc/core/modes.c b/src/irc/core/modes.c index 8528da70..ccfa2d6c 100644 --- a/src/irc/core/modes.c +++ b/src/irc/core/modes.c @@ -198,11 +198,11 @@ static void mode_set_arg(IRC_SERVER_REC *server, GString *str, mode_add_sorted(server, str, mode, arg, user); } -/* Mode that needs a parameter of a mask for both setting and removing (eg: bans) */ +/* Mode that needs a parameter of a mask for both setting and removing + (eg: bans) */ void modes_type_a(IRC_CHANNEL_REC *channel, const char *setby, char type, char mode, char *arg, GString *newmode) { - /* Currently only +b is dealt with */ if (mode == 'b') { if (type == '+') banlist_add(channel, arg, setby, time(NULL)); @@ -251,6 +251,26 @@ void modes_type_prefix(IRC_CHANNEL_REC *channel, const char *setby, int umode = (unsigned char) mode; nick_mode_change(channel, arg, channel->server->modes[umode].prefix, type, setby); + + if (g_strcasecmp(channel->server->nick, arg) == 0) { + /* see if we need to update channel->chanop */ + const char *prefix = + g_hash_table_lookup(channel->server->isupport, "PREFIX"); + if (*prefix == '(') { + prefix++; + while (*prefix != ')' && *prefix != '\0') { + if (*prefix == mode) { + channel->chanop = type == '+'; + break; + } + if (*prefix == 'o') + break; + } + } else { + if (mode == 'o' || mode == 'O') + channel->chanop = type == '+'; + } + } } int channel_mode_is_set(IRC_CHANNEL_REC *channel, char mode)