Fix clearing "helping" flag from users when parting other channels.
authorMichael Poole <mdpoole@troilus.org>
Thu, 17 Sep 2009 21:02:57 +0000 (17:02 -0400)
committerMichael Poole <mdpoole@troilus.org>
Thu, 17 Sep 2009 21:05:45 +0000 (17:05 -0400)
src/chanserv.c (handle_part): Allow the current user to be considered for
  channels other than the channel being /part'ed.

src/chanserv.c

index 2780729b7c2e4d52b5b6865688da4d86cf9daea5..f8ce1ae805e717d780001b3ce5dd063e20afd07d 100644 (file)
@@ -6715,10 +6715,19 @@ handle_part(struct modeNode *mn, UNUSED_ARG(const char *reason))
     if(IsHelping(mn->user) && IsSupportHelper(mn->user))
     {
         unsigned int ii;
-        for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii)
-             if(find_handle_in_channel(chanserv_conf.support_channels.list[ii], mn->user->handle_info, mn->user))
+        for(ii = 0; ii < chanserv_conf.support_channels.used; ++ii) {
+            struct chanNode *channel;
+            struct userNode *exclude;
+            /* When looking at the channel that is being /part'ed, we
+             * have to skip over the client that is leaving.  For
+             * other channels, we must not do that.
+             */
+            channel = chanserv_conf.support_channels.list[ii];
+            exclude = (channel == mn->channel) ? mn->user : NULL;
+            if(find_handle_in_channel(channel, mn->user->handle_info, exclude))
                 break;
-         if(ii == chanserv_conf.support_channels.used)
+        }
+        if(ii == chanserv_conf.support_channels.used)
             HANDLE_CLEAR_FLAG(mn->user->handle_info, HELPING);
     }
 }