From: akr Date: Sat, 24 Oct 1998 11:45:49 +0000 (+0000) Subject: eword-decode.el (eword-decode-field): New function. X-Git-Tag: doodle-1_11_1~7 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9da9f7d2cbd23ff1f5537b0327d2716c900e6003;p=elisp%2Fflim.git eword-decode.el (eword-decode-field): New function. --- diff --git a/ChangeLog b/ChangeLog index 35b2494..a78c00f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1998-10-19 Tanaka Akira + + * eword-decode.el (eword-decode-field): New function. + 1998-10-18 Tanaka Akira * Sync up to flim-1_11_0 from flim-1_10_5. diff --git a/eword-decode.el b/eword-decode.el index f176a48..60ccaf4 100644 --- a/eword-decode.el +++ b/eword-decode.el @@ -476,6 +476,39 @@ Each field name must be symbol." :group 'eword-decode :type '(repeat symbol)) +(defun eword-decode-field (field-name field-body &optional unfolded max-column) + "If FIELD-NAME is in `eword-decode-ignored-field-list', +return FIELD-BODY itself. + +If FIELD-NAME is in `eword-decode-structured-field-list', +FIELD-BODY is interpreted as structured field, +decode MIME encoded-words and return it. + +Otherwise, FIELD-BODY is interpreted as unstructured field, +decode MIME encoded-words and return it. + +Anyway, non-encoded-word part is decoded with `default-mime-charset'. + +If FIELD-BODY is already unfolded, UNFOLDED should be non-nil. + +If MAX-COLUMN is nil, FIELD-BODY is unfolded. +Otherwise, FIELD-BODY is folded with with MAX-COLUMN +(or `fill-column' if MAX-COLUMN is not integer.)" + (let ((decoded + (if unfolded + (let ((ew-ignore-76bytes-limit t)) + (ew-decode-field (symbol-name field-name) + (ew-lf-crlf-to-crlf field-body))) + (ew-decode-field (symbol-name field-name) + (ew-lf-crlf-to-crlf field-body))))) + (if max-column + (setq decoded (ew-crlf-refold + decoded + (1+ (string-width field-name)) + (if (integerp max-column) max-column fill-column))) + (setq decoded (ew-crlf-unfold decoded))) + (ew-crlf-to-lf decoded))) + (defun eword-decode-header (&optional code-conversion separator) "Decode MIME encoded-words in header fields. If CODE-CONVERSION is nil, it decodes only encoded-words. If it is