[evolution-patches] Fix for #62415 (Calendar - GW backend) attendee status not being shown properly



hi,
 For GW events , the status of the attendees is available only for the
organizer of the meeting through the recipientStatus element.This patch
allows the attendees to learn their partstat for a given item, by
looking up the mail (which is a base type for all Calendar items in the
GW SOAP protocol) properties.

harish
Index: servers/groupwise/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.58
diff -u -p -r1.58 ChangeLog
--- servers/groupwise/ChangeLog	2 Aug 2004 10:14:38 -0000	1.58
+++ servers/groupwise/ChangeLog	9 Aug 2004 15:54:54 -0000
@@ -1,3 +1,19 @@
+2004-08-09  Harish Krishnaswamy  <kharish novell com>
+
+	Fixes #62415.
+	* e-gw-connection.c: 
+	(e_gw_connection_new): remove unused variable. 
+	(e_gw_connection_get_items), (e_gw_connection_get_items_from_ids),
+	(e_gw_connection_get_deltas), (e_gw_connection_get_item):
+	update 	e_gw_item_new_from_soap_parameter calls with new parameter.
+	(e_gw_connection_accept_request): accept_level should be outside the
+	items element. (funny, the server did not catch us doing this).
+	* e-gw-item.[ch]: (set_recipient_list_from_soap_parameter): send item 
+	pointer instead of the list pointer since we need to access the 
+	self-status as well.
+	(e_gw_item_new_from_soap_parameter): add parmater email. set the 
+	self_status of the e_gw_item from the mail properties.
+
 2004-08-02  Chenthill Palanisamy <pchenthill novell com>
 
 	Fixes #57127
