;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.138 2000/06/08 03:24:01 cph Exp $
+;;; $Id: imail-top.scm,v 1.139 2000/06/08 04:16:07 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-generic insert-mime-message-part
(message body enclosure selector mark))
+(define-method insert-mime-message-part
+ (message (body <mime-body>) enclosure selector mark)
+ (insert-mime-message-binary message body enclosure selector mark))
+
(define-method insert-mime-message-part
(message (body <mime-body-multipart>) enclosure selector mark)
enclosure
(insert-newline mark)))
(insert-mime-message-part message (car parts) body `(,@selector ,i)
mark))))))
+\f
+(define-method insert-mime-message-part
+ (message (body <mime-body-message>) enclosure selector mark)
+ enclosure
+ (insert-string
+ (header-fields->string
+ (maybe-reformat-headers
+ (string->header-fields
+ (message-mime-body-part message `(,@selector HEADER) #t))
+ mark))
+ mark)
+ (insert-newline mark)
+ (insert-mime-message-part message
+ (mime-body-message-body body)
+ body
+ selector
+ mark))
(define-method insert-mime-message-part
(message (body <mime-body-text>) enclosure selector mark)
- (if (or (eq? (mime-body-subtype body) 'PLAIN)
- (let ((charset (mime-body-parameter body 'CHARSET "us-ascii")))
- (or (string-ci=? charset "us-ascii")
- (re-string-match "\\`iso-8859-[0-9]+\\'" charset #t))))
+ (if (re-string-match (string-append "\\`"
+ (regexp-group "us-ascii"
+ "iso-8859-[0-9]+"
+ "windows-[0-9]+")
+ "\\'")
+ (mime-body-parameter body 'CHARSET "us-ascii")
+ #t)
(let ((text
(message-mime-body-part
message
(guarantee-newline mark))
(insert-mime-message-binary message body enclosure selector mark)))
\f
-(define-method insert-mime-message-part
- (message (body <mime-body-message>) enclosure selector mark)
- enclosure
- (insert-string
- (header-fields->string
- (maybe-reformat-headers
- (string->header-fields
- (message-mime-body-part message `(,@selector HEADER) #t))
- mark))
- mark)
- (insert-newline mark)
- (insert-mime-message-part message
- (mime-body-message-body body)
- body
- selector
- mark))
-
-(define-method insert-mime-message-part
- (message (body <mime-body>) enclosure selector mark)
- (insert-mime-message-binary message body enclosure selector mark))
-
(define (insert-mime-message-binary message body enclosure selector mark)
message enclosure
(let ((start (mark-right-inserting-copy mark)))
(insert-string "<IMAIL-ATTACHMENT " mark)
(let ((column (mark-column mark)))
- (insert-string "name=" mark)
- (insert (mime-attachment-name body selector) mark)
- (insert-newline mark)
- (change-column column mark)
+ (let ((name (mime-attachment-name body selector #f)))
+ (if name
+ (begin
+ (insert-string "name=" mark)
+ (insert name mark)
+ (insert-newline mark)
+ (change-column column mark))))
(insert-string "type=" mark)
(insert (mime-body-type body) mark)
(insert-string "/" mark)
(insert (mime-body-subtype body) mark)
(insert-newline mark)
+ (if (eq? (mime-body-type body) 'TEXT)
+ (begin
+ (change-column column mark)
+ (insert-string "charset=" mark)
+ (insert (mime-body-parameter body 'CHARSET "us-ascii") mark)
+ (insert-newline mark)))
(change-column column mark)
(insert-string "encoding=" mark)
(insert (mime-body-one-part-encoding body) mark)
(mark-temporary! start))
(insert-newline mark))
-(define (mime-attachment-name body selector)
+(define (mime-attachment-name body selector provide-default?)
(or (mime-body-parameter body 'NAME #f)
- (string-append "unnamed-attachment-"
- (if (null? selector)
- "0"
- (decorated-string-append
- "" "." ""
- (map (lambda (n) (number->string (+ n 1)))
- selector))))))
+ (and provide-default?
+ (string-append "unnamed-attachment-"
+ (if (null? selector)
+ "0"
+ (decorated-string-append
+ "" "." ""
+ (map (lambda (n) (number->string (+ n 1)))
+ selector)))))))
(define (mark-mime-attachment mark)
(region-get mark 'IMAIL-MIME-ATTACHMENT #f))
(let ((alist
(uniquify-mime-attachment-names
(map (lambda (b.s)
- (cons (mime-attachment-name (car b.s) (cdr b.s))
+ (cons (mime-attachment-name (car b.s) (cdr b.s) #t)
b.s))
attachments))))
(prompt-for-alist-value "Save attachment"
(let ((filename (mime-body-disposition-filename body)))
(and filename
(list
- (merge-pathnames (filter-mime-attachment-filename filename)
+ (merge-pathnames
+ (filter-mime-attachment-filename filename)
(or (buffer-get buffer 'IMAIL-MIME-ATTACHMENT-DIRECTORY #f)
(buffer-default-directory buffer)))))))))
(if (or (not (file-exists? filename))
IMAIL To-Do List
-$Id: todo.txt,v 1.67 2000/06/08 02:03:30 cph Exp $
+$Id: todo.txt,v 1.68 2000/06/08 04:16:20 cph Exp $
Bug fixes
---------
attribute and uses the message indexes. It should pay attention to
UNSEEN and to UIDNEXT to figure out what it needs to do.
-* Restrict set of recognized character sets to US-ASCII, ISO-8859, and
- Windows-<n> for some value of <n>. Messages in other sets should be
- treated as unknowns; character set should appear in attachment
- descriptor.
-
* Treat messages in unrecognized encodings as type
application/octet-stream.
folder is locally modified. Meaningful only for file folders. Hook
up the save-folder code into M-x save-some-buffers.
-* Add command to rename folders.
-
* Add mail notification in mode line, active across the editor as long
as there is an IMAP connection open in some buffer.