;ELC   
;;; Compiled by daveg@contents-vnder-pressvre.mit.edu on Wed Dec 27 15:22:08 2006
;;; from file /afs/sipb.mit.edu/user/daveg/el/bbdb/lisp/bbdb-hooks.el
;;; in Emacs version 21.4.1
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`bbdb-hooks.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(require 'bbdb)
(defalias 'the-v18-byte-compiler-sucks-wet-farts-from-dead-pigeons '(macro . #[nil "\300\301\302\217\210\300\207" [nil (byte-code "\300\301!\207" [require vm] 2) ((error))] 3]))
(defalias 'Nukem-til-they-glow #[nil "\300\207" [nil] 1])
#@27 The internal date format.
(defvar bbdb-time-internal-format "%Y-%m-%d" (#$ . 898))
#@226 For use as a bbdb-change-hook; maintains a notes-field called `timestamp'
for the given record which contains the time when it was last modified.  If
there is such a field there already, it is changed, otherwise it is added.
(defalias 'bbdb-timestamp-hook #[(record) "\302\303\304	\305 \"#\207" [record bbdb-time-internal-format bbdb-record-putprop timestamp format-time-string current-time] 6 (#$ . 988)])
#@108 For use as a bbdb-create-hook; adds a notes-field called `creation-date'
which is the current time string.
(defalias 'bbdb-creation-date-hook #[(record) "\302\303\304	\305 \"#\207" [record bbdb-time-internal-format bbdb-record-putprop creation-date format-time-string current-time] 6 (#$ . 1403)])
#@132 Returns a marker at the beginning of the header block of the current
message.  This will not necessarily be in the current buffer.
(defalias 'bbdb-header-start #[nil "\306>\203 	\203 	q\210\307\n@!\207\310>\203( \311\303!\203% \203% q\210\312 \207\313>\2034 \fq\210\312 \207\314=\203C \315 \210q\210\312 \207\312 \207" [major-mode vm-mail-buffer vm-message-pointer rmail-buffer gnus-article-buffer mh-show-buffer (vm-mode vm-summary-mode) vm-start-of (rmail-mode rmail-summary-mode) boundp point-min-marker (gnus-Group-mode gnus-Subject-mode gnus-Article-mode) mh-folder-mode mh-show] 2 (#$ . 1709)])
#@397 Given the name of a field (like "Subject") this returns the value of
that field in the current message, or nil.  This works whether you're in
GNUS, Rmail, or VM.  This works on multi-line fields, but if more than
one field of the same name is present, only the last is returned.  It is
expected that the current buffer has a message in it, and (point) is at the
beginning of the message headers.
(defalias 'bbdb-extract-field-value #[(field-name) "\302!\303P\304	\204A \305\306!\204A m\204A \305!\203; \307\225b\210`\304\210`{\305\310!\203; 	\311\307\225\312\210`{Q\202' \313y\210\202 	)\207" [field-name done regexp-quote "[ 	]*:[ 	]*" nil looking-at "\n" 0 "\n[ 	]" " " 2 1] 4 (#$ . 2326)])
#@559 *An alist describing which messages to automatically create BBDB
records for.  This only works if bbdb/news-auto-create-p or 
bbdb/mail-auto-create-p (or both) is 'bbdb-ignore-most-messages-hook.
The format of this alist is 
   (( HEADER-NAME . REGEXP ) ... )
for example,
   (("From" . "@.*\.maximegalon\.edu")
    ("Subject" . "time travel"))
will cause BBDB entries to be made only for messages sent by people at 
Maximegalon U., or (that's *or*) people posting about time travel.

See also bbdb-ignore-some-messages-alist, which has the opposite effect.
(custom-declare-variable 'bbdb-ignore-most-messages-alist ''nil '(#$ . -3035) :group 'bbdb-noticing-records :type '(repeat (cons (string :tag "Header name") (regexp :tag "Regex to match on header value"))))
#@616 *An alist describing which messages *not* to automatically create
BBDB records for.  This only works if bbdb/news-auto-create-p or 
bbdb/mail-auto-create-p (or both) is 'bbdb-ignore-some-messages-hook.
The format of this alist is 
   (( HEADER-NAME . REGEXP ) ... )
for example,
   (("From" . "mailer-daemon")
    ("To" . "mailing-list-1\\|mailing-list-2")
    ("CC" . "mailing-list-1\\|mailing-list-2"))
will cause BBDB entries to not be made for messages from any mailer daemon,
or messages sent to or CCed to either of two mailing lists.

See also bbdb-ignore-most-messages-alist, which has the opposite effect.
(custom-declare-variable 'bbdb-ignore-some-messages-alist ''nil '(#$ . -3807) :group 'bbdb-noticing-records :type '(repeat (cons (string :tag "Header name") (regexp :tag "Regex to match on header value"))))
#@211 For use as the value of bbdb/news-auto-create-p or bbdb/mail-auto-create-p.
This will automatically create BBDB entries for messages which match
the bbdb-ignore-some-messages-alist (which see) and *no* others.
(defalias 'bbdb-ignore-most-messages-hook #[(&optional invert-sense) "\203 	\202	 \n\306\307p\310 \307\211\211\f\311\f!q\210\214~\210\203Z \204Z \fb\210@@@A\312!\211\203Q \313\f\"\203Q \306A\211\204, )q\210\203i ?\202k .\207" [invert-sense bbdb-ignore-some-messages-alist bbdb-ignore-most-messages-alist fieldval regexp field t nil bbdb-header-start marker-buffer bbdb-extract-field-value string-match marker b done case-fold-search rest] 9 (#$ . 4636)])
#@199 For use as a bbdb/news-auto-create-hook or bbdb/mail-auto-create-hook.
This will automatically create BBDB entries for messages which do *not*
match the bbdb-ignore-some-messages-alist (which see).
(defalias 'bbdb-ignore-some-messages-hook #[nil "\300\301!\207" [bbdb-ignore-most-messages-hook t] 2 (#$ . 5351)])
#@2366 *An alist which lets you have certain pieces of text automatically added
to the BBDB record representing the sender of the current message based on
the subject or other header fields.  This only works if bbdb-notice-hook 
is 'bbdb-auto-notes-hook.  The format of this alist is 

   (( HEADER-NAME
       (REGEXP . STRING) ... )
      ... )
for example,
   (("To" ("-vm@" . "VM mailing list"))
    ("Subject" ("sprocket" . "mail about sprockets")
               ("you bonehead" . "called me a bonehead")))

will cause the text "VM mailing list" to be added to the notes field of
the record corresponding to anyone you get mail from via one of the VM
mailing lists.  If, that is, bbdb/mail-auto-create-p is set such that the
record would have been created, or the record already existed.

The format of elements of this list may also be 
       (REGEXP FIELD-NAME STRING)
or
       (REGEXP FIELD-NAME STRING REPLACE-P)
instead of
       (REGEXP . STRING)

meaning add the given string to the named field.  The field-name may not
be name, address, phone, or net (builtin fields) but must be either ``notes,''
``company,'' or the name of a user-defined note-field. 
       ("pattern" . "string to add")
is equivalent to
       ("pattern" notes "string to add")

STRING can contain \& or \N escapes like in function
`replace-match'.  For example, to automatically add the contents of the
"organization" field of a message to the "company" field of a BBDB
record, you can use this:

        ("Organization" (".*" company "\\&"))

(Note you need two \ to get a single \ into a lisp string literal.)

If STRING is an integer N, the N'th matching subexpression is used, so
the above example could be written more efficiently as

        ("Organization" (".*" company 0))

If STRING is neither a string or an integer, it should be a function, which
will be called with the contents of the field.  The result of that function
call is used as the field value (the returned value must be a string.)

If REPLACE-P is t, the string replaces the old contents instead of
being appended to it.

If multiple clauses match the message, all of the corresponding strings
will be added.

This works for news as well.  You might want to arrange for this to have
a different value when in mail as when in news.

See also variables `bbdb-auto-notes-ignore' and `bbdb-auto-notes-ignore-all'.
(custom-declare-variable 'bbdb-auto-notes-alist 'nil '(#$ . -5672) :group 'bbdb-noticing-records :type '(repeat (bbdb-alist-with-header (string :tag "Header name") (repeat (cons (regexp :tag "Regexp to match on header value") (string :tag "String for notes if regexp matches"))))))
#@425 Alist of headers and regexps to ignore in bbdb-auto-notes-hook.
Each element looks like

    (HEADER . REGEXP)

For example,

    ("Organization" . "^Gatewayed from\\|^Source only")

would exclude the phony `Organization:' headers in GNU mailing-lists
gatewayed to gnu.* newsgroups.  Note that this exclusion applies only
to a single field, not to the entire message.  For that, use the variable
bbdb-auto-notes-ignore-all.
(custom-declare-variable 'bbdb-auto-notes-ignore 'nil '(#$ . 8326) :group 'bbdb-noticing-records :type '(repeat (cons (string :tag "Header name") (regexp :tag "Regexp to match on header value"))))
#@401 Alist of headers and regexps which cause the entire message to be ignored
in bbdb-auto-notes-hook.  Each element looks like

    (HEADER . REGEXP)

For example,

    ("From" . "BLAT\\.COM")

would exclude any notes recording for message coming from BLAT.COM. 
Note that this is different from `bbdb-auto-notes-ignore', which applies
only to a particular header field, rather than the entire message.
(custom-declare-variable 'bbdb-auto-notes-ignore-all 'nil '(#$ . 8954) :group 'bbdb-noticing-records :type '(repeat (cons (string :tag "Header name") (regexp :tag "Regexp to match on header value"))))
#@281 For use as a bbdb-notice-hook.  This might automatically add some text
to the notes field of the BBDB record corresponding to the current record
based on the header of the current message.  See the documentation for
the variables bbdb-auto-notes-alist and bbdb-auto-notes-ignore.
(defalias 'bbdb-auto-notes-hook #[(record) "\206\335	\306\n\307p\310 \306\211\211\211\211\211\211\211\211 !\"#$%&'()*+\311&!q\210\214~\210&b\210\312\313!\211#\203[ \314,\206U \315\316\317 !\315Q\211,#\"\204\327)\203\227 *\204\227 &b\210)@@%)@A\"\312%!\211#\203\216 \314\"#\"\203\216 \307*\202[ )A\211)\204` *\204\327+\203\327&b\210+@@%+@A$\312%!\211#\203\316$\203\316$@@\"$@A\211!:\203\344 !@ \320!8!A@!\202\351 \305 \306\321- \"\314\"#\"\205\322%.\"A\211/\203\314/#\"?\202\307)\2110\203[!\250\203*#!\224!\225O\202Y!;\2039\323#!\"\202Y&b\210!#!\2111;\204V1\203V\324\325!1#\2101)!0\203\304!\203\304\203v\314\326\316!!\327Q\"\204\304\f\203\243 \305=\203\212\330\331!\"\210\202\222\330\332 !#\210\333- !#\210\334-!\210\202\304 \305=\203\263\330\335!\"\210\202\273\330\336! #\210\337-! #\210)$A\211$\204\300 +A\211+\204\241 )'q.\207" [bbdb-readonly-p bbdb-auto-notes-alist bbdb-auto-notes-ignore-all replace-or-add-msg replace-p notes nil t bbdb-header-start marker-buffer bbdb-extract-field-value "From" string-match "\\b" regexp-quote user-login-name 2 bbdb-record-getprop assoc bbdb-auto-expand-newtext error "%s returned %s: not a string" "\\(\\Sw\\|\\`\\)" "\\(\\Sw\\|\\'\\)" message "Replacing with note \"%s\"" "Replacing field \"%s\" with \"%s\"" bbdb-record-putprop bbdb-maybe-update-display "Adding note \"%s\"" "Adding \"%s\" to field \"%s\"" bbdb-annotate-notes notes-field-name string regexp fieldval pairs field marker b case-fold-search ignore-all ignore rest bbdb-user-mail-names record bbdb-auto-notes-ignore re did-match s] 16 (#$ . 9562)])
(defalias 'bbdb-auto-expand-newtext #[(string newtext) "\306G\307\211\nW\203g 	H\211\310U\203Z T\211H\211\311U\203. \306\224\306\225O\202] \f\312Y\203T \f\313X\203T \f\314Z\211\224\203O \224\225O\202P \307)\202] \315\f!\202] \315\f!)PT\211\202 	+\207" [newtext expanded-newtext len pos c string 0 "" 92 38 49 57 48 char-to-string n] 5])
#@245 Certain sites have a single mail-host; for example, all mail originating
at hosts whose names end in ".cs.cmu.edu" can (and probably should) be
addressed to "user@cs.cmu.edu" instead.  This variable lists other hosts
which behave the same way.
(custom-declare-variable 'bbdb-canonical-hosts '(mapconcat 'regexp-quote '("cs.cmu.edu" "ri.cmu.edu" "edrc.cmu.edu" "andrew.cmu.edu" "mcom.com" "netscape.com" "cenatls.cena.dgac.fr" "cenaath.cena.dgac.fr" "irit.fr" "enseeiht.fr" "inria.fr" "cs.uiuc.edu" "xemacs.org") "\\|") '(#$ . 11904) :group 'bbdb :type '(regexp :tag "Regexp matching sites"))
(defalias 'bbdb-match-substring '(macro . #[(string match) "\302\303	D\304	DF\207" [string match substring match-beginning match-end] 5]))
(defalias 'sample-bbdb-canonicalize-net-hook #[(addr) "\302\303\304Q	\"\203 	\305\224\305\225O	\306\224\306\225OP\207\302\307	\"\203. 	\305\224\305\225O\310	\306\224\306\225OQ\207\302\311	\"\203D 	\305\224\305\225O\310	\306\224\306\225OQ\207\302\312	\"\203R 	\306\224\306\225O\207\302\313	\"\203h 	\306\224\306\225O\310	\305\224\305\225OQ\207\302\314	\"\203~ 	\305\224\305\225O\310	\306\224\306\225OQ\207\302\315	\"\203\214 	\305\224\305\225O\207\302\316	\"\203\234 	\317\211\224TO\320P\207	\207" [bbdb-canonical-hosts addr string-match "\\`\\([^@%!]+@\\).*\\.\\(" "\\)\\'" 1 2 "\\`\\([^@%!]+\\)%[^@%!.]+@\\(lucid\\.com\\)\\'" "@" "\\`\\([^@%]+\\)%\\([^@%!]+\\)\\(@lucid\\.com\\)?\\'" "\\`\\([^@%!]+\\)!\\([^@%!]+[@%]\\1\\)\\'" "\\`\\([^@%!.]+\\.[^@%!]+\\)!\\([^@%]+\\)\\'" "\\`\\([^@!]+\\)%\\([^@%!]+\\)@hplb\\.hpl\\.hp\\.com\\'" "\\`\\([^@%!]+\\)[@%][^@%!.]+\\'" ".%uunet\\.uu\\.net@[^@%!]+\\'" 0 "@UUNET.UU.NET"] 5])
#@109 Deletes redundant network addresses.
For use as a value of `bbdb-change-hook'.  See `bbdb-net-redundant-p'.
(defalias 'bbdb-delete-redundant-nets #[(record) "\306H\211\307\307\307\n\203, \n@\310	\"\203! B\202% \fB\nA\211\204 \205C \311\312\313\314\237\315#\"\210\f\237\306\fI\210\316-\207" [record nets rest net new redundant 6 nil bbdb-net-redundant-p message "Deleting redundant nets %s..." mapconcat identity ", " t] 7 (#$ . 13565)])
(provide 'bbdb-hooks)
