From: Teodor Zlatanov Date: Wed, 10 Dec 2003 19:57:15 +0000 (+0000) Subject: (spam-disable-spam-split-during-ham-respool): new X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=2b9aae73181dff80d82ea19b3620724f773e0f09 (spam-disable-spam-split-during-ham-respool): new variable. From lorentey@elte.hu (Lőrentey Károly) (spam-ham-copy-or-move-routine): respect spam-disable-spam-split-during-ham-respool. From lorentey@elte.hu (Lőrentey Károly) (spam-split-disabled): new variable. From lorentey@elte.hu (Lőrentey Károly) (spam-split): respect spam-split-disabled. From lorentey@elte.hu (Lőrentey Károly) --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87f258547..2b7f2ad88 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2003-12-10 Teodor Zlatanov + + * spam.el (spam-disable-spam-split-during-ham-respool): new + variable. From lorentey@elte.hu (L,Bu(Brentey K,Ba(Broly) + (spam-ham-copy-or-move-routine): respect + spam-disable-spam-split-during-ham-respool. From + lorentey@elte.hu (L,Bu(Brentey K,Ba(Broly) + (spam-split-disabled): new variable. From + lorentey@elte.hu (L,Bu(Brentey K,Ba(Broly) + (spam-split): respect spam-split-disabled. From + lorentey@elte.hu (L,Bu(Brentey K,Ba(Broly) + 2003-12-10 Katsumi Yamaoka * nnheaderxm.el (nnheader-xmas-run-at-time): Make it work diff --git a/lisp/spam.el b/lisp/spam.el index 61af4e1a5..4e64e6883 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -119,6 +119,15 @@ Competition." :type 'boolean :group 'spam) +(defcustom spam-disable-spam-split-during-ham-respool nil + "Whether spam-split should be ignored while resplitting ham in +a process destination. This is useful to prevent ham from ending +up in the same spam group after the resplit. Don't set this to t +if you have spam-split as the last rule in your split +configuration." + :type 'boolean + :group 'spam) + (defcustom spam-whitelist (expand-file-name "whitelist" spam-directory) "The location of the whitelist. The file format is one regular expression per line. @@ -696,8 +705,11 @@ spam-use-* variable.") (gnus-summary-mark-article article gnus-unread-mark)) (gnus-summary-set-process-mark article)) - (if respool ; respooling is with a "fake" group - (gnus-summary-respool-article nil respool-method) + (if respool ; respooling is with a "fake" group + (let ((spam-split-disabled + (or spam-split-disabled + spam-disable-spam-split-during-ham-respool))) + (gnus-summary-respool-article nil respool-method)) (if (or (not backend-supports-deletions) ; else, we are not respooling (> (length groups) 1)) (progn ; if copying, copy and set deletep @@ -826,6 +838,9 @@ definitely a spam.") "The spam-list-of-statistical-checks list contains all the mail splitters that need to have the full message body available.") +(defvar spam-split-disabled nil + "If non-nil, spam-split is disabled, and always returns nil.") + ;;;TODO: modify to invoke self with each check if invoked without specifics (defun spam-split (&rest specific-checks) "Split this message into the `spam' group if it is spam. @@ -836,35 +851,36 @@ spam-split-group to that string. See the Info node `(gnus)Fancy Mail Splitting' for more details." (interactive) - (let ((spam-split-group-choice spam-split-group)) - (dolist (check specific-checks) - (when (stringp check) - (setq spam-split-group-choice check) - (setq specific-checks (delq check specific-checks)))) - - (let ((spam-split-group spam-split-group-choice)) - (save-excursion - (save-restriction - (dolist (check spam-list-of-statistical-checks) - (when (and (symbolp check) (symbol-value check)) - (widen) - (gnus-message 8 "spam-split: widening the buffer (%s requires it)" - (symbol-name check)) - (return))) - ;; (progn (widen) (debug (buffer-string))) - (let ((list-of-checks spam-list-of-checks) - decision) - (while (and list-of-checks (not decision)) - (let ((pair (pop list-of-checks))) - (when (and (symbol-value (car pair)) - (or (null specific-checks) - (memq (car pair) specific-checks))) - (gnus-message 5 "spam-split: calling the %s function" - (symbol-name (cdr pair))) - (setq decision (funcall (cdr pair)))))) - (if (eq decision t) - nil - decision))))))) + (unless spam-split-disabled + (let ((spam-split-group-choice spam-split-group)) + (dolist (check specific-checks) + (when (stringp check) + (setq spam-split-group-choice check) + (setq specific-checks (delq check specific-checks)))) + + (let ((spam-split-group spam-split-group-choice)) + (save-excursion + (save-restriction + (dolist (check spam-list-of-statistical-checks) + (when (and (symbolp check) (symbol-value check)) + (widen) + (gnus-message 8 "spam-split: widening the buffer (%s requires it)" + (symbol-name check)) + (return))) + ;; (progn (widen) (debug (buffer-string))) + (let ((list-of-checks spam-list-of-checks) + decision) + (while (and list-of-checks (not decision)) + (let ((pair (pop list-of-checks))) + (when (and (symbol-value (car pair)) + (or (null specific-checks) + (memq (car pair) specific-checks))) + (gnus-message 5 "spam-split: calling the %s function" + (symbol-name (cdr pair))) + (setq decision (funcall (cdr pair)))))) + (if (eq decision t) + nil + decision)))))))) (defvar spam-registration-functions ;; first the ham register, second the spam register function