From: hmurata Date: Thu, 7 Apr 2005 13:32:26 +0000 (+0000) Subject: * elmo-util.el (elmo-map-recursive): New function. X-Git-Tag: wl-2_15_3~91 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=bf55bc07746be8a5225df656bcdb76fad35fd402;p=elisp%2Fwanderlust.git * elmo-util.el (elmo-map-recursive): New function. * modb-entity.el (modb-entity-decode-string-recursive): Use it. (modb-entity-encode-string-recursive): Ditto. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 2624c8b..88f508c 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,10 @@ +2005-04-07 Hiroya Murata + + * 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 * elmo-maildir.el (elmo-maildir-sequence-number): New function. diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 93497d0..9c119c4 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -1594,6 +1594,16 @@ NUMBER-SET is altered." (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) diff --git a/elmo/modb-entity.el b/elmo/modb-entity.el index 413d352..892feb1 100644 --- a/elmo/modb-entity.el +++ b/elmo/modb-entity.el @@ -326,26 +326,21 @@ If each field is t, function is set as default converter." (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)