Gnus development mailing list
 help / color / mirror / Atom feed
From: Michael Shields <shields@msrl.com>
Cc: ding@gnus.org
Subject: Re: displaying arbitrary headers in summary
Date: Thu, 06 Nov 2003 18:19:27 +0000	[thread overview]
Message-ID: <87islx1hsg.fsf@mulligatwani.msrl.com> (raw)
In-Reply-To: <87znf9d6i8.fsf@w3.org> (Max Froumentin's message of "Thu, 06 Nov 2003 13:30:07 +0100")

In message <87znf9d6i8.fsf@w3.org>,
Max Froumentin <max@lapin-bleu.net> wrote:
> Basically, I'd like to display the spamassassin score of each article
> in each line of the summary buffer. It's probably not easy since the
> content of the X-Spam-Status is not in the .now file by default,
> but maybe there's a way to put it in there.

Here is one approach, along with a function that sorts by spam score:

(add-to-list 'nnmail-extra-headers 'X-Spam-Status)
(defun gnus-article-spamassassin-score (header)
  "Return the Spamassassin score of this article, as a string."
  (gnus-replace-in-string
   (gnus-replace-in-string
    (gnus-extra-header 'X-Spam-Status header)
    ".*hits=" "")
   " .*" ""))
(defun gnus-user-format-function-s (header)
  (gnus-article-spamassassin-score header))
(defun gnus-article-sort-by-spam-status (h1 h2)
  "Sort articles by Spamassassin score."
  (< (string-to-number (gnus-article-spamassassin-score h1))
     (string-to-number (gnus-article-spamassassin-score h2))))

Now you can use "%us" in your gnus-summary-line-format to display the
spam score.  You could add to your spamtrap folder's group parameters:

 (gnus-summary-line-format "%U%R%z%I%(%[%6us: %-23,23f%]%) %s\n")
 (gnus-article-sort-functions
  '(gnus-article-sort-by-spam-status))

This displays the score for each article, and also puts the most
likely false positives at the top.
-- 
Shields.




  reply	other threads:[~2003-11-06 18:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-06 12:30 Max Froumentin
2003-11-06 18:19 ` Michael Shields [this message]
2003-11-06 19:58   ` Ted Zlatanov
2003-11-06 20:20     ` Michael Shields
2003-11-06 21:00       ` Ted Zlatanov
2003-11-13 17:32   ` making bogofilter write spam headers? Bill White
2003-11-13 18:07     ` Ted Zlatanov
2003-11-13 18:24       ` Bill White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87islx1hsg.fsf@mulligatwani.msrl.com \
    --to=shields@msrl.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).