Gnus development mailing list
 help / color / mirror / Atom feed
* Displaying stuff from spamassassin headers in the summary buffer?
@ 2024-01-27 23:02 Steinar Bang
  2024-01-27 23:29 ` Andreas Schwab
  0 siblings, 1 reply; 7+ messages in thread
From: Steinar Bang @ 2024-01-27 23:02 UTC (permalink / raw)
  To: ding

Is it possible to display something interesting extracted from
spamassassin headers in the summary buffer?

Here's an example:
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on schwantz
X-Spam-Level: **
X-Spam-Status: No, score=3.0 required=5.0 tests=AC_BR_BONANZA,
	DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,HTML_MESSAGE,
	T_KAM_HTML_FONT_INVALID,T_SCC_BODY_TEXT_LINE,URIBL_ABUSE_SURBL,
	URIBL_BLOCKED autolearn=no autolearn_force=no version=4.0.0

I dunno what "interesting" would mean here, but at least the spam score
in some form.

Right now I have to do C-u g to see these headers in the raw message.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-27 23:02 Displaying stuff from spamassassin headers in the summary buffer? Steinar Bang
@ 2024-01-27 23:29 ` Andreas Schwab
  2024-01-28  6:12   ` Steinar Bang
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2024-01-27 23:29 UTC (permalink / raw)
  To: ding

On Jan 28 2024, Steinar Bang wrote:

> Right now I have to do C-u g to see these headers in the raw message.

t runs the command gnus-summary-toggle-header (found in
gnus-summary-mode-map), which is an interactive byte-compiled Lisp
function in ‘gnus-sum.el’.

It is bound to t and W t.

(gnus-summary-toggle-header &optional ARG)

Show the headers if they are hidden, or hide them if they are shown.
If ARG is a positive number, show the entire header.
If ARG is a negative number, hide the unwanted header lines.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-27 23:29 ` Andreas Schwab
@ 2024-01-28  6:12   ` Steinar Bang
  2024-01-28 14:39     ` Eric Abrahamsen
  0 siblings, 1 reply; 7+ messages in thread
From: Steinar Bang @ 2024-01-28  6:12 UTC (permalink / raw)
  To: ding

>>>>> Andreas Schwab <schwab@linux-m68k.org>:

> On Jan 28 2024, Steinar Bang wrote:
>> Right now I have to do C-u g to see these headers in the raw message.

> t runs the command gnus-summary-toggle-header (found in
> gnus-summary-mode-map), which is an interactive byte-compiled Lisp
> function in ‘gnus-sum.el’.

> It is bound to t and W t.

When you say this, I think I actually knew this and had forgotten
it... I wonder of how I landed on 'C-u g'?

