diff lisp/gnus/nnimap.el @ 110451:4b82113fd203

Merge changes made in Gnus trunk. mail-parse.el (mail-header-encode-parameter): Use -encode-parameter instead of -encode-string. nnimap.el (nnimap-fetch-inbox): Use "[]" as the parameter instead of "". gnus-news.texi: Say what Emacs versions we support. nnimap.el: Implement group deletion. nnimap.el (nnimap-transform-headers): Return the size of the entire message in the Bytes header, not just the size of the first part. gnus-news.texi: The nnimap makeover. gnus-news.texi (Supported Emacs versions): Fix typo. nnimap.el (nnimap-request-move-article): Fix article moving from nnimap to other servers. nnimap.el (nnimap-request-set-mark): Don't wait for a response when we haven't requested anything. nnimap.el (nnimap-command): Make sure that the error message doesn't error out.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Mon, 20 Sep 2010 23:08:33 +0000
parents 33cf78a271ef
children b7b7e970d807
line wrap: on
line diff
--- a/lisp/gnus/nnimap.el	Tue Sep 21 00:42:47 2010 +0200
+++ b/lisp/gnus/nnimap.el	Mon Sep 20 23:08:33 2010 +0000
@@ -137,7 +137,7 @@
 
 (defun nnimap-transform-headers ()
   (goto-char (point-min))
-  (let (article bytes lines)
+  (let (article bytes lines size)
     (block nil
       (while (not (eobp))
 	(while (not (looking-at "^\\* [0-9]+ FETCH.*UID \\([0-9]+\\)"))
@@ -148,6 +148,12 @@
 	      bytes (nnimap-get-length)
 	      lines nil)
 	(beginning-of-line)
+	(setq size
+	      (and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
+				      (line-end-position)
+				      t)
+		   (match-string 1)))
+	(beginning-of-line)
 	(when (search-forward "BODYSTRUCTURE" (line-end-position) t)
 	  (let ((structure (ignore-errors (read (current-buffer)))))
 	    (while (and (consp structure)
@@ -157,7 +163,8 @@
 	(delete-region (line-beginning-position) (line-end-position))
 	(insert (format "211 %s Article retrieved." article))
 	(forward-line 1)
-	(insert (format "Chars: %d\n" bytes))
+	(when size
+	  (insert (format "Chars: %s\n" size)))
 	(when lines
 	  (insert (format "Lines: %s\n" lines)))
 	(re-search-forward "^\r$")
@@ -384,9 +391,9 @@
     (nreverse parts)))
 
 (deffoo nnimap-request-group (group &optional server dont-check info)
-  (with-current-buffer nntp-server-buffer
-    (let ((result (nnimap-possibly-change-group group server))
-	  articles active marks high low)
+  (let ((result (nnimap-possibly-change-group group server))
+	articles active marks high low)
+    (with-current-buffer nntp-server-buffer
       (when result
 	(if (and dont-check
 		 (setq active (nth 2 (assoc group nnimap-current-infos))))
@@ -424,6 +431,11 @@
 	    low high group))))
       t)))
 
+(deffoo nnimap-request-delete-group (group &optional force server)
+  (when (nnimap-possibly-change-group nil server)
+    (with-current-buffer (nnimap-buffer)
+      (car (nnimap-command "DELETE %S" (utf7-encode group))))))
+
 (defun nnimap-get-flags (spec)
   (let ((articles nil)
 	elems)
@@ -460,10 +472,11 @@
 		    (nnimap-find-article-by-message-id
 		     internal-move-group message-id))))
 	(with-temp-buffer
-	  (let ((result (eval accept-form)))
-	    (when result
-	      (nnimap-delete-article article)
-	      result)))))))
+	  (when (nnimap-request-article article group server (current-buffer))
+	    (let ((result (eval accept-form)))
+	      (when result
+		(nnimap-delete-article article)
+		result))))))))
 
 (deffoo nnimap-request-expire-articles (articles group &optional server force)
   (cond
@@ -530,7 +543,8 @@
 				(mapconcat #'identity flags " ")))))))
 	;; Wait for the last command to complete to avoid later
 	;; syncronisation problems with the stream.
-	(nnimap-wait-for-response sequence)))))
+	(when sequence
+	  (nnimap-wait-for-response sequence))))))
 
 (deffoo nnimap-request-accept-article (group &optional server last)
   (when (nnimap-possibly-change-group nil server)
@@ -863,7 +877,9 @@
     (if (equal (caar response) "OK")
 	(cons t response)
       (nnheader-report 'nnimap "%s"
-		       (mapconcat #'identity (car response) " "))
+		       (mapconcat (lambda (a)
+				    (format "%s" a))
+				  (car response) " "))
       nil)))
 
 (defun nnimap-get-response (sequence)
@@ -972,7 +988,7 @@
 		 "BODY.PEEK[HEADER] BODY.PEEK"
 	       "RFC822.PEEK"))
 	    (if nnimap-split-download-body-default
-		""
+		"[]"
 	      "[1]")))
    t))