added 'char **id' parameter to pass the server-generated ID to the caller.
authorRodrigo Moya <rodrigo@ximian.com>
Mon, 22 Mar 2004 11:07:14 +0000 (11:07 +0000)
committerRodrigo Moya <rodrigo@src.gnome.org>
Mon, 22 Mar 2004 11:07:14 +0000 (11:07 +0000)
2004-03-22  Rodrigo Moya <rodrigo@ximian.com>

* e-gw-connection.[ch] (e_gw_connection_send_item): added 'char **id'
parameter to pass the server-generated ID to the caller. Get the ID from
the sendItemResponse message.

servers/groupwise/ChangeLog
servers/groupwise/e-gw-connection.c
servers/groupwise/e-gw-connection.h

index 763a856..8cf7f3e 100644 (file)
@@ -1,3 +1,9 @@
+2004-03-22  Rodrigo Moya <rodrigo@ximian.com>
+
+       * e-gw-connection.[ch] (e_gw_connection_send_item): added 'char **id'
+       parameter to pass the server-generated ID to the caller. Get the ID from
+       the sendItemResponse message.
+
 2004-03-19  JP Rosevear <jpr@ximian.com>
 
        * e-gw-connection.c: 
index 5da35ce..53f97f3 100644 (file)
@@ -685,7 +685,7 @@ e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes
 }
 
 EGwConnectionStatus
-e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item)
+e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item, char **id)
 {
        SoupSoapMessage *msg;
        SoupSoapResponse *response;
@@ -694,6 +694,9 @@ e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item)
        g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_CONNECTION);
        g_return_val_if_fail (E_IS_GW_ITEM (item), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
+       if (id)
+               *id = NULL;
+
        /* compose SOAP message */
        msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "sendItemRequest");
        if (!msg) {
@@ -717,6 +720,14 @@ e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item)
        }
 
        status = e_gw_connection_parse_response_status (response);
+       if (status == E_GW_CONNECTION_STATUS_OK && id != NULL) {
+               SoupSoapParameter *param;
+
+               /* get the generated ID from the SOAP response */
+               param = soup_soap_response_get_first_parameter_by_name (response, "id");
+               if (param)
+                       *id = soup_soap_parameter_get_string_value (param);
+       }
 
        g_object_unref (msg);
        g_object_unref (response);
index 10573ed..26d65e0 100644 (file)
@@ -76,7 +76,7 @@ char               *e_gw_connection_get_container_id (EGwConnection *cnc, const
 EGwConnectionStatus e_gw_connection_get_items (EGwConnection *cnc, const char *container,
                                               const char *view, EGwFilter *filter, GList **list);
 EGwConnectionStatus e_gw_connection_get_deltas ( EGwConnection *cnc, GSList **adds, GSList **deletes, GSList **updates);
-EGwConnectionStatus e_gw_connection_send_item (EGwConnection *cnc, EGwItem *item);
+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);
 
 const char         *e_gw_connection_get_uri (EGwConnection *cnc);