static void e_book_backend_webdav_remove_contacts (EBookBackend *backend, EDataBook *book, guint32 opid, GCancellable *cancellable, const GSList *id_list) { EBookBackendWebdav *webdav = E_BOOK_BACKEND_WEBDAV (backend); EBookBackendWebdavPrivate *priv = webdav->priv; gchar *uid = id_list->data; GSList deleted_ids = {NULL,}; guint status; if (!e_backend_get_online (E_BACKEND (backend))) { e_data_book_respond_remove_contacts ( book, opid, EDB_ERROR (REPOSITORY_OFFLINE), NULL); return; } /* We make the assumption that the ID list we're passed is always exactly one element long, since we haven't specified "bulk-removes" * in our static capability list. */ if (id_list->next != NULL) { e_data_book_respond_remove_contacts ( book, opid, EDB_ERROR_EX (NOT_SUPPORTED, _("The backend does not support bulk removals")), NULL); return; } status = delete_contact (webdav, uid, cancellable); if (status != 204) { if (status == 401 || status == 407) { e_data_book_respond_remove_contacts ( book, opid, webdav_handle_auth_request (webdav), NULL); } else { g_warning ("DELETE failed with HTTP status %d", status); e_data_book_respond_remove_contacts ( book, opid, e_data_book_create_error_fmt (E_DATA_BOOK_STATUS_OTHER_ERROR, _("DELETE failed with HTTP status %d"), status), NULL); } return; } g_mutex_lock (&priv->cache_lock); e_book_backend_cache_remove_contact (priv->cache, uid); g_mutex_unlock (&priv->cache_lock); deleted_ids.data = uid; e_data_book_respond_remove_contacts (book, opid, EDB_ERROR (SUCCESS), &deleted_ids); }
static void _e_book_backend_remove_contacts (EBookBackend *backend, EDataBook *book, guint32 opid, GList *id_list) { GError *error = NULL; GList *ids = NULL; e_book_backend_sync_remove_contacts (E_BOOK_BACKEND_SYNC (backend), book, opid, id_list, &ids, &error); e_data_book_respond_remove_contacts (book, opid, error, ids); if (ids) g_list_free (ids); }