(spam-bogofilter-articles): Select the article
[gnus] / lisp / spam.el
index 4a22b9a..433aba0 100644 (file)
@@ -39,9 +39,6 @@
 (require 'dns)
 (require 'message)
 
-(eval-and-compile
-  (autoload 'bbdb-records "bbdb-com"))
-
 ;; Attempt to load BBDB macros
 (eval-when-compile
   (condition-case nil
 (eval-and-compile
   (autoload 'ifile-spam-filter "ifile-gnus"))
 
+;; autoload query-dig
+(eval-and-compile
+  (autoload 'query-dig "dig"))
+
 ;;; Main parameters.
 
+(defvar spam-use-dig t
+  "True if query-dig should be used instead of query-dns.")
+
 (defvar spam-use-blacklist t
   "True if the blacklist should be used.")
 
-(defvar spam-use-whitelist t
+(defvar spam-use-whitelist nil
   "True if the whitelist should be used.")
 
 (defvar spam-use-blackholes nil
-  ;; FIXME!  Turned off for now.  The DNS routines are said to be flaky.
   "True if blackholes should be used.")
 
-(defvar spam-use-bogofilter t
+(defvar spam-use-bogofilter nil
   "True if bogofilter should be used.")
 
-(defvar spam-use-bbdb t
+(defvar spam-use-bbdb nil
   "True if BBDB should be used.")
 
-(defvar spam-use-bbdb t
+(defvar spam-use-ifile nil
   "True if ifile should be used.")
 
 (defvar spam-split-group "spam"
@@ -134,6 +137,8 @@ Such articles will be transmitted to `bogofilter -s' on group exit.")
 (gnus-define-keys gnus-summary-mode-map
   "St" spam-bogofilter-score
   "Sx" gnus-summary-mark-as-spam
+  "Mst" spam-bogofilter-score
+  "Msx" gnus-summary-mark-as-spam
   "\M-d" gnus-summary-mark-as-spam)
 
 ;;; How to highlight a spam summary line.
@@ -198,8 +203,8 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        decision)
     (while (and list-of-checks (not decision))
       (let ((pair (pop list-of-checks)))
-       (when (eval (car pair))
-         (setq decision (apply (cdr pair))))))
+       (when (symbol-value (car pair))
+         (setq decision (funcall (cdr pair))))))
     (if (eq decision t)
        nil
       decision)))
@@ -209,12 +214,11 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 (defvar spam-blackhole-servers '("bl.spamcop.net"
                                 "relays.ordb.org"
                                 "dev.null.dk"
-                                "relays.visi.com"
-                                "rbl.maps.vix.com")
+                                "relays.visi.com")
   "List of blackhole servers.")
 
 (defun spam-check-blackholes ()
-  "Check the Receieved headers for blackholed relays."
+  "Check the Received headers for blackholed relays."
   (let ((headers (message-fetch-field "received"))
        ips matches)
     (when headers
@@ -230,9 +234,17 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
                ips)))
       (dolist (server spam-blackhole-servers)
        (dolist (ip ips)
-         (when (query-dns (concat ip "." server))
-           (push (list ip server (query-dns (concat ip "." server) 'TXT))
-                 matches)))))
+         (let ((query-string (concat ip "." server)))
+           (if spam-use-dig
+               (let ((query-result (query-dig query-string)))
+                 (when query-result
+                   (message "spam detected with blackhole check of relay %s (dig query result '%s')" query-string query-result)
+                   (push (list ip server query-result)
+                         matches)))
+             ;; else, if not using dig.el
+             (when (query-dns query-string)
+               (push (list ip server (query-dns query-string 'TXT))
+                     matches)))))))
     (when matches
       spam-split-group)))
 \f
@@ -377,7 +389,7 @@ The regular expression is matched against the address.")
 ;;;     make install
 ;;;
 ;;; Here as well, you need to become super-user for the last step.  Now,
-;;; initialises your word lists by doing, under your own identity:
+;;; initialize your word lists by doing, under your own identity:
 ;;;
 ;;;     mkdir ~/.bogofilter
 ;;;     touch ~/.bogofilter/badlist
@@ -526,7 +538,7 @@ spamicity coefficient of each, and the overall article spamicity."
              (message "%s %d" prefix counter))
            (setq article (pop articles))
            (gnus-summary-goto-subject article)
-           (gnus-summary-select-article)
+           (gnus-summary-show-article t)
            (gnus-eval-in-buffer-window article-copy
              (insert-buffer-substring gnus-original-article-buffer)
              ;; Remove spam classification redundant headers: they may induce