bbdb-auto-notes-rules examples

Rob Walker <[email protected]> Sun, 17 Sep 2017 23:12:29 -0700
Newsgroups gmane.mail.wanderlust.general
Message-ID <84fubkpmb6.wl-rob__20759.2080733322$1505715197$gmane$org@ladle.net>
I'm trying to do crazy things with bbdb-auto-notes-rules.  Here is my
current setting.

(setq bbdb-auto-notes-rules
      '(
	("User-Agent" (".*" mailer "\\&"))
	("X-Mailer" (".*" mailer "\\&"))
	("Organization" (".*" organization "\\&"))
	("From" (".*" from "\\&"))
	("Subject" (".*" last-subject "\\&" t))
	("Date" (".*" last-date "\\&" t))
	("To" (".*" to "\\&"))
	("Cc" (".*" cc "\\&"))
	("Message-ID" (".*" message-id "\\&" t))
	;; ("X-Spam-Status" ("score=" spam-score "\\1" t))
	;; ("X-Spam-Status" ("score=.* " spam-score "\\1" t))
	;; ("X-Spam-Status" ("score= .* " spam-score "\1" t))
	;; ("X-Spam-Status" ("score= " spam-score "\1" t))
	;; ("X-Spam-Status" ("score=.* .* .*" spam-score "\2" t))
	;; ("X-Spam-Status" ("score=\( * * *" spam-score "\1" t))
	;; ("X-Spam-Status" ("score= " spam-score "\\1" t))
	;; ("X-Spam-Status" ("score=\([-][0-9.]*\)" spam-score "\\1" t))
	;; ("X-Spam-Status" ("score=\\([-][0-9.]*\\)" spam-score "\\&" t))

	("X-Spam-Status" ("score=\\([-][0-9.]*\\)" spam-score "\\&" t))
	;; ("X-Spam-Status" ("score=\\([-][0-9.]*\\)" spam-score "\\1" t))

	;; this sets
	;; ("X-Spam-Status" ("\\(score\\)" spam-score "\\1" t))
	;; spam-score: No, score=-32.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,	DNS_FROM_AHBL_RHSBL,GREYLIST_ISWHITE autolearn=ham version=3.0.3-mmrules_20041125
	;; the REGEXP works, but the REPLACE \\1 is bringing in everything

	;; this sets
	;; ("X-Spam-Status" ("\\(score\\)" spam-score "\\2" t))
	;; spam-score: No, =-32.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,	DNS_FROM_AHBL_RHSBL,GREYLIST_ISWHITE autolearn=ham version=3.0.3-mmrules_20041125
	;; so we see that the REGEXP pulls out the "score" stuff

	("List-Archive" (".*" list-archive "\\&"))
	("X-Mailman-Version" (".*" mailman-version "\\&"))

	;; ("Content-Type" (".*" content-type "\\&" t))
	("References" (".*" references "\\&" t))

	;; ("Size" (".*" size "\\&" t))
	;; ("Score" (".*" score "\\&" t))
	;; ("Extra" (".*" extra "\\&"))
	;; ("number" (".*" number "\\&"))

	)
      )

As you can see, the X-Spam-Status has been tried a number of times,
and it hasn't gotten me to where I want it to be.  My first step is to
get it to write

spam-score: -32.1, -4.3, 5.5

and so on to my spam list.  I have tried some interesting things in
the regexp side. I thought that

("score=\\([-][0-9.]*\\)" spam-score "\\1" t)

was the best one, but I couldn't get it to work.

After I figure out how to do that, I will attempt to write a function
that turns it into a running average, using something like this.

spam-status: -32.1, 12

To keep track of the current average score and the total message count
in this bbdb record.

After I figure out how to do that, I'm going to try to keep a
suggested-refile field in the bbdb, and then auto-suggest the refile
messages, by looking at the previous-refile field in my bbdb, and
looking at the spam-status field.  Then my reading of email can be a
bunch of repeated "." keystrokes to accept the suggestions that the
learning code is doing for me on the auto-refile front.

My question right now is, "What documentation do I need to read to
figure out how to get the spam-score to pull out the "-32.1" ?  I have
tried some custom functions with (replace-match), but I didn't get
anywhere.  If any of you have really big examples of
bbdb-auto-notes-rules, I'd like to see them.

Thanks,
Rob