From: pk910 Date: Wed, 14 Dec 2011 20:30:15 +0000 (+0100) Subject: fixed invisible nicklist (bots need to be added even if they join invisible) X-Git-Tag: v5.3~139 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=17e165bebd45f75f8c43926e0c52a3d4b60a0886 fixed invisible nicklist (bots need to be added even if they join invisible) --- diff --git a/src/IRCParser.c b/src/IRCParser.c index 3e7c0b5..e96063e 100644 --- a/src/IRCParser.c +++ b/src/IRCParser.c @@ -171,7 +171,8 @@ static IRC_CMD(raw_join) { struct UserNode *user = getUserByMask(from); struct ChanNode *chan = getChanByName(argv[0]); if(!chan && !(user->flags & USERFLAG_ISBOT)) return 0; - if(chan && chan->chanbot != client->user) return 1; //we ignore it - but it's not a parse error + if(chan && ((!isBot(user) && chan->chanbot != client->user) || (isBot(user) && client->user != user))) return 1; //we ignore it - but it's not a parse error + //let Bots always add themselves! (maybe they join invisible) if(user == NULL) { user = addUserMask(from); } @@ -204,8 +205,10 @@ static IRC_CMD(raw_join) { get_userlist(chan, got_channel_userlist, chanuser); putsock(client, "MODE %s", chan->name); putsock(client, "MODE %s +b", chan->name); - } else if(!isUserOnChan(user, chan) && (chan->flags & CHANFLAG_RECEIVED_USERLIST)) { + } else if(!isUserOnChan(user, chan) && ((chan->flags & CHANFLAG_RECEIVED_USERLIST) || isBot(user))) { struct ChanUser *chanuser = addChanUser(chan, user); + if(isModeSet(chan->modes, 'D')) + chanuser->flags |= CHANUSERFLAG_INVISIBLE; if(!noEvent) { if(wasRegistering) user->flags |= USERFLAG_WAS_REGISTRING; @@ -271,7 +274,7 @@ static IRC_CMD(raw_part) { if(user == NULL) return 0; struct ChanNode *chan = getChanByName(argv[0]); if(chan == NULL) return 0; - if(chan->chanbot != client->user) return 1; //we ignore it - but it's not a parse error + if((!isBot(user) && chan->chanbot != client->user) || (isBot(user) && client->user != user)) return 1; //we ignore it - but it's not a parse error int keep_channel = 1; if(chan->chanbot == user && (chan->flags & CHANFLAG_REJOINING)) { struct ClientSocket **clients = chan->rejoin_array; @@ -385,7 +388,7 @@ static IRC_CMD(raw_kick) { struct UserNode *target = getUserByNick(argv[1]); struct ChanNode *chan = getChanByName(argv[0]); if(chan == NULL || target == NULL) return 0; - if(chan->chanbot != client->user) return 1; //we ignore it - but it's not a parse error + if(((!isBot(user) && chan->chanbot != client->user) || (isBot(user) && client->user != user))) return 1; //we ignore it - but it's not a parse error int keep_channel = 1; if(isUserOnChan(target, chan) && (chan->flags & CHANFLAG_RECEIVED_USERLIST)) { if(user == NULL) { diff --git a/src/WHOHandler.c b/src/WHOHandler.c index c8c6582..f7287a3 100644 --- a/src/WHOHandler.c +++ b/src/WHOHandler.c @@ -222,16 +222,15 @@ void recv_whohandler_354(struct ClientSocket *client, char **argv, unsigned int } } - struct UserNode *user; + struct UserNode *user = getUserByNick(argv[4]); struct ChanUser *chanuser; - if(chanuserflags & CHANUSERFLAG_INVISIBLE) { + if((chanuserflags & CHANUSERFLAG_INVISIBLE) && !isBot(user)) { user = createTempUser(argv[4]); user->flags |= USERFLAG_ISTMPUSER; chan->flags |= CHANFLAG_HAVE_INVISIBLES; chanuser = addInvisibleChanUser(chan, user); chanuser->flags = (chanuser->flags & ~CHANUSERFLAG_OPPED_OR_VOICED) | chanuserflags; } else { - user = getUserByNick(argv[4]); if(user == NULL) { user = addUser(argv[4]); } @@ -290,7 +289,7 @@ void recv_whohandler_315(struct ClientSocket *client, char **argv, unsigned int struct ChanUser *chanuser, *next; for(chanuser = getChannelUsers(entry->chan, NULL); chanuser; chanuser = next) { next = getChannelUsers(entry->chan, chanuser); - if(chanuser->flags & CHANUSERFLAG_INVISIBLE) { + if((chanuser->flags & CHANUSERFLAG_INVISIBLE) && !isBot(chanuser->user)) { delChanUser(chanuser, 1); } }