--- lisp/mail/ietf-drums.el~ 2017-01-04 22:16:46 +0000 +++ lisp/mail/ietf-drums.el 2017-01-11 23:18:33 +0000 @@ -171,8 +171,21 @@ (defun ietf-drums-strip (string) "Remove comments and whitespace from STRING." (ietf-drums-remove-whitespace (ietf-drums-remove-comments string))) +(defun ietf-drums-remove-garbage (string) + "Remove some gabage from STRING." + (while (string-match "[][()<>@,;:\\\"/?=]+" string) + (setq string (concat (substring string 0 (match-beginning 0)) + (substring string (match-end 0))))) + string) + +(defun ietf-drums-strip-cte (string) + "Remove comments, whitespace and gabage from STRING. +STRING is assumed to be a string that is extracted from +the Content-Transfer-Encoding header of a mail." + (ietf-drums-remove-garbage (inline (ietf-drums-strip string)))) + (defun ietf-drums-parse-address (string) "Parse STRING and return a MAILBOX / DISPLAY-NAME pair." (with-temp-buffer (let (display-name mailbox c display-string) --- lisp/mail/mail-parse.el~ 2017-01-04 22:16:46 +0000 +++ lisp/mail/mail-parse.el 2017-01-11 23:13:51 +0000 @@ -51,2 +51,3 @@ (defalias 'mail-header-strip 'ietf-drums-strip) +(defalias 'mail-header-strip-cte 'ietf-drums-strip-cte) (defalias 'mail-header-get-comment 'ietf-drums-get-comment)