Gnus development mailing list
 help / color / mirror / Atom feed
* Re: [gnus git]  branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies.
       [not found] ` <87a9ul60hm.fsf@silenus.orebokech.com>
@ 2012-11-14  9:58   ` Jan Tatarik
  2012-11-16  9:10     ` Romain Francoise
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Tatarik @ 2012-11-14  9:58 UTC (permalink / raw)
  To: Romain Francoise; +Cc: Lars Ingebrigtsen, GNUS mailing list

[-- 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

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

* Re: [gnus git]  branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies.
  2012-11-14  9:58   ` [gnus git] branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies Jan Tatarik
@ 2012-11-16  9:10     ` Romain Francoise
  2012-11-16  9:25       ` Jan Tatarik
  0 siblings, 1 reply; 3+ messages in thread
From: Romain Francoise @ 2012-11-16  9:10 UTC (permalink / raw)
  To: Jan Tatarik; +Cc: Lars Ingebrigtsen, GNUS mailing list

Jan Tatarik <jan.tatarik@gmail.com> writes:

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

Works for me, thanks. You have copyright papers on file, so if you provide
a fitting ChangeLog entry I can install that for you, if you like.



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

* Re: [gnus git]  branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies.
  2012-11-16  9:10     ` Romain Francoise
@ 2012-11-16  9:25       ` Jan Tatarik
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Tatarik @ 2012-11-16  9:25 UTC (permalink / raw)
  To: Romain Francoise; +Cc: Lars Ingebrigtsen, GNUS mailing list

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

On Fri, Nov 16 2012, Romain Francoise wrote:

> Jan Tatarik <jan.tatarik@gmail.com> writes:

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

> Works for me, thanks. You have copyright papers on file, so if you provide
> a fitting ChangeLog entry I can install that for you, if you like.

Here you go.


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

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 97d9a6812d5c91b9c591700a15c12467ecc77c50..a0bdde85bc3acb20749fb92ff64c58aeb5a9a862 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2012-11-16  Jan Tatarik  <jan.tatarik@gmail.com>
+
+	* gnus-score.el (gnus-score-body):
+	* gnus-logic.el (gnus-advanced-body): Don't score by headers when
+	scoring by body.
+
 2012-11-08  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (gnus-article-browse-html-parts): Always replace charset
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

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

end of thread, other threads:[~2012-11-16  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1T9Fqc-0004AW-7n@quimby.gnus.org>
     [not found] ` <87a9ul60hm.fsf@silenus.orebokech.com>
2012-11-14  9:58   ` [gnus git] branch master updated: m0-5-112-gb0e097a =1= Allow scoring on decoded (base64, etc) bodies Jan Tatarik
2012-11-16  9:10     ` Romain Francoise
2012-11-16  9:25       ` Jan Tatarik

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