home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / popcl221.zip / lamailer.cmd < prev    next >
OS/2 REXX Batch file  |  1994-09-16  |  2KB  |  73 lines

  1. /* LaMailer.cmd - Mail Delivery Agent for LaMail        */
  2. /* Copyright - Anonymous Software                       */
  3. /* J.Poltorak@bradford.ac.uk                            */
  4.  
  5. /* Modified by Claudio Fahey for popclient for OS/2     */
  6. /* e-mail: claudio@uclink.berkeley.edu                  */
  7.  
  8. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  9. call SysLoadFuncs
  10.  
  11. parse arg '-dest ' maildir ' -to ' to
  12.  
  13. date = date('o')
  14. time = time()
  15. mailbox = maildir
  16. inbox  = mailbox'\inbox.ndx'
  17.  
  18. parse value date time with  2 yy'/'mon'/'dd  hh':'+1 m +1 mm':'ss
  19. msg =  mailbox'\'mon || dd || yy || hh || m'.'mm || ss
  20.  
  21. header_state = 1
  22. subject = ''
  23.  
  24. do while lines() \= 0
  25.    line=linein()
  26.  
  27.    if (header_state) then do
  28.  
  29.        if word(line,1) = 'From:' then do
  30.            parse value subword(line,2) with fullname '<' from '>'
  31.            if from = '' then do
  32.                from = word(fullname,1)
  33.                fullname = ''
  34.                end
  35.            end
  36.        if word(line,1) = 'Subject:' then
  37.            subject = subword(line,2)
  38.        if line = '' then header_state = 0
  39.        end
  40.  
  41.    call lineout msg, line
  42.    end
  43.  
  44. call index
  45. call lineout msg
  46.  
  47. exit
  48.  
  49. index:
  50.    nickname = copies(' ',8)
  51.    fullname = strip(fullname)
  52.    from = strip(from)
  53.    parse value from with userid '@' nodename '.'
  54.    size = copies(' ',12)
  55.    f1 = copies(' ',8)
  56.    seen = ' '
  57.    from_to = ' '
  58.    f2 = ' '
  59.    call lineout inbox, nickname,
  60.        left(userid,8),
  61.        left(nodename,8),
  62.        translate(filespec('n',msg),' ','.'),
  63.        size,
  64.        date,
  65.        substr(time,1,5),
  66.        f1,
  67.        seen,
  68.        from_to,
  69.        f2,
  70.        fullname'01'x ||subject'0101'x ||from
  71. return
  72.  
  73.