Package: gnus-bonus-el Version: 26.6-1 Severity: normal Tags: patch, upstream
When gnus-pers-cc-fix is non-nil (the default setting), any occurrence of double quotes as part of an email address is eliminated in the Cc header. As a result, replying to a message with the following header --8<---------------cut here---------------start------------->8--- From: "Bar, Foo" <[EMAIL PROTECTED]> To: "Oltmanns, Elias" <[EMAIL PROTECTED]> Cc: "Wilde, Oscar" <[EMAIL PROTECTED]> --8<---------------cut here---------------end--------------->8--- leaves me with a message buffer like this one: --8<---------------cut here---------------start------------->8--- From: "Oltmanns, Elias" <[EMAIL PROTECTED]> To: "Bar, Foo" <[EMAIL PROTECTED]> Cc: Wilde, Oscar <[EMAIL PROTECTED]> --text follows this line-- --8<---------------cut here---------------end--------------->8--- This will most likely cause delivery failures since Wilde is not a qualified email address, and it certainly is not what the user, i.e., me, intended when replying to the original message. Please find attached a patch that fixes this issue employing rmail-dont-reply-to in quite a similar way as message-get-reply-headers in message.el does. Additionally, removes the function gnus-personalities-replace-in-string, as it's not used anymore.
--- gnus-pers.el.orig 2006-08-22 17:45:35.000000000 +0200 +++ gnus-pers.el 2006-08-22 17:49:01.000000000 +0200 @@ -82,6 +82,8 @@ (eval-when-compile (require 'cl)) (require 'nnmail) +(autoload 'rmail-dont-reply-to "mail-utils") +(autoload 'gnus-extract-address-components "gnus-util") ;; Variable setup @@ -306,39 +308,6 @@ (define-key message-mode-map "\C-c\C-p" 'gnus-personality-choose) -(defun gnus-personality-replace-in-string (str regexp newtext &optional literal) - "Replace all matches in STR for REGEXP with NEWTEXT string, - and returns the new string. -Optional LITERAL non-nil means do a literal replacement. -Otherwise treat `\\' in NEWTEXT as special: - `\\&' in NEWTEXT means substitute original matched text. - `\\N' means substitute what matched the Nth `\\(...\\)'. - If Nth parens didn't match, substitute nothing. - `\\\\' means insert one `\\'. - `\\u' means upcase the next character. - `\\l' means downcase the next character. - `\\U' means begin upcasing all following characters. - `\\L' means begin downcasing all following characters. - `\\E' means terminate the effect of any `\\U' or `\\L'. - -This is mostly copied from XEmacs' replace-in-string because Emacs doesn't -have that function." - (if (> (length str) 50) - (let ((cfs case-fold-search)) - (with-temp-buffer - (setq case-fold-search cfs) - (insert str) - (goto-char 1) - (while (re-search-forward regexp nil t) - (replace-match newtext t literal)) - (buffer-string))) - (let ((start 0) newstr) - (while (string-match regexp str start) - (setq newstr (replace-match newtext t literal str) - start (+ (match-end 0) (- (length newstr) (length str))) - str newstr)) - str))) - (defun gnus-personality-use (&optional personality) "Use a personality defined in gnus-personalities." (interactive) @@ -504,27 +473,16 @@ ; Now we have a problem with Cc when doing a followup. So let's check the Cc field and see if from is there: (save-excursion (save-restriction - (message-goto-cc) ;; Yes, yes. This inserts a Cc: if there's nothing there. No worries. - (beginning-of-line) - (let ((beg (point)) - (email (gnus-personality-replace-in-string from "\"" ""))) - (end-of-line) - (narrow-to-region beg (point)) - (goto-char (point-min)) - ; " mess me up. - (while (search-forward "\"" nil t) - (replace-match "") - ) - (goto-char (point-min)) - (if (search-forward email nil t) - (let* ((end (match-end 0)) - (start (match-beginning 0))) - (delete-region start end))) ; Excellent. Now we need to check for a blank line. - (unless (re-search-forward "[EMAIL PROTECTED]" nil t) + (message-narrow-to-head) + (let ((rmail-dont-reply-to-names + (cadr (gnus-extract-address-components from))) + (cc (message-field-value "Cc"))) + (when (and cc + (string-match rmail-dont-reply-to-names cc)) (widen) - (forward-line 1) - (beginning-of-line) - (delete-region beg (point))) + (message-remove-header "Cc") + (message-goto-cc) + (insert (rmail-dont-reply-to cc))) ) ) @@ -652,27 +610,16 @@ ; Now we have a problem with Cc when doing a followup. So let's check the Cc field and see if from is there: (save-excursion (save-restriction - (message-goto-cc) ;; Yes, yes. This inserts a Cc: if there's nothing there. No worries. - (beginning-of-line) - (let ((beg (point)) - (email (gnus-personality-replace-in-string from "\"" ""))) - (end-of-line) - (narrow-to-region beg (point)) - (goto-char (point-min)) - ; " mess me up. - (while (search-forward "\"" nil t) - (replace-match "") - ) - (goto-char (point-min)) - (if (search-forward email nil t) - (let* ((end (match-end 0)) - (start (match-beginning 0))) - (delete-region start end))) ; Excellent. Now we need to check for a blank line. - (unless (re-search-forward "[EMAIL PROTECTED]" nil t) + (message-narrow-to-head) + (let ((rmail-dont-reply-to-names + (cadr (gnus-extract-address-components from))) + (cc (message-field-value "Cc"))) + (when (and cc + (string-match rmail-dont-reply-to-names cc)) (widen) - (forward-line 1) - (beginning-of-line) - (delete-region beg (point))) + (message-remove-header "Cc") + (message-goto-cc) + (insert (rmail-dont-reply-to cc))) ) )
pgpLYuwshqNJd.pgp
Description: PGP signature