X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-def.el;h=276dadd582afa1cd12d87d0d7f7e3339b501886e;hb=f64e139c5380c9b142e90dc9c308bf525a45c8a2;hp=571558b79d249ab306d934a4d3146ea51c543500;hpb=bd85ba4ad2c5fcfb4440de15342cb365b097c581;p=elisp%2Fflim.git diff --git a/mime-def.el b/mime-def.el index 571558b..276dadd 100644 --- a/mime-def.el +++ b/mime-def.el @@ -26,10 +26,16 @@ ;;; 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 ["FLIM" (1 13 2) "Kasanui"] "Product name, version number and code name of MIME-library package.") ) @@ -55,16 +61,11 @@ (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 @@ -211,6 +212,11 @@ (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 @@ -224,29 +230,36 @@ (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) - -(make-obsolete-variable 'mime-message-structure "should not use it.") +(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 @@ -273,28 +286,40 @@ message/rfc822, `mime-entity' structures of them are included in (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