comparison src/post.c @ 152:ca9769519c96 noffle

[svn] * src/post.c: When posting to a non-local moderated group, only post to one server. Don't want multiple upstream servers each mailing the moderator. Non-moderated groups post to all servers groups in the article are fetched from - otherwise can't be sure an article cross-posted to a netwide group and a restricted one obtained from a just one server will propagate properly.
author bears
date Thu, 26 Oct 2000 22:55:49 +0100
parents 1c7303c71f66
children 945501c95a4e
comparison
equal deleted inserted replaced
151:cb799054bd61 152:ca9769519c96
1 /* 1 /*
2 post.c 2 post.c
3 3
4 $Id: post.c 227 2000-10-26 21:21:13Z bears $ 4 $Id: post.c 229 2000-10-26 21:55:49Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
420 static Bool 420 static Bool
421 postExternal( void ) 421 postExternal( void )
422 { 422 {
423 const char * grp; 423 const char * grp;
424 Str serversSeen; 424 Str serversSeen;
425 Bool err; 425 Bool err, modPosted;
426 426
427 /* 427 /*
428 * For each external group, send to that group's server if it has 428 * For each external group, send to that group's server if it has
429 * not seen the post already. 429 * not seen the post already.
430 */ 430 */
431 serversSeen[ 0 ] = '\0'; 431 serversSeen[ 0 ] = '\0';
432 err = FALSE; 432 err = modPosted = FALSE;
433 433
434 for ( grp = Itl_first( article.newsgroups ); 434 for ( grp = Itl_first( article.newsgroups );
435 grp != NULL; 435 grp != NULL;
436 grp = Itl_next( article.newsgroups ) ) 436 grp = Itl_next( article.newsgroups ) )
437 { 437 {
438 if ( Grp_exists( grp ) && ! Grp_local( grp ) ) 438 if ( Grp_exists( grp ) && ! Grp_local( grp ) )
439 { 439 {
440 const char * servName = Grp_server( grp ); 440 const char * servName = Grp_server( grp );
441 Bool moderated = ( Grp_postAllow( grp ) == 'm' );
441 442
442 if ( strstr( serversSeen, servName ) != NULL ) 443 if ( strstr( serversSeen, servName ) != NULL )
444 continue;
445
446 if ( moderated && modPosted )
443 continue; 447 continue;
444 448
445 if ( ! Out_add( servName, article.over.msgId, article.text ) ) 449 if ( ! Out_add( servName, article.over.msgId, article.text ) )
446 { 450 {
447 Log_err( "Cannot add posted article to outgoing directory" ); 451 Log_err( "Cannot add posted article to outgoing directory" );
448 err = TRUE; 452 err = TRUE;
449 } 453 }
454 /*
455 * If moderated group, send to one server only. Don't want to
456 * mailbomb the moderator.
457 */
458 else if ( moderated )
459 modPosted = TRUE;
460
450 Utl_catStr( serversSeen, " " ); 461 Utl_catStr( serversSeen, " " );
451 Utl_catStr( serversSeen, servName ); 462 Utl_catStr( serversSeen, servName );
452 } 463 }
453 } 464 }
454 465