This commit was manufactured by cvs2svn to create branch 'doodle'.
[elisp/flim.git] / ew-compat.el
1 (require 'ew-dec)
2 (require 'eword-decode)
3
4 (defun ew-gnus-structured-field-decoder (string)
5   (if (fboundp 'ew-decode-field)
6       (let ((ew-ignore-76bytes-limit t)
7             (ew-default-mime-charset default-mime-charset))
8         (condition-case nil
9             (ew-cut-cr-lf (ew-decode-field "From" (ew-lf-crlf-to-crlf string)))
10           (error
11            (message "gnus-structured-field-decoder error: %s" string)
12            (decode-mime-charset-string string 'x-ctext))))
13     (eword-decode-and-unfold-structured-field string)))
14
15 (defun ew-gnus-unstructured-field-decoder (string)
16   (if (fboundp 'ew-decode-field)
17       (let ((ew-ignore-76bytes-limit t)
18             (ew-default-mime-charset default-mime-charset))
19         (condition-case nil
20             (ew-cut-cr-lf (ew-decode-field "Subject" (ew-lf-crlf-to-crlf string)))
21           (error
22            (message "gnus-unstructured-field-decoder error: %s" string)
23            (decode-mime-charset-string string 'x-ctext))))
24     (eword-decode-unstructured-field-body (std11-unfold-string string) 'must-unfold)))
25