]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/uce.el
(smtpmail-via-smtp): Fall back to user-mail-address as sender.
[gnu-emacs] / lisp / mail / uce.el
index aa0dfdfee39ef5fa5dff24624b76e3592afbcc29..722ef28aa0cae1e34e1220a69464081fbd0770c6 100644 (file)
@@ -1,6 +1,6 @@
 ;;; uce.el --- facilitate reply to unsolicited commercial email
 
-;; Copyright (C) 1996, 1998 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2000 Free Software Foundation, Inc.
 
 ;; Author: stanislav shalunov <shalunov@mccme.ru>
 ;; Created: 10 Dec 1996
@@ -8,15 +8,15 @@
 
 ;; This file is part of GNU Emacs.
 
-;; This program is free software; you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as
-;; published by the Free Software Foundation; either version 2, or (at
-;; your option) any later version.
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
 
-;; This program is distributed in the hope that it will be useful, but
-;; without any warranty; without even the implied warranty of
-;; merchantability or fitness for a particular purpose.  See the GNU
-;; General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
 ;; Dec 3, 1997 -- changes from Gareth Jones <gdj1@gdjones.demon.co.uk>
 ;; handling Received headers following some line like `From:'.
 
-;;; Setup:
+;; Aug 16, 2000 -- changes from Detlev Zundel
+;; <detlev.zundel@stud.uni-karlsruhe.de> to make uce.el work with the
+;; latest Gnus.  Lars told him it should work for all versions of Gnus
+;; younger than three years.
 
-;; put in your ~./emacs the following line:
+;; Setup:
+
+;; Add the following line to your ~/.emacs:
 
 ;; (autoload 'uce-reply-to-uce "uce" "Reply to UCEs" t nil)
 
@@ -214,13 +219,18 @@ buffer with default To: to the sender, his postmaster, his abuse@
 address, and postmaster of the mail relay used."
   (interactive)
   (let ((message-buffer
-        (cond ((eq uce-mail-reader 'gnus) "*Article*")
+        (cond ((eq uce-mail-reader 'gnus) gnus-original-article-buffer)
               ((eq uce-mail-reader 'rmail) "RMAIL")
               (t (error 
-                  "Variable uce-mail-reader set to unrecognized value")))))
+                  "Variable uce-mail-reader set to unrecognized value"))))
+       (full-header-p (and (eq uce-mail-reader 'rmail)
+                           (not (rmail-msg-is-pruned)))))
     (or (get-buffer message-buffer)
        (error (concat "No buffer " message-buffer ", cannot find UCE")))
     (switch-to-buffer message-buffer)
+    ;; We need the message with headers pruned.
+    (if full-header-p
+       (rmail-toggle-header 1))
     (let ((to (mail-strip-quoted-names (mail-fetch-field "from" t)))
          (reply-to (mail-fetch-field "reply-to"))
          temp)
@@ -241,16 +251,18 @@ address, and postmaster of the mail relay used."
       (setq mail-send-actions nil)
       (setq mail-reply-buffer nil)
       (cond ((eq uce-mail-reader 'gnus)
-            (article-hide-headers -1)
-            (copy-region-as-kill (point-min) (point-max))
-            (article-hide-headers))
+            (copy-region-as-kill (point-min) (point-max)))
            ((eq uce-mail-reader 'rmail)
             (save-excursion
               (save-restriction
+                (rmail-toggle-header 1)
                 (widen)
                 (rmail-maybe-set-message-counters)
                 (copy-region-as-kill (rmail-msgbeg rmail-current-message) 
                                      (rmail-msgend rmail-current-message))))))
+      ;; Restore the pruned header state we found.
+      (if full-header-p
+         (rmail-toggle-header 0))
       (switch-to-buffer "*mail*")
       (erase-buffer)
       (setq temp (point))