unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Adjust EUDC to use BBDB 3.x
@ 2015-01-19 23:21 Sergio Durigan Junior
  2015-01-24  6:47 ` Thomas Fitzsimmons
  0 siblings, 1 reply; 5+ messages in thread
From: Sergio Durigan Junior @ 2015-01-19 23:21 UTC (permalink / raw)
  To: emacs-devel

Hi,

With the release of BBDB 3.x, EUDC does not work properly anymore.  The
reason is because BBDB renamed a few fields internally, and EUDC is
still using the old names.  Specifically, the problem happens because of
the 'net' -> 'mail' rename.

The following patch fixes this issue.  I tested it with my current .gnus
configuration, and it works fine.

I have the copyright assignment on file for contributing with GDB and
binutils, but I still do not have it for Emacs (this is my third patch
to the project IIRC).  So I will contact the copyright clerk at FSF and
get it done.  Meanwhile, I'd appreciate reviews and comments.

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

2015-01-19  Sergio Durigan Junior  <sergiodj@sergiodj.net>

	Adapt EUDC to BBDB 3.x
	* net/eudcb-bbdb.el (eudc-bbdb-attributes-translation-alist):
	Replacing 'net' by 'mail'.
	(eudc-bbdb-format-query): Likewise.
	(eudc-bbdb-filter-non-matching-record): Likewise.
	(eudc-bbdb-format-record-as-result): Likewise.

diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0400e5b..7abfd0c 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -43,7 +43,7 @@
 
 (defvar eudc-bbdb-attributes-translation-alist
   '((name . lastname)
-    (email . net)
+    (email . mail)
     (phone . phones))
   "Alist mapping EUDC attribute names to BBDB names.")
 
@@ -63,10 +63,10 @@
 		   firstname
 		   lastname))
 	(company (cdr (assq 'company query)))
-	(net (cdr (assq 'net query)))
+	(mail (cdr (assq 'mail query)))
 	(notes (cdr (assq 'notes query)))
 	(phone (cdr (assq 'phone query))))
-    (list name company net notes phone)))
+    (list name company mail notes phone)))
 
 
 (defun eudc-bbdb-filter-non-matching-record (record)
@@ -80,7 +80,7 @@
               (case-fold-search t)
               bbdb-val)
           (or (and (memq attr '(firstname lastname aka company phones
-                                addresses net))
+                                addresses mail))
                    (progn
                      (setq bbdb-val
                            (eval (list (intern (concat "bbdb-record-"
@@ -151,7 +151,7 @@
 The record is filtered according to `eudc-bbdb-current-return-attributes'"
   (require 'bbdb)
   (let ((attrs (or eudc-bbdb-current-return-attributes
-		   '(firstname lastname aka company phones addresses net notes)))
+		   '(firstname lastname aka company phones addresses mail notes)))
 	attr
 	eudc-rec
 	val)
@@ -163,7 +163,7 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'"
 	(setq val (eudc-bbdb-extract-phones record)))
        ((eq attr 'addresses)
 	(setq val (eudc-bbdb-extract-addresses record)))
-       ((memq attr '(firstname lastname aka company net notes))
+       ((memq attr '(firstname lastname aka company mail notes))
 	(setq val (eval
 		   (list (intern
 			  (concat "bbdb-record-"



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Adjust EUDC to use BBDB 3.x
  2015-01-19 23:21 [PATCH] Adjust EUDC to use BBDB 3.x Sergio Durigan Junior
@ 2015-01-24  6:47 ` Thomas Fitzsimmons
  2015-01-24 23:42   ` Sergio Durigan Junior
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Fitzsimmons @ 2015-01-24  6:47 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: emacs-devel

Hi Sergio,

Sergio Durigan Junior <sergiodj@sergiodj.net> writes:

> With the release of BBDB 3.x, EUDC does not work properly anymore.  The
> reason is because BBDB renamed a few fields internally, and EUDC is
> still using the old names.  Specifically, the problem happens because of
> the 'net' -> 'mail' rename.
>
> The following patch fixes this issue.  I tested it with my current .gnus
> configuration, and it works fine.
>
> I have the copyright assignment on file for contributing with GDB and
> binutils, but I still do not have it for Emacs (this is my third patch
> to the project IIRC).  So I will contact the copyright clerk at FSF and
> get it done.  Meanwhile, I'd appreciate reviews and comments.

This is an issue I've run into as well.

I'm concerned that this patch will break compatibility with BBDB 2.x.
It looks like the newer distribution releases are starting to package
BBDB 3.x (I just checked Fedora), so this may be less of a concern in
the future.  However, I think it's worth trying to make a patch that
supports both.  Can you file a bug report for this?

Thanks,
Thomas



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Adjust EUDC to use BBDB 3.x
  2015-01-24  6:47 ` Thomas Fitzsimmons
@ 2015-01-24 23:42   ` Sergio Durigan Junior
  2015-01-26 17:11     ` raman
  0 siblings, 1 reply; 5+ messages in thread
From: Sergio Durigan Junior @ 2015-01-24 23:42 UTC (permalink / raw)
  To: Thomas Fitzsimmons; +Cc: emacs-devel

On Saturday, January 24 2015, Thomas Fitzsimmons wrote:

> Hi Sergio,

Hey Thomas,

> Sergio Durigan Junior <sergiodj@sergiodj.net> writes:
>
>> With the release of BBDB 3.x, EUDC does not work properly anymore.  The
>> reason is because BBDB renamed a few fields internally, and EUDC is
>> still using the old names.  Specifically, the problem happens because of
>> the 'net' -> 'mail' rename.
>>
>> The following patch fixes this issue.  I tested it with my current .gnus
>> configuration, and it works fine.
>>
>> I have the copyright assignment on file for contributing with GDB and
>> binutils, but I still do not have it for Emacs (this is my third patch
>> to the project IIRC).  So I will contact the copyright clerk at FSF and
>> get it done.  Meanwhile, I'd appreciate reviews and comments.
>
> This is an issue I've run into as well.
>
> I'm concerned that this patch will break compatibility with BBDB 2.x.
> It looks like the newer distribution releases are starting to package
> BBDB 3.x (I just checked Fedora), so this may be less of a concern in
> the future.  However, I think it's worth trying to make a patch that
> supports both.  Can you file a bug report for this?

You're right, the patch only takes into account BBDB 3.x.

I filed a bug about the issue as requested:

  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19678>

And I adjusted the initial patch to be backwards-compatible with BBDB
2.x.  I'd appreciate if you could take a look and tell me WDYT.

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 15518a7..0ed1d67 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2015-01-24  Sergio Durigan Junior  <sergiodj@sergiodj.net>
+
+	Adapt EUDC to BBDB 3.x
+	* net/eudcb-bbdb.el (eudc-bbdb-get-major-version-number): New
+	function.
+	(eudc-bbdb-attributes-translation-alist): Use
+	eudc-bbdb-get-major-version-number to decide whether to use 'net'
+	(BBDB 2.x) or 'mail' (BBDB 3.x).
+	(eudc-bbdb-format-query): Likewise.
+	(eudc-bbdb-filter-non-matching-record): Likewise.
+	(eudc-bbdb-format-record-as-result): Likewise.
+
 2015-01-23  Thomas Fitzsimmons  <fitzsim@fitzsim.org>
 
 	* net/ldap.el (ldap-search-internal): Mention binddn in invalid
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index 0400e5b..d400871 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -41,9 +41,18 @@
 (defvar eudc-bbdb-current-query nil)
 (defvar eudc-bbdb-current-return-attributes nil)
 
+(defun eudc-bbdb-get-major-version-number ()
+  "Return the major version number of the BBDB version we are
+  currently using.  Return nil if we could not load BBDB."
+  (if (require 'bbdb nil t)
+      (string-to-number (substring bbdb-version 0 1))
+    0))
+
 (defvar eudc-bbdb-attributes-translation-alist
   '((name . lastname)
-    (email . net)
+    (email . (if (= (eudc-bbdb-get-major-version-number) 3)
+		 mail
+	       net))
     (phone . phones))
   "Alist mapping EUDC attribute names to BBDB names.")
 
@@ -63,10 +72,13 @@
 		   firstname
 		   lastname))
 	(company (cdr (assq 'company query)))
-	(net (cdr (assq 'net query)))
+	(mail (cdr (assq (if (= (eudc-bbdb-get-major-version-number) 3)
+			     'mail
+			   'net)
+			 query)))
 	(notes (cdr (assq 'notes query)))
 	(phone (cdr (assq 'phone query))))
-    (list name company net notes phone)))
+    (list name company mail notes phone)))
 
 
 (defun eudc-bbdb-filter-non-matching-record (record)
@@ -80,7 +92,10 @@
               (case-fold-search t)
               bbdb-val)
           (or (and (memq attr '(firstname lastname aka company phones
-                                addresses net))
+				addresses
+			        (if (= (eudc-bbdb-get-major-version-number) 3)
+				    mail
+				  net)))
                    (progn
                      (setq bbdb-val
                            (eval (list (intern (concat "bbdb-record-"
@@ -151,7 +166,11 @@
 The record is filtered according to `eudc-bbdb-current-return-attributes'"
   (require 'bbdb)
   (let ((attrs (or eudc-bbdb-current-return-attributes
-		   '(firstname lastname aka company phones addresses net notes)))
+		   '(firstname lastname aka company phones addresses
+		     (if (= (eudc-bbdb-get-major-version-number) 3)
+			 mail
+		       net)
+		     notes)))
 	attr
 	eudc-rec
 	val)
@@ -163,7 +182,11 @@ The record is filtered according to `eudc-bbdb-current-return-attributes'"
 	(setq val (eudc-bbdb-extract-phones record)))
        ((eq attr 'addresses)
 	(setq val (eudc-bbdb-extract-addresses record)))
-       ((memq attr '(firstname lastname aka company net notes))
+       ((memq attr '(firstname lastname aka company
+		     (if (= (eudc-bbdb-get-major-version-number) 3)
+			 mail
+		       net)
+		     notes))
 	(setq val (eval
 		   (list (intern
 			  (concat "bbdb-record-"



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Adjust EUDC to use BBDB 3.x
  2015-01-24 23:42   ` Sergio Durigan Junior
@ 2015-01-26 17:11     ` raman
  2015-01-26 17:18       ` Thomas Fitzsimmons
  0 siblings, 1 reply; 5+ messages in thread
From: raman @ 2015-01-26 17:11 UTC (permalink / raw)
  To: Sergio Durigan Junior; +Cc: Thomas Fitzsimmons, emacs-devel

Also eudc has been long broken with respect to use with ldap -- is there
a bug filed for that?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Adjust EUDC to use BBDB 3.x
  2015-01-26 17:11     ` raman
@ 2015-01-26 17:18       ` Thomas Fitzsimmons
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Fitzsimmons @ 2015-01-26 17:18 UTC (permalink / raw)
  To: raman; +Cc: Sergio Durigan Junior, emacs-devel

raman <raman@google.com> writes:

> Also eudc has been long broken with respect to use with ldap -- is there
> a bug filed for that?

Yes, bug#16322.

The patch set to improve LDAP support went into master on Friday.  Can
you try EUDC LDAP again and report any issues?  You may want to re-read
the EUDC Info manual, in particular the new LDAP Configuration node,
which has examples of minimal configurations.

Thomas



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-26 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-19 23:21 [PATCH] Adjust EUDC to use BBDB 3.x Sergio Durigan Junior
2015-01-24  6:47 ` Thomas Fitzsimmons
2015-01-24 23:42   ` Sergio Durigan Junior
2015-01-26 17:11     ` raman
2015-01-26 17:18       ` Thomas Fitzsimmons

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).