;;; 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
;; 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)
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)
(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))
(if (eq uce-mail-reader 'rmail)
(progn
(forward-line 2)
- (while (looking-at "Summary-Line:\\|Mail-From:")
- (forward-line 1))
+ (let ((case-fold-search t))
+ (while (looking-at "Summary-Line:\\|Mail-From:")
+ (forward-line 1)))
(delete-region temp (point))))
;; Now find the mail hub that first accepted this message.
;; This should try to find the last Received: header.