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



commit 6b214c010624954d395aa8d9bf06059f6e4f9d37
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 |   44 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 0aaf8fe..43c6d20 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,
@@ -1420,9 +1445,19 @@ 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);
+
+			/* 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,
@@ -1434,7 +1469,14 @@ process_free_busy_comp (EMeetingAttendee *attendee,
 							    fb.end.day,
 							    fb.end.hour,
 							    fb.end.minute,
-							    busy_type);
+			                                    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]