From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/82498 Path: news.gmane.org!not-for-mail From: Jan Tatarik Newsgroups: gmane.emacs.gnus.general 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 Message-ID: <5n5x2rpq3gwlo8.fsf@nb-jtatarik2.xing.hh> References: <87a9ul60hm.fsf@silenus.orebokech.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1352887215 23028 80.91.229.3 (14 Nov 2012 10:00:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 14 Nov 2012 10:00:15 +0000 (UTC) Cc: Lars Ingebrigtsen , GNUS mailing list To: Romain Francoise Original-X-From: ding-owner+M30764@lists.math.uh.edu Wed Nov 14 11:00:25 2012 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TYZlc-0001wn-8V for ding-account@gmane.org; Wed, 14 Nov 2012 11:00:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1TYZk7-0005Ac-KN; Wed, 14 Nov 2012 03:58:47 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1TYZk5-0005AP-Vk for ding@lists.math.uh.edu; Wed, 14 Nov 2012 03:58:45 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1TYZk0-0004Ba-VK for ding@lists.math.uh.edu; Wed, 14 Nov 2012 03:58:45 -0600 Original-Received: from mail-ee0-f44.google.com ([74.125.83.44]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1TYZjz-0006Ja-6y; Wed, 14 Nov 2012 10:58:39 +0100 Original-Received: by mail-ee0-f44.google.com with SMTP id b47so186435eek.17 for ; Wed, 14 Nov 2012 01:58:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=vkf4ccmdj3zuLEfItymfBOQtTXP9cbbLbl7NTuITP2g=; b=r940Dh97htPuEXi3oA37sjOB2SnBly0UHjK7eeZrjr52o3LwYD4i+nxrW1qJCQUKeu /vdtwVDzzJ+AqaEXfpg1+3Azs1TJXspmdaQXtNUqVsbk8qrCyLNdPuocznSDgTUQ5X8p 6OKcYvwLTvdbAaB0VuXjh8abXgwi/o6WHweCrji78TtcNmCxrXhc1ImYL25t+Buks+Yd WhiPMNV89Mf+mAiUJ1UGBhdX0EBU3axb18b+ccDuwXlMMeq5KLjvcYCirs2gS46VkbzR SkDcw//dtbwq0hDYDfJhx1mEWmYE9wKGaZ8hZikhCbp2CnU4+sUTemKQF3bH7XsoDB4R 2nIg== Original-Received: by 10.14.173.137 with SMTP id v9mr85479616eel.41.1352887113741; Wed, 14 Nov 2012 01:58:33 -0800 (PST) Original-Received: from nb-jtatarik2.xing.hh (office.xing.com. [82.112.107.65]) by mx.google.com with ESMTPS id k2sm28600782eep.15.2012.11.14.01.58.32 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Nov 2012 01:58:32 -0800 (PST) In-Reply-To: <87a9ul60hm.fsf@silenus.orebokech.com> (Romain Francoise's message of "Tue, 13 Nov 2012 15:28:21 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:82498 Archived-At: --=-=-= Content-Type: text/plain On Tue, Nov 13 2012, Romain Francoise wrote: > Lars Ingebrigtsen writes: >> commit b0e097a051ce5e58042ab6e1b5fa6519b1ed87c4 >> Author: Jan Tatarik >> 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. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=score-by-body-not-headers.patch 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 --=-=-=--