* rfc2047.el (rfc2047-field-value): Strip props.
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 17 May 2004 00:32:00 +0000 (00:32 +0000)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Mon, 17 May 2004 00:32:00 +0000 (00:32 +0000)
* mail-parse.el (mail-header-make-address): New alias.

* ietf-drums.el (ietf-drums-make-address): New function.

lisp/ChangeLog
lisp/ietf-drums.el
lisp/mail-parse.el
lisp/message.el
lisp/rfc2047.el

index 3c415d1..8aca415 100644 (file)
@@ -1,5 +1,11 @@
 2004-05-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * rfc2047.el (rfc2047-field-value): Strip props.
+
+       * mail-parse.el (mail-header-make-address): New alias.
+
+       * ietf-drums.el (ietf-drums-make-address): New function.
+
        * imap.el: Add compiler directives.
 
        * gnus-score.el (gnus-score-edit-done): run-hook->run-hooks. 
index eec283b..07fbc46 100644 (file)
@@ -263,6 +263,11 @@ backslash and doublequote.")
       (concat "\"" string "\"")
     string))
 
+(defun ietf-drums-make-address (name address)
+  (if name
+      (concat (ietf-drums-quote-string name) " <" address ">")
+    address))
+
 (provide 'ietf-drums)
 
 ;;; ietf-drums.el ends here
index a5de09b..951a967 100644 (file)
@@ -58,6 +58,7 @@
 (defalias 'mail-header-parse-date 'ietf-drums-parse-date)
 (defalias 'mail-narrow-to-head 'ietf-drums-narrow-to-header)
 (defalias 'mail-quote-string 'ietf-drums-quote-string)
+(defalias 'mail-header-make-address 'ietf-drums-make-address)
 
 (defalias 'mail-header-fold-field 'rfc2047-fold-field)
 (defalias 'mail-header-unfold-field 'rfc2047-unfold-field)
index 01a16b0..2104bb7 100644 (file)
@@ -2128,13 +2128,25 @@ Point is left at the beginning of the narrowed-to region."
 (defun message-delete-address ()
   "Delete the address under point."
   (interactive)
-  (let ((start (point))
-       (quote nil))
-    (message-narrow-to-field)
-    (while (and (not (eobp))
-               (or (not (eq (setq char (following-char)) ?,))
-                   (not quote)))
-      ())))
+  (let ((first t)
+       current-header addresses)
+    (save-restriction
+      (message-narrow-to-field)
+      (re-search-backward "[\t\n ,]" nil t)
+      (when (re-search-forward "[^\t\n ,]@[^\t\n ,]" nil t)
+       (setq current-header (match-string 0)
+             addresses (replace-regexp-in-string
+                        "[\n\t]" " " (mail-header-field-value)))
+       (goto-char (point-min))
+       (re-search-forward ": ?")
+       (delete-region (point) (point-max))
+       (dolist (address (mail-header-parse-addresses addresses))
+         (unless first
+           (insert ", "))
+         (setq first nil)
+         (unless (string-match (regexp-quote current-header) (car address))
+           (insert (mail-header-make-address
+                    (cdr address) (car address)))))))))
 
 \f
 
index b9b2e36..872355b 100644 (file)
@@ -134,7 +134,7 @@ This is either `base64' or `quoted-printable'."
     (save-restriction
       (rfc2047-narrow-to-field)
       (re-search-forward ":[ \t\n]*" nil t)
-      (buffer-substring (point) (point-max)))))
+      (buffer-substring-no-properties (point) (point-max)))))
 
 (defvar rfc2047-encoding-type 'address-mime
   "The type of encoding done by `rfc2047-encode-region'.