fixed invisible bot management (don't add them as invisible user)
authorpk910 <philipp@zoelle1.de>
Sat, 3 Mar 2012 11:01:11 +0000 (12:01 +0100)
committerpk910 <philipp@zoelle1.de>
Sat, 3 Mar 2012 11:01:11 +0000 (12:01 +0100)
src/WHOHandler.c

index e7ffb62ad9aa3c92552468fb9da54d57bf755a60..23737051f49aa93e152e4aadccb3fea3448661a6 100644 (file)
@@ -285,11 +285,9 @@ static void _recv_whohandler_354(struct ClientSocket *client, char **argv, unsig
         
         struct UserNode *user = getUserByNick(argv[5]);
         struct ChanUser *chanuser;
-        if((chanuserflags & CHANUSERFLAG_INVISIBLE)) {
-            if(!user) {
-                user = createTempUser(argv[5]);
-                user->flags |= USERFLAG_ISTMPUSER;
-            }
+        if((chanuserflags & CHANUSERFLAG_INVISIBLE) && (!user || (user && !isBot(user)))) {
+            user = createTempUser(argv[5]); //always add a temponary user to prevent cache problems when the user joins right now (while it's stored in our cache as being invisible)
+            user->flags |= USERFLAG_ISTMPUSER;
             chan->flags |= CHANFLAG_HAVE_INVISIBLES;
             chanuser = addInvisibleChanUser(chan, user);
             chanuser->flags = (chanuser->flags & ~CHANUSERFLAG_OPPED_OR_VOICED) | chanuserflags;