Peter Pletcher
2004-07-02 23:12:05 UTC
I've implemented an interface to the Evolution EBook
API to query the 'default address book'. I needed
this for importing from Evolution 1.4 as I don't even
have an addressbook.db file.
This was built for Evolution 1.4.6 - I have not tested
it with 1.2.x or the (development) 1.5 series as I
don't have access to such a system.
Untar the attached evolution_utils.tar.gz file into
native/evolution and run 'make' to build it. You'll
need GNOME and Evolution development libraries.
Here's a patch for evolution.py that attempts to use
this extension. If it fails we fall back to pawing
around the filesystem:
Index: evolution.py
===================================================================
RCS file:
/cvsroot/bitpim/bitpim/native/evolution/evolution.py,v
retrieving revision 1.4
diff -u -r1.4 evolution.py
--- evolution.py 29 Jun 2004 00:13:33 -0000
1.4
+++ evolution.py 2 Jul 2004 22:53:42 -0000
@@ -9,9 +9,11 @@
"Be at one with Evolution"
-# Evolution mostly sucks when compared to Outlook.
The UI and functionality
-# for the address book is a literal copy. There is
no API as such and we
-# just have to delve around the filesystem
+# Use the EBook API to query the default address book
for vcards.
+# This is built for Evolution 1.4 - for previous (or
later) versions we may
+# just have to fall back to the addressbook.db file.
+
+# To delve around the filesystem:
# root directory is ~/evolution
# folders are any directory containing a file named
folder-metadata.xml
@@ -54,6 +56,14 @@
"""Returns the contacts as a list of string
vcards
Note that the Windows EOL convention is used"""
+
+ try:
+ import evolution_utils
+ res = evolution_utils.query_default_book(
'(contains "x-evolution-any-field" "")' )
+ return res
+ except:
+ pass
+
dir=os.path.expanduser(folder)
p=os.path.join(dir, "addressbook.db")
if not os.path.isfile(p):
API to query the 'default address book'. I needed
this for importing from Evolution 1.4 as I don't even
have an addressbook.db file.
This was built for Evolution 1.4.6 - I have not tested
it with 1.2.x or the (development) 1.5 series as I
don't have access to such a system.
Untar the attached evolution_utils.tar.gz file into
native/evolution and run 'make' to build it. You'll
need GNOME and Evolution development libraries.
Here's a patch for evolution.py that attempts to use
this extension. If it fails we fall back to pawing
around the filesystem:
Index: evolution.py
===================================================================
RCS file:
/cvsroot/bitpim/bitpim/native/evolution/evolution.py,v
retrieving revision 1.4
diff -u -r1.4 evolution.py
--- evolution.py 29 Jun 2004 00:13:33 -0000
1.4
+++ evolution.py 2 Jul 2004 22:53:42 -0000
@@ -9,9 +9,11 @@
"Be at one with Evolution"
-# Evolution mostly sucks when compared to Outlook.
The UI and functionality
-# for the address book is a literal copy. There is
no API as such and we
-# just have to delve around the filesystem
+# Use the EBook API to query the default address book
for vcards.
+# This is built for Evolution 1.4 - for previous (or
later) versions we may
+# just have to fall back to the addressbook.db file.
+
+# To delve around the filesystem:
# root directory is ~/evolution
# folders are any directory containing a file named
folder-metadata.xml
@@ -54,6 +56,14 @@
"""Returns the contacts as a list of string
vcards
Note that the Windows EOL convention is used"""
+
+ try:
+ import evolution_utils
+ res = evolution_utils.query_default_book(
'(contains "x-evolution-any-field" "")' )
+ return res
+ except:
+ pass
+
dir=os.path.expanduser(folder)
p=os.path.join(dir, "addressbook.db")
if not os.path.isfile(p):