Mercurial > noffle
comparison src/noffle.c @ 132:a740dac296bc noffle
[svn] Fix repeated auto-unsubscribe bug & sync to 1.0pre7
author | bears |
---|---|
date | Mon, 14 Aug 2000 20:49:56 +0100 |
parents | 3c71e28c8eef |
children | 1c7303c71f66 |
comparison
equal
deleted
inserted
replaced
131:3598fc9581c1 | 132:a740dac296bc |
---|---|
8 not as server. If noffle runs as server, locking is performed while | 8 not as server. If noffle runs as server, locking is performed while |
9 executing NNTP commands, but temporarily released if no new command is | 9 executing NNTP commands, but temporarily released if no new command is |
10 received for some seconds (to allow multiple clients connect at the same | 10 received for some seconds (to allow multiple clients connect at the same |
11 time). | 11 time). |
12 | 12 |
13 $Id: noffle.c 183 2000-07-25 12:14:54Z bears $ | 13 $Id: noffle.c 197 2000-08-14 19:49:56Z bears $ |
14 */ | 14 */ |
15 | 15 |
16 #if HAVE_CONFIG_H | 16 #if HAVE_CONFIG_H |
17 #include <config.h> | 17 #include <config.h> |
18 #endif | 18 #endif |
45 #include "server.h" | 45 #include "server.h" |
46 #include "request.h" | 46 #include "request.h" |
47 #include "lock.h" | 47 #include "lock.h" |
48 #include "portable.h" | 48 #include "portable.h" |
49 | 49 |
50 static void | |
51 doUnsubscribe( const char *name ); | |
52 | |
53 struct Noffle | 50 struct Noffle |
54 { | 51 { |
55 Bool queryGrps; | 52 Bool queryGrps; |
56 Bool queryDsc; | 53 Bool queryDsc; |
57 Bool queryTimes; | 54 Bool queryTimes; |
244 autoUnsubscribeDays = Cfg_autoUnsubscribeDays(); | 241 autoUnsubscribeDays = Cfg_autoUnsubscribeDays(); |
245 maxAge = Cfg_autoUnsubscribeDays() * 24 * 3600; | 242 maxAge = Cfg_autoUnsubscribeDays() * 24 * 3600; |
246 if ( ! Cont_firstGrp( grp ) ) | 243 if ( ! Cont_firstGrp( grp ) ) |
247 return; | 244 return; |
248 Log_inf( "Expiring overviews not in database" ); | 245 Log_inf( "Expiring overviews not in database" ); |
246 Fetchlist_read(); | |
249 do | 247 do |
250 { | 248 { |
251 if ( ! Grp_exists( grp ) ) | 249 if ( ! Grp_exists( grp ) ) |
252 Log_err( "Overview file for unknown group %s exists", grp ); | 250 Log_err( "Overview file for unknown group %s exists", grp ); |
253 else | 251 else |
265 } | 263 } |
266 else | 264 else |
267 ++cntLeft; | 265 ++cntLeft; |
268 } | 266 } |
269 if ( ! Grp_local( grp ) | 267 if ( ! Grp_local( grp ) |
270 && autoUnsubscribe | 268 && Fetchlist_contains( grp ) |
269 && autoUnsubscribe | |
271 && difftime( now, Grp_lastAccess( grp ) ) > maxAge ) | 270 && difftime( now, Grp_lastAccess( grp ) ) > maxAge ) |
272 { | 271 { |
273 Log_ntc( "Auto-unsubscribing from %s after %d " | 272 Log_ntc( "Auto-unsubscribing from %s after %d " |
274 "days without access", | 273 "days without access", |
275 grp, autoUnsubscribeDays ); | 274 grp, autoUnsubscribeDays ); |
276 Pseudo_autoUnsubscribed( grp, autoUnsubscribeDays ); | 275 Pseudo_autoUnsubscribed( grp, autoUnsubscribeDays ); |
277 doUnsubscribe( grp ); | 276 Fetchlist_remove( grp ); |
277 Grp_setRmtNext( grp, GRP_RMT_NEXT_NOT_SUBSCRIBED ); | |
278 } | 278 } |
279 Cont_write(); | 279 Cont_write(); |
280 Grp_setFirstLast( grp, Cont_first(), Cont_last() ); | 280 Grp_setFirstLast( grp, Cont_first(), Cont_last() ); |
281 Log_inf( "%ld overviews deleted from group %s, %ld left (%ld-%ld)", | 281 Log_inf( "%ld overviews deleted from group %s, %ld left (%ld-%ld)", |
282 cntDel, grp, cntLeft, Grp_first( grp ), Grp_last( grp ) ); | 282 cntDel, grp, cntLeft, Grp_first( grp ), Grp_last( grp ) ); |
283 } | 283 } |
284 } | 284 } |
285 while ( Cont_nextGrp( grp ) ); | 285 while ( Cont_nextGrp( grp ) ); |
286 Fetchlist_write(); | |
286 } | 287 } |
287 | 288 |
288 static void | 289 static void |
289 doExpire( void ) | 290 doExpire( void ) |
290 { | 291 { |