X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=mime-def.el;h=a429c45970d350fc01242a319084420f0ea79a36;hb=9eb4dabcaa53a3142363229e46e651a0c37e8b53;hp=5ff449e88a9e2b381d8defb230bb4bc8f20cb78c;hpb=981d54ad86e55f98ccc443b6ff1a5990c0921fe9;p=elisp%2Fflim.git diff --git a/mime-def.el b/mime-def.el index 5ff449e..a429c45 100644 --- a/mime-def.el +++ b/mime-def.el @@ -1,8 +1,10 @@ -;;; mime-def.el --- definition module about MIME -*- coding: iso-8859-4; -*- +;;; mime-def.el --- definition module about MIME -*- coding: ctext; -*- -;; Copyright (C) 1995,96,97,98,99,2000 Free Software Foundation, Inc. +;; Copyright (C) 1995,96,97,98,99,2000,2001,2002,2003,2004 +;; Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko +;; Shuhei KOBAYASHI ;; Keywords: definition, MIME, multimedia, mail, news ;; This file is part of FLIM (Faithful Library about Internet Message). @@ -19,8 +21,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Code: @@ -28,13 +30,10 @@ (require 'mcharset) (require 'alist) -(eval-when-compile - (require 'cl) ; list* - (require 'luna) ; luna-arglist-to-arguments - ) +(eval-when-compile (require 'luna)) ; luna-arglist-to-arguments (eval-and-compile - (defconst mime-library-product ["FLIM" (1 14 2) "Yagi-Nishiguchi"] + (defconst mime-library-product ["LIMIT" (1 14 9) "Domyoji"] ;; D-Dòmyòji-A "Product name, version number and code name of MIME-library package.")) (defmacro mime-product-name (product) @@ -84,6 +83,12 @@ :type '(choice (integer :tag "Limit (bytes)") (const :tag "Don't limit" nil))) +(defcustom mime-header-accept-quoted-encoded-words nil + "*Accept encoded-words in quoted-strings." + :group 'mime-header + :type 'boolean) + + ;;; @@@ encoding ;;; @@ -129,36 +134,28 @@ If method is nil, this field will not be encoded." (defalias 'char-int 'identity)) -;;; @ about STD 11 +;;; @ MIME constants ;;; -(eval-and-compile - (defconst std11-quoted-pair-regexp "\\\\.") - (defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n)) - (defconst std11-qtext-regexp - (eval-when-compile - (concat "[^" std11-non-qtext-char-list "]")))) -(defconst std11-quoted-string-regexp - (eval-when-compile - (concat "\"" - (regexp-* - (regexp-or std11-qtext-regexp std11-quoted-pair-regexp)) - "\""))) +(defconst mime-tspecial-char-list + '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=)) +(defconst mime-token-regexp + (concat "[^" mime-tspecial-char-list "\000-\040]+")) +(defconst mime-attribute-char-regexp + (concat "[^" mime-tspecial-char-list "\000-\040" + "*'%" ; introduced in RFC 2231. + "]")) +(defconst mime-charset-regexp + (concat "[^" mime-tspecial-char-list "\000-\040" + "*'%" ; should not include "%"? + "]+")) -;;; @ about MIME -;;; +;; More precisely, length of "[A-Za-z]+" is limited to at most 8. +;; (defconst mime-language-regexp "[A-Za-z]+\\(-[A-Za-z]+\\)*") +(defconst mime-language-regexp "[-A-Za-z]+") -(eval-and-compile - (defconst mime-tspecial-char-list - '(?\] ?\[ ?\( ?\) ?< ?> ?@ ?, ?\; ?: ?\\ ?\" ?/ ?? ?=))) -(defconst mime-token-regexp - (eval-when-compile - (concat "[^" mime-tspecial-char-list "\000-\040]+"))) -(defconst mime-charset-regexp mime-token-regexp) - -(defconst mime-media-type/subtype-regexp - (concat mime-token-regexp "/" mime-token-regexp)) +(defconst mime-encoding-regexp mime-token-regexp) ;;; @@ base64 / B @@ -204,10 +201,9 @@ If method is nil, this field will not be encoded." ;;; (defsubst make-mime-content-type (type subtype &optional parameters) - (list* (cons 'type type) - (cons 'subtype subtype) - (nreverse parameters)) - ) + (cons (cons 'type type) + (cons (cons 'subtype subtype) + parameters))) (defsubst mime-content-type-primary-type (content-type) "Return primary-type of CONTENT-TYPE." @@ -215,15 +211,15 @@ If method is nil, this field will not be encoded." (defsubst mime-content-type-subtype (content-type) "Return subtype of CONTENT-TYPE." - (cdr (cadr content-type))) + (cdr (car (cdr content-type)))) (defsubst mime-content-type-parameters (content-type) "Return parameters of CONTENT-TYPE." - (cddr content-type)) + (cdr (cdr content-type))) (defsubst mime-content-type-parameter (content-type parameter) "Return PARAMETER value of CONTENT-TYPE." - (cdr (assoc parameter (mime-content-type-parameters content-type)))) + (cdr (assoc parameter (cdr (cdr content-type))))) (defsubst mime-type/subtype-string (type &optional subtype) @@ -237,6 +233,10 @@ If method is nil, this field will not be encoded." ;;; @ Content-Disposition ;;; +(defsubst make-mime-content-disposition (type &optional parameters) + (cons (cons 'type type) + parameters)) + (defsubst mime-content-disposition-type (content-disposition) "Return disposition-type of CONTENT-DISPOSITION." (cdr (car content-disposition))) @@ -325,7 +325,7 @@ service." (or (fboundp sym) (fset sym (symbol-function f)) )))) - + (defsubst mel-copy-backend (src-backend dst-backend) (let ((services mel-service-list)) (while services @@ -394,6 +394,39 @@ variable and (nth 1 (car (last ARGS))) is name of backend (encoding)." )))) +;;; @ unlimited patch +;;; + +;; unlimited patch by simm-emacs@fan.gr.jp +;; Mon, 10 Jan 2000 12:55:49 +0900 +(defvar mime-decode-unlimited t + "If non-nil, LIMIT decodes where RFC-illegal position. +If nil, LIMIT behaves as FLIM.") + +(defvar default-mime-charset-unlimited 'auto-detect + "Default Value of MIME-charset. +It is used when MIME-charset is not specified. +It must be symbol. + +If its value is 'auto-detect, (mime-insert-text-content) detects +Japanese coding-system and convert it. + +If its value is nil, use `default-mime-charset' instead.") + +(static-if (boundp 'nonascii-translation-table) + (defconst nonascii-translation-table-unlimited + (let ((i 0) (vec (make-vector 256 0))) + (while (< i 256) + (aset vec i i) + (setq i (1+ i))) + vec) + "Translation table to convert non-ASCII unibyte codes to multibyte. +This is used for no-converting unibyte text to multibyte, +and for inserting character codes specified by number. + +See `nonascii-translation-table'.")) + + ;;; @ end ;;;