Browse Source

Fix reading of entire email, not just headers

Apparently mel:message-header-stream gives you a stream that can access
the whole email.
Lily Carpenter 9 years ago
parent
commit
8f0cda6758
1 changed files with 4 additions and 1 deletions
  1. 4 1
      mailfilter-parse.lisp

+ 4 - 1
mailfilter-parse.lisp

@@ -126,6 +126,9 @@
126 126
       (loop-file-until s (lambda (x) (declare (ignore x)))  #'parse-line hash))
127 127
     hash))
128 128
 
129
+(defun end-of-headers-p (line)
130
+  (= (length line) 0))
131
+
129 132
 (defun message-match (message pattern)
130 133
   (let* ((scanner (cadr (gethash "regex" pattern)))
131 134
          (regex (car (gethash "regex" pattern)))
@@ -133,7 +136,7 @@
133 136
          (test))
134 137
     (with-open-stream (message-stream (mel:message-header-stream message))
135 138
       (loop for line = (read-line message-stream nil)
136
-            while (and line (not test))
139
+            while (and line (not test) (not (end-of-headers-p line)))
137 140
             do
138 141
                (setf test (cl-ppcre:scan scanner line))))
139 142
     test))