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

Re: [leafnode-list] Fetchnews: maxnews will not accept value



Matthias Andree wrote:
> 
> <snip>
> Beware however, if you set maxfetch to say 1,000, you're getting the
> 1,000 most recent articles.

We can easily break this restriction.

I use this code to get e.g. the 1,000 articles beginning at _the first_
available.
I have only to set "initialfetch" and/or "maxfetch" negative in the config
file.

-------------------------------------------------------------------------------------
    if ( initiallimit && server == 1 ) {
      server = window;	/* available articles... */
      if ( last-server > abs(initiallimit) ) {
        if (initiallimit > 0) {
	  if ( verbose > 1 )
	    printf( "skipping articles %d-%d inclusive (initial limit)\n", 
		    server, last-initiallimit );
	  syslog( LOG_INFO, "skipping articles %d-%d inclusive (initial limit)",
		server, last-initiallimit );
	  server = last-initiallimit+1;
        } else {
	  if ( verbose > 1 )
	    printf( "fetch only articles %d-%d inclusive (last article=%d)\n", 
		server, server+abs(initiallimit)-1, last );
	  syslog( LOG_INFO, 
	        "fetch only articles %d-%d inclusive (last article=%d)\n",
		server, server+abs(initiallimit)-1, last );
	  last = server + abs(initiallimit) - 1;
        }
      }
    }

    if ( server != 1 && window > server ) {
	syslog( LOG_INFO,
	        "articles %d-%d no more available!\n", server, window-1 );
	if ( verbose > 1 ) {
	  printf("articles %d-%d no more available!\n", server, window-1 );

        }
        server = window;	/* available articles... */
    }

    if ( artlimit && last-server > abs(artlimit) ) {
      if (artlimit > 0) {
	if ( verbose > 1 )
	    printf( "skipping articles %d-%d inclusive (article limit)\n",
		    server, last-artlimit-1 );
	syslog( LOG_INFO, "skipping articles %d-%d inclusive (article limit)",
		server, last-artlimit-1 );
	server = last-artlimit;
      } else {
	if ( verbose > 1 )
	    printf( "fetch only articles %d-%d inclusive (last article=%d)\n",
		server, server+abs(artlimit)-1, last );
	syslog( LOG_INFO, 
	        "fetch only articles %d-%d inclusive (last article=%d)\n",
		server, server+abs(artlimit)-1, last );
	last = server + abs(artlimit) - 1;
      }
    }
-------------------------------------------------------------------------------------

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