diff lisp/gnus/gnus-nocem.el @ 85712:a3c27999decb

Update Gnus to No Gnus 0.7 from the Gnus CVS trunk Revision: emacs@sv.gnu.org/emacs--devo--0--patch-911
author Miles Bader <miles@gnu.org>
date Sun, 28 Oct 2007 09:18:39 +0000
parents 24202b793a08
children 107ccd98fa12 880960b70474
line wrap: on
line diff
--- a/lisp/gnus/gnus-nocem.el	Sun Oct 28 04:58:17 2007 +0000
+++ b/lisp/gnus/gnus-nocem.el	Sun Oct 28 09:18:39 2007 +0000
@@ -129,11 +129,12 @@
 
 (defun gnus-fill-real-hashtb ()
   "Fill up a hash table with the real-name mappings from the user's active file."
-  (setq gnus-nocem-real-group-hashtb (gnus-make-hashtable
-				      (length gnus-newsrc-alist)))
+  (if (hash-table-p gnus-nocem-real-group-hashtb)
+      (clrhash gnus-nocem-real-group-hashtb)
+    (setq gnus-nocem-real-group-hashtb (make-hash-table :test 'equal)))
   (mapcar (lambda (group)
 	    (setq group (gnus-group-real-name (car group)))
-	    (gnus-sethash group t gnus-nocem-real-group-hashtb))
+	    (puthash group t gnus-nocem-real-group-hashtb))
 	  gnus-newsrc-alist))
 
 ;;;###autoload
@@ -191,7 +192,7 @@
 		       (and gnus-nocem-check-from
 			    (let ((case-fold-search t))
 			      (catch 'ok
-				(mapcar
+				(mapc
 				 (lambda (author)
 				   (if (consp author)
 				       (setq author (car author)))
@@ -237,11 +238,11 @@
       (gnus-request-article-this-buffer (mail-header-number header) group)
       (goto-char (point-min))
       (when (re-search-forward
-	     "-----BEGIN PGP\\( SIGNED\\)? MESSAGE-----"
+	     "-----BEGIN PGP\\(?: SIGNED\\)? MESSAGE-----"
 	     nil t)
 	(delete-region (point-min) (match-beginning 0)))
       (when (re-search-forward
-	     "-----END PGP \\(MESSAGE\\|SIGNATURE\\)-----\n?"
+	     "-----END PGP \\(?:MESSAGE\\|SIGNATURE\\)-----\n?"
 	     nil t)
 	(delete-region (match-end 0) (point-max)))
       (goto-char (point-min))
@@ -304,34 +305,26 @@
       (while (search-forward "\t" nil t)
 	(cond
 	 ((not (ignore-errors
-		 (setq group (let ((obarray gnus-nocem-real-group-hashtb))
-			       (read buf)))))
+		 (setq group (gnus-group-real-name (symbol-name (read buf))))
+		 (gethash group gnus-nocem-real-group-hashtb)))
 	  ;; An error.
 	  )
-	 ((not (symbolp group))
-	  ;; Ignore invalid entries.
-	  )
-	 ((not (boundp group))
-	  ;; Make sure all entries in the hashtb are bound.
-	  (set group nil))
 	 (t
-	  (when (gnus-gethash (gnus-group-real-name (symbol-name group))
-			      gnus-nocem-real-group-hashtb)
-	    ;; Valid group.
-	    (beginning-of-line)
-	    (while (eq (char-after) ?\t)
-	      (forward-line -1))
-	    (setq id (buffer-substring (point) (1- (search-forward "\t"))))
-	    (unless (if gnus-nocem-hashtb
-			(gnus-gethash id gnus-nocem-hashtb)
-		      (setq gnus-nocem-hashtb (gnus-make-hashtable))
-		      nil)
-	      ;; only store if not already present
-	      (gnus-sethash id t gnus-nocem-hashtb)
-	      (push id ncm))
-	    (forward-line 1)
-	    (while (eq (char-after) ?\t)
-	      (forward-line 1))))))
+	  ;; Valid group.
+	  (beginning-of-line)
+	  (while (eq (char-after) ?\t)
+	    (forward-line -1))
+	  (setq id (buffer-substring (point) (1- (search-forward "\t"))))
+	  (unless (if (hash-table-p gnus-nocem-hashtb)
+		      (gethash id gnus-nocem-hashtb)
+		    (setq gnus-nocem-hashtb (make-hash-table :test 'equal))
+		    nil)
+	    ;; only store if not already present
+	    (puthash id t gnus-nocem-hashtb)
+	    (push id ncm))
+	  (forward-line 1)
+	  (while (eq (char-after) ?\t)
+	    (forward-line 1)))))
       (when ncm
 	(setq gnus-nocem-touched-alist t)
 	(push (cons (let ((time (current-time))) (setcdr (cdr time) nil) time)
@@ -370,7 +363,9 @@
 	 (prev pprev)
 	 (expiry (days-to-time gnus-nocem-expiry-wait))
 	 entry)
-    (setq gnus-nocem-hashtb (gnus-make-hashtable (* (length alist) 51)))
+    (if (hash-table-p gnus-nocem-hashtb)
+	(clrhash gnus-nocem-hashtb)
+      (setq gnus-nocem-hashtb (make-hash-table :test 'equal)))
     (while (setq entry (car alist))
       (if (not (time-less-p (time-since (car entry)) expiry))
 	  ;; This entry has expired, so we remove it.
@@ -379,7 +374,7 @@
 	;; This is ok, so we enter it into the hashtable.
 	(setq entry (cdr entry))
 	(while entry
-	  (gnus-sethash (car entry) t gnus-nocem-hashtb)
+	  (puthash (car entry) t gnus-nocem-hashtb)
 	  (setq entry (cdr entry))))
       (setq alist (cdr alist)))))
 
@@ -397,7 +392,7 @@
 (defun gnus-nocem-unwanted-article-p (id)
   "Say whether article ID in the current group is wanted."
   (and gnus-nocem-hashtb
-       (gnus-gethash id gnus-nocem-hashtb)))
+       (gethash id gnus-nocem-hashtb)))
 
 (provide 'gnus-nocem)