[srvx-commits] CVS: services/src chanserv.c,1.358,1.359 chanserv.h,1.46,1.47 nickserv.c,1.240,1.241
                
                Brought to you by:
                
                    entrope
                    
                
            
            
        
        
        
    | 
      
      
      From: Entrope <en...@us...> - 2003-07-08 03:44:00
      
     | 
| Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26896/src
Modified Files:
	chanserv.c chanserv.h nickserv.c 
Log Message:
implement RFE [645100] - minor user issue
 (garbage-collect channels when they run out of users)
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.358
retrieving revision 1.359
diff -C2 -r1.358 -r1.359
*** chanserv.c	8 Jul 2003 03:08:20 -0000	1.358
--- chanserv.c	8 Jul 2003 03:43:56 -0000	1.359
***************
*** 1282,1287 ****
  }
  
  void
! del_channel_user(struct chanData *channel, struct userData *user)
  {
      struct chanList *entry = NULL;
--- 1282,1289 ----
  }
  
+ static void unregister_channel(struct chanData *channel);
+ 
  void
! del_channel_user(struct chanData *channel, struct userData *user, int do_gc)
  {
      struct chanList *entry = NULL;
***************
*** 1316,1319 ****
--- 1318,1322 ----
      if(user->info) free(user->info);
      free(user);
+     if(do_gc && !channel->users) unregister_channel(channel);
  }
  
***************
*** 1445,1449 ****
      while(channel->users)
      {
! 	del_channel_user(channel, channel->users);
      }
  
--- 1448,1452 ----
      while(channel->users)
      {
! 	del_channel_user(channel, channel->users, 0);
      }
  
***************
*** 2220,2228 ****
  	{
  	    dict_remove(merge, suData->handle->handle);
! 	    del_channel_user(source, suData);
  	}
  	else
  	{
! 	    del_channel_user(target, tuData);
  	}
      }
--- 2223,2231 ----
  	{
  	    dict_remove(merge, suData->handle->handle);
! 	    del_channel_user(source, suData, 0);
  	}
  	else
  	{
! 	    del_channel_user(target, tuData, 0);
  	}
      }
***************
*** 2613,2617 ****
      }
  
!     del_channel_user(channel->channel_info, victim);
      chanserv_notice(user, CSMSG_DELETED_USER, preposition(accessNames[access]), accessNames[access], handle->handle, channel->name);
      return 1;
--- 2616,2620 ----
      }
  
!     del_channel_user(channel->channel_info, victim, 1);
      chanserv_notice(user, CSMSG_DELETED_USER, preposition(accessNames[access]), accessNames[access], handle->handle, channel->name);
      return 1;
***************
*** 2644,2648 ****
  	if(uData->access == access && match_ircglob(uData->handle->handle, argv[1]))
  	{
! 	    del_channel_user(channel->channel_info, uData);
  	}
      }
--- 2647,2651 ----
  	if(uData->access == access && match_ircglob(uData->handle->handle, argv[1]))
  	{
! 	    del_channel_user(channel->channel_info, uData, 1);
  	}
      }
***************
*** 2734,2738 ****
  	if(uData->access == access || (access == ulNone && (uData->access < actor->access)))
  	{
! 	    del_channel_user(channel->channel_info, uData);
  	    count++;
  	}
--- 2737,2741 ----
  	if(uData->access == access || (access == ulNone && (uData->access < actor->access)))
  	{
! 	    del_channel_user(channel->channel_info, uData, 1);
  	    count++;
  	}
***************
*** 6571,6575 ****
                 don't worry about them. */
              next = channel->next;
!             del_channel_user(channel->channel, channel->user);
          }
      }
--- 6574,6578 ----
                 don't worry about them. */
              next = channel->next;
!             del_channel_user(channel->channel, channel->user, 1);
          }
      }
Index: chanserv.h
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** chanserv.h	7 Jul 2003 16:29:33 -0000	1.46
--- chanserv.h	8 Jul 2003 03:43:56 -0000	1.47
***************
*** 221,225 ****
  
  void init_chanserv(const char *nick);
! void del_channel_user(struct chanData *channel, struct userData *user);
  struct chanNode *chanserv_support_channel(void);
  enum userLevel user_level_from_name(const char *name);
--- 221,225 ----
  
  void init_chanserv(const char *nick);
! void del_channel_user(struct chanData *channel, struct userData *user, int do_gc);
  struct chanNode *chanserv_support_channel(void);
  enum userLevel user_level_from_name(const char *name);
Index: nickserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/nickserv.c,v
retrieving revision 1.240
retrieving revision 1.241
diff -C2 -r1.240 -r1.241
*** nickserv.c	8 Jul 2003 02:44:07 -0000	1.240
--- nickserv.c	8 Jul 2003 03:43:56 -0000	1.241
***************
*** 2593,2601 ****
          if (cList2 && (cList2->user->access >= cList->user->access)) {
              /* keep cList2 in hi_to; remove cList from hi_from */
!             del_channel_user(cList->channel, cList->user);
          } else {
              if (cList2) {
                  /* hi_from handle has higher access; remove cList2 from hi_to */
!                 del_channel_user(cList2->channel, cList2->user);
              }
              /* cList needs to be moved from hi_from to hi_to */
--- 2593,2601 ----
          if (cList2 && (cList2->user->access >= cList->user->access)) {
              /* keep cList2 in hi_to; remove cList from hi_from */
!             del_channel_user(cList->channel, cList->user, 1);
          } else {
              if (cList2) {
                  /* hi_from handle has higher access; remove cList2 from hi_to */
!                 del_channel_user(cList2->channel, cList2->user, 1);
              }
              /* cList needs to be moved from hi_from to hi_to */
 |