Importing Pterodactyl Gnus v0.97.
[elisp/gnus.git-] / lisp / gnus-nocem.el
index d678531..7e8a862 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-nocem.el --- NoCeM pseudo-cancellation treatment
-;; Copyright (C) 1995,96,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -121,7 +121,7 @@ matches an previously scanned and verified nocem message."
   (interactive)
   (let ((groups gnus-nocem-groups)
        (gnus-inhibit-demon t)
-       group active gactive articles)
+       group active gactive articles check-headers)
     (gnus-make-directory gnus-nocem-directory)
     ;; Load any previous NoCeM headers.
     (gnus-nocem-load-cache)
@@ -146,7 +146,7 @@ matches an previously scanned and verified nocem message."
          (save-excursion
            (let ((dependencies (make-vector 10 nil))
                  headers header)
-             (nnheader-temp-write nil
+             (with-temp-buffer
                (setq headers
                      (if (eq 'nov
                              (gnus-retrieve-headers
@@ -173,7 +173,14 @@ matches an previously scanned and verified nocem message."
                                    (null (mail-header-references header)))
                                (not (member (mail-header-message-id header)
                                             gnus-nocem-seen-message-ids))))
-                      (gnus-nocem-check-article group header)))))))
+                      (push header check-headers)))
+               (let ((i 0)
+                     (len (length check-headers)))
+                 (dolist (h check-headers)
+                   (gnus-message
+                    7 "Checking article %d in %s for NoCeM (%d of %d)..."
+                    (mail-header-number h) group (incf i) len)
+                   (gnus-nocem-check-article group h)))))))
        (setq gnus-nocem-active
              (cons (list group gactive)
                    (delq (assoc group gnus-nocem-active)
@@ -185,14 +192,12 @@ matches an previously scanned and verified nocem message."
 (defun gnus-nocem-check-article (group header)
   "Check whether the current article is an NCM article and that we want it."
   ;; Get the article.
-  (gnus-message 7 "Checking article %d in %s for NoCeM..."
-               (mail-header-number header) group)
   (let ((date (mail-header-date header))
        issuer b e type)
     (when (or (not date)
-             (nnmail-time-less
-              (nnmail-time-since (nnmail-date-to-time date))
-              (nnmail-days-to-time gnus-nocem-expiry-wait)))
+             (time-less-p
+              (time-since (date-to-time date))
+              (days-to-time gnus-nocem-expiry-wait)))
       (gnus-request-article-this-buffer (mail-header-number header) group)
       (goto-char (point-min))
       (when (re-search-forward "-----BEGIN PGP MESSAGE-----" nil t)
@@ -271,7 +276,7 @@ matches an previously scanned and verified nocem message."
                              gnus-nocem-real-group-hashtb)
            ;; Valid group.
            (beginning-of-line)
-           (while (= (following-char) ?\t)
+           (while (eq (char-after) ?\t)
              (forward-line -1))
            (setq id (buffer-substring (point) (1- (search-forward "\t"))))
            (unless (gnus-gethash id gnus-nocem-hashtb)
@@ -279,7 +284,7 @@ matches an previously scanned and verified nocem message."
              (gnus-sethash id t gnus-nocem-hashtb)
              (push id ncm))
            (forward-line 1)
-           (while (= (following-char) ?\t)
+           (while (eq (char-after) ?\t)
              (forward-line 1))))))
       (when ncm
        (setq gnus-nocem-touched-alist t)
@@ -302,13 +307,13 @@ matches an previously scanned and verified nocem message."
   "Save the NoCeM cache."
   (when (and gnus-nocem-alist
             gnus-nocem-touched-alist)
-    (nnheader-temp-write (gnus-nocem-cache-file)
+    (with-temp-file (gnus-nocem-cache-file)
       (gnus-prin1 `(setq gnus-nocem-alist ',gnus-nocem-alist)))
     (setq gnus-nocem-touched-alist nil)))
 
 (defun gnus-nocem-save-active ()
   "Save the NoCeM active file."
-  (nnheader-temp-write (gnus-nocem-active-file)
+  (with-temp-file (gnus-nocem-active-file)
     (gnus-prin1 `(setq gnus-nocem-active ',gnus-nocem-active))))
 
 (defun gnus-nocem-alist-to-hashtb ()
@@ -316,11 +321,11 @@ matches an previously scanned and verified nocem message."
   (let* ((alist gnus-nocem-alist)
         (pprev (cons nil alist))
         (prev pprev)
-        (expiry (nnmail-days-to-time gnus-nocem-expiry-wait))
+        (expiry (days-to-time gnus-nocem-expiry-wait))
         entry)
     (setq gnus-nocem-hashtb (gnus-make-hashtable (* (length alist) 51)))
     (while (setq entry (car alist))
-      (if (not (nnmail-time-less (nnmail-time-since (car entry)) expiry))
+      (if (not (time-less-p (time-since (car entry)) expiry))
          ;; This entry has expired, so we remove it.
          (setcdr prev (cdr alist))
        (setq prev alist)