;;; Code:
+(require 'poe)
+(require 'poem)
+(require 'pcustom)
(require 'mcharset)
+(require 'alist)
+
+(eval-when-compile (require 'cl)) ; list*
(eval-and-compile
- (defconst mime-library-product ["Chao" (1 13 0) "JR Fujinomori"]
+ (defconst mime-library-product ["SLIM" (1 13 6) "\e$BEg:jOB2N;R\e(B"]
"Product name, version number and code name of MIME-library package.")
)
(require 'custom)
-(eval-when-compile (require 'cl))
-
-(defgroup mime nil
+(defgroup mime '((default-mime-charset custom-variable))
"Emacs MIME Interfaces"
:group 'news
:group 'mail)
-(custom-handle-keyword 'default-mime-charset :group 'mime
- 'custom-variable)
-
(defcustom mime-uuencode-encoding-name-list '("x-uue" "x-uuencode")
"*List of encoding names for uuencode format."
:group 'mime
(require 'luna)
+(autoload 'mime-entity-content-type "mime")
+(autoload 'mime-parse-multipart "mime-parse")
+(autoload 'mime-parse-encapsulated "mime-parse")
+(autoload 'mime-entity-content "mime")
+
(luna-define-class mime-entity ()
(location
content-type children parent
(luna-define-internal-accessors 'mime-entity)
+(luna-define-method mime-entity-fetch-field ((entity mime-entity)
+ field-name)
+ (or (symbolp field-name)
+ (setq field-name (intern (capitalize (capitalize field-name)))))
+ (cdr (assq field-name
+ (mime-entity-original-header-internal entity))))
+
+(luna-define-method mime-entity-children ((entity mime-entity))
+ (let* ((content-type (mime-entity-content-type entity))
+ (primary-type (mime-content-type-primary-type content-type)))
+ (cond ((eq primary-type 'multipart)
+ (mime-parse-multipart entity)
+ )
+ ((and (eq primary-type 'message)
+ (memq (mime-content-type-subtype content-type)
+ '(rfc822 news external-body)
+ ))
+ (mime-parse-encapsulated entity)
+ ))
+ ))
-;;; @ message structure
-;;;
-
-(defvar mime-message-structure nil
- "Information about structure of message.
-Please use reference function `mime-entity-SLOT' to get value of SLOT.
-
-Following is a list of slots of the structure:
-
-node-id node-id (list of integers)
-content-type content-type (content-type)
-content-disposition content-disposition (content-disposition)
-encoding Content-Transfer-Encoding (string or nil)
-children entities included in this entity (list of entity)
-
-If an entity includes other entities in its body, such as multipart or
-message/rfc822, `mime-entity' structures of them are included in
-`children', so the `mime-entity' structure become a tree.")
-
-(make-variable-buffer-local 'mime-message-structure)
+(luna-define-method mime-insert-text-content ((entity mime-entity))
+ (insert
+ (decode-mime-charset-string (mime-entity-content entity)
+ (or (mime-content-type-parameter
+ (mime-entity-content-type entity)
+ "charset")
+ default-mime-charset)
+ 'CRLF)
+ ))
;;; @ for mm-backend
(cdr args)))
`(luna-define-method ,name ,args ,@body)
))
+
(put 'mm-define-method 'lisp-indent-function 'defun)
-(eval-when-compile
- (defmacro eval-module-depended-macro (module definition)
- (condition-case nil
- (progn
- (require (eval module))
- definition)
- (error `(eval-after-load ,(symbol-name (eval module)) ',definition))
- ))
- )
+(def-edebug-spec mm-define-method
+ (&define name ((arg symbolp)
+ [&rest arg]
+ [&optional ["&optional" arg &rest arg]]
+ &optional ["&rest" arg]
+ )
+ def-body))
-(eval-module-depended-macro
- 'edebug
- (def-edebug-spec mm-define-method
- (&define name ((arg symbolp)
- [&rest arg]
- [&optional ["&optional" arg &rest arg]]
- &optional ["&rest" arg]
- )
- def-body))
- )
+
+;;; @ message structure
+;;;
+
+(defvar mime-message-structure nil
+ "Information about structure of message.
+Please use reference function `mime-entity-SLOT' to get value of SLOT.
+
+Following is a list of slots of the structure:
+
+node-id node-id (list of integers)
+content-type content-type (content-type)
+content-disposition content-disposition (content-disposition)
+encoding Content-Transfer-Encoding (string or nil)
+children entities included in this entity (list of entity)
+
+If an entity includes other entities in its body, such as multipart or
+message/rfc822, `mime-entity' structures of them are included in
+`children', so the `mime-entity' structure become a tree.")
+
+(make-variable-buffer-local 'mime-message-structure)
+
+(make-obsolete-variable 'mime-message-structure "should not use it.")
;;; @ for mel-backend