;;;
-;;; 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 <morioka@jaist.ac.jp>
-;;; OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp> (1994/08/01)
+;;; OKABE Yasuo <okabe@kudpc.kyoto-u.ac.jp>
+;;; Artur Pioro <artur@flugor.if.uj.edu.pl>
;;; 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).
(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")
(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))
))
(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