-(defun spam-report-gmane (&rest articles)
- "Report an article as spam through Gmane"
- (dolist (article articles)
- (when (and gnus-newsgroup-name
- (or (null spam-report-gmane-regex)
- (string-match spam-report-gmane-regex gnus-newsgroup-name)))
- (gnus-message 6 "Reporting spam article %d to spam.gmane.org..." article)
- (if spam-report-gmane-use-article-number
- (spam-report-url-ping
- "spam.gmane.org"
- (format "/%s:%d"
- (gnus-group-real-name gnus-newsgroup-name)
- article))
+(defun spam-report-resend-ham (articles)
+ "Report an article as ham by resending via email."
+ (spam-report-resend articles t))
+
+(defconst spam-report-gmane-max-requests 4
+ "Number of reports to send before waiting for a response.")
+
+(defvar spam-report-gmane-wait nil
+ "When non-nil, wait until we get a server response.
+This makes sure we don't DOS the host, if many reports are
+submitted at once. Internal variable.")
+
+(defun spam-report-gmane-ham (&rest articles)
+ "Report ARTICLES as ham (unregister) through Gmane."
+ (interactive (gnus-summary-work-articles current-prefix-arg))
+ (let ((count 0))
+ (dolist (article articles)
+ (setq count (1+ count))
+ (let ((spam-report-gmane-wait
+ (zerop (% count spam-report-gmane-max-requests))))
+ (spam-report-gmane-internal t article)))))
+
+(defun spam-report-gmane-spam (&rest articles)
+ "Report ARTICLES as spam through Gmane."
+ (interactive (gnus-summary-work-articles current-prefix-arg))
+ (let ((count 0))
+ (dolist (article articles)
+ (setq count (1+ count))
+ (let ((spam-report-gmane-wait
+ (zerop (% count spam-report-gmane-max-requests))))
+ (spam-report-gmane-internal nil article)))))
+
+;; `spam-report-gmane' was an interactive entry point, so we should provide an
+;; alias.
+(defalias 'spam-report-gmane 'spam-report-gmane-spam)
+
+(defun spam-report-gmane-internal (unspam article)
+ "Report ARTICLE as spam or not-spam through Gmane, depending on UNSPAM."
+ (when (and gnus-newsgroup-name
+ (or (null spam-report-gmane-regex)
+ (string-match spam-report-gmane-regex gnus-newsgroup-name)))
+ (let ((rpt-host (if unspam "unspam.gmane.org" "spam.gmane.org")))
+ (gnus-message 6 "Reporting article %d to %s..." article rpt-host)
+ (cond
+ ;; Special-case nnweb groups -- these have the URL to use in
+ ;; the Xref headers.
+ ((eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnweb)
+ (spam-report-url-ping
+ rpt-host
+ (concat
+ "/"
+ (gnus-replace-in-string
+ (gnus-replace-in-string
+ (gnus-replace-in-string
+ (mail-header-xref (gnus-summary-article-header article))
+ "/raw" ":silent")
+ "^.*article.gmane.org/" "")
+ "/" ":"))))
+ (spam-report-gmane-use-article-number
+ (spam-report-url-ping
+ rpt-host
+ (format "/%s:%d"
+ (gnus-group-real-name gnus-newsgroup-name)
+ article)))
+ (t