diff lisp/gnus/nnimap.el @ 110428:6060b86fc551

Merge changes made in Gnus trunk. nnimap.el (nnimap-finish-retrieve-group-infos): Return data in the nntp buffer so the agent can save it. nnimap.el (nnimap-open-shell-stream): Bind `process-connection-type' to nil, so that CRLF doesn't get translated to \n; (nnimap-open-connection): Don't make 'shell commands only send \n. nnimap.el (nnimap-request-group): Don't make `M-g' bug out on group with no marks. gnus-agent.el (gnus-agent-load-alist): Nix out the alist if the file doesn't exist. nnimap.el (nnimap-finish-retrieve-group-infos): Protect against groups that have no articles. nnimap.el (nnimap-request-article): Check that we really got an article when we requested one. gnus-html.el (gnus-html-schedule-image-fetching): Ignore all errors from url-retrieve, for instance about invalid URLs. gnus-agent.el: Change default of gnus-agent-auto-agentize-methods to nil.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 19 Sep 2010 10:45:51 +0000
parents 93e093c035a0
children 33cf78a271ef
line wrap: on
line diff
--- a/lisp/gnus/nnimap.el	Sun Sep 19 11:53:28 2010 +0200
+++ b/lisp/gnus/nnimap.el	Sun Sep 19 10:45:51 2010 +0000
@@ -197,14 +197,14 @@
     (current-buffer)))
 
 (defun nnimap-open-shell-stream (name buffer host port)
-  (let ((process (start-process name buffer shell-file-name
-				shell-command-switch
-				(format-spec
-				 nnimap-shell-program
-				 (format-spec-make
-				  ?s host
-				  ?p port)))))
-    process))
+  (let ((process-connection-type nil))
+    (start-process name buffer shell-file-name
+		   shell-command-switch
+		   (format-spec
+		    nnimap-shell-program
+		    (format-spec-make
+		     ?s host
+		     ?p port)))))
 
 (defun nnimap-credentials (address ports)
   (let (port credentials)
@@ -263,8 +263,6 @@
 		(delete-process (nnimap-process nnimap-object))
 		(setq nnimap-object nil))))
 	  (when nnimap-object
-	    (when (eq nnimap-stream 'shell)
-	      (setf (nnimap-newlinep nnimap-object) t))
 	    (setf (nnimap-capabilities nnimap-object)
 		  (mapcar
 		   #'upcase
@@ -317,10 +315,14 @@
 		 (if (member "IMAP4REV1" (nnimap-capabilities nnimap-object))
 		     "UID FETCH %d BODY.PEEK[]"
 		   "UID FETCH %d RFC822.PEEK")
-		 article)))
+		 article))
+	  ;; Check that we really got an article.
+	  (goto-char (point-min))
+	  (unless (looking-at "\\* [0-9]+ FETCH")
+	    (setq result nil)))
 	(let ((buffer (nnimap-find-process-buffer (current-buffer))))
 	  (when (car result)
-	    (with-current-buffer to-buffer
+	    (with-current-buffer (or to-buffer nntp-server-buffer)
 	      (insert-buffer-substring buffer)
 	      (goto-char (point-min))
 	      (let ((bytes (nnimap-get-length)))
@@ -611,7 +613,19 @@
       (nnimap-update-infos (nnimap-flags-to-marks
 			    (nnimap-parse-flags
 			     (nreverse sequences)))
-			   infos))))
+			   infos)
+      ;; Finally, just return something resembling an active file in
+      ;; the nntp buffer, so that the agent can save the info, too.
+      (with-current-buffer nntp-server-buffer
+	(erase-buffer)
+	(dolist (info infos)
+	  (let* ((group (gnus-info-group info))
+		 (active (gnus-active group)))
+	    (when active
+	      (insert (format "%S %d %d y\n"
+			      (gnus-group-real-name group)
+			      (cdr active)
+			      (car active))))))))))
 
 (defun nnimap-update-infos (flags infos)
   (dolist (info infos)