(nnimap-get-groups): Reimplement to work with folded lines.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 26 Nov 2010 01:00:28 +0000 (02:00 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 26 Nov 2010 01:00:28 +0000 (02:00 +0100)
lisp/ChangeLog
lisp/nnimap.el

index da23969..1f565fb 100644 (file)
@@ -5,6 +5,7 @@
        (nnimap-find-uid-response): New function.
        (nnimap-request-accept-article): Use the UID returned, if any.
        (nnimap-request-move-article): Use the UID returned, if any.
+       (nnimap-get-groups): Reimplement to work with folded lines.
 
 2010-11-25  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index ebf1a55..63a1115 100644 (file)
@@ -1013,15 +1013,22 @@ textual parts.")
     (replace-match "\r\n" t t)))
 
 (defun nnimap-get-groups ()
-  (let ((result (nnimap-command "LIST \"\" \"*\""))
+  (erase-buffer)
+  (let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
        groups)
-    (when (car result)
-      (dolist (line (cdr result))
-       (when (and (equal (car line) "LIST")
-                  (not (and (caadr line)
-                            (string-match "noselect" (caadr line)))))
-         (push (car (last line)) groups)))
-      (nreverse groups))))
+    (nnimap-wait-for-response sequence)
+    (subst-char-in-region (point-min) (point-max)
+                         ?\\ ?% t)
+    (goto-char (point-min))
+    (nnimap-unfold-quoted-lines)
+    (goto-char (point-min))
+    (while (search-forward "* LIST " nil t)
+      (let ((flags (read (current-buffer)))
+           (separator (read (current-buffer)))
+           (group (read (current-buffer))))
+       (unless (member '%NoSelect flags)
+         (push group groups))))
+    (nreverse groups)))
 
 (deffoo nnimap-request-list (&optional server)
   (nnimap-possibly-change-group nil server)