;;; imap.el --- imap library
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
;; Author: Simon Josefsson <jas@pdc.kth.se>
;; Keywords: mail
(when imap-stream
buffer))))
+(defcustom imap-ping-server t
+ "If non-nil, check if IMAP is open.
+See the function `imap-ping-server'."
+ :version "23.0" ;; No Gnus
+ :group 'imap
+ :type 'boolean)
+
(defun imap-opened (&optional buffer)
"Return non-nil if connection to imap server in BUFFER is open.
If BUFFER is nil then the current buffer is used."
(with-current-buffer buffer
(and imap-process
(memq (process-status imap-process) '(open run))
- (imap-ping-server)))))
+ (if imap-ping-server
+ (imap-ping-server)
+ t)))))
(defun imap-ping-server (&optional buffer)
- "Ping the imap server in BUFFER with a noop command. Return non-nil
-if the server responds, and nil if it does not respond. If BUFFER is
-nil, the current buffer is used."
+ "Ping the IMAP server in BUFFER with a \"NOOP\" command.
+Return non-nil if the server responds, and nil if it does not
+respond. If BUFFER is nil, the current buffer is used."
(condition-case ()
(imap-ok-p (imap-send-command-wait "NOOP" buffer))
(error nil)))