[evolution/calendar-xfb: 4/10] EMeetingStore: added XFB detail extration/storing (heals build)



commit d4905bc27077fbc1b793dc0282f3f01695a2f7cb
Author: Christian Hilberg <chilberg src gnome org>
Date:   Fri Nov 9 10:52:30 2012 +0100

    EMeetingStore: added XFB detail extration/storing (heals build)
    
    * extract X-SUMMARY and X-LOCATION XFB details from a
      vfreebusy ical property (which is part of the ical
      component we get from the backends when querying
      free/busy information), either of which may be absent
    * the values we get will be validated for UTF-8 conformance
      (possibly being forced into) and length limited before
      being stored into the EMeetingAttendee alongside the
      other busy period details

 calendar/gui/e-meeting-store.c |   67 ++++++++++++++++++++++++++++++++--------
 1 files changed, 54 insertions(+), 13 deletions(-)
---
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index b7ab18d..f7bb717 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -1340,6 +1340,31 @@ process_callbacks (EMeetingStoreQueueData *qdata)
 }
 
 static void
+process_free_busy_comp_get_xfb (icalproperty *ip,
+                                gchar **summary,
+                                gchar **location)
+{	
+	const gchar *tmp = NULL;
+	
+	g_return_if_fail (ip != NULL);
+	g_return_if_fail (summary != NULL && *summary == NULL);
+	g_return_if_fail (location != NULL && *location == NULL);
+
+	/* We extract extended free/busy information from the icalproperty
+	 * here (X-SUMMARY and X-LOCATION). If the property carries such,
+	 * it will be displayed as a tooltip for the busy period. Otherwise,
+	 * nothing will happen (*summary and/or *location will be NULL)
+	 */
+	
+	tmp = icalproperty_get_parameter_as_string (ip, E_MEETING_FREE_BUSY_XPROP_SUMMARY);
+	*summary = e_meeting_xfb_utf8_string_new_from_ical (tmp,
+	                                                    E_MEETING_FREE_BUSY_XPROP_MAXLEN);
+	tmp = icalproperty_get_parameter_as_string (ip, E_MEETING_FREE_BUSY_XPROP_LOCATION);
+	*location = e_meeting_xfb_utf8_string_new_from_ical (tmp,
+	                                                     E_MEETING_FREE_BUSY_XPROP_MAXLEN);
+}
+
+static void
 process_free_busy_comp (EMeetingAttendee *attendee,
                         icalcomponent *fb_comp,
                         icaltimezone *zone,
@@ -1422,22 +1447,38 @@ process_free_busy_comp (EMeetingAttendee *attendee,
 
 		if (busy_type != E_MEETING_FREE_BUSY_LAST) {
 			icaltimezone *utc_zone = icaltimezone_get_utc_timezone ();
+			gchar *summary = NULL;
+			gchar *location = NULL;
 
 			icaltimezone_convert_time (&fb.start, utc_zone, zone);
 			icaltimezone_convert_time (&fb.end, utc_zone, zone);
-			e_meeting_attendee_add_busy_period (
-				attendee,
-				fb.start.year,
-				fb.start.month,
-				fb.start.day,
-				fb.start.hour,
-				fb.start.minute,
-				fb.end.year,
-				fb.end.month,
-				fb.end.day,
-				fb.end.hour,
-				fb.end.minute,
-				busy_type);
+
+			/* Extract extended free/busy (XFB) information from
+			 * the icalproperty, if it carries such.
+			 * See the comment for the EMeetingXfbData structure
+			 * for a reference.
+			 */
+			process_free_busy_comp_get_xfb (ip, &summary, &location);
+			
+			e_meeting_attendee_add_busy_period (attendee,
+							    fb.start.year,
+							    fb.start.month,
+							    fb.start.day,
+							    fb.start.hour,
+							    fb.start.minute,
+							    fb.end.year,
+							    fb.end.month,
+							    fb.end.day,
+							    fb.end.hour,
+							    fb.end.minute,
+			                                    busy_type,
+			                                    summary,
+			                                    location);
+			
+			if (summary != NULL)
+				g_free (summary);
+			if (location != NULL)
+				g_free (location);
 		}
 
 		ip = icalcomponent_get_next_property (fb_comp, ICAL_FREEBUSY_PROPERTY);



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