Re: [Evolution-hackers] Evolution requesting info on every year from 2011 down to 65535



On Tue, 2011-02-22 at 11:30 +1300, Andrew McMillan wrote:
> [...]
> Hi Carlos,
> 
> From RFC5545:
> 
>       The INTERVAL rule part contains a positive integer representing at
>       which intervals the recurrence rule repeats.  The default value is
>       "1", meaning every second for a SECONDLY rule, every minute for a
>       MINUTELY rule, every hour for an HOURLY rule, every day for a
>       DAILY rule, every week for a WEEKLY rule, every month for a
>       MONTHLY rule, and every year for a YEARLY rule.  For example,
>       within a DAILY rule, a value of "8" means every eight days.
> 
> So yes: 0 is also invalid, as you would expect :-)

 A very reasonable thing for the RFC to say :) This should probably be
done in libical, but within e-d-s it the following patch probably makes
more sense than the one I posted on the other thread ("Deal with
negative intervals")

[PATCH] ECalRecur: Convert negative intervals into the default (1)

Negative intervals have been spotted in the wild. An interval lower
than 1 doesn't make any sense, so if we see one, we replace it by the
default iCal interval of 1.
---
 calendar/libecal/e-cal-recur.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/calendar/libecal/e-cal-recur.c b/calendar/libecal/e-cal-recur.c
index 3c30618..9eda66a 100644
--- a/calendar/libecal/e-cal-recur.c
+++ b/calendar/libecal/e-cal-recur.c
@@ -996,7 +996,8 @@ e_cal_recur_from_icalproperty (icalproperty *prop, gboolean exception,
                ir = icalproperty_get_rrule (prop);
 
        r->freq = ir.freq;
-       r->interval = ir.interval;
+       /* Interval < 1 doesn't make sense, so use the default. */
+       r->interval = ir.interval < 1 ? 1 : ir.interval;
 
   r->enddate = e_cal_recur_obtain_enddate (&ir, prop, zone, convert_end_date);

-- 
Carlos Martín Nieto        http://www.cmartin.tk

"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI

Attachment: signature.asc
Description: This is a digitally signed message part



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