(browse-url): Required.
[gnus] / lisp / nnimap.el
index 70aa573..1785fd9 100644 (file)
@@ -316,7 +316,7 @@ textual parts.")
                   (setq port (or nnimap-server-port "imap"))
                   'starttls))
                '("imap"))
-              ((eq nnimap-stream 'ssl)
+              ((memq nnimap-stream '(ssl tls))
                (open-tls-stream
                 "*nnimap*" (current-buffer) nnimap-address
                 (setq port
@@ -424,7 +424,10 @@ textual parts.")
     result))
 
 (deffoo nnimap-close-server (&optional server)
-  t)
+  (when (nnoo-change-server 'nnimap server nil)
+    (ignore-errors
+      (delete-process (get-buffer-process (nnimap-buffer))))
+    t))
 
 (deffoo nnimap-request-close ()
   t)
@@ -623,10 +626,11 @@ textual parts.")
                (nnimap-update-infos marks (list info)))
              (goto-char (point-max))
              (let ((uidnext (nth 5 (car marks))))
-               (setq high (if uidnext
-                              (1- uidnext)
-                            (nth 3 (car marks)))
-                     low (or (nth 4 (car marks)) uidnext)))))
+               (setq high (or (if uidnext
+                                   (1- uidnext)
+                                 (nth 3 (car marks)))
+                               0)
+                     low (or (nth 4 (car marks)) uidnext 1)))))
          (erase-buffer)
          (insert
           (format
@@ -912,6 +916,16 @@ textual parts.")
                                  (or highest exists)))))))))
        t))))
 
+(deffoo nnimap-request-newgroups (date &optional server)
+  (nnimap-possibly-change-group nil server)
+  (with-current-buffer nntp-server-buffer
+    (erase-buffer)
+    (dolist (group (with-current-buffer (nnimap-buffer)
+                    (nnimap-get-groups)))
+      (unless (assoc group nnimap-current-infos)
+       ;; Insert dummy numbers here -- they don't matter.
+       (insert (format "%S 0 1 y\n" group))))))
+
 (deffoo nnimap-retrieve-group-data-early (server infos)
   (when (nnimap-possibly-change-group nil server)
     (with-current-buffer (nnimap-buffer)
@@ -990,7 +1004,9 @@ textual parts.")
       (nnimap-update-info info (cdr (assoc group flags))))))
 
 (defun nnimap-update-info (info marks)
-  (when marks
+  (when (and marks
+            ;; Ignore groups with no UIDNEXT values.
+            (nth 4 marks))
     (destructuring-bind (existing flags high low uidnext start-article
                                  permanent-flags) marks
       (let ((group (gnus-info-group info))