;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.114 2000/06/05 21:30:40 cph Exp $
+;;; $Id: imail-imap.scm,v 1.115 2000/06/10 20:17:57 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(substring-downcase! mailbox 0 6)
mailbox))
(else mailbox)))
-
+\f
(define-method url-body ((url <imap-url>))
(make-imap-url-string (imap-url-user-id url)
(imap-url-host url)
(port define standard initial-value #f)
(greeting define standard initial-value #f)
(capabilities define standard initial-value '())
+ (namespace define standard initial-value #f)
(sequence-number define standard initial-value 0)
(response-queue define accessor initializer (lambda () (cons '() '())))
(folder define standard initial-value #f)
(lambda ()
(set-imap-connection-greeting! connection #f)
(set-imap-connection-capabilities! connection '())
+ (set-imap-connection-namespace! connection #f)
(set-imap-connection-sequence-number! connection 0)
(let ((queue (imap-connection-response-queue connection)))
(set-car! queue '())
(imail-ui:delete-stored-pass-phrase url)
(error "Unable to log in:"
(imap:response:response-text-string response))))))
+ (if (memq 'NAMESPACE (imap-connection-capabilities connection))
+ (imap:command:namespace connection))
#t)))
\f
(define (test-imap-connection-open connection)
(receiver (imap-folder-connection folder))))))
\f
;;; These reflectors are needed to guarantee that we read the
-;;; appropriate information from the server. Normally most message
-;;; slots are filled in by READ-MESSAGE-HEADERS!, but it's possible
-;;; for READ-MESSAGE-HEADERS! to be interrupted, leaving unfilled
-;;; slots. Also, we don't want to fill the BODY slot until it is
-;;; requested, as the body might be very large.
+;;; appropriate information from the server. Some message slots are
+;;; filled in by READ-MESSAGE-HEADERS!, but it's possible for
+;;; READ-MESSAGE-HEADERS! to be interrupted, leaving unfilled slots.
(let ((accessor (slot-accessor <imap-message> 'UID))
(initpred (slot-initpred <imap-message> 'UID)))
'(ENVELOPE))))
(reflector imap-message-bodystructure 'BODYSTRUCTURE
(lambda (message initpred)
- (guarantee-slot-initialized message initpred "bodystructure"
+ (guarantee-slot-initialized message initpred "body structure"
'(BODYSTRUCTURE)))))
\f
;;;; MIME support
(define (imap:command:capability connection)
(imap:command:no-response connection 'CAPABILITY))
+(define (imap:command:namespace connection)
+ (imap:command:no-response connection 'NAMESPACE))
+
(define (imap:command:login connection user-id pass-phrase)
((imail-ui:message-wrapper "Logging in as " user-id)
(lambda ()
connection
(imap:response:capabilities response))
#f)
+ ((imap:response:namespace? response)
+ (set-imap-connection-namespace! connection response)
+ #f)
((imap:response:list? response)
(eq? command 'LIST))
((imap:response:lsub? response)
;;; -*-Scheme-*-
;;;
-;;; $Id: imap-response.scm,v 1.33 2000/06/01 20:07:07 cph Exp $
+;;; $Id: imap-response.scm,v 1.34 2000/06/10 20:18:06 cph Exp $
;;;
;;; Copyright (c) 2000 Massachusetts Institute of Technology
;;;
((SEARCH) (read-search-response port))
((STATUS) (read-status-response port))
((CAPABILITY) (read-capability-response port))
+ ((NAMESPACE) (read-namespace-response port))
(else (error "Malformed response code:" x))))))))
(define (read-tagged-response tag port)
(define (read-capability-response port)
(read-open-list read-interned-atom port))
+(define (read-namespace-response port)
+ (discard-known-char #\space port)
+ (let ((ns1 (read-generic port)))
+ (discard-known-char #\space port)
+ (let ((ns2 (read-generic port)))
+ (discard-known-char #\space port)
+ (list ns1 ns2 (read-generic port)))))
+
(define (read-response-text port)
(discard-known-char #\space port)
(let ((code
(define (imap:response:flags? response) (eq? (car response) 'FLAGS))
(define (imap:response:list? response) (eq? (car response) 'LIST))
(define (imap:response:lsub? response) (eq? (car response) 'LSUB))
+(define (imap:response:namespace? response) (eq? (car response) 'NAMESPACE))
(define (imap:response:no? response) (eq? (car response) 'NO))
(define (imap:response:ok? response) (eq? (car response) 'OK))
(define (imap:response:preauth? response) (eq? (car response) 'PREAUTH))
(define imap:response:list-delimiter cadr)
(define imap:response:list-mailbox caddr)
(define imap:response:list-flags cdddr)
+(define imap:response:namespace-personal cadr)
+(define imap:response:namespace-other caddr)
+(define imap:response:namespace-shared cadddr)
(define imap:response:recent-count cadr)
(define imap:response:search-indices cdr)