Index: servers/groupwise/e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.77
diff -u -p -r1.77 e-gw-connection.c
--- servers/groupwise/e-gw-connection.c	13 Jul 2004 12:58:27 -0000	1.77
+++ servers/groupwise/e-gw-connection.c	9 Aug 2004 15:54:55 -0000
@@ -331,7 +331,6 @@ e_gw_connection_new (const char *uri, co
 	if (param) {
 		SoupSoapParameter *subparam;
 		const char *param_value;
-		int i;
 
 		subparam = soup_soap_parameter_get_first_child_by_name (param, "email");
 		if (subparam) {
@@ -545,7 +544,7 @@ e_gw_connection_get_items (EGwConnection
 	     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
 		EGwItem *item;
 
-		item = e_gw_item_new_from_soap_parameter (container, subparam);
+		item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
 		if (item)
 			*list = g_list_append (*list, item);
         }
@@ -614,7 +613,7 @@ e_gw_connection_get_items_from_ids (EGwC
 	     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "item")) {
 		EGwItem *item;
 
-		item = e_gw_item_new_from_soap_parameter (container, subparam);
+		item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, subparam);
 		if (item)
 			*list = g_list_append (*list, item);
         }
@@ -723,7 +722,7 @@ e_gw_connection_get_deltas ( EGwConnecti
 				/*process each item */  
 				EGwItem *item;
 				/*FIXME  pass the container id */
-				item = e_gw_item_new_from_soap_parameter ("Calendar", subparam);
+				item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "Calendar", subparam);
                                 if (!item) { 
                                          g_object_unref (response); 
                                          g_object_unref (msg); 
@@ -745,7 +744,7 @@ e_gw_connection_get_deltas ( EGwConnecti
 			 EGwItem *item;
 			 /*process each item */
 			 /*item = get_item_from_updates (subparam);*/
-			 item = e_gw_item_new_from_soap_parameter ("Calendar", subparam);
+			 item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, "Calendar", subparam);
 			 if (item)
 				 *updates = g_slist_append (*updates, item);
                  } 
@@ -942,7 +941,7 @@ e_gw_connection_get_item (EGwConnection 
                 return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
         }
 	
-       	*item = e_gw_item_new_from_soap_parameter (container, param);
+       	*item = e_gw_item_new_from_soap_parameter (cnc->priv->user_email, container, param);
 	
                
 	/* free memory */
@@ -1036,8 +1035,8 @@ e_gw_connection_accept_request (EGwConne
 	msg = e_gw_message_new_with_header (cnc->priv->uri, cnc->priv->session_id, "acceptRequest");
 	soup_soap_message_start_element (msg, "items", NULL, NULL);
 	e_gw_message_write_string_parameter (msg, "item", NULL, id);
-	e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, accept_level);
 	soup_soap_message_end_element (msg);
+	e_gw_message_write_string_parameter (msg, "acceptLevel", NULL, accept_level);
 	e_gw_message_write_footer (msg);
 
 	response = e_gw_connection_send_message (cnc, msg);
Index: servers/groupwise/e-gw-item.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.c,v
retrieving revision 1.42
diff -u -p -r1.42 e-gw-item.c
--- servers/groupwise/e-gw-item.c	2 Aug 2004 10:14:38 -0000	1.42
+++ servers/groupwise/e-gw-item.c	9 Aug 2004 15:54:55 -0000
@@ -56,6 +56,11 @@ struct _EGwItemPrivate {
 
 	/* properties for tasks/calendars */
 	char *icalid;
+	/* if the self is not the organizer of the item, the 
+	 * status is not reflected in the recipientStatus.
+	 * Hence it should be gleaned from the 'status' element
+	 * of the Mail, the parent item.*/
+	ItemStatus self_status;
 	/* properties for category items*/
 	char *category_name;
 
@@ -371,12 +376,15 @@ e_gw_item_new_empty (void)
 }
 
 static void 
-set_recipient_list_from_soap_parameter (GSList **list, SoupSoapParameter *param)
+set_recipient_list_from_soap_parameter (EGwItem *item, SoupSoapParameter *param)
 {
         SoupSoapParameter *param_recipient;
         char *email, *cn;
 	EGwItemRecipient *recipient;
+	GList *email_list;
 
+	email_list = e_gw_item_get_email_list (item);
+	
         for (param_recipient = soup_soap_parameter_get_first_child_by_name (param, "recipient");
 	     param_recipient != NULL;
 	     param_recipient = soup_soap_parameter_get_next_child_by_name (param_recipient, "recipient")) {
@@ -412,20 +420,28 @@ set_recipient_list_from_soap_parameter (
 		
 		/* update Recipient Status
 		 look for accepted/declined and update the item else set it
-		 to none.*/
-		subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "recipientType");
+		 to none. */
+		subparam = soup_soap_parameter_get_first_child_by_name (param_recipient, "recipientStatus");
                 if (subparam) {
-                        const char *recip_type;
-                        recip_type = soup_soap_parameter_get_string_value (subparam);
-                        if (!strcmp (recip_type, "accepted")) 
+                        if (soup_soap_parameter_get_first_child_by_name (subparam, "deleted"))
+				recipient->status = E_GW_ITEM_STAT_DECLINED;
+			if (soup_soap_parameter_get_first_child_by_name (subparam, "declined"))
+				recipient->status = E_GW_ITEM_STAT_DECLINED;
+			else if (soup_soap_parameter_get_first_child_by_name (subparam, "accepted")) 
 				recipient->status = E_GW_ITEM_STAT_ACCEPTED;
-                        else if (!strcmp (recip_type, "deleted"))
-                                recipient->status = E_GW_ITEM_STAT_DECLINED;
-                        else
-				recipient->status = E_GW_ITEM_RECIPIENT_NONE;
+			else 	
+				recipient->status = E_GW_ITEM_STAT_NONE;
                 }
+		else {
+			/* if recipientStatus is not provided, use the
+			 * self_status, obtained from the mail properties. */
+			if (!strcmp ((const char *)email_list->data, recipient->email)) 
+				recipient->status = item->priv->self_status;
+			else
+				recipient->status = E_GW_ITEM_STAT_NONE;
+		}
 		
-                *list = g_slist_append (*list, recipient);
+                item->priv->recipient_list = g_slist_append (item->priv->recipient_list, recipient);
         }        
 }
 
@@ -1238,12 +1254,13 @@ append_group_fields_to_soap_message (EGw
 }
 
 EGwItem *
-e_gw_item_new_from_soap_parameter (const char *container, SoupSoapParameter *param)
+e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param)
 {
 	EGwItem *item;
         char *item_type;
 	SoupSoapParameter *subparam, *child, *category_param;
 	gboolean is_group_item = TRUE;
+	GList *user_email = NULL;
 	
 	g_return_val_if_fail (param != NULL, NULL);
 
@@ -1292,6 +1309,9 @@ e_gw_item_new_from_soap_parameter (const
 	g_free (item_type);
 
 	item->priv->container = g_strdup (container);
+	/* set the email of the user */
+	user_email = g_list_append (user_email, g_strdup (email));
+	e_gw_item_set_email_list (item, user_email);
 
 	/* If the parameter consists of changes - populate deltas */
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "changes");
@@ -1328,6 +1348,16 @@ e_gw_item_new_from_soap_parameter (const
 				item->priv->completed = FALSE;
 			g_free (value);
 
+		} else if (!g_ascii_strcasecmp (name, "status")) {
+			if (soup_soap_parameter_get_first_child_by_name (child, "deleted"))
+				item->priv->self_status = E_GW_ITEM_STAT_DECLINED;
+			else if (soup_soap_parameter_get_first_child_by_name (child, "declined"))
+				item->priv->self_status = E_GW_ITEM_STAT_DECLINED;
+			else if (soup_soap_parameter_get_first_child_by_name (child, "accepted"))
+				item->priv->self_status = E_GW_ITEM_STAT_ACCEPTED;
+			else 
+				item->priv->self_status = E_GW_ITEM_STAT_NONE;
+
 		} else if (!g_ascii_strcasecmp (name, "created")) {
 			char *formatted_date;
 			value = soup_soap_parameter_get_string_value (child);
@@ -1343,7 +1373,7 @@ e_gw_item_new_from_soap_parameter (const
 			if (tp) {
 				g_slist_foreach (item->priv->recipient_list, (GFunc) free_recipient, NULL);
 				item->priv->recipient_list = NULL;
-				set_recipient_list_from_soap_parameter (&item->priv->recipient_list, tp);
+				set_recipient_list_from_soap_parameter (item, tp);
 			}
 			tp = soup_soap_parameter_get_first_child_by_name (child, "from");
 			if (tp && is_group_item) {
Index: servers/groupwise/e-gw-item.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-item.h,v
retrieving revision 1.16
diff -u -p -r1.16 e-gw-item.h
--- servers/groupwise/e-gw-item.h	15 Jun 2004 15:59:07 -0000	1.16
+++ servers/groupwise/e-gw-item.h	9 Aug 2004 15:54:56 -0000
@@ -105,7 +105,7 @@ typedef struct {
 
 GType       e_gw_item_get_type (void);
 EGwItem    *e_gw_item_new_empty (void);
-EGwItem    *e_gw_item_new_from_soap_parameter (const char *container, SoupSoapParameter *param);
+EGwItem    *e_gw_item_new_from_soap_parameter (const char *email, const char *container, SoupSoapParameter *param);
 
 EGwItemType e_gw_item_get_item_type (EGwItem *item);
 void        e_gw_item_set_item_type (EGwItem *item, EGwItemType new_type);
@@ -185,6 +185,12 @@ void e_gw_item_set_recurrence_dates (EGw
 int e_gw_item_get_trigger (EGwItem *item);
 void e_gw_item_set_trigger (EGwItem *item, int trigger);
 
+typedef enum {
+	E_GW_ITEM_STAT_ACCEPTED,
+	E_GW_ITEM_STAT_DECLINED,
+	E_GW_ITEM_STAT_NONE
+} ItemStatus; 
+
 typedef struct {
 	char *email;
 	char *display_name;
@@ -194,11 +200,7 @@ typedef struct {
 		E_GW_ITEM_RECIPIENT_NONE
 	} type;
 
-	enum {
-		E_GW_ITEM_STAT_ACCEPTED,
-		E_GW_ITEM_STAT_DECLINED,
-		E_GW_ITEM_STAT_NONE
-	} status;
+	ItemStatus status;
 } EGwItemRecipient;
 
 gboolean    e_gw_item_append_to_soap_message (EGwItem *item, SoupSoapMessage *msg);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]