Mercurial > emacs
comparison lisp/net/imap.el @ 87859:1bb83c2fe524
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1001
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 20 Jan 2008 05:17:57 +0000 |
parents | 107ccd98fa12 |
children | 9f0819c582f0 |
comparison
equal
deleted
inserted
replaced
87858:f176bf2c0e6d | 87859:1bb83c2fe524 |
---|---|
1148 (when (imap-opened buffer) | 1148 (when (imap-opened buffer) |
1149 (setq imap-mailbox-data (make-vector imap-mailbox-prime 0))) | 1149 (setq imap-mailbox-data (make-vector imap-mailbox-prime 0))) |
1150 (when imap-stream | 1150 (when imap-stream |
1151 buffer)))) | 1151 buffer)))) |
1152 | 1152 |
1153 (defcustom imap-ping-server t | |
1154 "If non-nil, check if IMAP is open. | |
1155 See the function `imap-ping-server'." | |
1156 :version "23.0" ;; No Gnus | |
1157 :group 'imap | |
1158 :type 'boolean) | |
1159 | |
1153 (defun imap-opened (&optional buffer) | 1160 (defun imap-opened (&optional buffer) |
1154 "Return non-nil if connection to imap server in BUFFER is open. | 1161 "Return non-nil if connection to imap server in BUFFER is open. |
1155 If BUFFER is nil then the current buffer is used." | 1162 If BUFFER is nil then the current buffer is used." |
1156 (and (setq buffer (get-buffer (or buffer (current-buffer)))) | 1163 (and (setq buffer (get-buffer (or buffer (current-buffer)))) |
1157 (buffer-live-p buffer) | 1164 (buffer-live-p buffer) |
1158 (with-current-buffer buffer | 1165 (with-current-buffer buffer |
1159 (and imap-process | 1166 (and imap-process |
1160 (memq (process-status imap-process) '(open run)))))) | 1167 (memq (process-status imap-process) '(open run)) |
1168 (if imap-ping-server | |
1169 (imap-ping-server) | |
1170 t))))) | |
1171 | |
1172 (defun imap-ping-server (&optional buffer) | |
1173 "Ping the IMAP server in BUFFER with a \"NOOP\" command. | |
1174 Return non-nil if the server responds, and nil if it does not | |
1175 respond. If BUFFER is nil, the current buffer is used." | |
1176 (condition-case () | |
1177 (imap-ok-p (imap-send-command-wait "NOOP" buffer)) | |
1178 (error nil))) | |
1161 | 1179 |
1162 (defun imap-authenticate (&optional user passwd buffer) | 1180 (defun imap-authenticate (&optional user passwd buffer) |
1163 "Authenticate to server in BUFFER, using current buffer if nil. | 1181 "Authenticate to server in BUFFER, using current buffer if nil. |
1164 It uses the authenticator specified when opening the server. If the | 1182 It uses the authenticator specified when opening the server. If the |
1165 authenticator requires username/passwords, they are queried from the | 1183 authenticator requires username/passwords, they are queried from the |