[Date Prev][Date Next][Thread Prev][][Date Index][Thread Index]

Re: Use LSDB records for choosing the author's X-Face



>>>>> In <b9yd6gbrkpb.fsf@jpl.org>
>>>>>	Katsumi Yamaoka <yamaoka@jpl.org> wrote:

> これは複数の X-Face を扱うためのコードです。いろんな X-Face を使
> う人の BBDB レコードにはそれらが記録されているので、全部表示して
> しまえー、というわけです。:)

それならばという事で、LSDB でも複数の X-Face を表示出来るように修正し
ました。
mail-extract-address-components が名前を取得出来ない時にエラーになって
しまうようなのでそれの対策も含んでいます。(それと docstring の typo も)

お手数ですがどなたか commit をお願いします。

2003-07-16  OHASHI Akira  <bg66@koka-in.org>

	* shimbun/shimbun.el (shimbun-lsdb-get-x-face): Handle more X-Faces.
	Return nil when a full name is not able to be acquired.

-- 
OHASHI Akira (大橋 彰)
bg66@koka-in.org bg66@debian.org
Share what you know. Learn what you don't.
--- shimbun.el.orig	2003-07-16 16:00:01.000000000 +0900
+++ shimbun.el	2003-07-16 17:11:25.000000000 +0900
@@ -388,7 +388,7 @@
      (autoload 'bbdb-get-field "bbdb"))))
 
 (defun shimbun-bbdb-get-x-face (person)
-  "Search a face of a PERSON from LSDB.  When missing it, return nil."
+  "Search a face of a PERSON from BBDB.  When missing it, return nil."
   (let (x)
     (and (setq x (bbdb-search-simple
 		  nil
@@ -408,17 +408,20 @@
      (autoload 'lsdb-lookup-records "lsdb"))))
 
 (defun shimbun-lsdb-get-x-face (person)
-  "Return a face of a PERSON from BBDB.  When missing it, return nil."
+  "Return a face of a PERSON from LSDB.  When missing it, return nil."
   (lsdb-maybe-load-hash-tables)
   (let (x)
-    (and (setq x (car (lsdb-lookup-records
-		       (car (mail-extract-address-components person)))))
-	 (setq x (cadr (assq 'x-face x)))
+    (and (setq x (car (mail-extract-address-components person)))
+	 (setq x (car (lsdb-lookup-records x)))
+	 (setq x (cdr (assq 'x-face x)))
 	 (not (zerop (length x)))
-	 (concat "X-Face: "
-		 (mapconcat 'identity
-			    (split-string x)
-			    "\n ")))))
+	 (mapconcat (lambda (x-face)
+		      (concat "X-Face: "
+			      (mapconcat 'identity
+					 (split-string x-face)
+					 "\n ")))
+		    x
+		    "\n"))))
 
 ;;; Implementation of Shimbun API.