From: morioka Date: Mon, 9 Mar 1998 16:11:40 +0000 (+0000) Subject: tm 7.48. X-Git-Tag: tm7_48 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae74f9c27207811a2a591198006b2a30f604cea5;p=elisp%2Fsemi.git tm 7.48. --- diff --git a/signature.el b/signature.el index 324ace7..3d9a52c 100644 --- a/signature.el +++ b/signature.el @@ -1,15 +1,17 @@ ;;; -;;; signature.el --- signature utility for GNU Emacs +;;; signature.el --- a signature utility for GNU Emacs ;;; ;;; Copyright (C) 1995 Free Software Foundation, Inc. -;;; Copyright (C) 1994,1995 MORIOKA Tomohiko +;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko ;;; Copyright (C) 1994 OKABE Yasuo +;;; Copyright (C) 1996 Artur Pioro ;;; ;;; Author: MORIOKA Tomohiko -;;; OKABE Yasuo (1994/08/01) +;;; OKABE Yasuo +;;; Artur Pioro ;;; Created: 1994/7/11 ;;; Version: -;;; $Id: signature.el,v 7.3 1995/12/25 05:29:00 morioka Exp $ +;;; $Id: signature.el,v 7.6 1996/03/13 17:30:16 morioka Exp $ ;;; Keywords: mail, news, signature ;;; ;;; This file is part of tm (Tools for MIME). @@ -44,11 +46,15 @@ if non-nil. [signature.el]") (defvar signature-file-alist nil) +(defvar signature-file-prefix nil + "*String containing optional prefix for the signature file names") + ;;; ;;; Example: ;;; ;;; (setq signature-file-alist -;;; '((("Newsgroups" . "zxr") . "~/.signature-sun") +;;; '((("To" . signature-check-in-bbdb) . nil) +;;; (("Newsgroups" . "zxr") . "~/.signature-sun") ;;; (("To" . "uramimi") . "~/.signature-sun") ;;; (("Newsgroups" . "jokes") . "~/.signature-jokes") ;;; (("To" . "tea") . "~/.signature-jokes") @@ -78,15 +84,25 @@ if non-nil. [signature.el]") (let ((r (cdr b))) (while r (if (string-match (car r) f) - (throw 'tag (cdr cell)) + (throw 'tag + (concat + signature-file-prefix (cdr cell))) ) (setq r (cdr r)) )) ) ((stringp (cdr b)) (if (string-match (cdr b) f) - (throw 'tag (cdr cell)) + (throw 'tag + (concat + signature-file-prefix (cdr cell))) )) + ((functionp (cdr b)) + (let ((name (apply (cdr b) f (cdr cell)))) + (if name + (throw 'tag + (concat signature-file-prefix name)) + ))) )) (setq r (cdr r)) )) @@ -140,8 +156,42 @@ named -DISTRIBUTION interactively." (call-interactively 'signature/insert-signature-at-eof) (call-interactively 'signature/insert-signature-at-point))) +(defun signature-check-in-bbdb (address) + "Returns 'sigtype field from BBDB for user specified by ADDRESS" + (require 'bbdb) + (require 'bbdb-com) + (let ((addr-comp (mail-extract-address-components address)) + full-name net-name records record sigtype) + (setq full-name (car addr-comp)) + (setq net-name (mapconcat (lambda (x) x) (cdr addr-comp) "\\|")) + (setq records + (or + (and full-name + (bbdb-search (bbdb-records) full-name)) + (and net-name + (bbdb-search (bbdb-records) nil nil net-name)))) + (setq record (car records)) + (setq records (cdr records)) + (setq sigtype (and record (bbdb-record-getprop record 'sigtype))) + (while (and (not sigtype) records) + (setq record (car records)) + (setq records (cdr records)) + (setq sigtype (bbdb-record-getprop record 'sigtype))) + (if sigtype + (message (concat "Using signature for: " + (bbdb-record-firstname record) " " + (bbdb-record-lastname record) + (and (bbdb-record-aka record) + (concat " (AKA: " + (car (bbdb-record-aka record)) + ")")) + " <" (car (bbdb-record-net record)) ">"))) + sigtype)) + ;;; @ end ;;; (provide 'signature) + +;;; signature.el ends here