File bnc-443544-eds-free-busy.patch of Package evolution-data-server

Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(revision 9879)
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(revision 9881)
@@ -1785,6 +1785,7 @@
 		ECalComponentAttendee attendee;
 		GSList *attendee_list = NULL;
 		icalcomponent *icalcomp = NULL;
+		icaltimetype start_time, end_time;
 
 		tmp = soup_soap_parameter_get_first_child_by_name (subparam, "email");
 		if (tmp)
@@ -1801,6 +1802,11 @@
 		e_cal_component_commit_sequence (comp);
 		icalcomp = e_cal_component_get_icalcomponent (comp);
 
+		start_time = icaltime_from_timet_with_zone (start, 0, default_zone ? default_zone : NULL);
+		end_time = icaltime_from_timet_with_zone (end, 0, default_zone ? default_zone : NULL);
+		icalcomponent_set_dtstart (icalcomp, start_time);
+		icalcomponent_set_dtend (icalcomp, end_time);
+
 		memset (&attendee, 0, sizeof (ECalComponentAttendee));
 		if (name)
 			attendee.cn = name;
@@ -1829,7 +1835,24 @@
 			return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
 		}
 
-		for (subparam_block = soup_soap_parameter_get_first_child_by_name (param_blocks, "block");
+		subparam_block = soup_soap_parameter_get_first_child_by_name (param_blocks, "block");
+		/* The GW server only returns 'Busy', 'OOF' and 'Tentative' periods. The rest are 
+		 * assumed to be 'Free' periods. In case of an attendee having only 'Free' periods, 
+		 * ensure to send a block to the frontend saying so. */
+		if (subparam_block == NULL) {
+			struct icalperiodtype ipt;
+			icaltimetype sitt, eitt;
+			icalproperty *icalprop;
+			sitt = icaltime_from_timet_with_zone (start, 0, default_zone ? default_zone : NULL);
+			ipt.start = sitt;
+			eitt = icaltime_from_timet_with_zone (end, 0, default_zone ? default_zone : NULL);
+			ipt.end = eitt;
+			icalprop = icalproperty_new_freebusy (ipt);
+			icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "FREE");
+			icalcomponent_add_property(icalcomp, icalprop);
+		}
+
+		for (;
 		     subparam_block != NULL;
 		     subparam_block = soup_soap_parameter_get_next_child_by_name (subparam_block, "block")) {
 
openSUSE Build Service is sponsored by