;: -*- emacs-lisp -*-
;:* $Id: bbdb-sy.el,v 1.1 2003-10-17 23:18:54+10 steve Exp steve $
;:*=======================
;:* Gnus (My Gnus settings here)
;; Pre-load my gnus setting so that 'display-time' balloons get the
;; right settings right from the start.
(load-file (expand-file-name ".gnus" (getenv "HOME")))
;:*======================
;:* Some standard stuff first
(require 'bbdb)
(require 'bbdb-pgp)

(bbdb-initialize 'gnus 'message 'w3 'sendmail)
(bbdb-insinuate-gnus)
(bbdb-insinuate-message)
(bbdb-insinuate-sc)
(bbdb-insinuate-sendmail)
(bbdb-insinuate-w3)

;; BBDB/PGP stuff
(setq 
 bbdb/pgp-method 'mml-pgpmime
 bbdb/pgp-default-action 'sign)

(defun rf-bbdb-gnus-auto-notes-hook (record)
  "Runs `bbdb-auto-notes-hook' on the original article.
This is so a header doesn't have to be visible for BBDB to notice
any changes.
Kudos to Robert Fenk <fenk@users.sf.net> for this."
  (save-excursion
    (set-buffer (get-buffer gnus-article-buffer))
    (set-buffer gnus-original-article-buffer)
    (goto-char (point-min))
    (bbdb-auto-notes-hook record)))

(autoload 'gnus-convert-face-to-png "gnus-fun")

(defun sy-bbdb-display-colour-face ()
  "Search for face properties and display the faces.
This is from Alex Shroeder."
  (let ((inhibit-read-only t); edit the BBDB buffer
        (all-records bbdb-records)
        cface record start)
    (while all-records
      (setq record (caar all-records)
            cface (bbdb-record-getprop record 'cface)
            start (marker-position (nth 2 (car all-records))))
      (if cface
          (progn
            (set-extent-begin-glyph 
             (make-extent start start)
             (make-glyph 
              (list (vector 'png ':data (gnus-convert-face-to-png cface)))))
            (insert " ")))
      (setq all-records (cddr all-records)))))

(setq 
 bbdb-always-add-addresses t
 bbdb-canonicalize-redundant-nets-p t
 bbdb-canonicalize-net-hook
 '(lambda (addr)
    (cond ((string-match "\\`\\([^0-9]+\\)\\(-dated-[^@]+\\|-[0-9]+\\|\\+[^@]+\\.[^@]+\\)\\(@.*\\)\\'"
                         addr)
           (concat (substring addr (match-beginning 1) (match-end 1))
                   (substring addr (match-beginning 3) (match-end 3))))
          (t addr)))
 bbdb-complete-name-allow-cycling t
 bbdb-completion-display-record nil
 bbdb-completion-type 'primary-or-name
 bbdb-default-area-code 7
 bbdb-dial-local-prefix nil
 bbdb-display-layout 'multi-line
 bbdb-dwim-net-address-allow-redundancy t
 bbdb-electric-p nil
 bbdb-new-nets-always-primary nil
 bbdb-north-american-phone-numbers-p nil
 bbdb-notice-hook 'rf-bbdb-gnus-auto-notes-hook
 bbdb-offer-save 'auto
 bbdb-pop-up-display-layout 'multi-line
 bbdb-pop-up-target-lines 5
 bbdb-quiet-about-name-mismatches nil
 bbdb-use-pop-up nil
 bbdb-user-mail-names "\\(s?r?youngs\\|steve\\)@\\(bigpond\\.\\(com\\|net\\.au\\)\\|xemacs\\.org\\|localhost\\|eicq\\.dnsalias\\.org\\|users\\.\\(sf\\|sourceforge\\)\\.net\\)"
 bbdb/gnus-score-default 25
 bbdb/gnus-summary-in-bbdb-format-letter "X"
 bbdb/mail-auto-create-p nil
 bbdb/news-auto-create-p nil)
;:*=======================
;:* Update some stuff automatically
(setq bbdb-auto-notes-alist
      '(("Organization"
         (".*" company 0 'replace))
        ("Newsgroups"
         ("[^,]+" newsgroups 0))
        ("Subject"
         (".*" last-subj 0 'replace))
        ("User-Agent" 
         (".*" mailer 0 'replace))
        ("X-Mailer" 
         (".*" mailer 0 'replace))
        ("X-Newsreader" 
         (".*" mailer 0 'replace))
        ("X-Attribution"
         (".*" attribution 0 'replace))
        ("X-Now-Playing"
         (".*" music 0 'replace))
        ("X-Face" 
         (".+" face 0 'replace))
        ("Face" 
         (".+" cface 0 'replace))))
;:*=======================
;:* mail aliases
(autoload 'bbdb-define-all-aliases "bbdb-com" 
  "Hook mail alias feature of BBDB into message-mode." t)
;:*=======================
;:* Hooks
(add-hook 'bbdb-notice-hook 'bbdb-auto-notes-hook)
(add-hook 'bbdb-change-hook 'bbdb-timestamp-hook) 
(add-hook 'bbdb-create-hook 'bbdb-creation-date-hook)
(add-hook 'bbdb-list-hook 'sy-bbdb-display-colour-face)
(add-hook 'message-setup-hook 'bbdb-define-all-aliases)
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*
(message "bbdb initialised")

;; $Log: bbdb-sy.el,v $
;; Revision 1.1  2003-10-17 23:18:54+10  steve
;; Initial revision
;;

Created with XEmacs Valid HTML 4.01! Valid CSS!
Copyright © 2003 Steve Youngs
Verbatim copying and distribution is permitted in any medium, providing this notice is preserved.
Last modified: Sat Oct 18 02:00:53 EST 2003