Synch to Gnus 200310212318.
authoryamaoka <yamaoka>
Wed, 22 Oct 2003 00:04:20 +0000 (00:04 +0000)
committeryamaoka <yamaoka>
Wed, 22 Oct 2003 00:04:20 +0000 (00:04 +0000)
lisp/ChangeLog
lisp/message.el
lisp/spam.el

index 34ccf4e..070461b 100644 (file)
@@ -1,5 +1,15 @@
 2003-10-21  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+       * message.el (message-bounce): Don't erase except bounced header.
+
+2003-10-21  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el (spam-reverse-ip-string): new function to reverse an IP
+       address in a string
+       (spam-check-blackholes): use spam-reverse-ip-string
+
+2003-10-21  Katsumi Yamaoka  <yamaoka@jpl.org>
+
        * gnus-art.el (gnus-narrow-to-page): Clear as well as set the
        value for gnus-page-broken.
 
index af4e9d9..ea26e0f 100644 (file)
@@ -6949,32 +6949,36 @@ contains some mail you have written which has been bounced back to
 you."
   (interactive)
   (let ((cur (current-buffer))
-       boundary)
+       mime-boundary boundary)
     (message-pop-to-buffer (message-buffer-name "bounce"))
     (insert-buffer-substring cur)
     (undo-boundary)
     (message-narrow-to-head)
     (if (and (message-fetch-field "MIME-Version")
-            (setq boundary (message-fetch-field "Content-Type")))
-       (if (string-match "boundary=\"\\([^\"]+\\)\"" boundary)
-           (setq boundary (concat (match-string 1 boundary) " *\n"
-                                  "Content-Type: message/rfc822"))
-         (setq boundary nil)))
+            (setq mime-boundary (message-fetch-field "Content-Type")))
+       (if (string-match "boundary=\"\\([^\"]+\\)\"" mime-boundary)
+           (setq mime-boundary (concat (regexp-quote
+                                        (match-string 1 mime-boundary))
+                                       " *\nContent-Type: message/rfc822"))
+         (setq mime-boundary nil)))
     (widen)
     (goto-char (point-min))
-    (search-forward "\n\n" nil t)
-    (if (or (and boundary
-                (re-search-forward boundary nil t)
-                (forward-line 2))
-           (and (re-search-forward message-unsent-separator nil t)
+    (re-search-forward "\n\n+" nil t)
+    (setq boundary (point))
+    ;; We remove everything before the bounced mail.
+    (if (or (and mime-boundary
+                (re-search-forward mime-boundary nil t)
                 (forward-line 1))
-           (re-search-forward "^Return-Path:.*\n" nil t))
-       ;; We remove everything before the bounced mail.
-       (delete-region
-        (point-min)
-        (if (re-search-forward "^[^ \n\t]+:" nil t)
-            (match-beginning 0)
-          (point)))
+           (re-search-forward message-unsent-separator nil t)
+           (progn
+             (search-forward "\n\n" nil 'move)
+             (re-search-backward "^Return-Path:.*\n" boundary t)))
+       (progn
+         (forward-line 1)
+         (delete-region (point-min)
+                        (if (re-search-forward "^[^ \n\t]+:" nil t)
+                            (match-beginning 0)
+                          (point))))
       (when (re-search-backward "^.?From .*\n" nil t)
        (delete-region (match-beginning 0) (match-end 0))))
     (save-restriction
index d50e448..9b3adb1 100644 (file)
@@ -753,6 +753,12 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 \f
 ;;;; Blackholes.
 
+(defun spam-reverse-ip-string (ip)
+  (when (stringp ip)
+    (mapconcat 'identity
+              (nreverse (split-string ip "\\."))
+              ".")))
+
 (defun spam-check-blackholes ()
   "Check the Received headers for blackholed relays."
   (let ((headers (nnmail-fetch-field "received"))
@@ -765,14 +771,15 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
        (while (re-search-forward
                "\\[\\([0-9]+.[0-9]+.[0-9]+.[0-9]+\\)\\]" nil t)
          (gnus-message 9 "Blackhole search found host IP %s." (match-string 1))
-         (push (mapconcat 'identity
-                          (nreverse (split-string (match-string 1) "\\."))
-                          ".")
+         (push (spam-reverse-ip-string (match-string 1))
                ips)))
       (dolist (server spam-blackhole-servers)
        (dolist (ip ips)
          (unless (and spam-blackhole-good-server-regex
-                      (string-match spam-blackhole-good-server-regex ip))
+                      ;; match the good-server-regex against the reversed (again) IP string
+                      (string-match 
+                       spam-blackhole-good-server-regex
+                       (spam-reverse-ip-string ip)))
            (unless matches
              (let ((query-string (concat ip "." server)))
                (if spam-use-dig