Maybe I was told the previous time I asked this quesetion? (I miss
gmane's xapien search from 'G G'...)

But anyway: what I really-really-want is to have spam-tagged articles be
flagged, highlighted some way in the summary buffer by the spam score.

I think the concensus the last time I was "no" since the spamassassin
headers weren't in the set cached for use in the summary buffer, so the
entire article must be loaded and parsed.

But things may have changed...?

Thanks!


- Steinar



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-28  6:12   ` Steinar Bang
@ 2024-01-28 14:39     ` Eric Abrahamsen
  2024-01-28 22:15       ` Steinar Bang
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2024-01-28 14:39 UTC (permalink / raw)
  To: ding

Steinar Bang <sb@dod.no> writes:

>>>>>> Andreas Schwab <schwab@linux-m68k.org>:
>
>> On Jan 28 2024, Steinar Bang wrote:
>>> Right now I have to do C-u g to see these headers in the raw message.
>
>> t runs the command gnus-summary-toggle-header (found in
>> gnus-summary-mode-map), which is an interactive byte-compiled Lisp
>> function in ‘gnus-sum.el’.
>
>> It is bound to t and W t.

There's also `gnus-visible-headers', if you want to always see the
result in the article buffer.

> When you say this, I think I actually knew this and had forgotten
> it... I wonder of how I landed on 'C-u g'?
>
> Maybe I was told the previous time I asked this quesetion? (I miss
> gmane's xapien search from 'G G'...)
>
> But anyway: what I really-really-want is to have spam-tagged articles be
> flagged, highlighted some way in the summary buffer by the spam score.
>
> I think the concensus the last time I was "no" since the spamassassin
> headers weren't in the set cached for use in the summary buffer, so the
> entire article must be loaded and parsed.

I believe you could add your desired header to the `gnus-extra-headers'
variable, and get it from there?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-28 14:39     ` Eric Abrahamsen
@ 2024-01-28 22:15       ` Steinar Bang
  2024-01-29  1:06         ` Dan Christensen
  0 siblings, 1 reply; 7+ messages in thread
From: Steinar Bang @ 2024-01-28 22:15 UTC (permalink / raw)
  To: ding

>>>>> Eric Abrahamsen <eric@ericabrahamsen.net>:

> There's also `gnus-visible-headers', if you want to always see the
> result in the article buffer.

Yes... but I think the 't' trick further up in the thread is sufficient
to me here.

> I believe you could add your desired header to the `gnus-extra-headers'
> variable, and get it from there?

Thanks! I will investigate and follow up in this thread with what I find out.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-28 22:15       ` Steinar Bang
@ 2024-01-29  1:06         ` Dan Christensen
  2024-01-29  1:22           ` Eric Abrahamsen
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Christensen @ 2024-01-29  1:06 UTC (permalink / raw)
  To: ding

Here are some old settings that I'm not using these days, but which
might do things similar to what you want:

(add-to-list 'nnmail-extra-headers 'X-Spam-Status)
(add-to-list 'gnus-extra-headers 'X-Spam-Status)

(defun jdc-spam-status (h)
  "The spam rating from the X-Spam-Status header."
  (string-to-number (gnus-replace-in-string
		     (gnus-extra-header 'X-Spam-Status h)
		     ".*hits=" "")))

(defun gnus-user-format-function-s (h)
  (let ((ss (jdc-spam-status h)))
    (if (> (abs ss) 10)
	(round ss)
      ss)))

With the above settings, I'm able to display the spam score in the
summary buffer line using "%us" in gnus-summary-line-format.  This could
be adapted to display other info.

I also sort my spam group by spam score, so the ones that at most likely
to be mis-classified messages are together:

(defun jdc-gnus-article-sort-by-spam-status (h1 h2)
  "Sort articles by score from the X-Spam-Status: header."
  (< (jdc-spam-status h1) (jdc-spam-status h2)))

(defun jdc-gnus-thread-sort-by-spam-status (t1 t2)
  "Sort threads by score from the X-Spam-Status: header."
  (jdc-gnus-article-sort-by-spam-status
   (gnus-thread-header t1)
   (gnus-thread-header t2)))

But I don't see where I enable these functions.

Dan



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Displaying stuff from spamassassin headers in the summary buffer?
  2024-01-29  1:06         ` Dan Christensen
@ 2024-01-29  1:22           ` Eric Abrahamsen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2024-01-29  1:22 UTC (permalink / raw)
  To: ding

Dan Christensen <jdc@uwo.ca> writes:

> Here are some old settings that I'm not using these days, but which
> might do things similar to what you want:
>
> (add-to-list 'nnmail-extra-headers 'X-Spam-Status)
> (add-to-list 'gnus-extra-headers 'X-Spam-Status)
>
> (defun jdc-spam-status (h)
>   "The spam rating from the X-Spam-Status header."
>   (string-to-number (gnus-replace-in-string
> 		     (gnus-extra-header 'X-Spam-Status h)
> 		     ".*hits=" "")))
>
> (defun gnus-user-format-function-s (h)
>   (let ((ss (jdc-spam-status h)))
>     (if (> (abs ss) 10)
> 	(round ss)
>       ss)))
>
> With the above settings, I'm able to display the spam score in the
> summary buffer line using "%us" in gnus-summary-line-format.  This could
> be adapted to display other info.
>
> I also sort my spam group by spam score, so the ones that at most likely
> to be mis-classified messages are together:
>
> (defun jdc-gnus-article-sort-by-spam-status (h1 h2)
>   "Sort articles by score from the X-Spam-Status: header."
>   (< (jdc-spam-status h1) (jdc-spam-status h2)))
>
> (defun jdc-gnus-thread-sort-by-spam-status (t1 t2)
>   "Sort threads by score from the X-Spam-Status: header."
>   (jdc-gnus-article-sort-by-spam-status
>    (gnus-thread-header t1)
>    (gnus-thread-header t2)))
>
> But I don't see where I enable these functions.
>
> Dan

These are the remaining puzzle pieces I was too lazy to look up! Thank you.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-01-29  1:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-27 23:02 Displaying stuff from spamassassin headers in the summary buffer? Steinar Bang
2024-01-27 23:29 ` Andreas Schwab
2024-01-28  6:12   ` Steinar Bang
2024-01-28 14:39     ` Eric Abrahamsen
2024-01-28 22:15       ` Steinar Bang
2024-01-29  1:06         ` Dan Christensen
2024-01-29  1:22           ` Eric Abrahamsen

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).