comparison src/noffle.c @ 191:28488e0e3630 noffle

[svn] * src/group.h,src/group.c,src/noffle.c,src/server.c: Grp_setLastAccess is only ever called with last param as time(NULL), so remove it and call time() inside the implementation of Grp_setLastAccess. * src/client.c,src/group.h,src/group.c,src/noffle.c,src/post.c: Groups are automatically unsubscribed when the last access to the group is older than a particular threshold. However, for very low traffic groups, the last access may exceed the threshold simply because there has been no new article posted. In this case, rather than unsubscribe, update the group last access time. This means that groups are now only unsubscribed if the last access exceeds the threshold AND articles have arrived in the group since. Add Grp_setLastPostTime() to track the last time an article arrived in the group.
author bears
date Sat, 20 Oct 2001 14:23:46 +0100
parents f1bacee93ca6
children b9ef99708d1c
comparison
equal deleted inserted replaced
190:47569cf4ad4a 191:28488e0e3630
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 307 2001-09-12 20:33:44Z bears $ 13 $Id: noffle.c 310 2001-10-20 13:23:46Z 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
270 if ( ! Grp_local( grp ) 270 if ( ! Grp_local( grp )
271 && Fetchlist_contains( grp ) 271 && Fetchlist_contains( grp )
272 && autoUnsubscribe 272 && autoUnsubscribe
273 && difftime( now, Grp_lastAccess( grp ) ) > maxAge ) 273 && difftime( now, Grp_lastAccess( grp ) ) > maxAge )
274 { 274 {
275 Log_ntc( "Auto-unsubscribing from %s after %d " 275 /* If there have been recent posts, unsubscribe. */
276 "days without access", 276 if ( difftime( now, Grp_lastPostTime( grp ) ) <= maxAge )
277 grp, autoUnsubscribeDays ); 277 {
278 Pseudo_autoUnsubscribed( grp, autoUnsubscribeDays ); 278 Log_ntc( "Auto-unsubscribing from %s after %d "
279 Fetchlist_remove( grp ); 279 "days without access",
280 Grp_setRmtNext( grp, GRP_RMT_NEXT_NOT_SUBSCRIBED ); 280 grp, autoUnsubscribeDays );
281 Pseudo_autoUnsubscribed( grp, autoUnsubscribeDays );
282 Fetchlist_remove( grp );
283 Grp_setRmtNext( grp, GRP_RMT_NEXT_NOT_SUBSCRIBED );
284 }
285 else
286 {
287 /*
288 * Otherwise if no recent posts touch the access.
289 * This way we don't unsubscribe to low volume groups
290 * unread only because there are no recent posts.
291 */
292 Grp_setLastAccess( grp );
293 }
281 } 294 }
282 Cont_write(); 295 Cont_write();
283 Grp_setFirstLast( grp, Cont_first(), Cont_last() ); 296 Grp_setFirstLast( grp, Cont_first(), Cont_last() );
284 Log_inf( "%ld overviews deleted from group %s, %ld left (%ld-%ld)", 297 Log_inf( "%ld overviews deleted from group %s, %ld left (%ld-%ld)",
285 cntDel, grp, cntLeft, Grp_first( grp ), Grp_last( grp ) ); 298 cntDel, grp, cntLeft, Grp_first( grp ), Grp_last( grp ) );
502 printf( "%s is already in fetch list. Mode is now: %s.\n", 515 printf( "%s is already in fetch list. Mode is now: %s.\n",
503 name, mode == FULL ? "full" : mode == THREAD ? 516 name, mode == FULL ? "full" : mode == THREAD ?
504 "thread" : "overview" ); 517 "thread" : "overview" );
505 if ( ! Fetchlist_write() ) 518 if ( ! Fetchlist_write() )
506 fprintf( stderr, "Could not save fetchlist.\n" ); 519 fprintf( stderr, "Could not save fetchlist.\n" );
507 Grp_setLastAccess( name, time( NULL ) ); 520 Grp_setLastAccess( name );
508 return TRUE; 521 return TRUE;
509 } 522 }
510 523
511 static void 524 static void
512 doUnsubscribe( const char *name ) 525 doUnsubscribe( const char *name )