Bug #655748 - rdate parsing failure: unknown value for period 20068
authorMilan Crha <mcrha@redhat.com>
Wed, 3 Aug 2011 10:02:49 +0000 (12:02 +0200)
committerMilan Crha <mcrha@redhat.com>
Wed, 3 Aug 2011 10:03:39 +0000 (12:03 +0200)
calendar/libecal/e-cal-component.c
calendar/libecal/e-cal-recur.c

index 04aff0f..2d3e60e 100644 (file)
@@ -2774,8 +2774,10 @@ get_period_list (GSList *period_list,
 
                p = g_new (ECalComponentPeriod, 1);
 
-               /* Get value parameter */
+               /* Get start and end/duration */
+               ip = (* get_prop_func) (period->prop);
 
+               /* Get value parameter */
                if (period->value_param) {
                        icalparameter_value value_type;
 
@@ -2785,7 +2787,12 @@ get_period_list (GSList *period_list,
                                p->type = E_CAL_COMPONENT_PERIOD_DATETIME;
                        else if (value_type == ICAL_VALUE_DURATION)
                                p->type = E_CAL_COMPONENT_PERIOD_DURATION;
-                       else {
+                       else if (value_type == ICAL_VALUE_PERIOD) {
+                               if (icaldurationtype_is_null_duration (ip.period.duration) || icaldurationtype_is_bad_duration (ip.period.duration))
+                                       p->type = E_CAL_COMPONENT_PERIOD_DATETIME;
+                               else
+                                       p->type = E_CAL_COMPONENT_PERIOD_DURATION;
+                       } else {
                                g_message ("get_period_list(): Unknown value for period %d; "
                                           "using DATETIME", value_type);
                                p->type = E_CAL_COMPONENT_PERIOD_DATETIME;
@@ -2793,10 +2800,6 @@ get_period_list (GSList *period_list,
                } else
                        p->type = E_CAL_COMPONENT_PERIOD_DATETIME;
 
-               /* Get start and end/duration */
-
-               ip = (* get_prop_func) (period->prop);
-
                p->start = ip.period.start;
 
                if (p->type == E_CAL_COMPONENT_PERIOD_DATETIME)
index 2392777..49df9e5 100644 (file)
@@ -492,7 +492,7 @@ static void e_cal_recur_set_rule_end_date           (icalproperty   *prop,
                                                 time_t          end_date);
 
 #ifdef CAL_OBJ_DEBUG
-static gchar * cal_obj_time_to_string          (CalObjTime     *cotime);
+static const gchar * cal_obj_time_to_string            (CalObjTime     *cotime);
 #endif
 
 static ECalRecurVTable cal_obj_yearly_vtable = {
@@ -1433,7 +1433,9 @@ cal_object_get_rdate_end  (CalObjTime     *occ,
 
        /* This should never happen. */
        if (cmp == 0) {
-               g_warning ("Recurrence date not found");
+               #ifdef CAL_OBJ_DEBUG
+               g_debug ("%s: Recurrence date %s not found", G_STRFUNC, cal_obj_time_to_string (cc));
+               #endif
                return FALSE;
        }
 
@@ -3761,10 +3763,10 @@ cal_object_time_from_time       (CalObjTime     *cotime,
 /* Debugging function to convert a CalObjTime to a string. It uses a static
    buffer so beware. */
 #ifdef CAL_OBJ_DEBUG
-static gchar *
+static const gchar *
 cal_obj_time_to_string         (CalObjTime     *cotime)
 {
-       static gchar buffer[20];
+       static gchar buffer[50];
        gchar *weekdays[] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun",
                             "   " };
        gint weekday;