Merge lp:~rodrigo-moya/evolution-couchdb/set-descriptions into lp:evolution-couchdb

Proposed by Rodrigo Moya
Status: Merged
Merge reported by: Rodrigo Moya
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/evolution-couchdb/set-descriptions
Merge into: lp:evolution-couchdb
Diff against target: None lines
To merge this branch: bzr merge lp:~rodrigo-moya/evolution-couchdb/set-descriptions
Reviewer Review Type Date Requested Status
dobey (community) Approve
Eric Casteleijn (community) Approve
Guillermo Gonzalez Abstain
Rodrigo Moya (community) Abstain
Review via email: mp+9114@code.launchpad.net

This proposal supersedes a proposal from 2009-07-21.

To post a comment you must log in.
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote : Posted in a previous version of this proposal

Set the description for email addresses correctly

Revision history for this message
Chad Miller (cmiller) wrote : Posted in a previous version of this proposal

Looks good.

My only complaint is that I hate integers mapped to true/false, as in the three strcmp()s. "String compare", on equality, returns zero -- which is false in C. I really want a comparison to zero, or at least a comment there explaining what it means.

review: Approve
Revision history for this message
dobey (dobey) wrote : Posted in a previous version of this proposal

As already suggested, please use comparison against 0 for the strcmp/g_strcasecmp calls. Also, I think you might need to check that the return of e_vcard_attribute_param_get_name is not NULL, if it could ever return NULL, otherwise strcmp() will crash.

review: Needs Fixing
Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

The use of int as true/false values is just a matter of taste, but changed it anyway. Changed also the strcmp call with g_strcmp0, which deals correctly with NULL values.

review: Abstain
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

I wasn't able to build it, after installing some missing dependencies () ./autogen.sh says: "No package 'evolution-plugin' found" and searching in th epackage database the only matches are:
guillermo@gothmog:~/canonical/evolution-couchdb.set-descriptions$ apt-cache search evolution-plugin
evolution-plugins - standard plugins for Evolution
evolution-plugins-experimental - experimental plugins for Evolution

I already have evolution-plugins installed.

review: Abstain
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

> I wasn't able to build it, after installing some missing dependencies ()

libcouchdb-glib-dev libebook1.2-dev libedata-book1.2-dev

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

>
> > I wasn't able to build it, after installing some missing dependencies ()
>
> libcouchdb-glib-dev libebook1.2-dev libedata-book1.2-dev

evolution-plugin is in evolution-dev package, and then you also need those 3, plus libjson-glib-dev and evolution-data-server-dev. That should be all AFAICS

Revision history for this message
Eric Casteleijn (thisfred) wrote :

I can't find couchdb-glib, is this Karmic only (I haven't made the switch yet...)

Revision history for this message
Rodrigo Moya (rodrigo-moya) wrote :

> I can't find couchdb-glib, is this Karmic only (I haven't made the switch
> yet...)

you've got jaunty packages of couchdb-glib at the beta PPA -> https://launchpad.net/~ubuntuone/+archive/beta

Revision history for this message
Elliot Murphy (statik) wrote :

>
> > I wasn't able to build it, after installing some missing dependencies ()
>
> libcouchdb-glib-dev libebook1.2-dev libedata-book1.2-dev

you all probably already know this, but the easiest way to get the build dependencies is to use
 'apt-get build-dep <package-you-want-tobuild>'. Much easier than manually searching for various dependencies and waiting to see what configure complains about.

Revision history for this message
Eric Casteleijn (thisfred) wrote :

Code looks good, and builds. Caveat: My C is rusty at best.

review: Approve
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addressbook/e-book-backend-couchdb.c'
2--- addressbook/e-book-backend-couchdb.c 2009-07-01 16:03:33 +0000
3+++ addressbook/e-book-backend-couchdb.c 2009-07-21 22:21:49 +0000
4@@ -161,7 +161,7 @@
5 {
6 EContactDate *dt;
7 GSList *list;
8- gint i;
9+ GList *attr_list, *al;
10 const char *str;
11 CouchDBDocument *document;
12 EContactAddress *contact_address;
13@@ -178,14 +178,44 @@
14
15 /* email addresses */
16 list = NULL;
17- for (i = E_CONTACT_FIRST_EMAIL_ID; i <= E_CONTACT_LAST_EMAIL_ID; i++) {
18+ attr_list = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
19+ for (al = attr_list; al != NULL; al = al->next) {
20 const gchar *email;
21+ EVCardAttribute *attr = (EVCardAttribute *) al->data;
22
23- email = e_contact_get_const (contact, i);
24+ email = e_vcard_attribute_get_value (attr);
25 if (email) {
26 CouchDBStructField *sf;
27-
28- sf = couchdb_document_contact_email_new (email, /* FIXME */ NULL);
29+ GList *params;
30+ const gchar *description = NULL;
31+
32+ params = e_vcard_attribute_get_params (attr);
33+ if (params) {
34+ GList *pl;
35+
36+ for (pl = params; pl != NULL; pl = pl->next) {
37+ GList *v;
38+ EVCardAttributeParam *p = pl->data;
39+
40+ if (g_strcmp0 (EVC_TYPE, e_vcard_attribute_param_get_name (p)) != 0)
41+ continue;
42+
43+ v = e_vcard_attribute_param_get_values (p);
44+ while (v && v->data) {
45+ if (g_ascii_strcasecmp ((const gchar *) v->data, "HOME") == 0) {
46+ description = "home";
47+ break;
48+ } else if (g_ascii_strcasecmp ((const gchar *) v->data, "WORK") == 0) {
49+ description = "work";
50+ break;
51+ }
52+
53+ v = v->next;
54+ }
55+ }
56+ }
57+
58+ sf = couchdb_document_contact_email_new (email, description);
59 list = g_slist_append (list, sf);
60 }
61 }

Subscribers

People subscribed via source and target branches