I have seen the msg from Adrian Lanz regarding RFC2047-encoded From:
fields, a few months back.  I have been using the following patch to
bbdb.el for a couple of years, with no visible ill effects.  Ulike
Adrian's patch, mine decodes the From fields before looking them up
and/or storing them into .bbdb.  Encoded strings are not used or stored
anywhere.  It requires the presence of rfc2047.el, which was there in
21.3, but not in 20.7.

The patch itself:

*** bbdb.el     Thu Aug 11 13:09:05 2005
--- bbdb-patched.el     Thu Aug 11 22:27:06 2005
***************
*** 3126,3132 ****
  \(assuming that CREATE-P is true\).  "
    (let* ((data (if (consp from)
                     from ; if from is a cons, it's pre-parsed (hack hack)
!                  (mail-extract-address-components from)))
           (name (car data))
           (net (car (cdr data))))
      (if (equal name net) (setq name nil))
--- 3126,3134 ----
  \(assuming that CREATE-P is true\).  "
    (let* ((data (if (consp from)
                     from ; if from is a cons, it's pre-parsed (hack hack)
!                ;; BA was here.  This needs rfc2047.el
!                  (mail-extract-address-components
!                 (rfc2047-decode-string from))))
           (name (car data))
           (net (car (cdr data))))
      (if (equal name net) (setq name nil))


A version that tries to cope with requires and missing rfc2047:


*** bbdb.el     Thu Aug 11 13:09:05 2005
--- bbdb-patched2.el    Thu Aug 11 22:45:41 2005
***************
*** 58,63 ****
--- 58,67 ----
   ;; autoload doesn't work for these
   (condition-case nil (require 'message)
     (error (message "Warning: message not found.  Ensure it is in your 
`load-path'"))); for message-mode-map
+  ;;  TO FIX: byte-compiler will still complain about rfc2047-decode-string if
+  ;;  rfc2047 cannot be found.
+  (condition-case nil (require 'rfc2047)
+    (error (message "Warning: rfc2047 not found.  RFC2047-decoding of mail 
headers may not work."))); for rfc2047-decode-string 
   (require 'sendmail); for mail-mode-map
   )
  
***************
*** 110,115 ****
--- 114,122 ----
    (or (fboundp 'set-keymap-prompt)
        (fset 'set-keymap-prompt 'ignore)))
  
+ (unless (require 'rfc2047 nil t)
+     (defalias 'rfc2047-decode-string 'identity))
+ 
  ;; this should really be in bbdb-com
  ;;;###autoload
  (defun bbdb-submit-bug-report ()
***************
*** 3126,3132 ****
  \(assuming that CREATE-P is true\).  "
    (let* ((data (if (consp from)
                     from ; if from is a cons, it's pre-parsed (hack hack)
!                  (mail-extract-address-components from)))
           (name (car data))
           (net (car (cdr data))))
      (if (equal name net) (setq name nil))
--- 3133,3141 ----
  \(assuming that CREATE-P is true\).  "
    (let* ((data (if (consp from)
                     from ; if from is a cons, it's pre-parsed (hack hack)
!                ;; BA was here.  This needs rfc2047.el
!                  (mail-extract-address-components
!                 (rfc2047-decode-string from))))
           (name (car data))
           (net (car (cdr data))))
      (if (equal name net) (setq name nil))





-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to