home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
WINDOWS
/
DATACOM
/
RFDML112
/
GENIE.SCR
< prev
next >
Wrap
Text File
|
1993-11-16
|
8KB
|
314 lines
;------------------------------------------------------
;
;GENIE.SCR --- The script file for GENIE
;
;------------------------------------------------------
;
; We begin with the format specifiers to which allow
;the script to identify where the MailId, RealName,
;and Subject texts are in a newly downloaded letter.
;
Format
Sub: $SUBJECT$\n
From: $UID$ $NAME$\n
Endformat
;
;------------------------------------------------------
; The following aliases define some of the standard
; GEnie prompts:
;
Alias prompt 'Enter #, <H>elp, or <CR> to continue?'
Alias mainprompt 'Enter #, <P>revious, or <H>elp?'
Alias mailprompt '\nCommand?'
;
;------------------------------------------------------
; This is the main entry point into the script. It
; merely waits 2 seconds before sending HHH to allow
; the connection to settle.
;
Begin START
Caption 'connected'
Timeout 2 Goto CONNECT
End
;------------------------------------------------------
; These states deal with logging in, by sending the
; 'hhh' announcement, followed by the username and
; password.
;
Begin CONNECT
Transmit 'hhh'
When 'U#=' Goto USERNAME
Timeout 10 Goto CONNECT1
End
Begin CONNECT1
Transmit 'hhh'
When 'U#=' Goto USERNAME
Timeout 10 Goto USERNAME
End
Begin USERNAME
Transmit $USERNAME
Transmit ','
Transmit $PASSWORD
Transmit ',200:9'
Cr
When 'GEnie Logon' Goto LOGGED_IN
When 'REENTER U# ' Goto INVALID_LOGIN
Timeout 20 Goto NO_LOGIN
End
Begin INVALID_LOGIN
Transmit $USERNAME
Transmit ','
Transmit $PASSWORD
Transmit ',200:9'
Cr
When 'GEnie Logon' Goto LOGGED_IN
When 'REENTER U# ' Goto NO_LOGIN
Timeout 20 Goto NO_LOGIN
End
;------------------------------------------------------
; These states run once we are logged in. They watch
; the banners for signs of mail. If there is mail,
; we run the fetch states, if not, we go into mail
; and run the send states if we have mail to send.
;
Begin LOGGED_IN
Caption 'logged in'
When 'No letters waiting' Goto NO_MAIL
When %prompt% Goto GOTO_MAIL
Timeout 90 Goto NO_LOGIN
End
Begin GOTO_MAIL
Caption 'You Have Mail'
Transmit 'm 200:9'
Cr
When %mailprompt% Goto CHECK_INCOMING
When %prompt% Goto GOTO_MAIL
Timeout 45 Goto NO_LOGIN
End
Begin NO_MAIL
Caption 'No Mail'
When %prompt% Goto NO_MAIL_PROMPT
Timeout 90 Goto NO_LOGIN
End
Begin NO_MAIL_PROMPT
If MORE_LETTERS Then JUMP_TO_SEND
Timeout 1 Goto LOG_OFF
End
Begin JUMP_TO_SEND
Transmit 'm 200:9'
Cr
When %mailprompt% Goto 1ST_REQUEST_CREATE
When %prompt% Goto JUMP_TO_SEND
Timeout 45 Goto GIVE_UP
End
Begin CHECK_INCOMING
If FETCHING Then CHECK_MAIL
If MORE_LETTERS Then 1ST_REQUEST_CREATE
Timeout 1 Goto EXIT_MAIL
End
;------------------------------------------------------
; These states run for each letter that is to be
; downloaded. They merely send a "list" command
; for each queue index until GEnie complains that
; we've exceeded the highest index.
;
Begin CHECK_MAIL
Transmit 'display'
Cr
When 'No letters found' Goto NO_MAIL_DISPLAY
When 'Queue# Item From' Goto HAVE_MAIL
Timeout 30 Goto GIVE_UP
End
Begin NO_MAIL_DISPLAY
Caption 'No Mail'
If MORE_LETTERS Then SEND_MAIL
When %mailprompt% Goto EXIT_MAIL
Timeout 30 Goto GIVE_UP
End
Begin HAVE_MAIL
Caption 'You Have Mail'
ClearIndex
NextIndex
When %mailprompt% Goto FETCH_MAIL
Timeout 30 Goto GIVE_UP
End
Begin FETCH_MAIL
Caption 'Fetching Mail'
Transmit 'list '
Transmit $INDEX
Cr
When 'Item' Goto DOWNLD_LETTER
When 'exceeds last' Goto NO_MORE_MAIL
When %mailprompt% Goto FETCH_MAIL
Timeout 30 Goto GIVE_UP
End
Begin DOWNLD_LETTER
Download ASCII '=END=' Then DOWNLD_SUCCESS Else GIVE_UP
End
Begin DOWNLD_SUCCESS
Caption 'Letter Received'
Confirm LETTER.RECEIVED Successful
NextIndex
Transmit 'list '
Transmit $INDEX
Cr
When 'Item' Goto DOWNLD_LETTER
When 'exceeds last' Goto NO_MORE_MAIL
Timeout 30 Goto GIVE_UP
End
Begin NO_MORE_MAIL
Caption 'Fetched Mail'
If MORE_LETTERS Then SEND_MAIL
When %mailprompt% Goto EXIT_MAIL
Timeout 30 Goto GIVE_UP
End
;------------------------------------------------------
; These states run for each letter that is to be sent.
; First a letter is created, addressed, and subject line
; specified. Then an ASCII upload is done, and the
; BREAK character (Control-C) is sent. GEnie should
; respond with "##>", whereupon we send "*S" to terminate
; the letter.
;
Begin SEND_MAIL
Caption 'Sending Mail'
NewLetter
When %mailprompt% Goto REQUEST_CREATE
Timeout 30 Goto GIVE_UP
End
Begin 1ST_REQUEST_CREATE
Caption 'Sending Mail'
NewLetter
Transmit 'accept'
Cr
When 'To:' Goto TRANSMIT_DEST
Timeout 15 Goto GIVE_UP
End
Begin REQUEST_CREATE
Transmit 'accept'
Cr
When 'To:' Goto TRANSMIT_DEST
Timeout 15 Goto GIVE_UP
End
Begin TRANSMIT_DEST
Transmit $LETTER.DEST.USERNAME
Cr
When 'ignored - not found' Goto ABORT_SEND
When 'CC:' Goto DO_CC
When 'cc:' Goto DO_CC
When 'Carbon Copy:' Goto DO_CC
Timeout 15 Goto GIVE_UP
End
Begin DO_CC
If LETTER.CC Then TRANSMIT_CC
Cr
When 'Sub:' Goto SEND_SUBJECT
End
Begin TRANSMIT_CC
CreateCC 0 0 Delimiter ','
Transmit $LETTER.CC
Cr
When 'CC:' Goto DO_CC
When 'cc:' Goto DO_CC
When 'Carbon Copy:' Goto DO_CC
When 'Sub:' Goto SEND_SUBJECT
When 'ignored - not found' Goto ABORT_SEND
Timeout 15 Goto GIVE_UP
End
Begin SEND_SUBJECT
Transmit $LETTER.SUBJECT
Cr
When 'READY FOR INPUT' Goto UPLOAD_LETTER
When 'Subject:' Goto SEND_SUBJECT
Timeout 30 Goto GIVE_UP
End
Begin UPLOAD_LETTER
Caption 'Uploading Letter'
Upload ASCII Then UPLD_SUCCESS Else UPLD_FAILURE
End
Begin UPLD_FAILURE
Confirm LETTER.SENT Unsuccessful
Timeout 1 Goto GIVE_UP
End
Begin UPLD_SUCCESS
Timeout 2 Goto UPLD_SUCCESS1
End
Begin UPLD_SUCCESS1
Control C
When '>' Goto FINISH_SEND
Timeout 10 Goto UPLD_SUCCESS2
End
Begin UPLD_SUCCESS2
Control C
When '>' Goto FINISH_SEND
Timeout 20 Goto UPLD_FAILURE
End
Begin FINISH_SEND
Transmit '*S'
Cr
When 'Created' Goto LETTER_SENT
When '>' Goto FINISH_SEND
Timeout 30 Goto GIVE_UP
End
Begin LETTER_SENT
Caption 'Letter Sent'
Confirm LETTER.SENT Successful
If MORE_LETTERS Then SEND_MAIL
When %mailprompt% Goto EXIT_MAIL
Timeout 30 Goto GIVE_UP
End
Begin ABORT_SEND
Caption 'Bad Address'
Control C
Confirm LETTER.SENT Unsuccessful
If MORE_LETTERS Then SEND_MAIL
When %mailprompt% Goto EXIT_MAIL
Timeout 30 Goto GIVE_UP
End
;------------------------------------------------------
; These states deal with leaving the Mail Area and
; logging off from GEnie.
;
Begin EXIT_MAIL
Transmit 'exit'
Cr
Caption 'Leaving Mail Area'
When %mainprompt% Goto LOG_OFF
When %mailprompt% Goto EXIT_MAIL
When 'P 200?' Goto LOG_OFF
CarrierLoss Goto EXIT_PROGRAM
Timeout 20 Goto GIVE_UP
End
Begin LOG_OFF
Transmit 'bye'
Cr
Caption 'Logging off'
When 'NO CAR' Goto EXIT_PROGRAM
When %mainprompt% Goto LOG_OFF
When 'P 200?' Goto LOG_OFF
CarrierLoss Goto EXIT_PROGRAM
Timeout 20 Goto HANGUP_PHONE
End
Begin EXIT_PROGRAM
Caption 'Logged off'
CarrierLoss Goto EXIT_PROGRAM
Timeout 3 Goto BYE_BYE
End
Begin GIVE_UP
Caption 'Aborting'
Hangup
CarrierLoss Goto EXIT_PROGRAM
End
Begin HANGUP_PHONE
Hangup
CarrierLoss Goto EXIT_PROGRAM
End
Begin NO_LOGIN
Caption 'Unable to login'
Timeout 5 Goto GIVE_UP
End
Begin BYE_BYE
Exit
End