From 0b44304696e1155cb384543c6b8973bcccc295c1 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 29 Jun 2000 17:51:06 +0000 Subject: [PATCH] Fix IMAP URL completion so that folders that both are selectable and have subfolders appear twice in the completions list, once with the hierarchy delimiter, and once without. --- v7/src/imail/imail-imap.scm | 33 ++++++++++++++++++++++----------- v7/src/imail/todo.txt | 11 +---------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 04536bdb5..bd212109a 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.126 2000/06/24 01:37:56 cph Exp $ +;;; $Id: imail-imap.scm,v 1.127 2000/06/29 17:51:06 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -255,16 +255,27 @@ (if-unique (car responses))))))) (define (imap-mailbox-completions mailbox url) - (map (lambda (response) - (let ((mailbox (imap:response:list-mailbox response)) - (delimiter (imap:response:list-delimiter response))) - (if (and delimiter - (memq '\NOSELECT (imap:response:list-flags response))) - (string-append mailbox delimiter) - mailbox))) - (with-open-imap-connection url - (lambda (connection) - (imap:command:list connection "" (string-append mailbox "%")))))) + (with-open-imap-connection url + (lambda (connection) + (let ((get-list + (lambda (prefix) + (imap:command:list connection "" (string-append prefix "%"))))) + (append-map! + (lambda (response) + (let ((flags (imap:response:list-flags response)) + (delimiter (imap:response:list-delimiter response)) + (mailbox (imap:response:list-mailbox response))) + (let ((tail + (if (or (not delimiter) (memq '\NOINFERIORS flags)) + '() + (let ((container (string-append mailbox delimiter))) + (if (pair? (get-list container)) + (list container) + '()))))) + (if (memq '\NOSELECT flags) + tail + (cons mailbox tail))))) + (get-list mailbox)))))) ;;;; Server connection diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 8005ee807..26d39cf93 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,18 +1,9 @@ IMAIL To-Do List -$Id: todo.txt,v 1.100 2000/06/29 03:46:05 cph Exp $ +$Id: todo.txt,v 1.101 2000/06/29 17:51:01 cph Exp $ Bug fixes --------- -* IMAP URL completion must handle folders that contain both messages - and subfolders differently. Such folders should appear twice in the - completion list: once with no delimiter suffix, and once with a - delimiter suffix. That way when the user completes such a folder, - the message "complete, but not unique" will be shown, and it will be - obvious there are subfolders. As it now stands, there's no way to - tell there are subfolders other than by adding the delimiter suffix - and re-completing. - * Must be able to handle malformed headers in incoming mail. Generating a low-level error in this situation is unacceptable. -- 2.25.1