From: w.goesgens <w.g...@ou...> - 2008-01-29 18:37:34
|
<html><body> <p>Thanks, Terry. </p><p>your Patch is applied. there are two more of tho= se TODO's in the source which remained from the merger of Evolution a= nd Kcal fork backpatching action. If you've got a sugestion for these= too, be welcome ;-)</p><p>The mailinglist which caries the anouncements=20= and so on is at li...@so...; this one mostly just ca= ries the commit comments.</p><p>We're hoping to release the 0.30 with= in the next two weeks. Outstanding points are the two TODO's mentione= d above, and getting a working cmake implementation, so libkcal can use t= he upstream libical again. </p><blockquote>Tue Jan 29 2008 03:36:06=20= CET from Terry Wilson to fre...@li... <br=20= />Subject: [Freeassociation-devel] [patch] Problem using icalcomponent_fo= reach_recurrence() with time filters<br /><br />Ok, I've spent a whil= e tracking this down and think I have a suitable<br />fix for it.<br /><b= r />Situation:<br /><br />I need to parse a calendar for whether or not s= omeone is busy over a<br />particular timeframe. As an example:<br />...= <br /> calendar =3D icalparser_parse_string(calendar_text);<br /><br=20= /> utc_zone =3D icaltimezone_get_utc_timezone();<br /> start =3D=20= icaltime_current_time_with_zone(utc_zone);<br /> end =3D icaltime_cur= rent_time_with_zone(utc_zone);<br /> end.hour +=3D 1;<br /> icalt= ime_normalize(end);<br /><br /> for(iter =3D icalcomponent_get_first_= component(calendar,<br />ICAL_VEVENT_COMPONENT); iter; iter =3D<br />ical= component_get_next_component(calendar, ICAL_VEVENT_COMPONENT)) {<br /> =20= icalcomponent_foreach_recurrence(iter, start, end, callback,<br />N= ULL);<br /> }<br /><br />There are two problems. The first is that t= he VEVENT does not have<br />VTIMEZONEs locally, but they are in the pare= nt so matching the TZID<br />with a VTIMEZONE fails. There are two copie= s of<br />icalcomponent_get_datetime in the source. One is commented out= with a<br />TODO trying to figure out which one to use. The one that i= s<br />currently uncommented checks for the VTIMEZONE in the component.<b= r />Since this is being called from the _get_dtstart function, it will<br= />almost always fail to find the VTIMEZONE, so dtstart will be returned<= br />without a timezone. The one that is commented out, searches parents= <br />until it finds the VTIMEZONE to compare against. This seems to be=20= the<br />correct way to go about things.<br /><br />The second problem is= that the dtstart is not being converted to UTC<br />in this situation be= cause icalcomponent_foreach_recurrence() calls<br />icaltime_span_new(dts= tart, dtend, 1) which in turn calls<br />icaltime_as_timet_with_zone(dtst= art,<br />icaltimezone_get_utc_timezone()). Now, dtstart in my case is G= MT -6.<br />If you look in icaltimezone_convert_time, you will see that i= t returns<br />early because this means that we would be trying to conver= t from UTC<br />to UTC--completely ignoring the actual timezone of the dt= start.<br /><br />Attatched is a patch that changes which icalcomponent_g= et_datetime to<br />use, as well as fixes icaltime_span_new to call<br />= icaltime_as_timet_with_zone with the correct zone of the start/end of<br=20= />the span if it exists. I also have sample data and sample code<br />ex= ploiting the bug if it is helpful.<br /><br />Terry Wilson<br /><br /></b= lockquote> </body></html> |