comparison lisp/gnus/spam.el @ 68093:2212a4afa3ce

* spam.el (spam-group-ham-mark-p, spam-group-spam-mark-p) (spam-group-spam-marks): Delete functions. (spam-list-articles): Just call spam-group-ham-marks directly. (spam-group-ham-marks): Simplify.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 08 Jan 2006 21:29:46 +0000
parents fafd692d1e40
children 873a6f48b596
comparison
equal deleted inserted replaced
68092:d7f0db8b1ebb 68093:2212a4afa3ce
465 ;; convenience functions 465 ;; convenience functions
466 (defun spam-xor (a b) 466 (defun spam-xor (a b)
467 "Logical exclusive `or'." 467 "Logical exclusive `or'."
468 (and (or a b) (not (and a b)))) 468 (and (or a b) (not (and a b))))
469 469
470 (defun spam-group-ham-mark-p (group mark &optional spam)
471 (when (stringp group)
472 (let* ((marks (spam-group-ham-marks group spam))
473 (marks (if (symbolp mark)
474 marks
475 (mapcar 'symbol-value marks))))
476 (memq mark marks))))
477
478 (defun spam-group-spam-mark-p (group mark)
479 (spam-group-ham-mark-p group mark t))
480
481 (defun spam-group-ham-marks (group &optional spam) 470 (defun spam-group-ham-marks (group &optional spam)
482 (when (stringp group) 471 (when (stringp group)
483 (let* ((marks (if spam 472 (let ((marks (car (if spam
484 (gnus-parameter-spam-marks group) 473 (gnus-parameter-spam-marks group)
485 (gnus-parameter-ham-marks group))) 474 (gnus-parameter-ham-marks group)))))
486 (marks (car marks)) 475 (if (listp (car marks))
487 (marks (if (listp (car marks)) (car marks) marks))) 476 (car marks)
488 marks))) 477 marks))))
489
490 (defun spam-group-spam-marks (group)
491 (spam-group-ham-marks group t))
492 478
493 (defun spam-group-spam-contents-p (group) 479 (defun spam-group-spam-contents-p (group)
494 (if (stringp group) 480 (if (stringp group)
495 (or (member group spam-junk-mailgroups) 481 (or (member group spam-junk-mailgroups)
496 (memq 'gnus-group-spam-classification-spam 482 (memq 'gnus-group-spam-classification-spam
1048 (if (eq classification 'spam) 1034 (if (eq classification 'spam)
1049 (nth 3 flist) 1035 (nth 3 flist)
1050 (nth 2 flist)))) 1036 (nth 2 flist))))
1051 1037
1052 (defun spam-list-articles (articles classification) 1038 (defun spam-list-articles (articles classification)
1053 (let ((mark-check (if (eq classification 'spam) 1039 (let ((marks (mapcar 'eval (spam-group-ham-marks gnus-newsgroup-name
1054 'spam-group-spam-mark-p 1040 (eq classification 'spam))))
1055 'spam-group-ham-mark-p)) 1041 list)
1056 list mark-cache-yes mark-cache-no)
1057 (dolist (article articles) 1042 (dolist (article articles)
1058 (let ((mark (gnus-summary-article-mark article))) 1043 (if (memq (gnus-summary-article-mark article) marks)
1059 (unless (memq mark mark-cache-no) 1044 (push article list)))
1060 (if (memq mark mark-cache-yes)
1061 (push article list)
1062 ;; else, we have to actually check the mark
1063 (if (funcall mark-check
1064 gnus-newsgroup-name
1065 mark)
1066 (progn
1067 (push article list)
1068 (push mark mark-cache-yes))
1069 (push mark mark-cache-no))))))
1070 list)) 1045 list))
1071 1046
1072 (defun spam-register-routine (classification 1047 (defun spam-register-routine (classification
1073 check 1048 check
1074 &optional unregister 1049 &optional unregister