diff options
| author | Trevor Murphy | 2015-01-26 07:56:37 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2015-01-26 07:56:37 +0000 |
| commit | 242354a23acf214ad06d4e3e7e5f5580c8b21d4a (patch) | |
| tree | 8a939498d116cc31c771a397a296d12fba843cf9 | |
| parent | dafb0ef852f88f535df5527def7516a13bf63c60 (diff) | |
| download | emacs-242354a23acf214ad06d4e3e7e5f5580c8b21d4a.tar.gz emacs-242354a23acf214ad06d4e3e7e5f5580c8b21d4a.zip | |
lisp/gnus/nnimap.el Allow using the Google X-GM-LABELS, if present
| -rw-r--r-- | lisp/gnus/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 20 |
2 files changed, 22 insertions, 4 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7ef526b4253..2f3f3753ebd 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-01-26 Trevor Murphy <trevor.m.murphy@gmail.com> | ||
| 2 | |||
| 3 | * nnimap.el (nnimap-header-parameters): Refactor and request | ||
| 4 | X-GM-LABELS if it's been announced. | ||
| 5 | (nnimap-transform-headers): Gather and output GM-LABELS. | ||
| 6 | |||
| 1 | 2015-01-26 Peder O. Klingenberg <peder@klingenberg.no> | 7 | 2015-01-26 Peder O. Klingenberg <peder@klingenberg.no> |
| 2 | 8 | ||
| 3 | * mm-decode.el (mm-display-part): Make non-string methods work. | 9 | * mm-decode.el (mm-display-part): Make non-string methods work. |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index ced55619881..8e81abcf9c0 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -166,14 +166,21 @@ textual parts.") | |||
| 166 | (nnimap-find-process-buffer nntp-server-buffer)) | 166 | (nnimap-find-process-buffer nntp-server-buffer)) |
| 167 | 167 | ||
| 168 | (defun nnimap-header-parameters () | 168 | (defun nnimap-header-parameters () |
| 169 | (format "(UID RFC822.SIZE BODYSTRUCTURE %s)" | 169 | (let (params) |
| 170 | (format | 170 | (push "UID" params) |
| 171 | (push "RFC822.SIZE" params) | ||
| 172 | (when (nnimap-capability "X-GM-EXT-1") | ||
| 173 | (push "X-GM-LABELS" params)) | ||
| 174 | (push "BODYSTRUCTURE" params) | ||
| 175 | (push (format | ||
| 171 | (if (nnimap-ver4-p) | 176 | (if (nnimap-ver4-p) |
| 172 | "BODY.PEEK[HEADER.FIELDS %s]" | 177 | "BODY.PEEK[HEADER.FIELDS %s]" |
| 173 | "RFC822.HEADER.LINES %s") | 178 | "RFC822.HEADER.LINES %s") |
| 174 | (append '(Subject From Date Message-Id | 179 | (append '(Subject From Date Message-Id |
| 175 | References In-Reply-To Xref) | 180 | References In-Reply-To Xref) |
| 176 | nnmail-extra-headers)))) | 181 | nnmail-extra-headers)) |
| 182 | params) | ||
| 183 | (format "%s" (nreverse params)))) | ||
| 177 | 184 | ||
| 178 | (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old) | 185 | (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old) |
| 179 | (when group | 186 | (when group |
| @@ -197,7 +204,7 @@ textual parts.") | |||
| 197 | 204 | ||
| 198 | (defun nnimap-transform-headers () | 205 | (defun nnimap-transform-headers () |
| 199 | (goto-char (point-min)) | 206 | (goto-char (point-min)) |
| 200 | (let (article lines size string) | 207 | (let (article lines size string labels) |
| 201 | (block nil | 208 | (block nil |
| 202 | (while (not (eobp)) | 209 | (while (not (eobp)) |
| 203 | (while (not (looking-at "\\* [0-9]+ FETCH")) | 210 | (while (not (looking-at "\\* [0-9]+ FETCH")) |
| @@ -232,6 +239,9 @@ textual parts.") | |||
| 232 | t) | 239 | t) |
| 233 | (match-string 1))) | 240 | (match-string 1))) |
| 234 | (beginning-of-line) | 241 | (beginning-of-line) |
| 242 | (when (search-forward "X-GM-LABELS" (line-end-position) t) | ||
| 243 | (setq labels (ignore-errors (read (current-buffer))))) | ||
| 244 | (beginning-of-line) | ||
| 235 | (when (search-forward "BODYSTRUCTURE" (line-end-position) t) | 245 | (when (search-forward "BODYSTRUCTURE" (line-end-position) t) |
| 236 | (let ((structure (ignore-errors | 246 | (let ((structure (ignore-errors |
| 237 | (read (current-buffer))))) | 247 | (read (current-buffer))))) |
| @@ -251,6 +261,8 @@ textual parts.") | |||
| 251 | (insert (format "Chars: %s\n" size))) | 261 | (insert (format "Chars: %s\n" size))) |
| 252 | (when lines | 262 | (when lines |
| 253 | (insert (format "Lines: %s\n" lines))) | 263 | (insert (format "Lines: %s\n" lines))) |
| 264 | (when labels | ||
| 265 | (insert (format "X-GM-LABELS: %s\n" labels))) | ||
| 254 | ;; Most servers have a blank line after the headers, but | 266 | ;; Most servers have a blank line after the headers, but |
| 255 | ;; Davmail doesn't. | 267 | ;; Davmail doesn't. |
| 256 | (unless (re-search-forward "^\r$\\|^)\r?$" nil t) | 268 | (unless (re-search-forward "^\r$\\|^)\r?$" nil t) |