[X2serv-cvs] [CVS] Module x2: Change committed
Brought to you by:
sirvulcan
From: Alex S. <ru...@us...> - 2004-03-02 05:32:55
|
Committer : Alex Schumann <ru...@us...> CVSROOT : /cvsroot/x2serv Module : x2 Branch tags: stable Commit time: 2004-03-02 05:21:23 UTC Modified files: Tag: stable source/chan.c source/commands.c source/config.h source/main.c Log message: Fixed PEON's able to voice others, Added 4 day new channel expiration Added warning topic set for expiring channels ---------------------- diff included ---------------------- Index: x2/source/chan.c diff -u x2/source/chan.c:1.85 x2/source/chan.c:1.85.2.1 --- x2/source/chan.c:1.85 Sat May 17 20:43:45 2003 +++ x2/source/chan.c Mon Mar 1 21:21:07 2004 @@ -1911,6 +1911,15 @@ return; } +/* This checks for channels that have not + * been logged into by a (co)owner for + * CHANEXPIREDAYS and removes them. + * + * Also sets topic warning at + * CHANWARNEXPIREDAYS days + * and brand new channels + * are removed in NEWCHANEXPIREDAYS + */ void ExpireChannels(UserListType uptr) { ChannelListType TempChanPtr, NextChanPtr; @@ -1929,6 +1938,7 @@ NextChanPtr = TempChanPtr->Next; if((TempChanPtr->Regged) && !(TempChanPtr->settings[NODELETE]) && (TempChanPtr->LastAccess > 0)) /* If its not marked nodelete */ { + /* CHANEXPIREDAYS */ if ((time(NULL) - TempChanPtr->LastAccess) > 86400 * CHANEXPIREDAYS) /* older than CHANEXPIREDAYS days */ { Debug(DBGNOTICE, "Channel %s not visited since %lu. Removing..", TempChanPtr->Name, @@ -1950,6 +1960,38 @@ send_to_user(uptr, "Removing %s", TempChanPtr->Name); UnregExpired(TempChanPtr); } + /* CHANWARNEXPIREDAYS */ + if ((time(NULL) - TempChanPtr->LastAccess) > 86400 * CHANWARNEXPIREDAYS) + { + Debug(DBGNOTICE, "Channel %s not visited since %lu. Setting a warning topic.", TempChanPtr->Name, TempChanPtr->LastAccess); + /* First, change the topic */ + free(TempChanPtr->Topic); + if((TempChanPtr->Topic = (char *) malloc(strlen(CHANWARNMESSAGE) + 1))) + strcpy(TempChanPtr->Topic, CHANWARNMESSAGE); + else + Debug(DBGWARNING, "Error allocating memery for chan expire topic warning!"); + /* Next, set topic refresh to maximum */ + TempChanPtr->settings[TOPICFREQ] = 4; + /* Save */ + WriteChanOpFile(TempChanPtr); + } + /* NEWCHANEXPIREDAYS */ + if( ((time(NULL) - TempChanPtr->LastAccess) > 86400 * NEWCHANEXPIREDAYS) && (TempChanPtr->LastAccess==TempChanPtr->CreationDate) ) + { + Debug(DBGINFO, "Channel %s never visited since %lu. Removing..", TempChanPtr->Name, TempChanPtr->LastAccess); + logfile = fopen(ExpiredChanLog, "a"); + if(logfile != 0) + { + ct = time(NULL); + strcpy(tmp, ctime(&ct)); + tmp[strlen(tmp) - 1] = '\0'; + strcpy(lvistime, ctime(&TempChanPtr->LastAccess)); + fprintf(logfile, ":%s: Channel %s removed, never visited since %s", tmp, + TempChanPtr->Name, lvistime); + fclose(logfile); + } + UnregExpired(TempChanPtr); + } } TempChanPtr = NextChanPtr; } Index: x2/source/commands.c diff -u x2/source/commands.c:1.173 x2/source/commands.c:1.173.2.1 --- x2/source/commands.c:1.173 Mon Feb 17 00:58:48 2003 +++ x2/source/commands.c Mon Mar 1 21:21:09 2004 @@ -153,8 +153,8 @@ { "SPOOFSERV", c_spoofserv, NONE, 0, 0, 0, T, T }, { "RESETPASS", c_resetpass, REGED, MA, T, T, F, F }, { "OP", c_op, REGED, OP, T, F, F, T }, - { "VOICE", c_voice, REGED, PE, T, F, F, T }, - { "V", c_voice, REGED, PE, T, F, F, T }, + { "VOICE", c_voice, REGED, OP, T, F, F, T }, + { "V", c_voice, REGED, OP, T, F, F, T }, { "DEVOICE", c_devoice, REGED, OP, T, F, F, T }, { "OPCHAN", c_opchan, REQED, 0, 0, 0, T, T }, { "DEOPCHAN", c_deopchan, REQED, 0, 0, 0, T, T }, Index: x2/source/config.h diff -u x2/source/config.h:1.72 x2/source/config.h:1.72.2.1 --- x2/source/config.h:1.72 Sat May 17 21:04:09 2003 +++ x2/source/config.h Mon Mar 1 21:21:12 2004 @@ -136,9 +136,9 @@ * and 900 users at peak time. The bot will notify you via wallops if * these need to be increased. Small values only hurt performance, every- * thing will remain functional. */ -#define CHANSEGSIZE 3001 -#define USERSEGSIZE 3001 -#define SERVERSEGSIZE 61 +#define CHANSEGSIZE 30001 +#define USERSEGSIZE 30001 +#define SERVERSEGSIZE 128 #define ROUTSEGSIZE SERVERSEGSIZE #define NETSEGSIZE 41 #define NETLINKSEGSIZE 21 @@ -200,6 +200,12 @@ * removed when they reach this many days old. */ #define CHANEXPIREDAYS 30 +/* unreg new never-logged-into channels in __ days */ +#define NEWCHANEXPIREDAYS 4 +/* Warn of impending expiration in __ days*/ +#define CHANWARNEXPIREDAYS 28 +/* Warning message */ +#define CHANWARNMESSAGE "ATTENTION: This channel is going to expire soon! An Owner or CoOwner needs to log in!" /* This time stamp is used as the date registered channels were created in X2. * It should be older then the oldest channel on the network, or X2 wont get Index: x2/source/main.c diff -u x2/source/main.c:1.59 x2/source/main.c:1.59.2.1 --- x2/source/main.c:1.59 Sat May 17 20:43:45 2003 +++ x2/source/main.c Mon Mar 1 21:21:12 2004 @@ -940,6 +940,7 @@ if (ServerConnected) { int Now = time(NULL); + /* Check for ping timeout */ if (((Now - PingStamp) > PINGTIMEOUT) && (!GotPong)) { Debug(DBGINFO, "No ping recieved. Killing link.."); @@ -947,16 +948,16 @@ SockConnected = false; continue; } + /* Check for bans */ if ((Now - bantimer) >= 120) - { /* Once every 120 seconds check for expired bans.. */ - bantimer = Now; + { + bantimer = Now; CheckBanTimeouts(); CheckGlineTimeouts(); CheckSuspendedTimeouts(); - /* Superglines nolonger time out. */ - /*CheckSuperGlineTimeouts(); */ NETBURSTING = FALSE; /* after 2 min start parsing on_join completely */ } + /* Set topics and expire channels once a day */ if ((Now - TopicTimer_1) >= 86400) { TopicTimer_1 = Now; ----------------------- End of diff ----------------------- |