* elsp-bogofilter.el (elmo-spam-bogofilter-register-messages): Use
authorhmurata <hmurata>
Sat, 2 Sep 2006 01:47:31 +0000 (01:47 +0000)
committerhmurata <hmurata>
Sat, 2 Sep 2006 01:47:31 +0000 (01:47 +0000)
`elmo-spam-process-messages-as-mbox'.

* elsp-sa.el (elmo-spam-spamassassin-register-messages): Ditto.

elmo/ChangeLog
elmo/elsp-bogofilter.el
elmo/elsp-sa.el

index ce6df16..ea1aa77 100644 (file)
@@ -1,3 +1,10 @@
+2006-09-02  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
+
+       * elsp-bogofilter.el (elmo-spam-bogofilter-register-messages): Use
+       `elmo-spam-process-messages-as-mbox'.
+
+       * elsp-sa.el (elmo-spam-spamassassin-register-messages): Ditto.
+
 2006-08-27  Hiroya Murata  <lapis-lazuli@pop06.odn.ne.jp>
 
        * elsp-bsfilter.el (elsp-bsfilter-list-spam-files): Fix the
index fd58ff8..8548650 100644 (file)
@@ -127,26 +127,12 @@ Must be return a string or list of string."
   (if (not (< 0 elmo-spam-bogofilter-max-messages-per-process))
       (error "\
 non-positive value for `elmo-spam-bogofilter-max-messages-per-process'"))
-  (with-temp-buffer
-    (while numbers
-      (let ((count 0))
-       (while (and numbers
-                   (< count elmo-spam-bogofilter-max-messages-per-process))
-         (insert "From MAILER-DAEMON\n"
-                 (with-temp-buffer
-                   (elmo-spam-message-fetch folder (car numbers))
-                   (goto-char (point-min))
-                   (while (re-search-forward "^>*From " nil t)
-                     (goto-char (match-beginning 0))
-                     (insert ?>)
-                     (forward-line))
-                   (buffer-substring (point-min) (point-max)))
-                 "\n\n")
-         (setq count (1+ count)
-               numbers (cdr numbers)))
-       (elsp-bogofilter-register-buffer (current-buffer) spam restore)
-       (elmo-progress-notify 'elmo-spam-register count)
-       (erase-buffer)))))
+  (elmo-spam-process-messages-as-mbox
+   folder numbers elmo-spam-bogofilter-max-messages-per-process
+   (lambda (count spam restore)
+     (elsp-bogofilter-register-buffer (current-buffer) spam restore)
+     (elmo-progress-notify 'elmo-spam-register count))
+   spam restore))
 
 (luna-define-method elmo-spam-register-spam-messages :around
   ((processor elsp-bogofilter) folder &optional numbers restore)
index 24fe6e3..47a1c82 100644 (file)
                                                    spam
                                                    restore)
   (if (not (< 0 elmo-spam-spamassassin-max-messages-per-process))
-      (error
- "non-positive value for `elmo-spam-spamassassin-max-messages-per-process'"))
-  (with-temp-buffer
-    (while numbers
-      (let ((count 0))
-       (while (and numbers
-                   (< count elmo-spam-spamassassin-max-messages-per-process))
-         (insert "From MAILER-DAEMON@example.com\n"
-                 (with-temp-buffer
-                   (elmo-spam-message-fetch folder (car numbers))
-                   (goto-char (point-min))
-                   (while (re-search-forward "^>*From " nil t)
-                     (goto-char (match-beginning 0))
-                     (insert ?>)
-                     (forward-line))
-                   (buffer-substring (point-min) (point-max)))
-                 "\n\n")
-         (setq count (1+ count)
-               numbers (cdr numbers)))
-       (apply 'elmo-spamassassin-call 'learn
-              (delq nil
-                    (list "--mbox"
-                          (if spam "--spam" "--ham"))))
-       (elmo-progress-notify 'elmo-spam-register count)
-       (erase-buffer)))))
+      (error "\
+non-positive value for `elmo-spam-spamassassin-max-messages-per-process'"))
+  (elmo-spam-process-messages-as-mbox
+   folder numbers elmo-spam-spamassassin-max-messages-per-process
+   (lambda (count spam restore)
+     (apply 'elmo-spamassassin-call 'learn
+           (delq nil
+                 (list "--mbox"
+                       (if spam "--spam" "--ham"))))
+     (elmo-progress-notify 'elmo-spam-register count))
+   spam restore))
 
 (luna-define-method elmo-spam-register-spam-messages :around
   ((processor elsp-sa) folder &optional numbers restore)