From: Chris Hanson Date: Fri, 2 Jun 2000 02:23:37 +0000 (+0000) Subject: Implement URL-EXISTS? for IMAP folders. X-Git-Tag: 20090517-FFI~3635 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=b82cc5e9f918c876eb6b08013478f1be8db696cb;p=mit-scheme.git Implement URL-EXISTS? for IMAP folders. --- diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index c904763a4..417745181 100644 --- a/v7/src/imail/imail-imap.scm +++ b/v7/src/imail/imail-imap.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-imap.scm,v 1.100 2000/06/02 01:52:46 cph Exp $ +;;; $Id: imail-imap.scm,v 1.101 2000/06/02 02:23:19 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -84,8 +84,16 @@ "")) (define-method url-exists? ((url )) - url - #t) + (not + (condition? + (ignore-errors + (lambda () + (with-open-imap-connection url + (lambda (connection) + (imap:command:status connection + (imap-url-mailbox url) + '(MESSAGES)))) + #t))))) (define (compatible-imap-urls? url1 url2) ;; Can URL1 and URL2 both be accessed from the same IMAP session? @@ -1123,6 +1131,9 @@ (lambda () (imap:command:no-response connection 'SELECT mailbox)))) +(define (imap:command:status connection mailbox items) + (imap:command:no-response connection 'STATUS mailbox items)) + (define (imap:command:fetch connection index items) (imap:command:single-response imap:response:fetch? connection 'FETCH (+ index 1) items)) diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 753f3e51c..b209df808 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,5 +1,5 @@ IMAIL To-Do List -$Id: todo.txt,v 1.53 2000/05/30 13:01:05 cph Exp $ +$Id: todo.txt,v 1.54 2000/06/02 02:23:37 cph Exp $ Bug fixes --------- @@ -8,9 +8,6 @@ Bug fixes message that is written, when the target folder is not being visited. [I haven't seen this lately. Maybe it's fixed?] -* Implement operation for IMAP: URL-EXISTS?. [Is this desirable? - A straightforward implementation requires contacting the server.] - * Must be able to handle malformed headers in incoming mail. Generating a low-level error in this situation is unacceptable.