Don't mark nnimap articles as read on a server hangup
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 14 Feb 2015 05:42:41 +0000 (16:42 +1100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 14 Feb 2015 05:42:41 +0000 (16:42 +1100)
* nnimap.el (nnimap-retrieve-headers): If the server closes connection
during header retrieval, error out instead of interpreting the data in
the buffer as the only messages there.  This way, we don't mark
articles as read on a server hangup (bug#19035).

lisp/ChangeLog
lisp/nnimap.el

index 9f93a30..91643d1 100644 (file)
@@ -1,5 +1,10 @@
 2015-02-14  Lars Ingebrigtsen  <larsi@gnus.org>
 
+       * nnimap.el (nnimap-retrieve-headers): If the server closes connection
+       during header retrieval, error out instead of interpreting the data in
+       the buffer as the only messages there.  This way, we don't mark
+       articles as read on a server hangup (bug#19035).
+
        * mm-decode.el (mm-head-p): New function.
        (mm-display-part): Go to a blank line when inserting parts internally.
 
index e7f91b7..d8b49f7 100644 (file)
@@ -196,6 +196,8 @@ textual parts.")
          (nnimap-article-ranges (gnus-compress-sequence articles))
          (nnimap-header-parameters))
         t)
+       (unless (process-live-p (get-buffer-process (current-buffer)))
+         (error "Server closed connection")) 
        (nnimap-transform-headers)
        (nnheader-remove-cr-followed-by-lf))
       (insert-buffer-substring