home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgprex12.arj / PGPREXX.ZIP / PGPdeCod.CMD < prev    next >
Encoding:
Text File  |  1996-08-01  |  1.9 KB  |  75 lines

  1. /* REXX Program PGPdeCod.CMD version 1.2 */
  2. /* to decode PGP encrypted incoming mail
  3.    Companion to PGPckSig.CMD, PGPenCod.CMD (with SPLITMAIL.CMD and JOINMAIL.CMD)
  4.  
  5.    Copyright Lüko Willms <Lueko.Willms@T-Online.de>
  6.  
  7.    Configure this as a filter to be run when your mailer detects the string
  8.    '-----BEGIN PGP MESSAGE-----' in the body of an incoming mail message
  9. */
  10.  
  11. arg MailFile .
  12.  
  13. /* ------------------------ Get message data  ------ */
  14.  
  15. From  = ''
  16. Sender = ''
  17. MsgId = ''
  18. Timestamp=Date('O')||' '||Time()
  19. Betreff = ''
  20.  
  21. Erg = STREAM(MailFile,'C','OPEN READ')
  22.  
  23. Zeile = linein(MailFile)
  24. ContLine = 0
  25. DO WHILE Length(Zeile) > 0
  26.     /* Beachte Fortsetzungszeilen!! */
  27.     ContLine = ContLine & (LEFT(Zeile,1) = ' ' | LEFT(Zeile,1) = '09'x)
  28.     Zeile = STRIP(Zeile)
  29.     If \ ContLine then
  30.        DO
  31.        Tag = TRANSLATE(WORD(Zeile,1))
  32.        Zeile = Delstr(Zeile,1,Length(Tag))
  33.        END
  34.  
  35.     If RIGHT(Zeile,1) = ',' then
  36.        DO
  37.        ContLine = TRUE                                 /* for the next line... */
  38.        Zeile = DELSTR(Zeile,Length(Zeile),1)
  39.        END
  40.  
  41.     SELECT
  42.       When (Tag = 'FROM:') then
  43.         From = zeile
  44.       When (Tag = 'SENDER:') then
  45.         Sender = Zeile
  46.       When (Tag = 'MESSAGE-ID:') then
  47.         MsgId = Zeile
  48.       When (Tag = 'DATE:') then
  49.         Timestamp = Zeile
  50.       When (Tag = 'SUBJECT:') then
  51.         Betreff = Zeile
  52.       Otherwise
  53.         NOP
  54.     END /* Switch */
  55.  
  56.     Zeile = linein(MailFile)
  57. END /* Do Header */
  58.  
  59. Erg = STREAM(MailFile,'C','CLOSE')
  60.  
  61.  
  62. 'type ' MailFile '| pgp -f >> ' MailFile
  63.  
  64. /* Do logging ---------------------------------------------- */
  65. Erfolg = RC
  66. Tab = '09'x
  67. PARSE SOURCE . . MyName
  68. LogFile = FILESPEC("Drive",MyName)||FILESPEC("Path",MyName)||'PGPREXX.LOG'
  69. Erg = STREAM(LogFile,'C','OPEN WRITE')
  70. Erg = LINEOUT(LogFile,TimeStamp||Tab||'deCod'||Tab||MsgId||Tab||Erfolg||Tab||'From: '||From)
  71. Erg = STREAM(LogFile,'C','CLOSE')
  72.  
  73. exit
  74.  
  75.