From: yamaoka Date: Tue, 19 Dec 2000 12:51:09 +0000 (+0000) Subject: Synch with `flim-1_14'. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=582e35b6197eedd8a5fb3307c346378616b94691;p=elisp%2Fflim.git Synch with `flim-1_14'. --- diff --git a/ChangeLog b/ChangeLog index 64cf472..3d5f5ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,84 @@ +2000-12-19 MORIOKA Tomohiko + + * FLIM-1.14-API.en: New file. + + * smtp.el (smtp-open-connection-function): Add autoload cookie. + + * qmtp.el (qmtp-open-connection-function): Add autoload cookie. + + * mime.el (mime-entity-children): Add DOC. + (mime-entity-node-id): Add DOC. + (mime-entity-content-type): Add DOC. + (mime-entity-content-disposition): Add DOC. + (mime-entity-encoding): Add DOC. + +2000-12-19 MORIOKA Tomohiko + + * mime.el (mime-encode-field-body): Add autoload setting. + + * eword-encode.el (mime-encode-field-body): Renamed from + `eword-encode-field-body'; declare `eword-encode-field-body' as + obsolete alias. + (mime-encode-header-in-buffer): Use `mime-encode-field-body' + instead of `eword-encode-field-body'. + +2000-12-19 MORIOKA Tomohiko + + * mime.el (mime-encode-header-in-buffer): Renamed from + `eword-encode-header'. + + * mmdbuffer.el: Deleted. + + * mime-def.el (mime-header): New group. + (mime-field-decoding-max-size): New user option [moved from + eword-decode.el]. + (mime-field-encoding-method-alist): New user option [moved from + eword-encode.el]. + + * eword-encode.el (eword-field-encoding-method-alist): Moved to + mime-def.el and renamed to `mime-field-encoding-method-alist'. + (mime-header-charset-encoding-alist): Renamed from + `eword-charset-encoding-alist'. + (mime-header-default-charset-encoding): New variable. + (ew-find-charset-rule): Use + `mime-header-default-charset-encoding'. + (eword-in-subject-p): Declare as obsolete function. + (mime-encode-header-in-buffer): Renamed from + `eword-encode-header'; declare `eword-encode-header' as obsolete + alias. + + * eword-decode.el (eword-max-size-to-decode): Moved to mime-def.el + and renamed to `mime-field-decoding-max-size'. + (mime-header-lexical-analyzer): Renamed from + `eword-lexical-analyzer'; switch to variable. + +2000-12-19 MORIOKA Tomohiko + + * eword-encode.el (eword-encode-default-start-column): Switch to + variable. + +2000-12-17 MORIOKA Tomohiko + + * mime-parse.el: Require `luna'. + +2000-12-16 MORIOKA Tomohiko + + * eword-encode.el Use `find-charset-string' instead of + `find-non-ascii-charset-string'. + (eword-encode-addr-seq-to-rword-list): Don't use `butlast'. + (eword-encode-header): Use `find-charset-region' instead of + `find-non-ascii-charset-string'. + +2000-12-15 MORIOKA Tomohiko + + * mime/eword-decode.el: Don't use + `define-obsolete-function-alias'; so `eword-decode-header' is + deleted. + +2000-12-15 TAKAHASHI Kaoru + + * Makefile (tar): Use `cvs tag -R' instead of `cvs tag -RF'. + 2000-12-15 Daiki Ueno * smtp.el (smtp-send-buffer): Pass the BUFFER argument to diff --git a/FLIM-1.14-API.en b/FLIM-1.14-API.en new file mode 100644 index 0000000..44f01f1 --- /dev/null +++ b/FLIM-1.14-API.en @@ -0,0 +1,503 @@ +* MIME entity + +** How to use + +(require 'mime) + + +** Level 1 features + +[Function] mime-open-entity (type location) + Open an entity and return it. + +TYPE is representation-type. + +LOCATION is location of entity. Specification of it is depended on +representation-type. + + +[Function] mime-entity-children (entity) + Return list of entities included in the ENTITY. + + +[Function] mime-entity-node-id (entity) + Return node-id of ENTITY. + + +[Function] mime-find-entity-from-node-id (entity-node-id message) + Return entity from ENTITY-NODE-ID in MESSAGE. + (mime-find-entity-from-number (reverse entity-node-id) message)) + + +[Function] mime-find-entity-from-content-id (cid message) + Return entity from CID in MESSAGE. + + +[Function] mime-insert-entity (entity) + Insert header and body of ENTITY at point. + + +[Function] mime-write-entity (entity filename) + Write header and body of ENTITY into FILENAME. + + +[Function] mime-entity-body (entity) + Return network representation of ENTITY body. + + +[Function] mime-insert-entity-body (entity) + Insert network representation of ENTITY body at point. + + +[Function] mime-write-entity-body (entity filename) + Write body of ENTITY into FILENAME. + + +[Function] mime-entity-content (entity) + Return content of ENTITY as byte sequence (string). + + +[Function] mime-insert-entity-content (entity) + Insert content of ENTITY at point. + + +[Function] mime-write-entity-content (entity filename) + Write content of ENTITY into FILENAME. + + +[Function] mime-insert-text-content (entity) + Insert decoded text body of ENTITY. + + +[Function] mime-entity-fetch-field (entity field-name) + Return the value of the ENTITY's header field whose type is +FIELD-NAME. + + +** Level 2 features + +[Function] mime-entity-content-type (entity) + Return content-type of ENTITY. + + +[Function] mime-entity-content-disposition (entity) + Return content-disposition of ENTITY. + + +[Function] mime-entity-encoding (entity &optional default-encoding) + Return content-transfer-encoding of ENTITY. + +If the ENTITY does not have Content-Transfer-Encoding field, this +function returns DEFAULT-ENCODING. If it is nil, "7bit" is used as +default value. + + +[Function] mime-entity-number (entity) + Return entity-number of ENTITY. + (reverse (mime-entity-node-id-internal entity))) + + +[Function] mime-entity-parent (entity &optional message) + Return mother entity of ENTITY. + +If MESSAGE is specified, it is regarded as root entity. + + +[Function] mime-root-entity-p (entity &optional message) + Return t if ENTITY is root-entity (message). + +If MESSAGE is specified, it is regarded as root entity. + + +[Function] mime-find-root-entity (entity) + Return root entity of ENTITY. + + +[Function] mime-entity-read-field (entity field-name) + Parse FIELD-NAME field in header of ENTITY, and return the result. + +Format of result is depended on kind of field. For non-structured +field, this function returns string. For structured field, it returns +list corresponding with structure of the field. + +Strings in the result will be converted to internal representation of +Emacs. + +If FIELD-NAME field is not found, this function returns nil. + + +[Function] mime-insert-header (entity &optional invisible-fields + visible-fields) + Insert before point a decoded header of ENTITY. + + +[Function] mime-entity-name (entity) + Return name of the ENTITY. + + +[Function] mime-entity-filename (entity) + Return filename of ENTITY. + + +** Level 3 features + +[Function] mime-entity-cooked-p (entity) + Return non-nil if contents of ENTITY has been already + code-converted. + +[Function] mime-entity-set-content-type (entity content-type) + Set ENTITY's content-type to CONTENT-TYPE. + + +[Function] mime-entity-set-encoding (entity encoding) + Set ENTITY's content-transfer-encoding to ENCODING. + + +* encoded-word decoder + +** How to use + +(require 'mime) + + +** Level 1 features + +[Function] mime-decode-header-in-buffer (&optional code-conversion separator) + Decode MIME encoded-words in header fields. + +If CODE-CONVERSION is nil, it decodes only encoded-words. If it is +mime-charset, it decodes non-ASCII bit patterns as the mime-charset. +Otherwise it decodes non-ASCII bit patterns as the +default-mime-charset. + +If SEPARATOR is not nil, it is used as header separator. + + +[Function] mime-decode-header-in-region (start end + &optional code-conversion) + Decode MIME encoded-words in region between START and END. + +If CODE-CONVERSION is nil, it decodes only encoded-words. If it is +mime-charset, it decodes non-ASCII bit patterns as the mime-charset. +Otherwise it decodes non-ASCII bit patterns as the +default-mime-charset. + + +[Function] mime-decode-field-body (field-body field-name + &optional mode max-column) + Decode FIELD-BODY as FIELD-NAME in MODE, and return the result. + +Optional argument MODE must be `plain', `wide', `summary' or `nov'. +Default mode is `summary'. + +If MODE is `wide' and MAX-COLUMN is non-nil, the result is folded with +MAX-COLUMN. + +Non MIME encoded-word part in FILED-BODY is decoded with +`default-mime-charset'. + + +** Level 2 features + +[Function] mime-set-field-decoder (field &rest specs) + Set decoder of FIELD. + +SPECS must be like `MODE1 DECODER1 MODE2 DECODER2 ...'. + +Each mode must be `nil', `plain', `wide', `summary' or `nov'. +If mode is `nil', corresponding decoder is set up for every modes. + + +[Macro] mime-find-field-presentation-method (name) + Return field-presentation-method from NAME. + +NAME must be `plain', `wide', `summary' or `nov'. + + +[Function] mime-find-field-decoder (field &optional mode) + Return function to decode field-body of FIELD in MODE. + +Optional argument MODE must be object or name of +field-presentation-method. Name of field-presentation-method must be +`plain', `wide', `summary' or `nov'. +Default value of MODE is `summary'. + + +[Function] mime-update-field-decoder-cache (field mode &optional function) + Update field decoder cache `mime-field-decoder-cache'. + + +* encoded-word encoder + +** How to use + +(require 'mime) + + +** Level 1 features + +[Function] mime-encode-header-in-buffer (&optional code-conversion) + Encode header fields to network representation, such as MIME encoded-word. + +It refer variable `mime-field-encoding-method-alist'. + + +[Function] mime-encode-field-body (field-body field-name) + Encode FIELD-BODY as FIELD-NAME, and return the result. + +A lexical token includes non-ASCII character is encoded as MIME +encoded-word. ASCII token is not encoded. + + +* Content-Transfer-Encoding + +** How to use + +(require 'mel) + + +** Level 1 features + +[Function] mime-encode-region (start end encoding) + Encode region START to END of current buffer using ENCODING. + +ENCODING must be string. + + +[Function] mime-decode-region (start end encoding) + Decode region START to END of current buffer using ENCODING. + +ENCODING must be string. + + +[Function] mime-decode-string (string encoding) + Decode STRING using ENCODING. + +ENCODING must be string. If ENCODING is found in +`mime-string-decoding-method-alist' as its key, this function decodes +the STRING by its value. + + +[Function] mime-insert-encoded-file (filename encoding) + Insert file FILENAME encoded by ENCODING format. + + +[Function] mime-write-decoded-region (start end filename encoding) + Decode and write current region encoded by ENCODING into FILENAME. + +START and END are buffer positions. + + +* Mailcap + +** How to use + +(require 'mime-conf) + + +** Level 1 features + +[Function] mime-parse-mailcap-buffer (&optional buffer order) + Parse BUFFER as a mailcap, and return the result. + +If optional argument ORDER is a function, result is sorted by it. +If optional argument ORDER is not specified, result is sorted original +order. Otherwise result is not sorted. + + +[Variable] mime-mailcap-file (default value is "~/.mailcap") + File name of user's mailcap file. + + +[Function] mime-parse-mailcap-file (&optional filename order) + Parse FILENAME as a mailcap, and return the result. + +If optional argument ORDER is a function, result is sorted by it. +If optional argument ORDER is not specified, result is sorted original +order. Otherwise result is not sorted. + + +[Function] mime-format-mailcap-command (mtext situation) + Return formated command string from MTEXT and SITUATION. + +MTEXT is a command text of mailcap specification, such as +view-command. + +SITUATION is an association-list about information of entity. Its key +may be: + + 'type primary media-type + 'subtype media-subtype + 'filename filename + STRING parameter of Content-Type field + + +* MIME Field parsing + +** How to use + +(require 'mime) + + +** Level 2 features + +[Variable] mime-field-parser-alist + Alist to specify field parser. + + +[Function] mime-parse-Content-Type (string) + Parse STRING as field-body of Content-Type field. + +Return value is + (PRIMARY-TYPE SUBTYPE (NAME1 . VALUE1)(NAME2 . VALUE2) ...) +or nil. PRIMARY-TYPE and SUBTYPE are symbol and NAME_n and VALUE_n +are string. + + +[Function] mime-read-Content-Type () + Read field-body of Content-Type field from current-buffer, +and return parsed it. Format of return value is as same as +`mime-parse-Content-Type'. + + +[Function] mime-parse-Content-Disposition (string) + Parse STRING as field-body of Content-Disposition field. + + +[Function] mime-read-Content-Disposition () + Read field-body of Content-Disposition field from current-buffer, +and return parsed it. + + +[Function] mime-parse-Content-Transfer-Encoding (string) + Parse STRING as field-body of Content-Transfer-Encoding field. + + +[Function] mime-read-Content-Transfer-Encoding (&optional default-encoding) + Read field-body of Content-Transfer-Encoding field from +current-buffer, and return it. + +If is is not found, return DEFAULT-ENCODING. + + +[Function] mime-parse-msg-id (tokens) + Parse TOKENS as msg-id of Content-Id or Message-Id field. + + +[Function] mime-uri-parse-cid (string) + Parse STRING as cid URI. + + +* MIME message parsing + +** How to use + +(require 'mime) + + +** Level 3 features + +[Function] mime-parse-buffer (&optional buffer representation-type) + Parse BUFFER as a MIME message. + +If buffer is omitted, it parses current-buffer. + + +* STD 11 parsing + +** How to use + +(require 'std11) + + +** Level 1 features + +[Function] std11-fetch-field (name) + Return the value of the header field NAME. + +The buffer is expected to be narrowed to just the headers of the message. + + +[Function] std11-narrow-to-header (&optional boundary) + Narrow to the message header. + +If BOUNDARY is not nil, it is used as message header separator. + + +[Function] std11-field-body (name &optional boundary) + Return the value of the header field NAME. + +If BOUNDARY is not nil, it is used as message header separator. + + +[Function] std11-unfold-string (string) + Unfold STRING as message header field. + + +** Level 2 features + +[Function] std11-lexical-analyze (string &optional analyzer start) + Analyze STRING as lexical tokens of STD 11. + + +[Function] std11-address-string (address) + Return string of address part from parsed ADDRESS of RFC 822. + + +[Function] std11-full-name-string (address) + Return string of full-name part from parsed ADDRESS of RFC 822. + + +[Function] std11-msg-id-string (msg-id) + Return string from parsed MSG-ID of RFC 822. + + +[Function] std11-fill-msg-id-list-string (string &optional column) + Fill list of msg-id in STRING, and return the result. + + +[Function] std11-parse-address-string (string) + Parse STRING as mail address. + + +[Function] std11-parse-addresses-string (string) + Parse STRING as mail address list. + + +[Function] std11-parse-msg-id-string (string) + Parse STRING as msg-id. + + +[Function] std11-parse-msg-ids-string (string) + Parse STRING as `*(phrase / msg-id)'. + + +[Function] std11-extract-address-components (string) + Extract full name and canonical address from STRING. + +Returns a list of the form (FULL-NAME CANONICAL-ADDRESS). +If no name can be extracted, FULL-NAME will be nil. + + +* SMTP + +** How to use + +(require 'smtp) + + +** Level 1 features + +[Function] smtp-send-buffer (sender recipients buffer) + + +* QMTP + +** How to use + +(require 'qmtp) + + +** Level 1 features + +[Function] qmtp-send-buffer (sender recipients buffer) diff --git a/Makefile b/Makefile index 12d4325..8895e20 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,7 @@ clean: tar: cvs commit - sh -c 'cvs tag -RF $(PACKAGE)-`echo $(VERSION) | tr . _`; \ + sh -c 'cvs tag -R $(PACKAGE)-`echo $(VERSION) | tr . _`; \ cd /tmp; \ cvs -d :pserver:anonymous@cvs.m17n.org:/cvs/root \ export -d $(PACKAGE)-$(VERSION) \ diff --git a/eword-decode.el b/eword-decode.el index 1dd428a..21ed55c 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -38,16 +38,6 @@ (eval-when-compile (require 'cl)) ; list*, pop -(defgroup eword-decode nil - "Encoded-word decoding" - :group 'mime) - -(defcustom eword-max-size-to-decode 1000 - "*Max size to decode header field." - :group 'eword-decode - :type '(choice (integer :tag "Limit (bytes)") - (const :tag "Don't limit" nil))) - ;;; @ MIME encoded-word definition ;;; @@ -143,8 +133,8 @@ decode the charset included in it, it is not decoded." start-column &optional max-column start) - (if (and eword-max-size-to-decode - (> (length string) eword-max-size-to-decode)) + (if (and mime-field-decoding-max-size + (> (length string) mime-field-decoding-max-size)) string (or max-column (setq max-column fill-column)) @@ -471,8 +461,8 @@ If SEPARATOR is not nil, it is used as header separator." (point-max))) code-conversion)) -(define-obsolete-function-alias 'eword-decode-header - 'mime-decode-header-in-buffer) +;; (define-obsolete-function-alias 'eword-decode-header +;; 'mime-decode-header-in-buffer) ;;; @ encoded-word decoder @@ -554,7 +544,7 @@ as a version of Net$cape)." "*Max position of eword-lexical-analyze-cache. It is max size of eword-lexical-analyze-cache - 1.") -(defcustom eword-lexical-analyzer +(defvar mime-header-lexical-analyzer '(eword-analyze-quoted-string eword-analyze-domain-literal eword-analyze-comment @@ -574,9 +564,7 @@ format. Previous function is preferred to next function. If a function returns nil, next function is used. Otherwise the return value will -be the result." - :group 'eword-decode - :type '(repeat function)) +be the result.") (defun eword-analyze-quoted-string (string start &optional must-unfold) (let ((p (std11-check-enclosure string ?\" ?\" nil start))) @@ -694,7 +682,7 @@ be the result." dest ret) (while (< start len) (setq ret - (let ((rest eword-lexical-analyzer) + (let ((rest mime-header-lexical-analyzer) func r) (while (and (setq func (car rest)) (null diff --git a/eword-encode.el b/eword-encode.el index f7111c1..71ebd75 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -33,39 +33,9 @@ ;;; @ variables ;;; -(defgroup eword-encode nil - "Encoded-word encoding" - :group 'mime) - -(defcustom eword-field-encoding-method-alist - '(("X-Nsubject" . iso-2022-jp-2) - ("Newsgroups" . nil) - ("Message-ID" . nil) - (t . mime) - ) - "*Alist to specify field encoding method. -Its key is field-name, value is encoding method. - -If method is `mime', this field will be encoded into MIME format. - -If method is a MIME-charset, this field will be encoded as the charset -when it must be convert into network-code. - -If method is `default-mime-charset', this field will be encoded as -variable `default-mime-charset' when it must be convert into -network-code. - -If method is nil, this field will not be encoded." - :group 'eword-encode - :type '(repeat (cons (choice :tag "Field" - (string :tag "Name") - (const :tag "Default" t)) - (choice :tag "Method" - (const :tag "MIME conversion" mime) - (symbol :tag "non-MIME conversion") - (const :tag "no-conversion" nil))))) - -(defvar eword-charset-encoding-alist +;; User options are defined in mime-def.el. + +(defvar mime-header-charset-encoding-alist '((us-ascii . nil) (iso-8859-1 . "Q") (iso-8859-2 . "Q") @@ -89,6 +59,8 @@ If method is nil, this field will not be encoded." (utf-8 . "B") )) +(defvar mime-header-default-charset-encoding "Q") + ;;; @ encoded-text encoder ;;; @@ -187,10 +159,10 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (defun ew-find-charset-rule (charsets) (if charsets (let* ((charset (find-mime-charset-by-charsets charsets)) - (encoding (cdr (or (assq charset eword-charset-encoding-alist) - '(nil . "Q"))))) - (list charset encoding) - ))) + (encoding + (cdr (or (assq charset mime-header-charset-encoding-alist) + (cons charset mime-header-default-charset-encoding))))) + (list charset encoding)))) (defun tm-eword::words-to-ruled-words (wl &optional mode) (mapcar (function @@ -401,7 +373,7 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (append dest (list (let ((ret (ew-find-charset-rule - (find-non-ascii-charset-string str)))) + (find-charset-string str)))) (make-ew-rword str (car ret)(nth 1 ret) 'phrase) ) @@ -464,7 +436,8 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is (if (or (eq pname 'spaces) (eq pname 'comment)) (nconc dest (list (list (cdr token) nil nil))) - (nconc (butlast dest) + (nconc (nreverse (cdr (reverse dest))) + ;; (butlast dest) (list (list (concat (car (car (last dest))) (cdr token)) @@ -575,10 +548,8 @@ MODE is allows `text', `comment', `phrase' or nil. Default value is ;;; @ application interfaces ;;; -(defcustom eword-encode-default-start-column 10 - "Default start column if it is omitted." - :group 'eword-encode - :type 'integer) +(defvar eword-encode-default-start-column 10 + "Default start column if it is omitted.") (defun eword-encode-string (string &optional column mode) "Encode STRING as encoded-words, and return the result. @@ -621,7 +592,7 @@ Optional argument COLUMN is start-position of the field." (or column eword-encode-default-start-column) (eword-encode-split-string string 'text)))) -(defun eword-encode-field-body (field-body field-name) +(defun mime-encode-field-body (field-body field-name) "Encode FIELD-BODY as FIELD-NAME, and return the result. A lexical token includes non-ASCII character is encoded as MIME encoded-word. ASCII token is not encoded." @@ -640,27 +611,25 @@ encoded-word. ASCII token is not encoded." Resent-Sender To Resent-To Cc Resent-Cc Bcc Resent-Bcc Dcc)) - (eword-encode-address-list field-body start) - ) + (eword-encode-address-list field-body start)) ((eq field-name 'In-Reply-To) - (eword-encode-in-reply-to field-body start) - ) + (eword-encode-in-reply-to field-body start)) ((memq field-name '(Mime-Version User-Agent)) - (eword-encode-structured-field-body field-body start) - ) + (eword-encode-structured-field-body field-body start)) (t - (eword-encode-unstructured-field-body field-body start) - )) - ))) + (eword-encode-unstructured-field-body field-body start)))))) +(defalias 'eword-encode-field-body 'mime-encode-field-body) +(make-obsolete 'eword-encode-field-body 'mime-encode-field-body) (defun eword-in-subject-p () (let ((str (std11-field-body "Subject"))) (if (and str (string-match eword-encoded-word-regexp str)) str))) +(make-obsolete 'eword-in-subject-p "Don't use it.") (defsubst eword-find-field-encoding-method (field-name) (setq field-name (downcase field-name)) - (let ((alist eword-field-encoding-method-alist)) + (let ((alist mime-field-encoding-method-alist)) (catch 'found (while alist (let* ((pair (car alist)) @@ -670,13 +639,14 @@ encoded-word. ASCII token is not encoded." (throw 'found (cdr pair)) )) (setq alist (cdr alist))) - (cdr (assq t eword-field-encoding-method-alist)) + (cdr (assq t mime-field-encoding-method-alist)) ))) -(defun eword-encode-header (&optional code-conversion) +;;;###autoload +(defun mime-encode-header-in-buffer (&optional code-conversion) "Encode header fields to network representation, such as MIME encoded-word. -It refer variable `eword-field-encoding-method-alist'." +It refer variable `mime-field-encoding-method-alist'." (interactive "*") (save-excursion (save-restriction @@ -688,7 +658,7 @@ It refer variable `eword-field-encoding-method-alist'." (setq bbeg (match-end 0) field-name (buffer-substring (match-beginning 0) (1- bbeg)) end (std11-field-end)) - (and (find-non-ascii-charset-region bbeg end) + (and (delq 'ascii (find-charset-region bbeg end)) (let ((method (eword-find-field-encoding-method (downcase field-name)))) (cond ((eq method 'mime) @@ -696,9 +666,8 @@ It refer variable `eword-field-encoding-method-alist'." (buffer-substring-no-properties bbeg end) )) (delete-region bbeg end) - (insert (eword-encode-field-body field-body - field-name)) - )) + (insert (mime-encode-field-body field-body + field-name)))) (code-conversion (let ((cs (or (mime-charset-to-coding-system @@ -709,6 +678,8 @@ It refer variable `eword-field-encoding-method-alist'." )) )) ))) +(defalias 'eword-encode-header 'mime-encode-header-in-buffer) +(make-obsolete 'eword-encode-header 'mime-encode-header-in-buffer) ;;; @ end diff --git a/mime-def.el b/mime-def.el index 1da89bc..dfe1ccd 100644 --- a/mime-def.el +++ b/mime-def.el @@ -70,6 +70,54 @@ :type '(repeat string)) +;;; @@ for encoded-word +;;; + +(defgroup mime-header nil + "Header representation, specially encoded-word" + :group 'mime) + +;;; @@@ decoding +;;; + +(defcustom mime-field-decoding-max-size 1000 + "*Max size to decode header field." + :group 'mime-header + :type '(choice (integer :tag "Limit (bytes)") + (const :tag "Don't limit" nil))) + +;;; @@@ encoding +;;; + +(defcustom mime-field-encoding-method-alist + '(("X-Nsubject" . iso-2022-jp-2) + ("Newsgroups" . nil) + ("Message-ID" . nil) + (t . mime) + ) + "*Alist to specify field encoding method. +Its key is field-name, value is encoding method. + +If method is `mime', this field will be encoded into MIME format. + +If method is a MIME-charset, this field will be encoded as the charset +when it must be convert into network-code. + +If method is `default-mime-charset', this field will be encoded as +variable `default-mime-charset' when it must be convert into +network-code. + +If method is nil, this field will not be encoded." + :group 'mime-header + :type '(repeat (cons (choice :tag "Field" + (string :tag "Name") + (const :tag "Default" t)) + (choice :tag "Method" + (const :tag "MIME conversion" mime) + (symbol :tag "non-MIME conversion") + (const :tag "no-conversion" nil))))) + + ;;; @ required functions ;;; diff --git a/mime-parse.el b/mime-parse.el index d6d3d23..daa0e11 100644 --- a/mime-parse.el +++ b/mime-parse.el @@ -25,6 +25,7 @@ ;;; Code: (require 'mime-def) +(require 'luna) (require 'std11) (autoload 'mime-entity-body-buffer "mime") diff --git a/mime.el b/mime.el index a3da250..a2ac434 100644 --- a/mime.el +++ b/mime.el @@ -33,8 +33,12 @@ (eval-and-compile +(autoload 'mime-encode-header-in-buffer "eword-encode" + "Encode header fields to network representation, such as MIME encoded-word.") + (autoload 'eword-encode-header "eword-encode" "Encode header fields to network representation, such as MIME encoded-word.") +(make-obsolete 'eword-encode-header 'mime-encode-header-in-buffer) (autoload 'mime-parse-Content-Type "mime-parse" "Parse STRING as field-body of Content-Type field.") @@ -65,6 +69,10 @@ current-buffer, and return it.") ) +(autoload 'mime-encode-field-body "eword-encode" + "Encode FIELD-BODY as FIELD-NAME, and return the result.") + + ;;; @ Entity Representation and Implementation ;;; @@ -88,10 +96,12 @@ representation-type." ;;; (defun mime-entity-children (entity) + "Return list of entities included in the ENTITY." (or (mime-entity-children-internal entity) (luna-send entity 'mime-entity-children entity))) (defun mime-entity-node-id (entity) + "Return node-id of ENTITY." (mime-entity-node-id-internal entity)) (defun mime-entity-number (entity) @@ -264,6 +274,7 @@ If MESSAGE is specified, it is regarded as root entity." ;; (make-obsolete 'mime-fetch-field 'mime-entity-fetch-field) (defun mime-entity-content-type (entity) + "Return content-type of ENTITY." (or (mime-entity-content-type-internal entity) (let ((ret (mime-entity-fetch-field entity "Content-Type"))) (if ret @@ -272,6 +283,7 @@ If MESSAGE is specified, it is regarded as root entity." )))) (defun mime-entity-content-disposition (entity) + "Return content-disposition of ENTITY." (or (mime-entity-content-disposition-internal entity) (let ((ret (mime-entity-fetch-field entity "Content-Disposition"))) (if ret @@ -280,6 +292,10 @@ If MESSAGE is specified, it is regarded as root entity." )))) (defun mime-entity-encoding (entity &optional default-encoding) + "Return content-transfer-encoding of ENTITY. +If the ENTITY does not have Content-Transfer-Encoding field, this +function returns DEFAULT-ENCODING. If it is nil, \"7bit\" is used as +default value." (or (mime-entity-encoding-internal entity) (let ((ret (mime-entity-fetch-field entity "Content-Transfer-Encoding"))) (mime-entity-set-encoding-internal diff --git a/mmdbuffer.el b/mmdbuffer.el deleted file mode 100644 index 5a1ae20..0000000 --- a/mmdbuffer.el +++ /dev/null @@ -1,187 +0,0 @@ -;;; mmdual.el --- MIME entity module for dual buffers - -;; Copyright (C) 1998,1999,2000 Free Software Foundation, Inc. - -;; Author: MORIOKA Tomohiko -;; Keywords: MIME, multimedia, mail, news - -;; This file is part of FLIM (Faithful Library about Internet Message). - -;; This program is free software; you can redistribute it and/or -;; modify it under the terms of the GNU General Public License as -;; published by the Free Software Foundation; either version 2, or (at -;; your option) any later version. - -;; This program is distributed in the hope that it will be useful, but -;; WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;; General Public License for more details. - -;; 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. - -;;; Code: - -(require 'mime) - -(eval-and-compile - (luna-define-class mime-dual-entity (mime-entity) - (header-buffer - body-buffer)) - - (luna-define-internal-accessors 'mime-dual-entity) - ) - -(luna-define-method initialize-instance :after ((entity mime-dual-entity) - &rest init-args) - (let ((buf (mime-dual-entity-header-buffer-internal entity))) - (if buf - (with-current-buffer buf - (or (mime-entity-content-type-internal entity) - (mime-entity-set-content-type-internal - entity - (let ((str (std11-fetch-field "Content-Type"))) - (if str - (mime-parse-Content-Type str) - ))))))) - entity) - -(luna-define-method mime-entity-name ((entity mime-dual-entity)) - (buffer-name (mime-dual-entity-header-buffer-internal entity)) - ) - - -(luna-define-method mime-insert-header ((entity mime-dual-entity) - &optional invisible-fields - visible-fields) - (let* ((buf (mime-dual-entity-header-buffer-internal entity)) - header-start header-end) - (with-current-buffer buf - (setq header-start (point-min) - header-end (point-max))) - (mime-insert-header-from-buffer buf header-start header-end - invisible-fields visible-fields) - )) - -(luna-define-method mime-entity-content ((entity mime-dual-entity)) - (mime-decode-string - (with-current-buffer (mime-dual-entity-body-buffer-internal entity) - (buffer-string)) - (mime-entity-encoding entity))) - -(luna-define-method mime-entity-fetch-field :around - ((entity mime-dual-entity) field-name) - (or (luna-call-next-method) - (with-current-buffer (mime-dual-entity-header-buffer-internal entity) - (let ((ret (std11-fetch-field field-name))) - (when ret - (or (symbolp field-name) - (setq field-name - (intern (capitalize (capitalize field-name))))) - (mime-entity-set-original-header-internal - entity - (put-alist field-name ret - (mime-entity-original-header-internal entity))) - ret))))) - -(luna-define-method mime-insert-entity-content ((entity mime-dual-entity)) - (insert - (mime-decode-string - (with-current-buffer (mime-dual-entity-body-buffer-internal entity) - (buffer-substring (point-min)(point-max))) - (mime-entity-encoding entity)))) - -(luna-define-method mime-write-entity-content ((entity mime-dual-entity) - filename) - (with-current-buffer (mime-dual-entity-body-buffer-internal entity) - (mime-write-decoded-region (point-min) - (point-max) - filename - (or (mime-entity-encoding entity) "7bit")))) - -(luna-define-method mime-insert-entity ((entity mime-dual-entity)) - (let (buf) - (setq buf (mime-dual-entity-header-buffer-internal entity)) - (when buf - (insert-buffer (mime-dual-entity-header-buffer-internal entity)) - (setq buf (mime-dual-entity-body-buffer-internal entity)) - (when buf - (insert "\n") - (insert-buffer buf))))) - -(luna-define-method mime-write-entity ((entity mime-dual-entity) filename) - (let (buf) - (setq buf (mime-dual-entity-header-buffer-internal entity)) - (if (null buf) - (error "No header buffer.") - (with-current-buffer buf - (write-region-as-raw-text-CRLF - (point-min)(point-max) filename)) - (setq buf (mime-dual-entity-body-buffer-internal entity)) - (when buf - (with-temp-buffer - (insert "\n") - (write-region-as-raw-text-CRLF - (point-min)(point-max) - filename 'append)) - (with-current-buffer buf - (write-region-as-raw-text-CRLF - (point-min)(point-max) - filename 'append)))))) - -(luna-define-method mime-write-entity-body ((entity mime-dual-entity) filename) - (with-current-buffer (mime-dual-entity-body-buffer-internal entity) - (write-region-as-binary (point-min)(point-max) - filename))) - - -;;; @ buffer -;;; - -(luna-define-method mime-entity-header-buffer ((entity mime-dual-entity)) - (mime-dual-entity-header-buffer-internal entity)) - -(luna-define-method mime-entity-body-buffer ((entity mime-dual-entity)) - (mime-dual-entity-body-buffer-internal entity)) - -(luna-define-method mime-entity-buffer ((entity mime-dual-entity)) - (message "mime-dual-entity does not have mime-entity-buffer.") - nil) - -(luna-define-method mime-entity-body-start-point ((entity mime-dual-entity)) - (with-current-buffer (mime-entity-body-buffer entity) - (point-min))) - -(luna-define-method mime-entity-body-end-point ((entity mime-dual-entity)) - (with-current-buffer (mime-entity-body-buffer entity) - (point-max))) - -(luna-define-method mime-entity-point-min ((entity mime-dual-entity)) - (message "mime-dual-entity does not have mime-entity-point-min.") - nil) - -(luna-define-method mime-entity-point-max ((entity mime-dual-entity)) - (message "mime-dual-entity does not have mime-entity-point-max.") - nil) - -(luna-define-method mime-goto-header-start-point ((entity mime-dual-entity)) - (set-buffer (mime-dual-entity-header-buffer-internal entity)) - (goto-char (point-min))) - -(luna-define-method mime-goto-body-start-point ((entity mime-dual-entity)) - (set-buffer (mime-dual-entity-body-buffer-internal entity)) - (goto-char (point-min))) - -(luna-define-method mime-goto-body-end-point ((entity mime-dual-entity)) - (set-buffer (mime-dual-entity-body-buffer-internal entity)) - (goto-char (point-max))) - - -;;; @ end -;;; - -(provide 'mmdual) - -;;; mmdual.el ends here diff --git a/qmtp.el b/qmtp.el index feab66a..f1f3104 100644 --- a/qmtp.el +++ b/qmtp.el @@ -61,6 +61,7 @@ called from `qmtp-via-qmtp' with arguments SENDER and RECIPIENTS.") :type 'integer :group 'qmtp) +;;;###autoload (defvar qmtp-open-connection-function (function open-network-stream)) (defvar qmtp-error-response-alist diff --git a/smtp.el b/smtp.el index e389660..c63c81b 100644 --- a/smtp.el +++ b/smtp.el @@ -112,7 +112,7 @@ don't define this value." :group 'smtp-extensions) (defvar sasl-mechanisms) - +;;;###autoload (defvar smtp-open-connection-function (function open-network-stream)) (defvar smtp-read-point nil)