Added a function for sending a delegate request. Changed the na me and
authorChenthill Palanisamy <pchenthill@novell.com>
Mon, 6 Jun 2005 12:20:20 +0000 (12:20 +0000)
committerChenthill Palanisamy <pchen@src.gnome.org>
Mon, 6 Jun 2005 12:20:20 +0000 (12:20 +0000)
2005-06-06  Chenthill Palanisamy  <pchenthill@novell.com>

* e-gw-connection.[ch] (e_gw_connection_delegate_request): Added  a function for sending a delegate request.
* e-gw-item.h (add_distribution_to_soap_message): Changed the na
me and made it public.
* e-gw-item.c (e_gw_item_set_calendar_item_elements),
(e_gw_item_append_to_soap_message): Changed the name of the
above mentioned function.

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

index a010516..3801fb0 100644 (file)
@@ -1,3 +1,12 @@
+2005-06-06  Chenthill Palanisamy  <pchenthill@novell.com>
+
+       * e-gw-connection.[ch] (e_gw_connection_delegate_request): Added        a function for sending a delegate request.
+       * e-gw-item.h (add_distribution_to_soap_message): Changed the na
+       me and made it public.
+       * e-gw-item.c (e_gw_item_set_calendar_item_elements),
+       (e_gw_item_append_to_soap_message): Changed the name of the
+               above mentioned function.
+
 2005-05-12  Harish Krishnaswamy  <kharish@novell.com>
 
        * libegroupwise.pc.in: Remove hardcoded value.
index e2b531e..3be0d27 100644 (file)
@@ -1328,6 +1328,44 @@ e_gw_connection_complete_request (EGwConnection *cnc, const char *id)
        return status;
 }
 
+EGwConnectionStatus 
+e_gw_connection_delegate_request (EGwConnection *cnc, EGwItem *item, const char *id, const char *comments_org, const char *comments_del, const char *recur_key)
+{
+       SoupSoapMessage *msg;
+       int status;
+       SoupSoapResponse *response;
+
+       msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "delegateRequest");
+       
+       if (id)
+               e_gw_message_write_string_parameter (msg, "id", NULL, id);
+
+       e_gw_item_add_distribution_to_soap_message (item, msg);
+       if (comments_org)
+               e_gw_message_write_string_parameter (msg, "commentToOrganizer", NULL, comments_org);
+       if (comments_del)
+               e_gw_message_write_string_parameter (msg, "commentToDelegatee", NULL, comments_del);
+       if (recur_key)
+               e_gw_message_write_string_parameter (msg, "recurrenceAllInstances", NULL, recur_key);
+       
+       e_gw_message_write_footer (msg);
+
+       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);
+       if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
+               reauthenticate (cnc);
+       
+       g_object_unref (response);
+       g_object_unref (msg);
+       
+       return status;
+}
+
 const char *
 e_gw_connection_get_version (EGwConnection *cnc)
 {
index e1c5825..c67a843 100644 (file)
@@ -109,6 +109,7 @@ EGwConnectionStatus e_gw_connection_accept_request (EGwConnection *cnc, const ch
 EGwConnectionStatus e_gw_connection_decline_request (EGwConnection *cnc, const char *id);
 EGwConnectionStatus e_gw_connection_retract_request (EGwConnection *cnc, const char *id, const char *comment, gboolean retract_all, gboolean resend);
 EGwConnectionStatus e_gw_connection_complete_request (EGwConnection *cnc, const char *id);
+EGwConnectionStatus e_gw_connection_delegate_request (EGwConnection *cnc, EGwItem *item, const char *id, const char *comments_org, const char *comments_del, const char *recur_key);
 EGwConnectionStatus e_gw_connection_create_book (EGwConnection *cnc, char *book_name, char**id);
 EGwConnectionStatus e_gw_connection_remove_book (EGwConnection *cnc, char *book_uid);
 EGwConnectionStatus e_gw_connection_get_address_book_list (EGwConnection *cnc, GList **container_list);
index 1468d71..89046fd 100644 (file)
@@ -2538,8 +2538,8 @@ append_gw_item_options (SoupSoapMessage *msg, EGwItem *item)
        soup_soap_message_end_element (msg);
 }
 
-static void
-add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
+void
+e_gw_item_add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
 {
        GSList *rl;
        EGwItemPrivate *priv;
@@ -2566,7 +2566,7 @@ add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
        /* add each recipient */
        for (rl = recipient_list; rl != NULL; rl = rl->next) {
                char *dist_type;
-               char *status;
+               char *status = NULL;
 
                EGwItemRecipient *recipient = (EGwItemRecipient *) rl->data;
                
@@ -2589,7 +2589,8 @@ add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
                        status = "declined";
                else
                        status = "";
-               e_gw_message_write_string_parameter (msg, "recipientStatus", NULL, status);
+               if (status && *status)
+                       e_gw_message_write_string_parameter (msg, "recipientStatus", NULL, status);
                
                soup_soap_message_end_element (msg);            
        }
@@ -2709,7 +2710,7 @@ e_gw_item_set_calendar_item_elements (EGwItem *item, SoupSoapMessage *msg)
        e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject ? priv->subject : "");
 
        if (priv->recipient_list != NULL) {
-               add_distribution_to_soap_message (item, msg);
+               e_gw_item_add_distribution_to_soap_message (item, msg);
                if (priv->set_sendoptions)
                        append_gw_item_options (msg, item);
        }
@@ -2798,7 +2799,7 @@ e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg)
                if (priv->subject)
                        e_gw_message_write_string_parameter (msg, "subject", NULL, priv->subject) ;
                /*distribution*/
-               add_distribution_to_soap_message(item, msg) ;
+               e_gw_item_add_distribution_to_soap_message(item, msg) ;
                
                if (priv->set_sendoptions) {
                        /* item options */
index ad5871f..670a585 100644 (file)
@@ -285,7 +285,7 @@ typedef struct {
 } EGwItemRecipient;
 
 gboolean    e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
-
+void e_gw_item_add_distribution_to_soap_message (EGwItem *item, SoupSoapMessage *msg);
 G_END_DECLS
 
 #endif