From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/53041 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.gnus.general Subject: Re: spam-stat and base64 encoded messages Date: Fri, 06 Jun 2003 17:30:17 +0200 Organization: http://purl.org/harder/ Sender: ding-owner@lists.math.uh.edu Message-ID: References: <03of1dyplo.fsf@msgid.viggen.net> <4nof1cguhz.fsf@holmes.bwh.harvard.edu> <4nn0gv28m3.fsf@lockgroove.bwh.harvard.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1054916654 31130 80.91.224.249 (6 Jun 2003 16:24:14 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 6 Jun 2003 16:24:14 +0000 (UTC) Original-X-From: ding-owner+M1585@lists.math.uh.edu Fri Jun 06 18:24:13 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19OJzu-00081D-00 for ; Fri, 06 Jun 2003 18:23:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19OK1P-0004L1-00; Fri, 06 Jun 2003 11:24:55 -0500 Original-Received: from sclp3.sclp.com ([64.157.176.121]) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 19OK1G-0004Kt-00 for ding@lists.math.uh.edu; Fri, 06 Jun 2003 11:24:46 -0500 Original-Received: (qmail 51388 invoked by alias); 6 Jun 2003 16:24:46 -0000 Original-Received: (qmail 51383 invoked from network); 6 Jun 2003 16:24:46 -0000 Original-Received: from quimby.gnus.org (80.91.224.244) by sclp3.sclp.com with SMTP; 6 Jun 2003 16:24:46 -0000 Original-Received: from news by quimby.gnus.org with local (Exim 3.12 #1 (Debian)) id 19OKHU-0002F5-00 for ; Fri, 06 Jun 2003 18:41:32 +0200 Original-To: ding@gnus.org Original-Path: localhost.localdomain!nobody Original-Newsgroups: gnus.ding Original-Lines: 67 Original-NNTP-Posting-Host: 0xc3f952eb.esnxr1.ras.tele.dk Original-X-Trace: quimby.gnus.org 1054917692 8622 195.249.82.235 (6 Jun 2003 16:41:32 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: 6 Jun 2003 16:41:32 GMT X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; writes: > On Fri, 06 Jun 2003, harder@myrealbox.com wrote: >> Ted Zlatanov 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)))))))))