Metropoli BBS
VIEWER: nntptransfer MODE: TEXT (ASCII)
.KEY HOST,GROUPS/K,HISTORY/K,STAMP/K,KILL/K,TO/K,PANIC/K,BATCH/K/N,BLIP/K/N,TRACE/K,AUTONEWS/K
;*
;*   Sample script to invoke nntp client and add news to uucp Newsbase
;*
;*  Mandatory parameter of name of news server; all other parameters have
;*  reasonable defaults (assuming you have a uulib:NewsGroups file).
;*
.def HOST $newsserver
.def GROUPS "UULIB:NewsGroups"      ;file containing list of groups
.def HISTORY "AmiTCP:db/NewsHistory"   ;file containing news history
.def STAMP "AmiTCP:db/NewsStamp" ;file containing date news last retrieved
.def KILL "AmiTCP:db/nntpKillFile"  ;file containing kill instructions
.def BLIP 5            ;frequency of display of blipmsg
.def TO "uuspool:NewsBatch"      ;file to contain batched news
.def PANIC 150000       ;maximum size of pending news in T:
.def BATCH 4           ;maximum number of requests batched to server
.def TRACE 3            ;amount of information displayed
.BRA {
.KET }

changetaskpri 2 ; set task priority for quicker news download;
if NOT EXISTS {Groups}        ;Check we have a Groups file
   echo "You must set up a '{Groups}' file, or give the name"
   echo "of another file containing the news groups you want"
   quit 10
endif
echo "Newsserver: "{host}
echo "Pulling News..."
echo >t:nntpclient-Commands "NEWGROUPS t:nntp-NewGroups*NNEWNEWS {Groups} {to}"

failat 11            ;nntpclient has done something at error level 10
nntpclient <t:nntpclient-Commands {host} COMPLEX BATCH {batch} BLIP {blip} BLIPMSG "NNTP: %5ld articles received" HISTORYFILE {history} STAMPFILE {stamp} TRACE {trace}
failat 10            ;back to default
delete t:nntpclient-Commands QUIET  ;don't want command file now
echo "News Dowloaded"
if {autodown} eq "YES"
  amiconnect down
endif
if exists t:nntp-NewGroups    ;Got any new groups ?
   echo "{host} has the following new news groups:"
   echo
   type t:nntp-NewGroups >> uulib:NewNewsGroups   ; Show new groups
   type t:nntp-Newgroups
   echo "Newgroup list appended to uulib:newnewsgroups"
endif
if exists {to}
   failat 30         ;don't worry if we can't find GetPriority
   getpriority >nil:    ;preserve the current priority in a local variable
   failat 20         ;back to default
   changetaskpri -4     ;postprocessing is a background task
   rnews {to}
   failat 10            ; because
   ; delete {to} quiet    ;get rid of the postprocessed file
   get >nil: Priority      ;check that Priority local var. was set
   if not WARN
     changetaskpri $Priority ;re-instate the saved priority
   endif
else
   echo "Sorry, no news transferred"
endif
[ RETURN TO DIRECTORY ]