;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.266 2001/06/04 19:25:09 cph Exp $
+;;; $Id: imail-top.scm,v 1.267 2001/06/12 00:58:03 cph Exp $
;;;
;;; Copyright (c) 1999-2001 Massachusetts Institute of Technology
;;;
(directory-pathname (file-folder-pathname folder))
(user-homedir-pathname)))
(receive-modification-events folder notice-folder-event)
+ (add-kill-buffer-hook buffer disassociate-buffer-from-folder)
(add-kill-buffer-hook buffer delete-associated-buffers)
- (add-kill-buffer-hook buffer stop-probe-folder-thread)
- (start-probe-folder-thread buffer))))
+ (if (eq? (folder-connection-status folder) 'ONLINE)
+ (start-probe-folder-thread folder)))))
+
+(define (disassociate-buffer-from-folder buffer)
+ (without-interrupts
+ (lambda ()
+ (let ((folder (buffer-get buffer 'IMAIL-FOLDER #f)))
+ (if folder
+ (begin
+ (ignore-modification-events folder notice-folder-event)
+ (remove-property! folder 'BUFFER)))))))
(define (delete-associated-buffers folder-buffer)
(for-each (lambda (buffer)
;;;; Folder-event handling
(define (notice-folder-event folder type parameters)
- type parameters
+ parameters
+ (if (eq? type 'STATUS)
+ (case (folder-connection-status folder)
+ ((ONLINE) (start-probe-folder-thread folder))
+ ((OFFLINE) (stop-probe-folder-thread folder))))
(maybe-add-command-suffix! notice-folder-modifications folder))
(define (notice-folder-modifications folder)
\f
;;;; Probe-folder thread
-(define (start-probe-folder-thread buffer)
- (stop-probe-folder-thread buffer)
+(define (start-probe-folder-thread folder)
+ (stop-probe-folder-thread folder)
(without-interrupts
(lambda ()
- (let ((folder (buffer-get buffer 'IMAIL-FOLDER #f))
- (interval (ref-variable imail-update-interval #f)))
- (if (and folder interval)
+ (let ((interval (ref-variable imail-update-interval #f)))
+ (if interval
(store-property! folder
'PROBE-REGISTRATION
(start-standard-polling-thread
(define ((probe-folder-output-processor folder))
(let ((folder (weak-car folder)))
(and folder
- (eq? (folder-connection-status folder) 'ONLINE)
- (begin
- (probe-folder folder)
- #t))))
-
-(define (stop-probe-folder-thread buffer)
+ (if (and (imail-folder->buffer folder #f)
+ (eq? (folder-connection-status folder) 'ONLINE))
+ (begin
+ (probe-folder folder)
+ #t)
+ (begin
+ (stop-probe-folder-thread folder)
+ #f)))))
+
+(define (stop-probe-folder-thread folder)
(without-interrupts
(lambda ()
- (let ((folder (buffer-get buffer 'IMAIL-FOLDER #f)))
- (if folder
+ (let ((holder (get-property folder 'PROBE-REGISTRATION #f)))
+ (if holder
(begin
- (let ((holder (get-property folder 'PROBE-REGISTRATION #f)))
- (if holder
- (stop-standard-polling-thread holder)))
+ (stop-standard-polling-thread holder)
(remove-property! folder 'PROBE-REGISTRATION)))))))
\f
;;;; Message insertion procedures
IMAIL To-Do List
-$Id: todo.txt,v 1.130 2001/06/04 19:25:11 cph Exp $
+$Id: todo.txt,v 1.131 2001/06/12 00:58:15 cph Exp $
Bug fixes
---------
means toggle sense of marked lines (*t also does this, perhaps is
preferable). S and H do links. P prints file.
-* The PROBE-FOLDER thread is left running even when connection to
- server is severed. In fact it is running as long as the buffer is
- around. It should be started when the connection is established,
- and stopped when the connection is dropped.
-
* The RENAME-FOLDER operation must change the folder object to refer
to the new URL rather than the old. The operation must close the
folder if it is open, then discard all the state, and finally