aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/pas
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend/pas')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c23
-rw-r--r--addressbook/backend/pas/pas-backend.c14
-rw-r--r--addressbook/backend/pas/pas-book.c12
3 files changed, 27 insertions, 22 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 923c7e907d..73f1797320 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -515,6 +515,7 @@ typedef struct {
GList *mod_cards;
GList *mod_ids;
GList *del_ids;
+ GList *del_cards;
} PASBackendFileChangeContext;
static void
@@ -530,10 +531,21 @@ pas_backend_file_changes_foreach_key (const char *key, gpointer user_data)
db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0);
if (db_error != 0) {
+ EContact *contact;
char *id = id_dbt.data;
+ char *vcard_string;
+
+ contact = e_contact_new ();
+ e_contact_set (contact, E_CONTACT_UID, id);
+
+ vcard_string = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
ctx->del_ids = g_list_append (ctx->del_ids,
g_strdup (id));
+ ctx->del_cards = g_list_append (ctx->del_cards,
+ vcard_string);
+
+ g_object_unref (contact);
}
}
@@ -645,14 +657,17 @@ pas_backend_file_get_changes (PASBackendSync *backend,
g_free (i->data);
g_free (v->data);
- }
- for (i = ctx.del_ids; i != NULL; i = i->next){
+ }
+ for (i = ctx.del_ids, v = ctx.del_cards; i != NULL; i = i->next, v = v->next){
char *id = i->data;
-
+ char *vcard = v->data;
+
e_dbhash_remove (ehash, id);
+
changes = g_list_prepend (changes,
- pas_backend_change_delete_new (id));
+ pas_backend_change_delete_new (vcard));
g_free (i->data);
+ g_free (v->data);
}
e_dbhash_write (ehash);
diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c
index 5b559940d1..a447d64851 100644
--- a/addressbook/backend/pas/pas-backend.c
+++ b/addressbook/backend/pas/pas-backend.c
@@ -448,8 +448,8 @@ pas_backend_change_add_new (const char *vcard)
{
GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
- new_change->_d = GNOME_Evolution_Addressbook_ContactAdded;
- new_change->_u.add_vcard = CORBA_string_dup (vcard);
+ new_change->changeType= GNOME_Evolution_Addressbook_ContactAdded;
+ new_change->vcard = CORBA_string_dup (vcard);
return new_change;
}
@@ -459,19 +459,19 @@ pas_backend_change_modify_new (const char *vcard)
{
GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
- new_change->_d = GNOME_Evolution_Addressbook_ContactModified;
- new_change->_u.mod_vcard = CORBA_string_dup (vcard);
+ new_change->changeType= GNOME_Evolution_Addressbook_ContactModified;
+ new_change->vcard = CORBA_string_dup (vcard);
return new_change;
}
GNOME_Evolution_Addressbook_BookChangeItem*
-pas_backend_change_delete_new (const char *id)
+pas_backend_change_delete_new (const char *vcard)
{
GNOME_Evolution_Addressbook_BookChangeItem* new_change = GNOME_Evolution_Addressbook_BookChangeItem__alloc();
- new_change->_d = GNOME_Evolution_Addressbook_ContactDeleted;
- new_change->_u.del_id = CORBA_string_dup (id);
+ new_change->changeType= GNOME_Evolution_Addressbook_ContactDeleted;
+ new_change->vcard = CORBA_string_dup (vcard);
return new_change;
}
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 08078887b6..346b37ceed 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -612,17 +612,7 @@ pas_book_respond_get_changes (PASBook *book,
for (i = 0, l = changes; l; l = l->next, i ++) {
GNOME_Evolution_Addressbook_BookChangeItem *change = (GNOME_Evolution_Addressbook_BookChangeItem*)l->data;
changelist._buffer[i] = *change;
- switch (change->_d) {
- case GNOME_Evolution_Addressbook_ContactAdded:
- changelist._buffer[i]._u.add_vcard = CORBA_string_dup (change->_u.add_vcard);
- break;
- case GNOME_Evolution_Addressbook_ContactModified:
- changelist._buffer[i]._u.mod_vcard = CORBA_string_dup (change->_u.mod_vcard);
- break;
- case GNOME_Evolution_Addressbook_ContactDeleted:
- changelist._buffer[i]._u.del_id = CORBA_string_dup (change->_u.del_id);
- break;
- }
+ changelist._buffer[i].vcard = CORBA_string_dup (change->vcard);
}
g_list_foreach (changes, (GFunc)CORBA_free, NULL);