[X2serv-cvs] CVS: x2/source commands.c,1.118,1.119
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2001-01-14 08:09:39
|
Update of /cvsroot/x2serv/x2/source In directory usw-pr-cvs1:/tmp/cvs-serv23018/source Modified Files: commands.c Log Message: Unregistering a channel while 1 or more user was joined caused the userlist and banlist not to be deleted, and in fact remain attached to the channel pointer. This caused the userlist to remain intact after unreg/regchan cycle, in addition to wasting memory. Fixed. Index: commands.c =================================================================== RCS file: /cvsroot/x2serv/x2/source/commands.c,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -r1.118 -r1.119 *** commands.c 2001/01/12 10:34:34 1.118 --- commands.c 2001/01/14 08:09:26 1.119 *************** *** 125,139 **** { "USERS", c_userlist, REGED, 0, 0, 0, F, T }, { "USERLIST", c_userlist, REGED, 0, 0, 0, F, T }, ! { "LAMERLIST", c_llist, REGED, PE, T, T, F, T }, ! { "LAMELIST", c_llist, REGED, PE, T, T, F, T }, ! { "LAMERS", c_llist, REGED, PE, T, T, F, T }, ! { "SHITLIST", c_llist, REGED, PE, T, T, F, T }, ! { "PLIST", c_plist, REGED, PE, T, T, F, T }, ! { "OLIST", c_olist, REGED, PE, T, T, F, T }, { "MLIST", c_mlist, REGED, 0, 0, 0, F, T }, { "CLIST", c_clist, REGED, 0, 0, 0, F, T }, { "WLIST", c_wlist, REGED, 0, 0, 0, F, T }, ! { "BLIST", c_llist, REGED, PE, T, T, F, T }, ! { "LLIST", c_llist, REGED, PE, T, T, F, T }, { "CHANSTAT", c_chanstat, REQED, 0, 0, 0, F, T }, { "CHANSTATS", c_chanstat, REQED, 0, 0, 0, F, T }, --- 125,139 ---- { "USERS", c_userlist, REGED, 0, 0, 0, F, T }, { "USERLIST", c_userlist, REGED, 0, 0, 0, F, T }, ! { "LAMERLIST", c_llist, REGED, 0, T, T, F, T }, ! { "LAMELIST", c_llist, REGED, 0, T, T, F, T }, ! { "LAMERS", c_llist, REGED, 0, T, T, F, T }, ! { "SHITLIST", c_llist, REGED, 0, T, T, F, T }, ! { "PLIST", c_plist, REGED, 0, T, T, F, T }, ! { "OLIST", c_olist, REGED, 0, T, T, F, T }, { "MLIST", c_mlist, REGED, 0, 0, 0, F, T }, { "CLIST", c_clist, REGED, 0, 0, 0, F, T }, { "WLIST", c_wlist, REGED, 0, 0, 0, F, T }, ! { "BLIST", c_llist, REGED, 0, T, T, F, T }, ! { "LLIST", c_llist, REGED, 0, T, T, F, T }, { "CHANSTAT", c_chanstat, REQED, 0, 0, 0, F, T }, { "CHANSTATS", c_chanstat, REQED, 0, 0, 0, F, T }, *************** *** 1019,1027 **** if (target->Modes & UMODEgod) strcat(modetmp, "(GOD)"); ! send_to_user(uptr, "\002| Modes : +%s\002", modetmp); for(ahptr = target->AuthHandles;ahptr;ahptr = ahptr->Next) { ! send_to_user(uptr, "\002| %s\002 on %s.", ahptr->hptr->Handle, ahptr->cptr->Name); } --- 1019,1027 ---- if (target->Modes & UMODEgod) strcat(modetmp, "(GOD)"); ! send_to_user(uptr, "\002 Modes : +%s\002", modetmp); for(ahptr = target->AuthHandles;ahptr;ahptr = ahptr->Next) { ! send_to_user(uptr, "\002 %s\002 on %s.", ahptr->hptr->Handle, ahptr->cptr->Name); } *************** *** 3054,3057 **** --- 3054,3059 ---- HandleListType tmphptr; UserListType target; + int OwnerNumber = 0, CoOwnerNumber = 0, ManagerNumber = 0, OpNumber = 0, PeonNumber = 0, LamerNumber = 0; + *************** *** 3091,3094 **** --- 3093,3104 ---- return(FALSE); } + GetChanStats(cptr, &OwnerNumber, &CoOwnerNumber, &ManagerNumber, + &OpNumber, &PeonNumber, &LamerNumber); + if(*level == 'W' && OwnerNumber > 0) + { + send_to_user(uptr, "Sorry, only one owner per channel is allowed. Delete the old owner first, or add this person as a CoOwner instead."); + return(FALSE); + } + genpass(Pass, GENPASSLEN); tmphptr = AddHandle(cptr, handle, crypt(Pass, "X2"), "*", *level, 1, 0, 0); *************** *** 3123,3126 **** --- 3133,3137 ---- char Pass[GENPASSLEN+1]; HandleListType tmphptr; + int OwnerNumber = 0, CoOwnerNumber = 0, ManagerNumber = 0, OpNumber = 0, PeonNumber = 0, LamerNumber = 0; if(!(rest && *rest)) *************** *** 3162,3165 **** --- 3173,3183 ---- return(FALSE); } + GetChanStats(cptr, &OwnerNumber, &CoOwnerNumber, &ManagerNumber, + &OpNumber, &PeonNumber, &LamerNumber); + if(levelch == 'W' && OwnerNumber > 0) + { + send_to_user(uptr, "Sorry, only one owner is allowed per channel. Either delete the old owner first, or add this person as a CoOwner instead."); + return(FALSE); + } if(!pass) genpass(Pass, GENPASSLEN); *************** *** 3687,3690 **** --- 3705,3710 ---- char ChanName[LINEBUFFSIZE]; int s, line = 0; + HandleListType hptr; + LamerListType lptr; ChanFile = fopen(CHANFILENAME, "r"); *************** *** 3764,3770 **** cptr->Reggedby = NULL; ! /* TODO : Delete userlist banlist etc */ - /** Done deleting operseg **/ /* Regged...*/ cptr->Regged = FALSE; --- 3784,3799 ---- cptr->Reggedby = NULL; ! /* Delete userlist, and lamerlist.. */ ! for(hptr = cptr->Handles;hptr;hptr = hptr->Next) ! { ! DelHandle(cptr, hptr); ! } ! cptr->Handles = NULL; ! for(lptr = cptr->Lamers;lptr;lptr = lptr->Next) ! { ! free(lptr); ! } ! cptr->Lamers = NULL; /* Regged...*/ cptr->Regged = FALSE; |