Gnus development mailing list
 help / color / mirror / Atom feed
From: Jan Tatarik <jan.tatarik@gmail.com>
To: Romain Francoise <romain@orebokech.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, GNUS mailing list <ding@gnus.org>
Subject: Re: [gnus git]  branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies.
Date: Wed, 14 Nov 2012 10:58:31 +0100	[thread overview]
Message-ID: <5n5x2rpq3gwlo8.fsf@nb-jtatarik2.xing.hh> (raw)
In-Reply-To: <87a9ul60hm.fsf@silenus.orebokech.com> (Romain Francoise's message of "Tue, 13 Nov 2012 15:28:21 +0100")

[-- Attachment #1: Type: text/plain, Size: 769 bytes --]

On Tue, Nov 13 2012, Romain Francoise wrote:

> Lars Ingebrigtsen <larsi@gnus.org> writes:

>> commit b0e097a051ce5e58042ab6e1b5fa6519b1ed87c4
>> Author: Jan Tatarik <jan.tatarik@gmail.com>
>> Date:   Wed Sep 5 15:40:34 2012 +0200

>>     Allow scoring on decoded (base64, etc) bodies.

>>     * gnus-score.el (gnus-score-decode-text-parts): Ditto.

>>     * gnus-logic.el (gnus-advanced-body): Allow scoring on decoded bodies.

> It seems that this change, or another recent change (didn't check), makes
> Gnus match "body" score rules on message headers as well, which is wrong.
> For example if you add a "body" rule for "X-Mailer", "User-Agent" or any
> other header, all messages match.

Yes, that was my change breaking this. The attached patch should fix
this.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: score-by-body-not-headers.patch --]
[-- Type: text/x-diff, Size: 3487 bytes --]

diff --git a/lisp/gnus-logic.el b/lisp/gnus-logic.el
index a440b7799303ddf46674c35c20f5bba51388b50c..60d7b31713b192f821060a8b463b6e771c4ea29f 100644
--- a/lisp/gnus-logic.el
+++ b/lisp/gnus-logic.el
@@ -181,17 +181,18 @@
   (with-current-buffer nntp-server-buffer
     (let* ((request-func (cond ((string= "head" header)
                                 'gnus-request-head)
-                               ;; We need to peek at the headers to detect the
-                               ;; content encoding
                                ((string= "body" header)
-                                'gnus-request-article)
+                                'gnus-request-body)
                                (t 'gnus-request-article)))
            ofunc article handles)
       ;; Not all backends support partial fetching.  In that case, we
       ;; just fetch the entire article.
-      (unless (gnus-check-backend-function
-               (intern (concat "request-" header))
-               gnus-newsgroup-name)
+      ;; When scoring by body, we need to peek at the headers to detect the
+      ;; content encoding
+      (unless (or (gnus-check-backend-function
+                   (intern (concat "request-" header))
+                   gnus-newsgroup-name)
+                  (string= "body" header))
         (setq ofunc request-func)
         (setq request-func 'gnus-request-article))
       (setq article (mail-header-number gnus-advanced-headers))
diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el
index f215b84551499cee6de7a0f67beac8251a9e2ce2..b70619608399d547eca394b2e2511ec74c65b280 100644
--- a/lisp/gnus-score.el
+++ b/lisp/gnus-score.el
@@ -1762,21 +1762,22 @@ score in `gnus-newsgroup-scored' by SCORE."
                 (all-scores scores)
                 (request-func (cond ((string= "head" header)
                                      'gnus-request-head)
-                                    ;; We need to peek at the headers to detect
-                                    ;; the content encoding
                                     ((string= "body" header)
-                                     'gnus-request-article)
+                                     'gnus-request-body)
                                     (t 'gnus-request-article)))
                 entries alist ofunc article last)
            (when articles
              (setq last (mail-header-number (caar (last articles))))
              ;; Not all backends support partial fetching.  In that case,
              ;; we just fetch the entire article.
-             (unless (gnus-check-backend-function
-                      (and (string-match "^gnus-" (symbol-name request-func))
-                           (intern (substring (symbol-name request-func)
-                                              (match-end 0))))
-                      gnus-newsgroup-name)
+             ;; When scoring by body, we need to peek at the headers to detect
+             ;; the content encoding
+             (unless (or (gnus-check-backend-function
+                          (and (string-match "^gnus-" (symbol-name request-func))
+                               (intern (substring (symbol-name request-func)
+                                                  (match-end 0))))
+                          gnus-newsgroup-name)
+                         (string= "body" header))
                (setq ofunc request-func)
                (setq request-func 'gnus-request-article))
              (while articles

       reply	other threads:[~2012-11-14  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1T9Fqc-0004AW-7n@quimby.gnus.org>
     [not found] ` <87a9ul60hm.fsf@silenus.orebokech.com>
2012-11-14  9:58   ` Jan Tatarik [this message]
2012-11-16  9:10     ` Romain Francoise
2012-11-16  9:25       ` Jan Tatarik

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=5n5x2rpq3gwlo8.fsf@nb-jtatarik2.xing.hh \
    --to=jan.tatarik@gmail.com \
    --cc=ding@gnus.org \
    --cc=larsi@gnus.org \
    --cc=romain@orebokech.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).