[gnus git] branch master updated: m0-11-118-g8f60081 =1= Allow using the Google X-GM-LABELS, if present

Lars <[email protected]> Mon, 26 Jan 2015 08:17:26 +0100
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  8f6008165e9f96274f439bc7b5a01852db3ac6ac (commit)
      from  aaa6f741d48c765c5af9312004d6d49e14c9304c (commit)


- Log -----------------------------------------------------------------
commit 8f6008165e9f96274f439bc7b5a01852db3ac6ac
Author: Trevor Murphy <[email protected]>
Date:   Mon Jan 26 18:16:30 2015 +1100

    Allow using the Google X-GM-LABELS, if present
    
    * nnimap.el (nnimap-header-parameters): Refactor and request
    X-GM-LABELS if it's been announced.
    (nnimap-transform-headers): Gather and output GM-LABELS.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 11f1282..acaf487 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-26  Trevor Murphy  <[email protected]>
+
+	* nnimap.el (nnimap-header-parameters): Refactor and request
+	X-GM-LABELS if it's been announced.
+	(nnimap-transform-headers): Gather and output GM-LABELS.
+
 2014-12-30  Peder O. Klingenberg  <[email protected]>
 
 	* mm-decode.el (mm-display-part): Make non-string methods work.
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index ced5561..8e81abc 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -166,14 +166,21 @@ textual parts.")
   (nnimap-find-process-buffer nntp-server-buffer))
 
 (defun nnimap-header-parameters ()
-  (format "(UID RFC822.SIZE BODYSTRUCTURE %s)"
-	  (format
+  (let (params)
+    (push "UID" params)
+    (push "RFC822.SIZE" params)
+    (when (nnimap-capability "X-GM-EXT-1")
+      (push "X-GM-LABELS" params))
+    (push "BODYSTRUCTURE" params)
+    (push (format
 	   (if (nnimap-ver4-p)
 	       "BODY.PEEK[HEADER.FIELDS %s]"
 	     "RFC822.HEADER.LINES %s")
 	   (append '(Subject From Date Message-Id
 			     References In-Reply-To Xref)
-		   nnmail-extra-headers))))
+		   nnmail-extra-headers))
+	  params)
+    (format "%s" (nreverse params))))
 
 (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
   (when group
@@ -197,7 +204,7 @@ textual parts.")
 
 (defun nnimap-transform-headers ()
   (goto-char (point-min))
-  (let (article lines size string)
+  (let (article lines size string labels)
     (block nil
       (while (not (eobp))
 	(while (not (looking-at "\\* [0-9]+ FETCH"))
@@ -232,6 +239,9 @@ textual parts.")
 				      t)
 		   (match-string 1)))
 	(beginning-of-line)
+	(when (search-forward "X-GM-LABELS" (line-end-position) t)
+	  (setq labels (ignore-errors (read (current-buffer)))))
+	(beginning-of-line)
 	(when (search-forward "BODYSTRUCTURE" (line-end-position) t)
 	  (let ((structure (ignore-errors
 			     (read (current-buffer)))))
@@ -251,6 +261,8 @@ textual parts.")
 	  (insert (format "Chars: %s\n" size)))
 	(when lines
 	  (insert (format "Lines: %s\n" lines)))
+	(when labels
+	  (insert (format "X-GM-LABELS: %s\n" labels)))
 	;; Most servers have a blank line after the headers, but
 	;; Davmail doesn't.
 	(unless (re-search-forward "^\r$\\|^)\r?$" nil t)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    6 ++++++
 lisp/nnimap.el |   20 ++++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project