GNOME Bugzilla – Bug 656207
e_cal_client_get_object_sync() does not work correctly if RID is NULL
Last modified: 2013-09-14 16:54:14 UTC
If I call e_cal_client_get_object_sync(client, "20080407T193125Z-19554-727-1-50@gollum", NULL, &comp, NULL, &gerror), I get the following result: *** BEGIN:VCALENDAR PRODID:-//Ximian//NONSGML Evolution Calendar//EN VERSION:2.0 BEGIN:VEVENT UID:20080407T193125Z-19554-727-1-50@gollum DTSTAMP:20080407T193125Z DTSTART:20080413T090000Z DTEND:20080413T093000Z TRANSP:OPAQUE SEQUENCE:7 SUMMARY:Recurring: Modified CLASS:PUBLIC CREATED:20080407T193241 LAST-MODIFIED:20080407T193647 RECURRENCE-ID:20080413T090000Z DESCRIPTION:second instance modified END:VEVENT END:VCALENDAR *** Instead of: *** BEGIN:VCALENDAR PRODID:-//Ximian//NONSGML Evolution Calendar//EN VERSION:2.0 BEGIN:VEVENT UID:20080407T193125Z-19554-727-1-50@gollum DTSTAMP:20080407T193125Z DTSTART:20080406T090000Z DTEND:20080406T093000Z TRANSP:OPAQUE SEQUENCE:2 SUMMARY:Recurring DESCRIPTION:recurs each Sonday\, 10 times CLASS:PUBLIC RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=SU;UNTIL=20080608T090000Z CREATED:20080407T193241 LAST-MODIFIED:20080407T193241 END:VEVENT END:VCALENDAR *** It returns an instance instead of returning the parent. I'm not able to reproduce the issue by using the deprecated ecal API (e_cal_get_object). I compared the code for e_cal_client_get_object_sync() and e_cal_get_object() and I found the following difference: e_cal_client_get_object_sync() is calling complete_get_object_master() which does: *** } else if (res && icalcomponent_isa (tmp_comp) == ICAL_VCALENDAR_COMPONENT) { // XXX: Why this loop? for (master_comp = icalcomponent_get_first_component (tmp_comp, kind); master_comp; master_comp = icalcomponent_get_next_component (tmp_comp, kind)) { if (!icalcomponent_get_uid (master_comp)) continue; if (icaltime_is_valid_time (icalcomponent_get_recurrenceid (master_comp)) && !icaltime_is_null_time (icalcomponent_get_recurrenceid (master_comp))) break; } if (!master_comp) master_comp = icalcomponent_get_first_component (tmp_comp, kind); *icalcomp = master_comp ? icalcomponent_new_clone (master_comp) : NULL; } *** The equivalent in e_cal_get_object() does not have the for loop and calls icalcomponent_get_first_component() directly. If I comment the for loop, the method returns the expected result. In the for loop, it appears we are making sure that master_comp has a recurrence ID but I don't think this is correct when the client asks for a parent (with RID == NULL).
Created attachment 193484 [details] [review] Proposed patch for MASTER
Thanks for the finding, I did this wrong. I would check for valid times first, and then for null times, but this will work too. Please commit to master.
Fix committed to master: http://git.gnome.org/browse/evolution-data-server/commit/?id=d20c579f010fee1381a8ea2a1472f2e270ea7746