set newsgroup test

echo "Connecting to NNTP server... "
nntpstart
exitcode != 0 echo "$bred$NNTP error. Sorry." getkey tmp menu /osbbs/menus/test
echo "ready.\n\n"

datefmt = "M d y" set datedesc "(M/D/Y)"
datefmt = "d M y" set datedesc "(D/M/Y)"

[Redraw]
echo "\c$grey$NEWS MENU\n"
echo "---------\n"
echo "S: Change server (Current is $nntpserver$)\n"
echo "G: Change newsgroup (Current is $newsgroup$)\n"
echo "P: Post article\n"
echo "A: Read all messages\n"
echo "N: Read new messages\n"
echo "X: Exit\n\n"

select key "psnagx "

key = " " jump Redraw
key = "a" jump ReadAll
key = "n" jump ReadNew
key = "x" nntpstop menu /osbbs/menus/test
key = "g" jump Group
key = "s" jump Server
key = "p" jump Post

[Group]
echo "$grey$Enter new group:$yellow$ "
getstring tmp 40 echo "\n"
tmp != "empty" set newsgroup tmp
jump Redraw

[ReadAll]
set newsdate 0
jump tmp

[ReadNew]
echo "$grey$Read news after $datedesc$:$yellow$ " 
getstring tmp 10 echo "\n"
getdate newsdate tmp
exitcode = 1 echo "$bred$Invalid date.$grey$ Try again ;-)\n\n" jump ReadNew
[tmp]
readnewnews
exitcode = 4 echo "$grey$No news.\n"
exitcode = 2 echo "$bred$Group $newsgroup$ doesn't exist.\n" 
exitcode = 1 echo "$bred$Error.\n"
exitcode != 0 getkey tmp
jump Redraw

[Server]
echo "$grey$Enter new server: $yellow$"
getstring tmp 80
tmp = "empty" jump Redraw
nntpstop
set nntpserver tmp
nntpstart
exitcode != 0 echo "$bred$ERROR!" set nntpserver "localhost" getkey tmp menu menus/test
jump Redraw

[Post]
echo "$grey$Subject: $yellow$"
getstring subject 40
subject = "empty" jump Redraw
post
exitcode = 1 echo "$bred$Error.\n"
exitcode = 2 echo "$bred$Posting is not allowed on this server.\n"
exitcode = 3 echo "$bred$Group $newsgroup$ doesn't exist.\n"
exitcode != 0 getkey tmp 
jump Redraw
