[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Retriving only bodies



Andrea Furin wrote:
> 
> My problem: I retrive subjects (delaybody=1 in config file); I mark some articles'bodies for
> later retriving; now: if I run fetchnews It'll download not only the body of the 
> marked articles but also new subjetcs ;-( Could this be resolved?
> Thanks in advance

Try this:

--------------------------- cut here -------------------------------
*** fetchnews.c.org	Sun Jan 14 01:02:40 2001
--- fetchnews.c	Sun May 27 10:32:50 2001
***************
*** 96,108 ****
  	longjmp( jmpbuffer, 1 );
  }
  
- #ifdef NOTYET
  static int testheaderbody( char optchar ) {
-     if ( !delaybody ) {
- 	printf( "Option -%c can only be used in conjunction with delaybody -"
- 		"ignored\n", optchar );
- 	return 0;
-     }
      if ( headerbody == 1 ) {	/* already seen -H */
  	printf( "Option -%c and -H cannot be used together - ignored\n",
  		optchar );
--- 96,102 ----
***************
*** 115,121 ****
      }
      return 1;
  }
- #endif
  
  static void usage( void ) {
     fprintf( stderr, "Usage: fetchnews [-v] [-x #] [-l] [-n] [-f] [-P]\n"
--- 109,114 ----
***************
*** 125,130 ****
--- 118,126 ----
                      "  -n: do not automatically expire unread groups\n"
  		    "  -f: force reload of groupinfo file\n"
  		    "  -P: only post outgoing articles, don't fetch any\n"
+ 		    "  -H: with delaybody=1, get only article headers\n"
+ 		    "  -B: with delaybody=1, get only article bodies\n"
+ 		    "  -d: enables debug mode\n"
  		    );
  }
  
***************
*** 1570,1575 ****
--- 1566,1572 ----
  int main( int argc, char ** argv ) {
      int option, reply;
      volatile time_t lastrun;
+     int debugflag = 0;
  
      verbose = 0;
      usesupplement = 0;
***************
*** 1580,1586 ****
  
      myopenlog( "fetchnews" );
  
!     while ( (option=getopt( argc, argv, "Pflnvx:" )) != -1 ) {
  	if ( option == 'v' ) {
  	    verbose++;
  	} else if ( option == 'x' ) {
--- 1577,1583 ----
  
      myopenlog( "fetchnews" );
  
!     while ( (option=getopt( argc, argv, "PHBdflnvx:" )) != -1 ) {
  	if ( option == 'v' ) {
  	    verbose++;
  	} else if ( option == 'x' ) {
***************
*** 1600,1605 ****
--- 1597,1610 ----
  	    forceactive = 1;
  	} else if ( option == 'P' ) {
  	    postonly = 1;
+ 	} else if ( option == 'H') {
+ 	    if ( !testheaderbody('H') ) exit( 2 );
+ 	    headerbody = 1;
+ 	} else if ( option == 'B') {
+ 	    if ( !testheaderbody('B') ) exit( 2 );
+ 	    headerbody = 2;
+ 	} else if ( option == 'd' ) {
+ 	    debugflag = 1;
  	} else {
  	    usage();
  	    exit( 1 );
***************
*** 1630,1636 ****
  	    unlink( lockfile );
  	exit( 2 );
      }
! 
      if ( !postonly ) {
  	if ( forceactive )
  	    fakeactive();
--- 1635,1653 ----
  	    unlink( lockfile );
  	exit( 2 );
      }
!     if ( delaybody && !headerbody ) {
! 	printf( "Option -H or -B mandatory with delaybody\n" );
! 	exit( 2 );
!     }
!     if ( !delaybody  && headerbody ) {
! 	printf( "Option -H or -B can only be used in conjunction with"
! 	        " delaybody - ignored\n" );
! 	exit( 2 );
!     }
!     if ( debugflag ) {
! 	debugmode = 1;
! 	syslog( LOG_DEBUG, "debugmode forced to %d", debugmode );
!     }
      if ( !postonly ) {
  	if ( forceactive )
  	    fakeactive();
--------------------------- cut here -------------------------------

I have played with that some time ago...
Patch against leafnode-1.9.18ma4, but works also for leafnode-1.9.1x
versions.
A precision:
After retrieving the selected bodies, run applyfilter to suppress the now
unwanted articles without bodies. (undocumented)

Don't forget also to suppress the two lines:
	    g->first = 1;
	    g->last = 1;
(should be done in the next version 1.8.19...)

Good luck! - Bonne chance!
Bye - Salut.

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list