`elmo-spam-process-messages-as-mbox'.
* elsp-sa.el (elmo-spam-spamassassin-register-messages): Ditto.
+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
(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)
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)