2008-01-14 Knut Anders Hatlen <kahatlen@gmail.com> (tiny change)
authorReiner Steib <Reiner.Steib@gmx.de>
Mon, 14 Jan 2008 23:11:24 +0000 (23:11 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Mon, 14 Jan 2008 23:11:24 +0000 (23:11 +0000)
* imap.el (imap-ping-server): New function.
(imap-opened): Call imap-ping-server.

lisp/ChangeLog
lisp/imap.el

index 09d8e61..c48aa16 100644 (file)
@@ -1,3 +1,8 @@
+2008-01-14  Knut Anders Hatlen  <kahatlen@gmail.com>  (tiny change)
+
+       * imap.el (imap-ping-server): New function.
+       (imap-opened): Call imap-ping-server.
+
 2008-01-11  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-art.el (gnus-article-describe-bindings): New function.
index 4f1ef94..dda64ac 100644 (file)
@@ -1157,7 +1157,16 @@ If BUFFER is nil then the current buffer is used."
        (buffer-live-p buffer)
        (with-current-buffer buffer
         (and imap-process
-             (memq (process-status imap-process) '(open run))))))
+             (memq (process-status imap-process) '(open run))
+             (imap-ping-server)))))
+
+(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."
+  (condition-case ()
+      (imap-ok-p (imap-send-command-wait "NOOP" buffer))
+    (error nil)))
 
 (defun imap-authenticate (&optional user passwd buffer)
   "Authenticate to server in BUFFER, using current buffer if nil.