home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / comm / spot-1.3.lha / Spot / Rexx / CC.spot < prev    next >
Text File  |  1993-10-04  |  3KB  |  135 lines

  1. /********************************************************************/
  2. /*    $VER: CarbonCopy.spot 1.1 (9.8.93)                */
  3. /*    Peter Hanrahan                            */
  4. /*                                    */
  5. /*    CC.spot is a utility to allow SPOT to send messages to        */
  6. /*    multiple  recipients.                        */
  7. /*    When  run from SPOT it  will run  the text editor (set        */
  8. /*    in  the  script).  The first lines of the message must        */
  9. /*    contain  the  names and addresses of the recipients in        */
  10. /*    the  form `CC:  name @ address, name @ address '.        */
  11. /*    Each  line  of these addresses must start with `CC:  '        */
  12. /*    and  when  more  than one address is listed on a line,        */
  13. /*    the address must terminate with a `,'.                */
  14. /*                                                                  */
  15. /*    You  must  be in a message area to use CC.spot, and if        */
  16. /*    you  are  in  a  netmail  area  the  fido  address  is        */
  17. /*    neccessary.  If  you  are in  an  echo mail  area, the        */
  18. /*    address may be omitted as it is not used.            */
  19. /********************************************************************/
  20.  
  21.  
  22.  
  23.  
  24. address spot
  25. options results
  26. kludge = '01'x||'Via SpotCC: V1.1'
  27.  
  28. ed = 'ED -Sticky'            /*Your editor command*/
  29. tmp1='T:CC1.tmp'            /*Name of first temp file*/
  30. tmp2='T:CC2.tmp'            /*Name of second temp file*/
  31. width = 76                /*Text width for CC list*/
  32.  
  33. ismessages
  34. if rc > 0 then do
  35.   'requestnotify "Must be in a message area!"'
  36.   exit
  37. end
  38.  
  39. /*trace results*/
  40.  
  41. CR = '0d'x
  42. QU = '22'x
  43. NL = '0a'x
  44.  
  45. 'gettoaddress'
  46. echo = rc
  47.  
  48. TOP:
  49.  
  50. address command ed tmp1
  51.  
  52. Call open(mas,tmp1,r)
  53. cc = 0
  54. do forever
  55.   cline =readln(mas)
  56.   ccheck = upper(left(cline,3))
  57.   if ccheck ~= 'CC:' then leave
  58.   cline = substr(cline,5)
  59.   do forever
  60.     if cline = '' then leave
  61.     i = index(cline,',')
  62.       if i > 0 then do
  63.       usr = left(cline,i-1)
  64.       cline = substr(cline,i+2)
  65.     end
  66.     else do
  67.       usr = cline
  68.     end
  69.     cc = cc + 1
  70.     user.cc = usr
  71.     at = index(usr,'@')
  72.     if at > 1 then do
  73.       nam.cc = left(usr,at-2)
  74.       addr.cc = substr(usr,at+2)
  75.     end
  76.     else do
  77.       if echo = 0 then do
  78.         'requestnotify PROMPT "You MUST supply an address for all netmail"'
  79.         close(mas)
  80.         call TOP
  81.         EXIT
  82.       end
  83.       nam.cc = usr
  84.     end
  85.     if echo = 5 then user.cc = nam.cc
  86.     if i = 0 then leave
  87.   end
  88. end
  89. mbod = readch(mas,60000)
  90. call close(mas)
  91. if cline~= '' then mbod = cline||CR||mbod
  92.  
  93. do me = 1 to cc
  94.   call open(meso,tmp2,w)
  95.   call writeln(meso,kludge)
  96.   call writech(meso,mbod)
  97.   if cc > 2 then cclist =NL||NL'(Copies sent to:'NL
  98.   else cclist = NL||NL'(Copy sent to:'NL
  99.   com = 0
  100.   wi = 0
  101.   do ccl = 1 to cc
  102.     if me = ccl then iterate
  103.     if com > 0 then cclist = cclist','
  104.     com = 1
  105.     usr = ' 'user.ccl
  106.     wil = length(usr)+1
  107.     wid = wi + wil
  108.     if wid > width then do
  109.       cclist = cclist||NL||usr
  110.       wi = wil
  111.     end
  112.     else do
  113.       cclist = cclist||usr
  114.       wi = wid
  115.     end
  116.   end
  117.   call writech(meso,cclist)
  118.   call writeln(meso,')'||'0a'x)
  119.   call close(meso)
  120.   if me = 1 then do
  121.     'spot2front'
  122.     'write TO' QU||nam.me||QU 'TOADDR' QU||addr.me||QU 'FILE' QU||tmp2||QU 'NOEDIT'
  123.     'lastmessage'
  124.     'getsubject'
  125.     subj = result
  126.     'progressopen TITLE "Processing mail"'
  127.     preq = result
  128.   end
  129.   else 'write TO' QU||nam.me||QU 'TOADDR' QU||addr.me||QU 'SUBJECT' QU||subj||QU 'FILE' QU||tmp2||QU 'NOEDIT NOGUI'
  130.   'progressupdate' preq me cc
  131. end
  132. 'progressclose' preq
  133. address command 'Delete >NIL:' tmp1
  134. address command 'Delete >NIL:' tmp2
  135.