Gnus development mailing list
 help / color / mirror / Atom feed
From: Benjamin Rutt <rutt+news@cis.ohio-state.edu>
Subject: patches add variable `gnus-confirm-mail-reply-to-news'
Date: Mon, 20 May 2002 22:41:11 -0400	[thread overview]
Message-ID: <wc3it5i1auw.fsf@gamma.cis.ohio-state.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 1194 bytes --]

Attached are two patches against today's CVS.  They implement a
feature that lets a user enable an option which will require
confirmation before allowing a mail reply to a usenet article.  This
will help users catch their mistake when they accidently press 'R' to
respond to a usenet article when they really meant to press 'F'.
(FWIW, these patches are inspired by this month's gnu.emacs.gnus
thread rooted by message id <7w4rhgb773.fsf@i19.ruc.dk>).

The first patch is to gnus-msg.el.  For readers of this patch:  I only
added the lines

  ;; Allow user to require confirmation before replying by mail to the
  ;; author of a news article.
  (when (or (not (gnus-news-group-p gnus-newsgroup-name))
	    (not gnus-confirm-mail-reply-to-news)
	    (y-or-n-p "Really reply by mail to article author? "))

to the method `gnus-summary-reply', however adding the 'when' at the
top required that the rest of the function be reindented, so the patch
is a little harder to read than normal because of the reindents.

The second patch is to gnus.texi and is pretty straightforward.

Comments welcome.  If someone would like to commit this, please go
ahead as I've signed papers.  Thanks,
-- 
Benjamin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gnus-sum.el.patch --]
[-- Type: text/x-patch, Size: 4442 bytes --]

Index: gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 6.88
diff -u -r6.88 gnus-msg.el
--- gnus-msg.el	2002/05/01 22:17:08	6.88
+++ gnus-msg.el	2002/05/21 02:24:52
@@ -239,6 +239,13 @@
   :group 'gnus-message
   :type 'boolean)
 
