From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/56292 Path: main.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: [spam-report.el] Offline Gmane spam reporting Date: Thu, 05 Feb 2004 15:30:31 -0500 Organization: =?koi8-r?q?=F4=C5=CF=C4=CF=D2=20=FA=CC=C1=D4=C1=CE=CF=D7?= @ Cienfuegos Sender: ding-owner@lists.math.uh.edu Message-ID: <4nr7x9uv4o.fsf@collins.bwh.harvard.edu> References: <4n7jz51bv8.fsf@collins.bwh.harvard.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1076013151 22659 80.91.224.253 (5 Feb 2004 20:32:31 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2004 20:32:31 +0000 (UTC) Original-X-From: ding-owner+M4832@lists.math.uh.edu Thu Feb 05 21:32:26 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AoqAj-0008Kr-00 for ; Thu, 05 Feb 2004 21:32:26 +0100 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 1AoqAT-0007mQ-00; Thu, 05 Feb 2004 14:32:09 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AoqAO-0007mL-00 for ding@lists.math.uh.edu; Thu, 05 Feb 2004 14:32:04 -0600 Original-Received: from clifford.bwh.harvard.edu (clifford.bwh.harvard.edu [134.174.9.41]) by justine.libertine.org (Postfix) with ESMTP id A524A3A004A for ; Thu, 5 Feb 2004 14:32:02 -0600 (CST) Original-Received: from collins.bwh.harvard.edu (collins [134.174.9.80]) by clifford.bwh.harvard.edu (8.10.2+Sun/8.11.0) with ESMTP id i15KUfU17134 for ; Thu, 5 Feb 2004 15:30:41 -0500 (EST) Original-Received: from collins.bwh.harvard.edu (localhost [127.0.0.1]) by collins.bwh.harvard.edu (8.12.9+Sun/8.11.0) with ESMTP id i15KUWvl003199 for ; Thu, 5 Feb 2004 15:30:32 -0500 (EST) Original-Received: (from tzz@localhost) by collins.bwh.harvard.edu (8.12.9+Sun/8.12.9/Submit) id i15KUWE3003196; Thu, 5 Feb 2004 15:30:32 -0500 (EST) Original-To: ding@gnus.org X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Mail-Followup-To: ding@gnus.org In-Reply-To: (Reiner Steib's message of "Tue, 03 Feb 2004 23:59:46 +0100") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (usg-unix-v) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:56292 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:56292 On Tue, 03 Feb 2004, 4.uce.03.r.s@nurfuerspam.de wrote: On Mon, Feb 02 2004, Ted Zlatanov wrote: > On Sun, 01 Feb 2004, 4.uce.03.r.s@nurfuerspam.de wrote: > >>> when I'm reading Gmane groups offline, I cannot use the >>> spam-report functions. Wouldn't it be nice to collect the >>> requests (the URLs) in a file and use them later when online? > [...] >> Very nice, thank you. Go ahead and apply, but make sure you also >> update gnus.el so the new spam-report function is an available spam >> processor. Let me know if you need help with any of it. > > Sorry, I couldn't anything referring to > `spam-report-url-ping-function' in `gnus.el'. If it's needed, > please install it. Oh I see, I thought this was a whole new function when in fact it's a choice of spam-report-url-ping-function. gnus.el has gnus-group-spam-exit-processor-report-gmane which can be associated with exiting from a group to report all spam in it to Gmane, and eventually calls spam-report-url-ping-function. >>> I'm not sure if we should use `spam-directory' or `gnus-directory' >>> in the default value of `spam-report-requests-file'. Is >>> `spam-report.el' supposed to be independent from `spam.el'? At >>> least it doesn't require it. > > Any comment on this? I have used the following now: > > (defcustom spam-report-requests-file > (nnheader-concat gnus-directory "spam/" > "spam-report-requests.url") That's fine. > Yes, I agree. I didn't want to change the default value of > `spam-directory', only its initialization, which should be derived > from `gnus-directory' in some way (see my path in the previous > posting): > > [...] > -(defcustom spam-directory "~/News/spam/" > +(defcustom spam-directory (nnheader-concat gnus-directory "spam/") > [...] Oh, I see. Excellent! I like it a lot. > I don't know the reason for using `nnheader-concat', but I guess > there is a good reason, because it's used elsewhere in most of the > Gnus files. Heh, cargo cult at its best... I have no idea either, but I'll keep this in mind. > I've committed my previously posted patch plus some additions: > > * spam.el (spam-directory): Derive from `gnus-directory'. > > * spam-report.el (spam-report-url-to-file) > (spam-report-requests-file): New function and variable for > offline reporting. (spam-report-url-ping-function): Add > `spam-report-url-to-file' and user defined function. > (spam-report-url-ping-mm-url): Remove doubled slash. Great, thanks! > (defun spam-report-process-queue (&optional file keep) > "Report all queued requests from `spam-report-requests-file'. > > If KEEP is t, leave old requests in the file. If KEEP is > the symbol `ask', query before flushing the queue file." > (interactive > (list (read-file-name > "File: " > (file-name-directory spam-report-requests-file) > spam-report-requests-file > nil > (file-name-nondirectory spam-report-requests-file) > spam-report-requests-file) > current-prefix-arg)) > (or file (setq file spam-report-requests-file)) > (save-excursion > (set-buffer (find-file-noselect file)) > (goto-char (point-min)) > (while (and (not (eobp)) > (re-search-forward > "http://\\([^/]+\\)\\(/.*\\) *$" (point-at-eol) t)) > (spam-report-url-ping-plain (match-string 1) (match-string 2)) > (forward-line 1)) > (if (or (eq keep nil) > (and (eq keep 'ask) > (y-or-n-p > (format > "Flush requests from `%s'? " (current-buffer))))) > (progn > (gnus-message 7 "Flushing request file `%s'" > spam-report-requests-file) > (erase-buffer) > (save-buffer) > (kill-buffer (current-buffer))) > (gnus-message 7 "Keeping requests in `%s'" > spam-report-requests-file)))) I would use spam-report-url-ping-function instead of s-r-u-p-plain there, unless s-r-u-p-function is equal to s-r-u-p-to-file (then we fall back to s-r-u-p-plain or maybe alert the user he's doing something strange). > (add-to-list 'gnus-agent-plugged-hook > (lambda () > (setq spam-report-url-ping-function > 'spam-report-url-ping-plain)) > (spam-report-process-queue));; see below > (add-to-list 'gnus-agent-unplugged-hook > (lambda () > (setq spam-report-url-ping-function > 'spam-report-url-to-file))) I would save the old spam-report-url-ping-function in the unplugged hook, and restore it in the plugged hook, in case the user wants something other than 's-r-u-p-plain (they may already have 's-r-u-p-to-file for instance!) The code looks great otherwise, thanks so much for doing it! > AFAICS, the `spam-report-url-ping*' stuff isn't documented in the > manual. This should be added together with the new > `spam-report-url-to-file' function, probably in (info "(gnus)Gmane > Spam Reporting"). OK, I'll put it on my TODO list (unless someone else wants to do it). Ted