12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- (require 'gnus-art)
- (defun spam-wash ()
- "Treat the current buffer prior to spam analysis."
- (interactive)
- (run-hooks 'gnus-article-decode-hook)
- (save-excursion
- (save-restriction
- (let* ((buffer-read-only nil)
- (gnus-inhibit-treatment t)
- (gnus-article-buffer (current-buffer))
- (handles (or (mm-dissect-buffer nil gnus-article-loose-mime)
- (and gnus-article-emulate-mime
- (mm-uu-dissect))))
- handle)
- (when gnus-article-mime-handles
- (mm-destroy-parts gnus-article-mime-handles)
- (setq gnus-article-mime-handle-alist nil))
- (setq gnus-article-mime-handles handles)
- (when (and handles
- (or (not (stringp (car handles)))
- (cdr handles)))
- (article-goto-body)
- (delete-region (point) (point-max))
- (spam-treat-parts handles))))))
- (defun spam-treat-parts (handle)
- (if (stringp (car handle))
- (mapcar 'spam-treat-parts (cdr handle))
- (if (bufferp (car handle))
- (save-restriction
- (narrow-to-region (point) (point))
- (when (let ((case-fold-search t))
- (string-match "text" (car (mm-handle-type handle))))
- (mm-insert-part handle))
- (goto-char (point-max)))
- (mapcar 'spam-treat-parts handle))))
- (provide 'spam-wash)
|