+2005-04-07 Hiroya Murata <lapis-lazuli@pop06.odn.ne.jp>
+
+ * elmo-util.el (elmo-map-recursive): New function.
+
+ * modb-entity.el (modb-entity-decode-string-recursive): Use it.
+ (modb-entity-encode-string-recursive): Ditto.
+
2005-04-05 Yuuichi Teranishi <teranisi@gohome.org>
* elmo-maildir.el (elmo-maildir-sequence-number): New function.
(t (funcall func x))))
list-of-list))
+(defun elmo-map-recursive (function object)
+ (let* ((prev (list 'dummy))
+ (result prev))
+ (while (consp object)
+ (setq prev (setcdr prev (list (elmo-map-recursive function (car object))))
+ object (cdr object)))
+ (when object
+ (setcdr prev (funcall function object)))
+ (cdr result)))
+
(defun elmo-parse (string regexp &optional matchn)
(or matchn (setq matchn 1))
(let (list)
(mapconcat 'identity value ", "))))
(defun modb-entity-decode-string-recursive (field value)
- (cond ((stringp value)
- (elmo-msgdb-get-decoded-cache value))
- ((consp value)
- (setcar value (modb-entity-decode-string-recursive field (car value)))
- (setcdr value (modb-entity-decode-string-recursive field (cdr value)))
- value)
- (t
- value)))
+ (elmo-map-recursive
+ (lambda (element)
+ (if (stringp element)
+ (elmo-msgdb-get-decoded-cache element)
+ element))
+ value))
(defun modb-entity-encode-string-recursive (field value)
- (cond ((stringp value)
+ (elmo-map-recursive
+ (lambda (element)
+ (if (stringp element)
(elmo-with-enable-multibyte
- (encode-mime-charset-string value elmo-mime-charset)))
- ((consp value)
- (setcar value (modb-entity-encode-string-recursive field (car value)))
- (setcdr value (modb-entity-encode-string-recursive field (cdr value)))
- value)
- (t
- value)))
-
+ (encode-mime-charset-string element elmo-mime-charset)))
+ element)
+ value))
(defun modb-entity-create-field-indices (slots)
(let ((index 0)