+(defcustom gnus-confirm-mail-reply-to-news
+  nil
+  "If non-nil, you will be asked to confirm a reply by mail to a
+USENET article."
+  :group 'gnus-message
+  :type 'boolean)
+
 ;;; Internal variables.
 
 (defvar gnus-inhibit-posting-styles nil
@@ -978,51 +985,56 @@
   (interactive
    (list (and current-prefix-arg
 	      (gnus-summary-work-articles 1))))
-  (let* ((article
-	  (if (listp (car yank))
-	      (caar yank)
-	    (car yank)))
-	 (gnus-article-reply (or article (gnus-summary-article-number)))
-	 (headers ""))
-    ;; Stripping headers should be specified with mail-yank-ignored-headers.
-    (when yank
-      (gnus-summary-goto-subject article))
-    (gnus-setup-message (if yank 'reply-yank 'reply)
-      (if (not very-wide)
-	  (gnus-summary-select-article)
-	(dolist (article very-wide)
-	  (gnus-summary-select-article nil nil nil article)
-	  (save-excursion
-	    (set-buffer (gnus-copy-article-buffer))
-	    (gnus-msg-treat-broken-reply-to)
-	    (save-restriction
-	      (message-narrow-to-head)
-	      (setq headers (concat headers (buffer-string)))))))
-      (set-buffer (gnus-copy-article-buffer))
-      (gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to)
-      (save-restriction
-	(message-narrow-to-head)
-	(when very-wide
-	  (erase-buffer)
-	  (insert headers))
-	(goto-char (point-max)))
-      (mml-quote-region (point) (point-max))
-      (message-reply nil wide)
+  ;; Allow user to require confirmation before replying by mail to the
+  ;; author of a news article.
+  (when (or (not (gnus-news-group-p gnus-newsgroup-name))
+	    (not gnus-confirm-mail-reply-to-news)
+	    (y-or-n-p "Really reply by mail to article author? "))
+    (let* ((article
+	    (if (listp (car yank))
+		(caar yank)
+	      (car yank)))
+	   (gnus-article-reply (or article (gnus-summary-article-number)))
+	   (headers ""))
+      ;; Stripping headers should be specified with mail-yank-ignored-headers.
       (when yank
-	(gnus-inews-yank-articles yank))
-      (when (or gnus-message-replysign gnus-message-replyencrypt)
-	(let (signed encrypted)
-	  (save-excursion
-	    (set-buffer gnus-article-buffer)
-	    (setq signed (memq 'signed gnus-article-wash-types))
-	    (setq encrypted (memq 'encrypted gnus-article-wash-types)))
-	  (cond ((and gnus-message-replysign signed)
-		 (mml-secure-message mml-default-sign-method 'sign))
-		((and gnus-message-replyencrypt encrypted)
-		 (mml-secure-message mml-default-encrypt-method
-				     (if gnus-message-replysignencrypted
-					 'signencrypt
-				       'encrypt)))))))))
+	(gnus-summary-goto-subject article))
+      (gnus-setup-message (if yank 'reply-yank 'reply)
+	(if (not very-wide)
+	    (gnus-summary-select-article)
+	  (dolist (article very-wide)
+	    (gnus-summary-select-article nil nil nil article)
+	    (save-excursion
+	      (set-buffer (gnus-copy-article-buffer))
+	      (gnus-msg-treat-broken-reply-to)
+	      (save-restriction
+		(message-narrow-to-head)
+		(setq headers (concat headers (buffer-string)))))))
+	(set-buffer (gnus-copy-article-buffer))
+	(gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to)
+	(save-restriction
+	  (message-narrow-to-head)
+	  (when very-wide
+	    (erase-buffer)
+	    (insert headers))
+	  (goto-char (point-max)))
+	(mml-quote-region (point) (point-max))
+	(message-reply nil wide)
+	(when yank
+	  (gnus-inews-yank-articles yank))
+	(when (or gnus-message-replysign gnus-message-replyencrypt)
+	  (let (signed encrypted)
+	    (save-excursion
+	      (set-buffer gnus-article-buffer)
+	      (setq signed (memq 'signed gnus-article-wash-types))
+	      (setq encrypted (memq 'encrypted gnus-article-wash-types)))
+	    (cond ((and gnus-message-replysign signed)
+		   (mml-secure-message mml-default-sign-method 'sign))
+		  ((and gnus-message-replyencrypt encrypted)
+		   (mml-secure-message mml-default-encrypt-method
+				       (if gnus-message-replysignencrypted
+					   'signencrypt
+					 'encrypt))))))))))
 
 (defun gnus-summary-reply-with-original (n &optional wide)
   "Start composing a reply mail to the current message.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: gnus.texi.patch --]
[-- Type: text/x-patch, Size: 585 bytes --]

Index: gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 6.279
diff -u -r6.279 gnus.texi
--- gnus.texi	2002/05/16 15:06:53	6.279
+++ gnus.texi	2002/05/21 02:37:44
@@ -10736,6 +10736,11 @@
 If non-@code{nil}, add a @code{to-list} group parameter to mail groups
 that have none when you do a @kbd{a}.
 
+@item gnus-confirm-mail-reply-to-news
+@vindex gnus-confirm-mail-reply-to-news
+If non-@code{nil}, you will be asked to confirm a reply by mail to a
+USENET article.
+
 @end table
 
 

             reply	other threads:[~2002-05-21  2:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-21  2:41 Benjamin Rutt [this message]
2002-05-21  9:36 ` Simon Josefsson
2002-05-21 10:46   ` Kai Großjohann
2002-05-21 12:49     ` Simon Josefsson
2002-05-21 17:11       ` Benjamin Rutt
2002-05-21 17:19         ` Benjamin Rutt
2002-05-22  8:52       ` Russ Allbery
2002-05-22  9:10         ` Simon Josefsson
2002-05-22 21:44           ` Benjamin Rutt
2002-05-23 21:36           ` Benjamin Rutt
2002-05-26 16:22           ` Raymond Scholz
2002-05-26 19:11             ` Simon Josefsson
2002-10-16 15:31               ` Raymond Scholz
2002-06-09  9:45 ` Thomas Skogestad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=wc3it5i1auw.fsf@gamma.cis.ohio-state.edu \
    --to=rutt+news@cis.ohio-state.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).