aead390fbf65eae8092f73503336c66e4fd0c3dd
[elisp/gnus.git-] / README-gnus-bbdb.en
1 -*- mode: text; fill-column: 70; -*-
2
3 ---
4  If BBDB is used then, bbdb-gnus.elc can't be shared with them before
5 Semi-gnus 6.8.X. It is necessary to byte-compile it again.
6
7 ;; It is a simple way that only bbdb-gnus.el is byte-compiled after
8 ;; gnus starts.
9
10 ---
11 gnus-bbdb.el
12
13  This is the BBDB API module for Semi-gnus. `mime-bbdb' should not be
14 necessary for Semi-gnus, if that module were used.
15
16  You need FLIM 1.11.3 or later.
17
18  If you are using bbdb-auto-notes-hook, the patch listed at the end
19 of this file should be applied. If not, it might not.
20
21  EXAMPLE:
22
23 ;; You need to set nothing for `mime-bbdb'.
24 ;(setq mime-bbdb/use-mail-extr nil)
25 ;(eval-after-load "mail-extr" '(require 'mime-bbdb))
26
27 ;; Some hooks defined by defcustom might have significant values by
28 ;; default in the T-gnus' tradition.  It is safe to add the following
29 ;; settings in .gnus file rather than .emacs (or equivalent) file.
30 ;; Exceptionally, it may be better to put the line (require 'bbdb) in
31 ;; .emacs file if you would like to use BBDB not only for T-gnus.
32
33 (require 'bbdb)
34 (require 'gnus-bbdb)
35 (bbdb-initialize 'sc)  ;; 'Gnus or 'gnus should be deleted.
36 (add-hook 'gnus-startup-hook 'gnus-bbdb-insinuate)
37 (add-hook 'message-setup-hook 'gnus-bbdb-insinuate-message)
38
39  If you would like to decode the quoted encoded words forcibly, even
40 though FLIM does not decode them, put the following lines in your
41 .gnus file.
42
43 (setq gnus-bbdb/decode-field-body-function
44       (function
45        (lambda (field-body field-name)
46          (eword-decode-string field-body))))
47
48 ---
49  This is a patch for bbdb-com.el, bbdb-hooks.el and bbdb.el.
50
51 ------ cut here ------ cut here ------ cut here ------ cut here ------
52 --- bbdb-2.34/lisp/bbdb-com.el~ Tue Jan 15 23:00:57 2002
53 +++ bbdb-2.34/lisp/bbdb-com.el  Thu Jan 31 03:55:01 2002
54 @@ -1686,7 +1686,7 @@
55            ;; to be enclosed in quotes.  Double-quotes and backslashes have
56            ;; already been escaped.  This quotes a few extra characters as
57            ;; well (!,%, and $) just for common sense.
58 -          ((string-match "[][\000-\037\177()<>@,;:.!$%]" name)
59 +         ((string-match "[][\000-\037\177<>@,;.!$%]" name)
60             (format "\"%s\" <%s>" name net))
61            (t
62             (format "%s <%s>" name net)))))
63 --- bbdb-2.34/lisp/bbdb-hooks.el~       Tue Jan 15 09:00:11 2002
64 +++ bbdb-2.34/lisp/bbdb-hooks.el        Thu Jan 31 03:55:01 2002
65 @@ -36,4 +36,6 @@
66  ;;
67  
68 +(eval-when-compile (require 'cl))
69 +
70  (require 'bbdb)
71  (require 'bbdb-com)
72 @@ -405,13 +407,23 @@
73           ignore
74           field pairs fieldval  ; do all bindings here for speed
75           regexp string notes-field-name notes
76 -         replace-p)
77 +         replace-p extract-field-value-funtion)
78      (set-buffer (marker-buffer marker))
79      (save-restriction
80 -      (widen)
81 -      (goto-char marker)
82 -      (if (and (setq fieldval (bbdb-extract-field-value "From"))
83 -               (string-match (bbdb-user-mail-names) fieldval))
84 +      (let ((function-list bbdb-extract-field-value-function-list)
85 +           function)
86 +       (or (progn
87 +             (while (and (not extract-field-value-funtion)
88 +                         (setq function (car function-list)))
89 +               (setq extract-field-value-funtion (funcall function)
90 +                     function-list (cdr function-list)))
91 +             extract-field-value-funtion)
92 +           (progn
93 +             (widen)
94 +             (goto-char marker)
95 +             (setq extract-field-value-funtion 'bbdb-extract-field-value))))
96 +      (if (and (setq fieldval (funcall extract-field-value-funtion "From"))
97 +              (string-match (bbdb-user-mail-names) fieldval))
98            ;; Don't do anything if this message is from us.  Note that we have
99            ;; to look at the message instead of the record, because the record
100            ;; will be of the recipient of the message if it is from us.
101 @@ -421,7 +433,7 @@
102            (goto-char marker)
103            (setq field (car (car ignore-all))
104                  regexp (cdr (car ignore-all))
105 -                fieldval (bbdb-extract-field-value field))
106 +                fieldval (funcall extract-field-value-funtion field))
107            (if (and fieldval
108                     (string-match regexp fieldval))
109                (setq ignore t)
110 @@ -434,7 +446,8 @@
111                  pairs (cdr (car rest))  ; (REGEXP . STRING) or
112                                          ; (REGEXP FIELD-NAME STRING) or
113                                          ; (REGEXP FIELD-NAME STRING REPLACE-P)
114 -                fieldval (bbdb-extract-field-value field)) ; e.g., Subject line
115 +                fieldval (funcall extract-field-value-funtion field))
116 +                                        ; e.g., Subject line
117            (when fieldval
118              ;; we perform the auto notes stuff only for authors of a message
119              ;; or if explicitly requested
120 --- bbdb-2.34/lisp/bbdb.el~     Tue Jan 15 23:00:58 2002
121 +++ bbdb-2.34/lisp/bbdb.el      Thu Jan 31 03:55:01 2002
122 @@ -737,6 +737,7 @@
123  (defvar bbdb-showing-changed-ones nil)
124  (defvar bbdb-modified-p nil)
125  (defvar bbdb-address-print-formatting-alist) ; "bbdb-print"
126 +(defvar bbdb-extract-field-value-function-list nil)
127  
128  (defvar bbdb-debug t)
129  (defmacro bbdb-debug (&rest body)
130 ------ cut here ------ cut here ------ cut here ------ cut here ------
131
132 ---