home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / WIN_UTL2 / RFDMAIL.ZIP / TDC.SCR < prev    next >
Text File  |  1994-01-19  |  14KB  |  518 lines

  1. ;------------------------------------------------------
  2. ;TDC.SCR --- The script file for TDC (dircon.co.uk)
  3. ;------------------------------------------------------
  4. ;   We begin with the format specifiers to which allow
  5. ;the script to identify where the MailId, RealName,
  6. ;and Subject texts are in a newly downloaded letter.
  7. ;
  8. Format
  9. Subject: $SUBJECT$\n
  10. Subj: $SUBJECT$\n
  11. From: "$NAME$" <$UID$>\n
  12. From: ""$NAME$"" <$UID$>\n
  13. From: $NAME$<$UID$>\n
  14. From: $UID$ ($NAME$)\n
  15. From: $UID$ \n
  16. From: $UID$\n
  17. Endformat
  18. ;------------------------------------------------------
  19. ;   Next is a set of aliases which determine various
  20. ; items such as where some of the standard commands
  21. ; like '/usr/ucb/mail' live.
  22. ;
  23. Alias shellstart 'go ksh'
  24. Alias sendmail 'mail '
  25. Alias readmail 'mail'
  26. Alias saveletter 's '
  27. Alias deleteletter 'd '
  28. Alias quitmail 'q'
  29. Alias mailnull '#'
  30. Alias mailshellesc '!'
  31. Alias rm '/bin/rm -f '
  32. Alias echo '/bin/echo '
  33. Alias cat '/bin/cat '
  34. Alias logoff 'off'
  35. ;------------------------------------------------------
  36. ; The following aliases determine the various prompts the
  37. ; script will look for.
  38. ;
  39. Alias menuprompt ' -> '
  40. Alias prompt '\n$ '
  41. Alias mailprompt '\n& '
  42. Alias subjectprompt '\nSubject: '
  43. Alias ccprompt1 'Cc:'
  44. Alias ccprompt2 'CC:'
  45. Alias ccprompt3 'cc:'
  46. Alias loginprompt 'login: '
  47. Alias passwdprompt 'assword:'
  48. Alias havemailprompt 'message'
  49. Alias nomailprompt 'No mail'
  50. ;
  51. ; If you want to append your ~/.signature file to every outgoing
  52. ; message, set the following alias to SEND_SIG, otherwise set it
  53. ; to NO_SIGNATURE:
  54. ;
  55. Alias signature NO_SIGNATURE
  56. ;
  57. ;------------------------------------------------------
  58. ; The following aliases determine what the script will look
  59. ; for to determine that we've successfully logged in
  60. ; (banner1-2), and what it will look for to determine that
  61. ; we've successfully logged out (logoffbanner1-2)
  62. ;
  63. Alias banner1 'The Direct Connection'
  64. Alias banner2 '\nLast login:'
  65. Alias logoffbanner1 %loginprompt%
  66. Alias logoffbanner2 'closed'
  67. ;------------------------------------------------------
  68. ; The following alias should be set TRUE if your modem
  69. ; drops carrier every time you make a connection.  This
  70. ; alias simply forces the script to wait 2 seconds for
  71. ; the connection to settle before starting the script.
  72. ;
  73. Alias waitasec FALSE
  74. ;
  75. ;------------------------------------------------------
  76. ; The following aliases determine the command to use for
  77. ; downloading, and the prompt the upload program will send
  78. ; when it's ready to send data.  Comment these out if
  79. ; you don't want to use ZMODEM:
  80. ;
  81. Alias sz 'sz '
  82. Alias szprompt1 '\n**'
  83. Alias dnloadproto ZMODEM
  84. ;
  85. ; Uncomment the following aliases if you want to use YMODEM
  86. ; as your download protocol:
  87. ;
  88. ;Alias sz 'sb '
  89. ;Alias szprompt1 '\nsb: 1 file'
  90. ;Alias dnloadproto YMODEM
  91. ;
  92. ; Uncomment the following aliases if you want to use XMODEM
  93. ; as your download protocol:
  94. ;
  95. ;Alias sz 'sx '
  96. ;Alias szprompt1 'command now.'
  97. ;Alias dnloadproto XMODEM
  98. ;
  99. ;------------------------------------------------------
  100. ; The following aliases determine the command to use for
  101. ; uploading, and the prompt the upload program will send
  102. ; when it's ready to receive data.  Comment these out if
  103. ; you don't want to use ZMODEM:
  104. ;
  105. Alias rz 'rz -a '
  106. Alias rzprompt1 'to your modem  '
  107. Alias rzprompt2 'ready'
  108. Alias uploadproto ZMODEM
  109. ;
  110. ; Uncomment the following aliases if you want to use YMODEM
  111. ; as your upload protocol:
  112. ;
  113. ;Alias rz 'rb -a '
  114. ;Alias rzprompt1 'to your modem'
  115. ;Alias rzprompt2 'ready'
  116. ;Alias uploadproto YMODEM
  117. ;
  118. ; Uncomment the following aliases if you want to use XMODEM
  119. ; as your upload protocol:
  120. ;
  121. ;Alias rz 'rx -ac '
  122. ;Alias rzprompt1 'to your modem'
  123. ;Alias rzprompt2 'ready to receive'
  124. ;Alias uploadproto XMODEM
  125. ;
  126. ; Uncomment the following aliases if you want to use KERMIT
  127. ; as your upload protocol:
  128. ;
  129. ;Alias rz 'kermit -e 256 -r '
  130. ;Alias rzprompt1 'READY TO RECEIVE'
  131. ;Alias rzprompt2 'ready to receive'
  132. ;Alias uploadproto KERMIT
  133. ;
  134. ;------------------------------------------------------
  135. ; This is the main entry-point for the script, which
  136. ; decides which intermediate network will be used to
  137. ; connect to the host.
  138. ;
  139. Begin START
  140.    If %waitasec% Then WAIT_START
  141.    If TRUE Then DIRECT
  142. End
  143. Begin WAIT_START
  144.    Timeout 2 Goto DIRECT
  145. End
  146. ;------------------------------------------------------
  147. ; This is the entry-point for The Direct Connection
  148. ; host.  This state merely sends CR's every three
  149. ; seconds until it sees a login prompt.
  150. ;
  151. Begin DIRECT
  152.    Caption 'login: '
  153.    Cr
  154.    When %loginprompt% Goto USERNAME
  155.    Timeout 3 Goto START
  156. End
  157. ;------------------------------------------------------
  158. ; At this point we've seen the host's login prompt, and
  159. ; are attempting to log in.
  160. ;
  161. Begin USERNAME
  162.    Transmit $USERNAME
  163.    Cr
  164.    When %passwdprompt% Goto PASSWORD
  165.    When %loginprompt% Goto USERNAME
  166.    Timeout 120 Goto NO_LOGIN
  167. End
  168. Begin PASSWORD
  169.    Transmit $PASSWORD
  170.    Cr
  171.    When %passwdprompt% Goto PASSWORD
  172.    When %loginprompt% Goto USERNAME
  173.    When %banner1% Goto LOGGED_IN
  174.    When %banner2% Goto LOGGED_IN
  175.    When %menuprompt% Goto GO_TO_SHELL
  176.    When %prompt% Goto JUMP_TO_MAIL
  177.    Timeout 120 Goto NO_LOGIN
  178. End
  179. Begin LOGGED_IN
  180.    Caption 'logged in'
  181.    When %menuprompt% Goto GO_TO_SHELL
  182.    When %prompt% Goto JUMP_TO_MAIL
  183.    Timeout 120 Goto NO_LOGIN
  184. End
  185. Begin GO_TO_SHELL
  186.    Caption 'Starting a Shell'
  187.    Transmit %shellstart%
  188.    Cr
  189.    When %prompt% Goto JUMP_TO_MAIL
  190.    Timeout 120 Goto NO_LOGIN
  191. End
  192. ;------------------------------------------------------
  193. ; These states check to see if there is any mail waiting
  194. ; by running the host's mail program and looking for
  195. ; keywords indicating the presence/absence of mail.
  196. ; If there's mail (and the script is in fetch mode),
  197. ; then the FETCH_FROM_MAIN_MENU sequence is started.
  198. ; If there's no mail, but there are letters to send,
  199. ; the SEND_MAIL sequence is started.  Otherwise the
  200. ; script just logs off.
  201. ;
  202. Begin JUMP_TO_MAIL
  203.    Transmit %readmail%
  204.    Cr
  205.    When %nomailprompt% Goto NO_MAIL_WAITING
  206.    When %havemailprompt% Goto MAIL_WAITING
  207.    Timeout 10 Goto RETRY_JUMP
  208. End
  209. Begin RETRY_JUMP
  210.    Transmit %readmail%
  211.    Cr
  212.    When %nomailprompt% Goto NO_MAIL_WAITING
  213.    When %havemailprompt% Goto MAIL_WAITING
  214.    Timeout 15 Goto GIVE_UP
  215. End
  216. Begin NO_MAIL_WAITING
  217.    Caption 'No Mail'
  218.    If MORE_LETTERS Then SEND_MAIL
  219.    When %prompt% Goto LOG_OFF
  220.    Timeout 15 Goto GIVE_UP
  221. End
  222. Begin MAIL_WAITING
  223.    Caption 'You Have Mail'
  224.    If FETCHING Then FETCH_FROM_MAIN_MENU
  225.    If MORE_LETTERS Then SEND_BUT_QUIT
  226.    When %mailprompt% Goto QUIT_MAIL
  227.    Timeout 120 Goto LOG_OFF
  228. End
  229. Begin QUIT_MAIL
  230.    Transmit %quitmail%
  231.    Cr
  232.    When %mailprompt% Goto QUIT_MAIL
  233.    When %prompt% Goto LOG_OFF
  234.    Timeout 15 Goto GIVE_UP
  235. End
  236. Begin SEND_BUT_QUIT
  237.    Transmit %quitmail%
  238.    Cr
  239.    When %mailprompt% Goto SEND_BUT_QUIT
  240.    When %prompt% Goto REQUEST_UPLOAD_LETTER
  241.    Timeout 15 Goto GIVE_UP
  242. End
  243. ;------------------------------------------------------
  244. ; These states execute for each letter to be downloaded.
  245. ; They save the letter to the mail.tmp file, download
  246. ; the file, instruct RFD to put the letter in the In Box,
  247. ; delete the letter on the host, then check for more mail.
  248. ;
  249. Begin FETCH_FROM_MAIN_MENU
  250.    When %mailprompt% Goto PRESERVE_MAIL
  251.    Timeout 10 Goto PRESERVE_MAIL
  252. End
  253. Begin PRESERVE_MAIL
  254.    Transmit 'preserve *'
  255.    Cr
  256.    ClearIndex
  257.    When %mailprompt% Goto DEL_TMPFILE
  258.    Timeout 20 Goto DEL_TMPFILE
  259. End
  260. Begin DEL_TMPFILE
  261.    Transmit %mailshellesc%
  262.    Transmit %rm%
  263.    Transmit $LETTER.FILENAME
  264.    Cr
  265.    NextIndex
  266.    When %mailprompt% Goto SAVE_CURLETTER
  267.    Timeout 20 Goto SAVE_CURLETTER
  268. End
  269. Begin SAVE_CURLETTER
  270.    Transmit %saveletter%
  271.    Transmit $INDEX
  272.    Transmit ' '
  273.    Transmit $LETTER.FILENAME
  274.    Cr
  275.    When 'New file' Goto REQUEST_DOWNLOAD
  276.    When 'No messages' Goto NO_MORE_MAIL
  277.    When 'Invalid message' Goto NO_MORE_MAIL
  278.    Timeout 10 Goto REQUEST_DOWNLOAD
  279. End
  280. Begin REQUEST_DOWNLOAD
  281.    Caption 'Fetching Mail'
  282.    Transmit %mailshellesc%
  283.    Transmit %sz%
  284.    Transmit $LETTER.FILENAME
  285.    Cr
  286.    When %szprompt1% Goto DOWNLD_LETTER
  287.    Timeout 20 Goto ABORT_DOWNLD
  288. End
  289. Begin ABORT_DOWNLD
  290.    Control X
  291.    Control X
  292.    Control X
  293.    Control X
  294.    Control X
  295.    Control X
  296.    Control X
  297.    Control C
  298.    When %prompt% Goto JUMP_TO_MAIL
  299.    When %mailprompt% Goto REQUEST_DOWNLOAD
  300.    Timeout 20 Goto JUMP_TO_MAIL
  301. End
  302. Begin PAUSE_FOR_DOWNLD
  303.    Timeout 1 Goto DOWNLD_LETTER
  304. End
  305. Begin DOWNLD_LETTER
  306.    Caption 'Starting Local Download Receive'
  307.    Download %dnloadproto% Then DOWNLD_SUCCESS Else RETRY_DNLOAD
  308. End
  309. Begin RETRY_DNLOAD
  310.    Caption 'Retrying Download'
  311.    Transmit %mailnull%
  312.    Cr
  313.    When %mailprompt% Goto RETRY_REQDNLOAD
  314.    Timeout 5 Goto RETRY_REQDNLOAD
  315. End
  316. Begin RETRY_REQDNLOAD
  317.    Transmit %mailshellesc%
  318.    Transmit %sz%
  319.    Transmit $LETTER.FILENAME
  320.    Cr
  321.    When %szprompt1% Goto RETRY_DOWNLD_LETTER
  322.    Timeout 20 Goto ABORT_DOWNLD
  323. End
  324. Begin RETRY_DOWNLD_LETTER
  325.    Download %dnloadproto% Then DOWNLD_SUCCESS Else GIVE_UP
  326. End
  327. Begin DOWNLD_SUCCESS
  328.    Confirm LETTER.RECEIVED Successful
  329.    Caption 'Letter Received'
  330.    Transmit %mailnull%
  331.    Cr
  332.    When %mailprompt% Goto DELETE_LETTER
  333.    Timeout 5 Goto SEND_DOWNLD_CR
  334. End
  335. Begin SEND_DOWNLD_CR
  336.    Transmit %mailnull%
  337.    Cr
  338.    When %mailprompt% Goto DELETE_LETTER
  339.    Timeout 5 Goto SEND_DOWNLD_CR
  340. End
  341. Begin DELETE_LETTER
  342.    Caption 'Deleting Letter'
  343.    Transmit %deleteletter%
  344.    Transmit ' '
  345.    Transmit $INDEX
  346.    Cr
  347.    When %mailprompt% Goto DEL_TMPFILE
  348.    Timeout 10 Goto DEL_TMPFILE
  349. End
  350. Begin NO_MORE_MAIL
  351.    Caption 'Fetched Mail'
  352.    When %mailprompt% Goto END_FETCH
  353.    Timeout 10 Goto END_FETCH
  354. End
  355. Begin END_FETCH
  356.    Transmit %quitmail%
  357.    Cr
  358.    If MORE_LETTERS Then SEND_MAIL
  359.    When %mailprompt% Goto END_FETCH
  360.    When %prompt% Goto LOG_OFF
  361.    Timeout 10 Goto LOG_OFF
  362. End
  363. ;------------------------------------------------------
  364. ; These states execute for each letter to send.  First
  365. ; the letter is uploaded into the mail.tmp file, then
  366. ; the host's mail program is run, giving it the address,
  367. ; then the subject, body, and CC information.
  368. ;
  369. Begin SEND_MAIL
  370.    When %prompt% Goto DEL_UPFILE
  371.    Timeout 15 Goto DEL_UPFILE
  372. End
  373. Begin DEL_UPFILE
  374.    Transmit %rm%
  375.    Transmit $LETTER.FILENAME
  376.    Cr
  377.    When %prompt% Goto REQUEST_UPLOAD_LETTER
  378.    Timeout 30 Goto GIVE_UP
  379. End
  380. Begin REQUEST_UPLOAD_LETTER
  381.    Transmit %rz%
  382.    Cr
  383.    When %rzprompt1% Goto BEGIN_LETTER_UPLOAD
  384.    When %rzprompt2% Goto BEGIN_LETTER_UPLOAD
  385.    Timeout 20 Goto GIVE_UP
  386. End
  387. Begin WAIT_FOR_UPLOAD
  388.    Timeout 1 Goto BEGIN_LETTER_UPLOAD
  389. End
  390. Begin BEGIN_LETTER_UPLOAD
  391.    NewLetter
  392.    Upload %uploadproto% Then UPLOAD_SUCCESS Else GIVE_UP
  393. End
  394. Begin UPLOAD_SUCCESS
  395.    Caption 'Letter Uploaded'
  396.    Cr
  397.    When %prompt% Goto SEND_LETTER
  398.    Timeout 5 Goto END_LETTER_UPLOAD
  399. End
  400. Begin END_LETTER_UPLOAD
  401.    Cr
  402.    When %prompt% Goto SEND_LETTER
  403.    Timeout 5 Goto END_LETTER_UPLOAD2
  404. End
  405. Begin END_LETTER_UPLOAD2
  406.    Control C
  407.    When %prompt% Goto SEND_LETTER
  408.    Timeout 5 Goto GIVE_UP
  409. End
  410. Begin SEND_LETTER
  411.    Transmit %sendmail%
  412.    Transmit $LETTER.DEST.USERNAME
  413.    Cr
  414.    When %subjectprompt% Goto SEND_SUBJECT
  415.    When 'not found' Goto RETRY_SEND_LETTER
  416.    Timeout 15 Goto GIVE_UP
  417. End
  418. Begin RETRY_SEND_LETTER
  419.    Transmit %sendmail%
  420.    Transmit $LETTER.DEST.USERNAME
  421.    Cr
  422.    When %subjectprompt% Goto SEND_SUBJECT
  423.    When 'not found' Goto GIVE_UP
  424.    Timeout 15 Goto GIVE_UP
  425. End
  426. Begin SEND_SUBJECT
  427.    Transmit $LETTER.SUBJECT
  428.    Cr
  429.    Timeout 2 Goto SEND_BODY
  430. End
  431. Begin SEND_BODY
  432.    Transmit '~r '
  433.    Transmit $LETTER.FILENAME
  434.    Cr
  435.    Timeout 1 Goto %signature%
  436. End
  437. Begin SEND_SIG
  438.    Transmit '~r .signature'
  439.    Cr
  440.    Timeout 1 Goto NO_SIGNATURE
  441. End
  442. Begin SEND_CC
  443.    Transmit '~c '
  444.    CreateCC 0 80 Delimiter ','
  445.    Transmit $LETTER.CC
  446.    Cr
  447.    Timeout 1 Goto NO_SIGNATURE
  448. End
  449. Begin NO_SIGNATURE
  450.    If LETTER.CC Then SEND_CC
  451.    Control D
  452.    When %prompt% Goto LETTER_SENT
  453.    When %ccprompt1% Goto SEND_CC_CR
  454.    When %ccprompt2% Goto SEND_CC_CR
  455.    When %ccprompt3% Goto SEND_CC_CR
  456.    Timeout 5 Goto NO_SIGNATURE
  457. End
  458. Begin SEND_CC_CR
  459.    Cr
  460.    When %prompt% Goto LETTER_SENT
  461.    When %ccprompt1% Goto SEND_CC_CR
  462.    When %ccprompt2% Goto SEND_CC_CR
  463.    When %ccprompt3% Goto SEND_CC_CR
  464.    Timeout 10 Goto SEND_CC_CR
  465. End
  466. Begin LETTER_SENT
  467.    Caption 'Letter Sent'
  468.    Confirm LETTER.SENT Successful
  469.    Transmit %rm%
  470.    Transmit $LETTER.FILENAME
  471.    Cr
  472.    When %prompt% Goto SEND_MORE_MAIL
  473.    Timeout 15 Goto GIVE_UP
  474. End
  475. Begin SEND_MORE_MAIL
  476.    If MORE_LETTERS Then REQUEST_UPLOAD_LETTER
  477.    If TRUE Then LOG_OFF
  478. End
  479. ;------------------------------------------------------
  480. ; These states deal with logging off the system
  481. ;
  482. Begin WAIT_TO_LOG_OFF
  483.    When %prompt% Goto LOG_OFF
  484.    Timeout 20 Goto GIVE_UP
  485. End
  486. Begin LOG_OFF
  487.    Transmit %logoff%
  488.    Cr
  489.    Caption 'Logging off'
  490.    When 'NO CAR' Goto EXIT_PROGRAM
  491.    When %logoffbanner1% Goto HANGUP_PHONE
  492.    When %logoffbanner2% Goto HANGUP_PHONE
  493.    When %prompt% Goto LOG_OFF
  494.    CarrierLoss Goto EXIT_PROGRAM
  495.    Timeout 20 Goto GIVE_UP
  496. End
  497. Begin EXIT_PROGRAM
  498.    Caption 'Logged off'
  499.    CarrierLoss Goto EXIT_PROGRAM
  500.    Timeout 3 Goto BYE_BYE
  501. End
  502. Begin GIVE_UP
  503.    Caption 'Aborting'
  504.    Hangup
  505.    CarrierLoss Goto EXIT_PROGRAM
  506. End
  507. Begin HANGUP_PHONE
  508.    Hangup
  509.    CarrierLoss Goto EXIT_PROGRAM
  510. End
  511. Begin NO_LOGIN
  512.    Timeout 5 Goto GIVE_UP
  513. End
  514. Begin BYE_BYE
  515.    Exit
  516. End
  517.  
  518.