diff options
author | Sivaiah Nallagatla <snallagatla@novell.com> | 2004-06-01 06:58:22 +0000 |
---|---|---|
committer | Sivaiah Nallagatla <siva@src.gnome.org> | 2004-06-01 06:58:22 +0000 |
commit | b1f199f59745bdb6dabadfab20b98780c6810561 (patch) | |
tree | 4c08cb6d10f2042e3f2f07f6d4454d132f8563ef | |
parent | 486aa52ebac7504a727b21911fc45300f84c927b (diff) | |
download | evolution-data-server-b1f199f59745bdb6dabadfab20b98780c6810561.tar.gz |
new function to delete many items on server at onece instead sending one
2004-06-01 Sivaiah Nallagatla <snallagatla@novell.com>
* e-gw-connection.[ch] (e_gw_connection_remove_items):
new function to delete many items on server at onece instead
sending one request for each item, removal pretty fast :)
-rw-r--r-- | servers/groupwise/ChangeLog | 7 | ||||
-rw-r--r-- | servers/groupwise/e-gw-connection.c | 51 | ||||
-rw-r--r-- | servers/groupwise/e-gw-connection.h | 1 |
3 files changed, 51 insertions, 8 deletions
diff --git a/servers/groupwise/ChangeLog b/servers/groupwise/ChangeLog index e6e77767e..def6415df 100644 --- a/servers/groupwise/ChangeLog +++ b/servers/groupwise/ChangeLog @@ -1,3 +1,10 @@ +2004-06-01 Sivaiah Nallagatla <snallagatla@novell.com> + + * e-gw-connection.[ch] (e_gw_connection_remove_items): + new function to delete many items on server at onece instead + sending one request for each item, removal pretty fast :) + + 2004-05-31 Sivaiah Nallagatla <snallagatla@novel.com> * e-gw-connection.c (set_group_fields_from_soap_parameter) : diff --git a/servers/groupwise/e-gw-connection.c b/servers/groupwise/e-gw-connection.c index a4beebda1..ec32d7ad9 100644 --- a/servers/groupwise/e-gw-connection.c +++ b/servers/groupwise/e-gw-connection.c @@ -639,7 +639,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "getDeltaRequest"); if (!msg) { g_warning (G_STRLOC ": Could not build SOAP message"); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_UNKNOWN; } @@ -652,7 +652,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes response = e_gw_connection_send_message (cnc, msg); if (!response) { g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; } @@ -660,7 +660,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes if (status != E_GW_CONNECTION_STATUS_OK) { g_object_unref (response); g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); return status; } @@ -669,13 +669,13 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes if (!param) { g_object_unref (response); g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; } if (!g_ascii_strcasecmp ( soup_soap_parameter_get_string_value (param), "0")) { g_message ("No deltas"); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_OK; } @@ -683,7 +683,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes if (!param) { g_object_unref (response); g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; } @@ -701,7 +701,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes if (!param_id) { g_object_unref (response); g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); } uid = (char *)soup_soap_parameter_get_string_value (param_id); /*if (!e_cal_backend_cache_remove_component (cache, uid, NULL)) @@ -723,7 +723,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes if (!item) { g_object_unref (response); g_object_unref (msg); - g_object_unref (cnc); + // g_object_unref (cnc); return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; } /*if (!e_cal_backend_cache_put_component (cache, comp)) @@ -983,6 +983,41 @@ e_gw_connection_remove_item (EGwConnection *cnc, const char *container, const ch return status; } +EGwConnectionStatus +e_gw_connection_remove_items (EGwConnection *cnc, const char *container, GList *item_ids) +{ + SoupSoapMessage *msg; + SoupSoapResponse *response; + EGwConnectionStatus status; + + g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION); + + /* build the SOAP message */ + msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "removeItemsRequest"); + if (container && *container) + e_gw_message_write_string_parameter (msg, "container", NULL, container); + + soup_soap_message_start_element (msg, "items", NULL, NULL); + for (; item_ids != NULL; item_ids = g_list_next (item_ids)) + e_gw_message_write_string_parameter (msg, "item", NULL, item_ids->data); + soup_soap_message_end_element (msg); + e_gw_message_write_footer (msg); + + /* send message to server */ + response = e_gw_connection_send_message (cnc, msg); + if (!response) { + g_object_unref (msg); + return E_GW_CONNECTION_STATUS_INVALID_RESPONSE; + } + + status = e_gw_connection_parse_response_status (response); + + /* free memory */ + g_object_unref (response); + g_object_unref (msg); + + return status; +} const char * e_gw_connection_get_uri (EGwConnection *cnc) { diff --git a/servers/groupwise/e-gw-connection.h b/servers/groupwise/e-gw-connection.h index fb30b6773..b3c5f9029 100644 --- a/servers/groupwise/e-gw-connection.h +++ b/servers/groupwise/e-gw-connection.h @@ -78,6 +78,7 @@ EGwConnectionStatus e_gw_connection_get_items (EGwConnection *cnc, const char *c EGwConnectionStatus e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates); EGwConnectionStatus e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, char **id); EGwConnectionStatus e_gw_connection_remove_item (EGwConnection *cnc, const char *container, const char *id); +EGwConnectionStatus e_gw_connection_remove_items (EGwConnection *cnc, const char *container, GList *item_ids); const char *e_gw_connection_get_uri (EGwConnection *cnc); const char *e_gw_connection_get_session_id (EGwConnection *cnc); |