* spam.el (spam-list-of-processors, spam-registration-functions):
authorTeodor Zlatanov <tzz@lifelogs.com>
Thu, 20 May 2004 18:32:35 +0000 (18:32 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Thu, 20 May 2004 18:32:35 +0000 (18:32 +0000)
add spam-use-resend
(spam-group-spam-processor-report-resend-p): utility wrapper
(spam-report-articles-gmane): doc fix
(spam-report-articles-resend,
spam-report-resend-register-routine): wrappers around
spam-report-resend-to

* spam-report.el (spam-report-resend-to, spam-report-resend):
support for resending spam
(spam-report-gmane): line length >80 fix

* gnus.el (spam-process): add spam-use-resend

lisp/ChangeLog
lisp/gnus.el
lisp/spam-report.el
lisp/spam.el

index a3c4ba4..ed737f8 100644 (file)
@@ -1,3 +1,19 @@
+2004-05-20  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el (spam-list-of-processors, spam-registration-functions):
+       add spam-use-resend
+       (spam-group-spam-processor-report-resend-p): utility wrapper
+       (spam-report-articles-gmane): doc fix
+       (spam-report-articles-resend,
+       spam-report-resend-register-routine): wrappers around
+       spam-report-resend-to
+
+       * spam-report.el (spam-report-resend-to, spam-report-resend):
+       support for resending spam
+       (spam-report-gmane): line length >80 fix
+
+       * gnus.el (spam-process): add spam-use-resend
+
 2004-05-20  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>
 
        * spam.el (spam-mark-spam-as-expired-and-move-routine): Return the
index 9f331da..747e3fb 100644 (file)
@@ -1896,6 +1896,7 @@ Only applicable to non-spam (unclassified and ham) groups.")
            (const :tag "Spam: Blacklist"     (spam spam-use-blacklist))
            (const :tag "Spam: Bsfilter"      (spam spam-use-bsfilter))
            (const :tag "Spam: Gmane Report"  (spam spam-use-gmane))
+           (const :tag "Spam: Resend Message"(spam spam-use-resend))
            (const :tag "Spam: ifile"         (spam spam-use-ifile))
            (const :tag "Spam: Spam Oracle"   (spam spam-use-spamoracle))
            (const :tag "Spam: Spam-stat"     (spam spam-use-stat))
index 521b401..25343cc 100644 (file)
@@ -79,12 +79,36 @@ The function must accept the arguments `host' and `report'."
   :type 'file
   :group 'spam-report)
 
+(defcustom spam-report-resend-to (or 
+                                 (when (length user-mail-address) 
+                                   user-mail-address)
+                                 "nonexistent-user-please-fix@invalid.domain")
+  "Email address that spam articles are resent to when reporting."
+  :type 'string
+  :group 'spam-report)
+
 (defvar spam-report-url-ping-temp-agent-function nil
   "Internal variable for `spam-report-agentize' and `spam-report-deagentize'.
 This variable will store the value of `spam-report-url-ping-function' from
 before `spam-report-agentize' was run, so that `spam-report-deagentize' can
 undo that change.")
 
+(defun spam-report-resend (&rest articles)
+  "Report an article as spam by resending via email."
+  (dolist (article articles)
+    (gnus-message 6 
+                 "Reporting spam article %d to <%s>..." 
+                 article spam-report-resend-to)
+    ;; This is ganked from the `gnus-summary-resend-message' function.
+    ;; It involves rendering the SPAM, which is undesirable, but there does
+    ;; not seem to be a nicer way to achieve this.
+    ;; select this particular article
+    (gnus-summary-select-article nil nil nil article)
+    ;; resend it to the destination address
+    (save-excursion
+      (set-buffer gnus-original-article-buffer)
+      (message-resend spam-report-resend-to))))
+
 (defun spam-report-gmane (&rest articles)
   "Report an article as spam through Gmane"
   (dolist (article articles)
@@ -93,10 +117,11 @@ undo that change.")
                   (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))
+         (spam-report-url-ping 
+          "spam.gmane.org"
+          (format "/%s:%d"
+                  (gnus-group-real-name gnus-newsgroup-name)
+                  article))
        (with-current-buffer nntp-server-buffer
          (gnus-request-head article gnus-newsgroup-name)
          (goto-char (point-min))
index 07c3651..49fc504 100644 (file)
@@ -55,7 +55,8 @@
 
 ;; autoload spam-report
 (eval-and-compile
-  (autoload 'spam-report-gmane "spam-report"))
+  (autoload 'spam-report-gmane "spam-report")
+  (autoload 'spam-report-resend "spam-report"))
 
 ;; autoload gnus-registry
 (eval-and-compile
@@ -659,7 +660,9 @@ finds ham or spam.")
     nil))
 
 (defvar spam-list-of-processors
+  ;; note the resend and gmane processors are not defined in gnus.el
   '((gnus-group-spam-exit-processor-report-gmane spam spam-use-gmane)
+    (gnus-group-spam-exit-processor-report-resend spam spam-use-resend)
     (gnus-group-spam-exit-processor-bogofilter   spam spam-use-bogofilter)
     (gnus-group-spam-exit-processor-bsfilter    spam spam-use-bsfilter)
     (gnus-group-spam-exit-processor-blacklist    spam spam-use-blacklist)
@@ -705,6 +708,9 @@ variable with a classification and a spam-use-* variable.")
 (defun spam-group-spam-processor-report-gmane-p (group)
   (spam-group-processor-p group 'gnus-group-spam-exit-processor-report-gmane))
 
+(defun spam-group-spam-processor-report-resend-p (group)
+  (spam-group-processor-p group 'gnus-group-spam-exit-processor-report-resend))
+
 (defun spam-group-spam-processor-bogofilter-p (group)
   (spam-group-processor-p group 'gnus-group-spam-exit-processor-bogofilter))
 
@@ -742,13 +748,23 @@ variable with a classification and a spam-use-* variable.")
   (spam-group-processor-p group 'gnus-group-ham-exit-processor-spamoracle))
 
 (defun spam-report-articles-gmane (n)
-  "Report the current message as spam.
+  "Report the current message as spam via Gmane.
 Respects the process/prefix convention."
   (interactive "P")
   (dolist (article (gnus-summary-work-articles n))
     (gnus-summary-remove-process-mark article)
     (spam-report-gmane article)))
 
+(defun spam-report-articles-resend (n)
+  "Report the current message as spam by resending it.
+Respects the process/prefix convention.  Also see
+`spam-report-resend-to'."
+  (interactive "P")
+  (let ((articles (gnus-summary-work-articles n)))
+    (spam-report-resend articles)
+    (dolist (article articles)
+      (gnus-summary-remove-process-mark article))))
+
 (defun spam-necessary-extra-headers ()
   "Return the extra headers spam.el thinks are necessary."
   (let (list)
@@ -1325,12 +1341,16 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
                         spam-stat-register-spam-routine
                         spam-stat-unregister-ham-routine
                         spam-stat-unregister-spam-routine)
-    ;; note that spam-use-gmane is not a legitimate check
+    ;; note that spam-use-gmane and spam-use-resend are not legitimate checks
     (spam-use-gmane      nil
                         spam-report-gmane-register-routine
                         ;; does Gmane support unregistration?
                         nil
                         nil)
+    (spam-use-resend     nil
+                        spam-report-resend-register-routine
+                        nil
+                        nil)
     (spam-use-spamassassin spam-spamassassin-register-ham-routine
                           spam-spamassassin-register-spam-routine
                           spam-spamassassin-unregister-ham-routine
@@ -2058,6 +2078,9 @@ REMOVE not nil, remove the ADDRESSES."
   (when articles
     (apply 'spam-report-gmane articles)))
 
+(defun spam-report-resend-register-routine (articles)
+  (spam-report-resend articles))
+
 \f
 ;;;; Bogofilter
 (defun spam-check-bogofilter-headers (&optional score)