* bug#25896: gnus-read-ephemeral-bug-group can modify message body
@ 2017-02-28 7:11 Glenn Morris
2017-03-01 5:23 ` Katsumi Yamaoka
0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2017-02-28 7:11 UTC (permalink / raw)
To: 25896
Package: emacs
Version: 26.0.50
Severity: minor
In revision 4daca38:
emacs -Q -l gnus
M-x gnus-read-ephemeral-emacs-bug-group RET 25891 RET:
I noticed that the To: lines in the examples quoted in the message body
(eg "To: Victor Lazzarini <Victor.Lazzarini AT nuim.ie>") are modified,
by having 25891@debbugs added to them.
I guess in gnus-read-ephemeral-bug-group, the
;; Add the debbugs address so that we can respond to reports easily.
(while (re-search-forward "^To: " nil t)
should only be applied to message headers, not the bodies as well.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#25896: gnus-read-ephemeral-bug-group can modify message body
2017-02-28 7:11 bug#25896: gnus-read-ephemeral-bug-group can modify message body Glenn Morris
@ 2017-03-01 5:23 ` Katsumi Yamaoka
2017-03-01 23:35 ` Glenn Morris
0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2017-03-01 5:23 UTC (permalink / raw)
To: Glenn Morris; +Cc: 25896
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
On Tue, 28 Feb 2017 02:11:21 -0500, Glenn Morris wrote:
> emacs -Q -l gnus
> M-x gnus-read-ephemeral-emacs-bug-group RET 25891 RET:
> I noticed that the To: lines in the examples quoted in the message body
> (eg "To: Victor Lazzarini <Victor.Lazzarini AT nuim.ie>") are modified,
> by having 25891@debbugs added to them.
How about a diff below? This version doesn't add the debbugs
address if it already exists in To: or Cc: field in a message
header, otherwise it adds the address to the To header, or adds
the To header along with the address if the To header is absent.
All are done in each narrowed message header of mbox data.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1566 bytes --]
--- lisp/gnus/gnus-group.el~ 2017-01-04 22:16:44.000000000 +0000
+++ lisp/gnus/gnus-group.el 2017-03-01 05:06:46.565658800 +0000
@@ -2464,14 +2464,33 @@
(file-exists-p file))
(insert-file-contents file)
(url-insert-file-contents (format mbox-url id)))))
- (goto-char (point-min))
;; Add the debbugs address so that we can respond to reports easily.
- (while (re-search-forward "^To: " nil t)
- (end-of-line)
- (insert (format ", %s@%s" (car ids)
- (replace-regexp-in-string
- "/.*$" ""
- (replace-regexp-in-string "^http://" "" mbox-url)))))))
+ (let ((address
+ (format "%s@%s" (car ids)
+ (replace-regexp-in-string
+ "/.*$" ""
+ (replace-regexp-in-string "^http://" "" mbox-url)))))
+ (goto-char (point-min))
+ (while (re-search-forward (concat "^" message-unix-mail-delimiter)
+ nil t)
+ (narrow-to-region (point)
+ (if (search-forward "\n\n" nil t)
+ (1- (point))
+ (point-max)))
+ (unless (string-match (concat "\\(?:\\`\\|[ ,<]\\)"
+ (regexp-quote address)
+ "\\(?:\\'\\|[ ,>]\\)")
+ (concat (message-fetch-field "to") " "
+ (message-fetch-field "cc")))
+ (goto-char (point-min))
+ (if (re-search-forward "^To:" nil t)
+ (progn
+ (message-next-header)
+ (skip-chars-backward "\t\n ")
+ (insert ", " address))
+ (insert "To: " address "\n")))
+ (goto-char (point-max))
+ (widen)))))
(gnus-group-read-ephemeral-group
(format "nndoc+ephemeral:bug#%s"
(mapconcat 'number-to-string ids ","))
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#25896: gnus-read-ephemeral-bug-group can modify message body
2017-03-01 5:23 ` Katsumi Yamaoka
@ 2017-03-01 23:35 ` Glenn Morris
2017-03-02 7:56 ` Katsumi Yamaoka
0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2017-03-01 23:35 UTC (permalink / raw)
To: Katsumi Yamaoka; +Cc: 25896
Katsumi Yamaoka wrote:
> How about a diff below? This version doesn't add the debbugs
> address if it already exists in To: or Cc: field in a message
> header, otherwise it adds the address to the To header, or adds
> the To header along with the address if the To header is absent.
> All are done in each narrowed message header of mbox data.
I didn't test it, but this sounds right to me, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#25896: gnus-read-ephemeral-bug-group can modify message body
2017-03-01 23:35 ` Glenn Morris
@ 2017-03-02 7:56 ` Katsumi Yamaoka
0 siblings, 0 replies; 4+ messages in thread
From: Katsumi Yamaoka @ 2017-03-02 7:56 UTC (permalink / raw)
To: Glenn Morris; +Cc: 25896-done
On Wed, 01 Mar 2017 18:35:18 -0500, Glenn Morris wrote:
> I didn't test it, but this sounds right to me, thanks.
Done. Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-02 7:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-28 7:11 bug#25896: gnus-read-ephemeral-bug-group can modify message body Glenn Morris
2017-03-01 5:23 ` Katsumi Yamaoka
2017-03-01 23:35 ` Glenn Morris
2017-03-02 7:56 ` Katsumi Yamaoka
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).