;ELC   
;;; compiled by amu@mit.edu on Fri May 16 19:36:57 1997
;;; from file /afs/sipb.mit.edu/contrib/emacs/packages/bbdb-1.50/bbdb-hooks.el
;;; emacs version 19.30.1.
;;; bytecomp version FSF 2.10
;;; optimization is on.
;;; this file uses opcodes which do not exist in Emacs 18.

(if (and (boundp 'emacs-version)
	 (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 (quote bbdb))
(defalias 'the-v18-byte-compiler-sucks-wet-farts-from-dead-pigeons '(macro . #[nil "" [nil (byte-code "!" [require vm] 2) ((error))] 3]))
(defalias 'Nukem-til-they-glow #[nil "" [nil] 1])
#@113 Returns a string for use as a timestamp.  
Currently this returns strings like "13 Mar 92".  Redefine to taste.
(defalias 'bbdb-time-string #[nil " O	O	O\n\f\n," [current-time-string time 8 10 day 4 7 mon 22 24 year " "] 6 (#$ . 715)])
#@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) "	 #" [bbdb-record-putprop record timestamp bbdb-time-string] 4 (#$ . 979)])
#@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) "	 #" [bbdb-record-putprop record creation-date bbdb-time-string] 4 (#$ . 1334)])
#@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 "> \n \nq@HH>, !) ) q >9 \nq =I  q  " [major-mode (vm-mode vm-summary-mode) vm-mail-buffer vm-message-pointer 0 (rmail-mode rmail-summary-mode) boundp rmail-buffer point-min-marker (gnus-Group-mode gnus-Subject-mode gnus-Article-mode) gnus-Article-buffer mh-folder-mode mh-show mh-show-buffer] 2 (#$ . 1580)])
#@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) "	!P\fA !A mA 	!; Ǖb``{!; \fǕ`{Q' y \f)" [regexp-quote field-name "[ 	]*:[ 	]*" nil done looking-at "\n" 0 "\n[ 	]" " " 2 1] 4 (#$ . 2107)])
#@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.
(defvar bbdb-ignore-most-messages-alist nil (#$ . -2735))
#@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.
(defvar bbdb-ignore-some-messages-alist nil (#$ . -3358))
#@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) " 		 \np ĉ	\n\f	!q~c c 	b@@@A!Z \"Z A/ )\nqr ?t ." [invert-sense bbdb-ignore-some-messages-alist bbdb-ignore-most-messages-alist t nil bbdb-header-start fieldval regexp field marker b done case-fold-search rest marker-buffer bbdb-extract-field-value string-match] 9 (#$ . 4038)])
#@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 "!" [bbdb-ignore-most-messages-hook t] 2 (#$ . 4680)])
#@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'.
(defvar bbdb-auto-notes-alist nil (#$ . -4992))
#@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.
(defvar bbdb-auto-notes-ignore nil (#$ . 7412))
#@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.
(defvar bbdb-auto-notes-ignore-all nil (#$ . 7891))
#@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) "	p 	\n\f!q~b!\f^ X  !Q\f\"  b@@@A!\f \f\" ^ Ac b@@@A!\f@@@A\n: \n@	\n8\nA@\n 		\"\f\"!\"A\"\"\f\"?)#a\n0\f\n\nO_\n;?\f\n\"_b\n\f!%;\\%\\\n%#%)\n#\n~\n!Q\"	=\n\"	\n#	\n#!	=\n\"\n	#\n	#)A A )q." [bbdb-readonly-p bbdb-auto-notes-alist nil bbdb-auto-notes-ignore-all t bbdb-header-start replace-or-add-msg replace-p notes notes-field-name string regexp fieldval pairs field marker b case-fold-search ignore-all ignore rest marker-buffer bbdb-extract-field-value "From" string-match bbdb-user-mail-names "\\b" regexp-quote user-login-name 2 bbdb-record-getprop record assoc bbdb-auto-notes-ignore re did-match bbdb-auto-expand-newtext s 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] 16 (#$ . 8350)])
(defalias 'bbdb-auto-expand-newtext #[(string newtext) "	G\fWp 	HUb 	THU1 	Of Y[ X[ ZV 	OW )f !f !)PT +" [0 newtext "" expanded-newtext len pos c 92 38 string 49 57 48 n char-to-string] 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.
(defvar bbdb-canonical-hosts (mapconcat (quote regexp-quote) (quote ("cs.cmu.edu" "ri.cmu.edu" "edrc.cmu.edu" "andrew.cmu.edu" "lucid.com" "cenatls.cena.dgac.fr" "cenaath.cena.dgac.fr" "irit.fr" "enseeiht.fr" "inria.fr")) "\\|") (#$ . 10201))
(defalias 'bbdb-match-substring '(macro . #[(string match) "	DDF" [substring string match-beginning match match-end] 5]))
(defalias 'sample-bbdb-canonicalize-net-hook #[(addr) "\nQ\f\" \fŔŕO\fƔƕOP\f\". \fŔŕO\fƔƕOQ\f\"D \fŔŕO\fƔƕOQ\f\"R \fƔƕO\f\"h \fƔƕO\fŔŕOQ\f\"~ \fŔŕO\fƔƕOQ\f\" \fŔŕO\f\" \fω\\OP\f" [string-match "\\`\\([^@%!]+@\\).*\\.\\(" bbdb-canonical-hosts "\\)\\'" addr 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) "H2 @\n\"% B+ BA N #\"I-" [record 6 nets rest nil net new redundant bbdb-net-redundant-p message "Deleting redundant nets %s..." mapconcat identity ", " t] 7 (#$ . 11494)])
