Gnus development mailing list
 help / color / mirror / Atom feed
From: Jesper Harder <harder@myrealbox.com>
Subject: Re: spam-stat and base64 encoded messages
Date: Fri, 06 Jun 2003 17:30:17 +0200	[thread overview]
Message-ID: <m3llwfz0ja.fsf@defun.localdomain> (raw)
In-Reply-To: <4nn0gv28m3.fsf@lockgroove.bwh.harvard.edu>

Ted Zlatanov <tzz@lifelogs.com> writes:

> On Fri, 06 Jun 2003, harder@myrealbox.com wrote:
>> Ted Zlatanov <tzz@lifelogs.com> writes:
>> 
>>> Maybe the backend or Gnus should optionally decode it before
>>> spam-stat ever sees the message in the splitting?  Right now it's
>>> not done for performance.  I don't think spam-stat.el or spam.el
>>> should do what logically is not their task.
>> 
>> At the moment spam-stat.el also reads directly from files, so
>> decoding by the back end wouldn't be enough.
>
> You're right.  Assuming we don't care about the attachments as
> entities, but only want to inline them in the message as plain text,
> what Gnus functionality can I use to do this?

   (run-hooks 'gnus-article-decode-hook)

does part of the job.  Specifically it:

* decodes rfc2047-encoded headers.
* decodes single-part text/plain QP and Base64 encoded messages.

It's probably better than nothing, and as far as I can tell there are
no unintended side effects ... but a lot of spam is multipart/* and/or
text/html.

I don't think there's any existing functionality that does exactly
what we want.  `gnus-display-mime' is the closest, but it does far
too much.  

You can hack it a bit and wrap some `flet's and `let's around it to
make it sort of work, but it's not really the right way (at least
without some more work):

(require 'cl)

(defun my-decode (&optional ihandles)
  (interactive)
  (flet ((gnus-treat-article (&rest ignore)))
    (let ((gnus-summary-buffer (current-buffer))
	  (mm-text-html-renderer 'mm-inline-text))
      (save-excursion
	(let* ((handles (or ihandles
			    (mm-dissect-buffer nil gnus-article-loose-mime)
			    (and gnus-article-emulate-mime
				 (mm-uu-dissect))))
	       buffer-read-only handle name type b e display)
	  (when (and (not ihandles)
		     (not gnus-displaying-mime))
	    ;; Top-level call; we clean up.
	    (when gnus-article-mime-handles
	      (mm-destroy-parts gnus-article-mime-handles)
	      (setq gnus-article-mime-handle-alist nil));; A trick.
	    (setq gnus-article-mime-handles handles))
	  (if (and handles
		   (or (not (stringp (car handles)))
		       (cdr handles)))
	      (progn
		(when (and (not ihandles)
			   (not gnus-displaying-mime))
		  ;; Clean up for mime parts.
		  (article-goto-body)
		  (delete-region (point) (point-max)))
		(let ((gnus-displaying-mime t))
		  (gnus-mime-display-part handles)))))))))



  reply	other threads:[~2003-06-06 15:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05  7:01 Oystein Viggen
2003-06-05 20:05 ` Ted Zlatanov
2003-06-06  2:02   ` Jesper Harder
2003-06-06  3:22     ` Ted Zlatanov
2003-06-06 15:30       ` Jesper Harder [this message]
2003-06-06 23:21         ` Oystein Viggen
2003-06-09  1:21           ` Jesper Harder
2003-06-09 20:06             ` Ted Zlatanov
2003-06-11 19:42               ` Jesper Harder
2003-08-02 21:17                 ` Alex Schroeder
2003-08-04  7:36                   ` Adam Sjøgren
2003-08-08  0:02                     ` Alex Schroeder
2003-06-06  1:59 ` Jesper Harder

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=m3llwfz0ja.fsf@defun.localdomain \
    --to=harder@myrealbox.com \
    /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).