;*
;*   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).
;*

if NOT EXISTS UULIB:NewsGroups        ;Check we have a Groups file
   echo "You must set up a 'UULIB:NewsGroups' file, or give the name"
   echo "of another file containing the news groups you want"
   quit 10
endif

if NOT news.demon.co.uk eq localhost
   if NOT news.demon.co.uk eq $HostName
      if NOT news.demon.co.uk eq $NodeName
         if NOT $Slip0State eq Online
            echo "NNTPTransfer: Not connected."
            quit 10
            endif
         endif
      endif
   endif
endif

echo "Pulling News..."
copy amitcp:db/NewsStamp amitcp:db/NewsStamp.bak
echo >t:nntpclient-Commands "NEWGROUPS t:nntp-NewGroups*NNEWNEWS UULIB:NewsGroups uuspool:NewsBatch"

failat 11            ;nntpclient has done something at error level 10
nntpclient <t:nntpclient-Commands news.demon.co.uk COMPLEX BATCH 9 BLIP 10 BLIPMSG "NNTP: %5ld articles received" HISTORYFILE AmiTCP:db/NewsHistory STAMPFILE AmiTCP:db/NewsStamp TRACE 3
;type t:nntpclient-Commands      ;diagnostic - commented out
failat 10            ;back to default
delete t:nntpclient-Commands QUIET  ;don't want command file now
copy uuspool:NewsBatch usr:spool
delete ram:spool/NewsBatch

if exists t:nntp-NewGroups    ;Got any new groups ?
   echo "news.demon.co.uk has the following new news groups:"
   echo
   type t:nntp-NewGroups      ; Show new groups
   delete t:nntp-NewGroups quiet ; and get rid of the file
endif
