disconnect from server.
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.87 2000/05/22 20:51:00 cph Exp $
+;;; $Id: imail-core.scm,v 1.88 2000/05/23 02:57:13 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
;; Probe FOLDER's server for changes. Useful as a check for new mail.
(define-generic probe-folder (folder))
+
+;; -------------------------------------------------------------------
+;; Return a symbol representing FOLDER's connection status. The
+;; returned value is one of the following symbols:
+;; ONLINE Open connection to the server.
+;; OFFLINE No connection to the server.
+;; NO-SERVER Folder is not server-based.
+
+(define-generic folder-connection-status (folder))
+
+;; -------------------------------------------------------------------
+;; Disconnect FOLDER from its associated server. The folder will
+;; automatically reconnect as needed.
+
+(define-generic disconnect-folder (folder))
\f
;;;; Message type
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.37 2000/05/22 20:32:37 cph Exp $
+;;; $Id: imail-file.scm,v 1.38 2000/05/23 02:57:18 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(close-folder folder))
(define-method probe-folder ((folder <file-folder>))
+ folder
+ unspecific)
+
+(define-method folder-connection-status ((folder <file-folder>))
+ folder
+ 'NO-SERVER)
+
+(define-method disconnect-folder ((folder <file-folder>))
folder
unspecific)
\ No newline at end of file
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.79 2000/05/23 00:37:57 cph Exp $
+;;; $Id: imail-imap.scm,v 1.80 2000/05/23 02:57:21 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method %close-folder ((folder <imap-folder>))
(let ((connection (imap-folder-connection folder)))
(maybe-close-imap-connection connection)
- (set-imap-connection-folder! connection #f)))
+ (set-imap-connection-folder! connection #f))
+ (folder-modified! folder 'STATUS))
(define-method folder-length ((folder <imap-folder>))
- (guarantee-imap-folder-open folder)
(imap-folder-n-messages folder))
(define-method %get-message ((folder <imap-folder>) index)
- (guarantee-imap-folder-open folder)
(vector-ref (imap-folder-messages folder) index))
(define-method first-unseen-message-index ((folder <imap-folder>))
- (guarantee-imap-folder-open folder)
(or (imap-folder-unseen folder) 0))
(define-method expunge-deleted-messages ((folder <imap-folder>))
(define-method probe-folder ((folder <imap-folder>))
(guarantee-imap-folder-open folder)
(imap:command:noop (imap-folder-connection folder)))
+
+(define-method folder-connection-status ((folder <imap-folder>))
+ (if (test-imap-connection-open (imap-folder-connection folder))
+ 'ONLINE
+ 'OFFLINE))
+
+(define-method disconnect-folder ((folder <imap-folder>))
+ (close-folder folder))
\f
;;;; IMAP command invocation
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.91 2000/05/23 02:26:01 cph Exp $
+;;; $Id: imail-top.scm,v 1.92 2000/05/23 02:57:28 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
\\[imail-expunge] Expunge deleted messages.
\\[imail-save-folder] Save the current folder.
+\\[imail-get-new-mail] Poll the server for changes.
+\\[imail-disconnect] Disconnect from the server.
\\[imail-quit] Quit IMAIL: save, then switch to another buffer.
\\[imail-mail] Mail a message (same as \\[mail-other-window]).
(define-key 'imail #\x 'imail-expunge)
(define-key 'imail #\g 'imail-get-new-mail)
+(define-key 'imail #\m-d 'imail-disconnect)
(define-key 'imail #\s 'imail-save-folder)
(define-key 'imail #\c-m-h 'imail-summary)
(index (message-index message)))
(and folder
(if index
- (let ((n (folder-length folder)))
+ (let ((n (folder-length folder))
+ (status (folder-connection-status folder)))
(string-append
+ (case status
+ ((ONLINE) " online")
+ ((OFFLINE) " offline")
+ (else ""))
" "
(number->string (+ 1 index))
"/"
message
#t
(not (get-property message 'FULL-HEADERS? #f))))))
+
+(define-command imail-disconnect
+ "Disconnect the selected IMAIL folder from its server.
+Has no effect on non-server-based folders."
+ ()
+ (lambda ()
+ (disconnect-folder (selected-folder))))
\f
(define-command imail-search
"Show message containing next match for given string.
IMAIL To-Do List
-$Id: todo.txt,v 1.39 2000/05/23 02:12:10 cph Exp $
+$Id: todo.txt,v 1.40 2000/05/23 02:57:49 cph Exp $
Bug fixes
---------
* Write M-x imail-resend.
-* Add an indication showing the connection status in the mode line.
-
* Add mail notification in mode line, active across the editor as long
as there is an IMAP connection open in some buffer.