/* SendFile.rexx by Matt English & John Ruckart 9-20-92 version 1.2 alterations by Richard Lee Stockton, 2 Aug 93 version 1.2a 16 Sep 93 version 1.2b This is a utility for BBBBS sysops. This will allow you to send emailfiles to any BBS user quickly and without having to load-up BBSlocal. You can even send emailfiles to someone who is on line at the time. Very easy to use. This is freely distributable as long as no-one makes any money on it, this notice remains, and the credits at the main menu remain. If you find a bug, or have an idea for additional features, please give me a call at The Alternative BBS, 503-761-3043. Matt English. ******* Thanks to John Ruckart for help & bug testing! ************/ IF ~SHOW('P','QuickSortPort') THEN CALL setup.rexx() IF ~SHOW('P','QuickSortPort') THEN EXIT 666 figarg='s:CONFIG.BBS' IF ~EXISTS(figarg) THEN figarg='BBS:BBS_TEXT/CONFIG.BBS' x=OPEN(f,figarg,'R') IF x=0 THEN DO SAY 's:CONFIG.BBS and BBS:BBS/CONFIG.BBS are both missing!' CALL GETOUT(21) END lynes.='' DO i=1 TO 33 lynes.i=READLN(f) END CALL CLOSE(f) compos=POS('/*',lynes.1) IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1) bbsname=STRIP(lynes.1) sysopname=WORD(lynes.2,1) bbsdevice=word(lynes.4,1) bbspath=WORD(lynes.6,1) IF ~EXISTS(bbspath) THEN DO SAY bbspath 'does not exist!' CALL SETCLIP('BBS_ALPHA') CALL GETOUT(22) END testchar=RIGHT(bbspath,1) IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/' cushion=word(lynes.12,1) pen1 = '' pen2 = '' pen3 = '' def = '' start: say' 'pen3' SendFile ' say' 'pen3' Version 1.2b 16 Sep 93' say' 'pen2' by Matt English 'def'' say Options prompt' Who would you like to send a file to? 'pen3'(Q=Quit)'def' > ' pull sendname sendname = strip(upper(sendname)) sendname = translate(sendname,'_',' ') if sendname = '' then call start if sendname = 'Q' then exit say' Searching for 'pen3''sendname''def'...' call open(names,bbspath'lists/users','r') foundhim = 0 do until foundhim = 1 nameline = readln(names) do i = 1 to 3 user = strip(word(nameline,i)) if user = '' then do say say' I can''t find 'pen3''sendname''def' on the BBS list!' options prompt' Would you like to view the user list? (Y,n) > ' pull view say call seek(names,0,'b') if view = 'N' then do call close(names) call start end stop = 0 j = 0 do until stop = 1 j = j + 1 sayline = strip(readln(names)) if sayline ~= '' then say' 'sayline'' if j // 16 = 0 | sayline = '' then do say options prompt' Return = continue Q = Quit > ' pull cont say if cont = 'Q' then do call close(names) call start end end if eof(names) then do call close(names) call start end end end if user = sendname then do call close(names) foundhim = 1 end end end if foundhim = 0 then do say say' I can''t find 'pen3''sendname''def' on the BBS list!' options prompt' Would you like to view the user list? (Y,n) > ' pull view say if view = 'N' then do call close(names) call start end call seek(names,0,'b') stop = 0 j = 0 do until stop = 1 j = j + 1 sayline = strip(readln(names)) if sayline ~= '' then say' 'sayline'' if j // 16 = 0 | sayline = '' then do say options prompt' Return = continue Q = Quit > ' pull cont say if cont = 'Q' then do call close(names) call start end end if eof(names) then do call close(names) call start end end end say' 'sendname' has been located...' say say' Please select a file to send...' say frompath=GETCLIP('BBS_frompath') fullfile=GetFile(150,36,frompath,'',' Select File to Send ') IF fullfile='' THEN SIGNAL start x=POS('/',fullfile) IF x=0 THEN x=POS(':',fullfile) IF x>0 THEN DO sendfile=SUBSTR(fullfile,x+1) frompath=LEFT(fullfile,x) IF RIGHT(frompath,1)='/' THEN frompath=LEFT(frompath,x-1) CALL SETCLIP('BBS_frompath',frompath) END ELSE sendfile=fullfile address command'c:info 'bbsdevice' > Ram:is_disk_in' /* Check to see if a disk is in df0: */ call open(disktest,'Ram:is_disk_in','r') do 3 r = readln(disktest) end infoline = readln(disktest) call close(disktest) blocksfree = word(infoline,4) bytesfree = (blocksfree * 512) - cushion say' There are 'pen3''bytesfree''def' bytes available for UpLoading...' say if exists(fullfile) then address command'c:list 'fullfile' nohead > Ram:fileinfo' /* Check to see if a disk is in df0: */ else do say' 'pen3'I can''t find that file... Hmmm....' say' 'pen2'SENDFILE canceled..' call delay(50) call start end if RC > 10 then call start call open(bytetest,'Ram:fileinfo','r') infoline = readln(bytetest) call close(bytetest) bytes = word(infoline,2) say' The file is 'bytes' bytes!' if bytes > bytesfree then do say say' Sorry, there''s not enough room for that file on your BBS device!' say' 'pen3'SENDFILE has been canceled!'def'' call delay(50) say end say /* Check to see if emailfile dir exists for this user */ emdirs = showdir(bbspath'emailfiles','d') gotdir = 0 e = 0 do until gotdir = 1 e = e + 1 if sendname = word(emdirs,e) then gotdir = 1 if e = words(emdirs) & gotdir = 0 then do makedir(bbspath'emailfiles/'sendname) gotdir = 1 end end address command'c:copy 'fullfile' 'bbspath'emailfiles/'sendname'' checkit = showdir(bbspath'emailfiles/'sendname,'f') itsok = '' do c = 1 to words(checkit) inthere = word(checkit,c) if upper(inthere) = upper(sendfile) then itsok = 1 end if itsok = '' then do say say' There was a problem with the file copy.. Email 'pen3'NOT'def' sent.' call pressreturn call start end call open(last,bbspath'Numbers/LastMail','r') enum = readln(last) + 1 call close(last) call open(last,bbspath'Numbers/LastMail','w') call writeln(last,enum) call close(last) thedate = date() thetime = time('c') call open(note,bbspath'email/'sendname'/'sysopname'.'enum,'w') call writeln(note,'Mail: 'enum' File: 'sendfile) call writeln(note,'From: 'sysopname) call writeln(note,' To: 'sendname) call writeln(note,'Subj: File Request') call writeln(note,'Date: 'thedate' 'thetime) call writeln(note,'====================================================================') call writeln(note,' Here is the file that you requested!') call writeln(note,' - SysOp -') call writeln(note,' ') /* THE FOLLOWING CODE WAS ADDED TO ALLOW SYSOPS TO ADD TEXT TO MESSAGE */ options Prompt 'Do you wish to add to the message? (Ny) > ' pull answer addone = 0 if answer = 'Y' then do say' Hit return at the end of each line, blank line to end' do until addone = 1 say options Prompt '> ' parse pull line if line ~='' then call writeln(note,line) else addone = 1 end end /* END OF ADDED CODE */ call close(note) say say' The file has been sent, with a note attached!' say call alertuser call delay(50) call start pressreturn: options prompt' 'pen3'Press return to continue'def'' pull response say return alertuser: If GETCLIP('BBS_level')~='' & WORD(GETCLIP('BBS_lastcaller'),1)=sendname THEN CALL SETCLIP('BBS_MESSAGE','You have a file in Email waiting for you.') RETURN