fixes #314925.
authorChenthill Palanisamy <pchen@src.gnome.org>
Sat, 1 Oct 2005 15:31:39 +0000 (15:31 +0000)
committerChenthill Palanisamy <pchen@src.gnome.org>
Sat, 1 Oct 2005 15:31:39 +0000 (15:31 +0000)
calendar/ChangeLog
calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
calendar/backends/groupwise/e-cal-backend-groupwise.c

index d4aba4d..3932bbc 100644 (file)
@@ -1,3 +1,10 @@
+2005-10-01  Chenthill Palanisamy  <pchenthill@novell.com>
+
+       Fixes #314925
+       * backends/groupwise/e-cal-backend-groupwise-utils.c:
+       (get_attendee_prop), (set_attendees_to_item): Get the 
+       delegated attendee and remove the delfrom parameter.
+
 2005-10-01  Harry Lu <harry.lu@sun.com>
 
        * libecal/e-cal.c: (generate_instances): use the same logic as in
index 3111cfd..793b5ab 100644 (file)
@@ -336,14 +336,32 @@ e_cal_backend_groupwise_set_attachments_from_comp (ECalComponent *comp,
 
        e_gw_item_set_attach_id_list (item, attach_list);
 }
-       
+
+/* Returns the icalproperty for the Attendee associted with email id */
+static icalproperty *
+get_attendee_prop (icalcomponent *icalcomp, const char *attendee)
+{
+       icalproperty *prop;     
+
+       for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
+                       prop;
+                       prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) {
+               const char *att = icalproperty_get_attendee (prop);
+
+               if (!g_ascii_strcasecmp (att, attendee)) {
+                       return prop;
+               }
+       }
+
+       return NULL;
+}
+
 /* get_attendee_list from cal comp and convert into
  * egwitemrecipient and set it on recipient_list*/
 static void
 set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default_zone, gboolean delegate, const char *user_email)
 {
        if (e_cal_component_has_attendees (comp)) {
-               gboolean att_changed = FALSE;
                GSList *attendee_list, *recipient_list = NULL, *al;
 
                e_cal_component_get_attendee_list (comp, &attendee_list);       
@@ -355,8 +373,10 @@ set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default
                                continue;               
                        
                        if (delegate) {
-                               attendee->delfrom = "";
-                               att_changed = TRUE;
+                               icalproperty *prop = get_attendee_prop (e_cal_component_get_icalcomponent (comp), 
+                                               attendee->value);
+                               if (prop) 
+                                       icalproperty_remove_parameter_by_kind (prop, ICAL_DELEGATEDFROM_PARAMETER);
                        }
        
                        recipient = g_new0 (EGwItemRecipient, 1);
@@ -381,10 +401,6 @@ set_attendees_to_item (EGwItem *item, ECalComponent *comp, icaltimezone *default
                        recipient_list = g_slist_append (recipient_list, recipient);
                }
 
-               /* Reset the ECalComponent with changes if necessary*/
-               if(att_changed)
-                       e_cal_component_set_attendee_list (comp, attendee_list);        
-
                e_cal_component_free_attendee_list(attendee_list);
        
                /* recipient_list shouldn't be freed. Look into the function below. */
index f2e2821..10d027c 100644 (file)
@@ -1817,12 +1817,13 @@ e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal,
                        return GNOME_Evolution_Calendar_ObjectNotFound;
                }
 
-               if (e_cal_backend_groupwise_utils_check_delegate (comp, e_gw_connection_get_user_email (priv->cnc))) {
+               if (e_cal_component_has_attendees (comp) && 
+                               e_cal_backend_groupwise_utils_check_delegate (comp, e_gw_connection_get_user_email (priv->cnc))) {
                        const char *id = NULL, *recur_key = NULL;
                        
                        item = e_gw_item_new_for_delegate_from_cal (cbgw, comp);
 
-                       if (mod == CALOBJ_MOD_ALL) {
+                       if (mod == CALOBJ_MOD_ALL && e_cal_component_is_instance (comp)) {
                                recur_key = uid;
                        } else {
                                id = e_gw_item_get_id (item);