;;; nnimap.el --- IMAP interface for Gnus
-;; Copyright (C) 2010-2011 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Simon Josefsson <simon@josefsson.org>
(stream-type (plist-get props :type)))
(when (and stream (not (memq (process-status stream) '(open run))))
(setq stream nil))
+
+ (when (and (fboundp 'set-network-process-option) ;; Not in XEmacs.
+ (fboundp 'process-type) ;; Emacs 22 doesn't provide it.
+ (eq (process-type stream) 'network))
+ ;; Use TCP-keepalive so that connections that pass through a NAT
+ ;; router don't hang when left idle.
+ (set-network-process-option stream :keepalive t))
+
(setf (nnimap-process nnimap-object) stream)
(setf (nnimap-stream-type nnimap-object) stream-type)
(if (not stream)
((eq action 'set) ""))
(mapconcat #'identity flags " ")))))))
;; Wait for the last command to complete to avoid later
- ;; syncronisation problems with the stream.
+ ;; synchronization problems with the stream.
(when sequence
(nnimap-wait-for-response sequence))))))
t)))
(deffoo nnimap-retrieve-group-data-early (server infos)
- (when (nnimap-possibly-change-group nil server)
+ (when (and (nnimap-possibly-change-group nil server)
+ infos)
(with-current-buffer (nnimap-buffer)
(erase-buffer)
(setf (nnimap-group nnimap-object) nil)
(deffoo nnimap-finish-retrieve-group-infos (server infos sequences)
(when (and sequences
+ (nnimap-possibly-change-group nil server)
;; Check that the process is still alive.
(get-buffer-process (nnimap-buffer))
(memq (process-status (get-buffer-process (nnimap-buffer)))
- '(open run))
- (nnimap-possibly-change-group nil server))
+ '(open run)))
(with-current-buffer (nnimap-buffer)
;; Wait for the final data to trickle in.
(when (nnimap-wait-for-response (if (eq (cadar sequences) 'qresync)
(cdr (assq 'uidvalidity (gnus-info-params info)))))
(and old-uidvalidity
(not (equal old-uidvalidity uidvalidity))
- (> start-article 1)))
+ (or (not start-article)
+ (> start-article 1))))
(gnus-group-remove-parameter info 'uidvalidity)
(gnus-group-remove-parameter info 'modseq))
;; We have the data needed to update.
(declare-function gnus-fetch-headers "gnus-sum"
(articles &optional limit force-new dependencies))
+(autoload 'nnir-search-thread "nnir")
+
(deffoo nnimap-request-thread (header &optional group server)
(when group
(setq group (nnimap-decode-gnus-group group)))
(nnimap-command "UID SEARCH %s" cmd))))
(when result
(gnus-fetch-headers
- (and (car result) (delete 0 (mapcar #'string-to-number
- (cdr (assoc "SEARCH" (cdr result))))))
+ (and (car result)
+ (delete 0 (mapcar #'string-to-number
+ (cdr (assoc "SEARCH" (cdr result))))))
nil t))))))
(defun nnimap-possibly-change-group (group server)