Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: [spam-report.el] Offline Gmane spam reporting
Date: Thu, 05 Feb 2004 15:30:31 -0500	[thread overview]
Message-ID: <4nr7x9uv4o.fsf@collins.bwh.harvard.edu> (raw)
In-Reply-To: <v9smhrg465.fsf@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Tue, 03 Feb 2004 23:59:46 +0100")

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



  reply	other threads:[~2004-02-05 20:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-01 14:35 Reiner Steib
2004-02-01 21:39 ` Kai Grossjohann
2004-02-01 23:40   ` Reiner Steib
2004-02-02 14:46     ` Kai Grossjohann
2004-02-02 20:10 ` Ted Zlatanov
2004-02-03 22:59   ` Reiner Steib
2004-02-05 20:30     ` Ted Zlatanov [this message]
2004-02-05 22:07       ` Reiner Steib
2004-02-09 20:51         ` Ted Zlatanov
2004-02-24 14:05           ` Reiner Steib

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=4nr7x9uv4o.fsf@collins.bwh.harvard.edu \
    --to=tzz@lifelogs.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).