branch: externals/ebdb
commit 2b27fcca0fd36e071aa4dfceae0aaeae9765e258
Author: Eric Abrahamsen <>
Commit: Eric Abrahamsen <>

    Be more careful about testing against user mail addresses
    * ebdb-mua.el (ebdb-mua-test-headers): This can derail the whole
      process if works incorrectly (eg, user has no mail address), so put
      more thorough checks in place.
 ebdb-mua.el | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/ebdb-mua.el b/ebdb-mua.el
index f82d49e..0869919 100644
--- a/ebdb-mua.el
+++ b/ebdb-mua.el
@@ -227,7 +227,7 @@ accordingly."
        ((eq ebdb-user-mail-address-re 'self)
         (let ((self-rec (ebdb-record-self)))
           (unless self-rec
-            (user-error "`ebdb-user-mail-address-re' set to 'self, but 
`ebdb-record-self' is not set.? "))
+            (user-error "`ebdb-user-mail-address-re' set to 'self, but 
`ebdb-record-self' is not set"))
           (setq ebdb-user-mail-address-re
                 (regexp-opt (slot-value
                              (ebdb-record-cache self-rec)
@@ -598,13 +598,14 @@ HEADER-TYPE, as well as the IGNORE-ADDRESS argument, and 
 variables `ebdb-user-mail-address-re',
 `ebdb-accept-header-alist', and `ebdb-ignore-header-alist'."
   (let ((name (car address-parts))
-       (mail (cadr address-parts)))
+       (mail (cadr address-parts))
+       (user-mail (ebdb-get-user-mail-address-re)))
     (and (null (or (and (stringp ignore-address)
                        (or (and name (string-match-p ignore-address name))
                            (and mail (string-match-p ignore-address mail))))
-                  (string-match-p
-                   (ebdb-get-user-mail-address-re)
-                   mail)))
+                  (and (stringp user-mail)
+                       (null (string-empty-p user-mail))
+                       (string-match-p user-mail mail))))
         (cond ((null (or ebdb-accept-header-alist

Reply via email to