diff options
-rw-r--r-- | addressbook/ChangeLog | 12 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-file.c | 30 |
2 files changed, 39 insertions, 3 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 9dfd5c6717..f71b433b0b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,17 @@ 2001-10-15 Chris Toshok <toshok@ximian.com> + * backend/pas/pas-backend-ldap.c (create_card_dtor): unref + op->view. + (pas_backend_ldap_process_create_card): ref op->view. + (remove_card_dtor): unref op->view. + (pas_backend_ldap_process_remove_card): ref op->view. + (modify_card_dtor): unref op->view. + (pas_backend_ldap_process_modify_card): ref op->view. + (ldap_search_dtor): unref op->view. + (pas_backend_ldap_search): ref op->view. + +2001-10-15 Chris Toshok <toshok@ximian.com> + * backend/pas/pas-backend-ldap.c (pas_backend_ldap_process_get_book_view): make sure to unref the book_view here so we don't leak them. diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index 56c6485e7f..08698a74ca 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -508,6 +508,7 @@ do_create(PASBackend *backend, } else { + g_free (id); ret_val = NULL; } @@ -575,8 +576,20 @@ pas_backend_file_process_remove_card (PASBackend *backend, int db_error; EIterator *iterator; char *vcard_string; + const char *id; - string_to_dbt (req->id, &id_dbt); + /* This is disgusting, but for a time cards were added with + ID's that are no longer used (they contained both the uri + and the id.) If we recognize it as a uri (file:///...) trim + off everything before the last '/', and use that as the + id.*/ + if (!strncmp (req->id, "file:///", strlen ("file:///"))) { + id = strrchr (req->id, '/') + 1; + } + else + id = req->id; + + string_to_dbt (id, &id_dbt); memset (&vcard_dbt, 0, sizeof (vcard_dbt)); db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0); @@ -632,14 +645,25 @@ pas_backend_file_process_modify_card (PASBackend *backend, int db_error; EIterator *iterator; ECard *card; - const char *id; + const char *id, *lookup_id; char *old_vcard_string; /* create a new ecard from the request data */ card = e_card_new(req->vcard); id = e_card_get_id(card); - string_to_dbt (id, &id_dbt); + /* This is disgusting, but for a time cards were added with + ID's that are no longer used (they contained both the uri + and the id.) If we recognize it as a uri (file:///...) trim + off everything before the last '/', and use that as the + id.*/ + if (!strncmp (id, "file:///", strlen ("file:///"))) { + lookup_id = strrchr (id, '/') + 1; + } + else + lookup_id = id; + + string_to_dbt (lookup_id, &id_dbt); memset (&vcard_dbt, 0, sizeof (vcard_dbt)); /* get the old ecard - the one that's presently in the db */ |