/*
------------------------------------------------------------------------
                 Oves SommarHus BBS +46-(0)16-146837 
  $VER: Start.Rexx 1.02 (27-06-96) Snille Of LoserKlubben.inc
------------------------------------------------------------------------

Description:  Let the Sysop have FAVORITE file(s) that users can
              download. (Personaly I had a picture of my girlfrend :-)

Requirements: CNet 3.05 
              The GiveUser command in C:

Install:      Just input this line where ever you want in your bbsmenu
              GIrl      `0-|#0PFiles:Utilities/SysopFavorite.Rexx}


Mail me at:   E-Mail:
              erik.pettersson@mailbox.swipnet.se

              NetMail:
              Erik Pettersson 2:206/404.0 FidoNet
              Snille 137:466/102.0 wARPNet

------------------------------------------------------------------------
*/

options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
tr=transmit ; se=sendstring ; gc=getchar ; gu=getuser ; gs=getscratch
a='rexxsupport.library' ; if ~show('l',a) then if ~addlib(a,0,-30) then exit

/* ------------------------------- Config here ---------------------------------------- */
NOTFree=0                                   /* 0 Free DL, 1 Half credit, 2 Full credit. */

File1='GFx:SnillesPictures/SnillesGirl.Iff' /* Path and File1 to DL                     */
File2='GFx:SnillesPictures/SnillesGirl.Jpg' /* Path and File2 to DL                     */
File3='GFx:SnillesPictures/SnillesGirl.Gif' /* Path and File3 to DL                     */
File4=''                                    /* Path and File4 to DL                     */

LogFile='Favorite.Log'                      /* Name of log file that keeps track of the */
                                            /* users that uses the door.                */
LogPath='SysData:Log/'                      /* Dir to store log il in.                  */
PrgPath='PFiles:Utilities/SysopsFavorite/'  /* Dir to progrm.                           */
GiveUser='C:GiveUser'                       /* Dir and GiveUser command                 */
/* ----------------------------- Config ends here ------------------------------------- */

gu 1300072 ; Handle=Result
gu 1300093 ; Name=Result
gu 1500000 ; Time=Result
gu 1200014 ; Port=Result
gu 1200012 ; Acc=Result

Main:
sendfile PrgPath'Select.ANSI'

Select:
Query "c7 Select: " ; Val=upper(Result)
IF Val='###PANIC' then Exit
IF Val=1 then do
	If File1~='' then do
		address command ''GiveUser' 'Port' 'NOTFree' 'File1''
		signal Save1
	end
end
IF Val=2 then do
	If File2~='' then do
		address command ''GiveUser' 'Port' 'NOTFree' 'File2''
		signal Save1
	end
end
IF Val=3 then do
	If File3~='' then do
		address command ''GiveUser' 'Port' 'NOTFree' 'File3''
		signal Save1
	end
end
IF Val=4 then do
	If File4~='' then do
		address command ''GiveUser' 'Port' 'NOTFree' 'File4''
		signal Save1
	end
end
IF VAL='A' Then do
	sendfile PrgPath'About.ANSI'
	tr "n1c6 [c3Pause - Press a keyc6]" ; Getchar
	signal Main
end
tr '!1 Okey, okey it was a bad idea sorry! '

Save1:
Line='c7'Time' c3'Handle' c5('Name')c7 Selected: 'Val
If Acc=1 Then Exit
If open(1,''LogPath''LogFile'','r') Then do
	call close(1)
	Signal Save2
end
call open(1,''LogPath''LogFile'','W')
Signal Save3

Save2:
call open(1,''LogPath''LogFile'','A')

Save3:
call writeln(1,Line)
call close(1)

Exit

SYNTAX: ; ERROR: ; IOERR: ; er=rc' ('errortext(rc)') in line 'sigl
	getuser 1311992 ; a=result ; getuser 1311960 ; b=result ; c='"'a||b'"'
	er='Error Code 'er' of 'c ; transmit er ; logentry er ; bufferflush
Exit
