Recurrent Events
Iñigo Martínez
inigomartinez at gmail.com
Sat Feb 4 01:54:59 PST 2017
Hi,
Ok, I have done some testing following your hints and I understand
what is going on. I wasn't making a proper distinction between objects
and instances and now I do get the master object of a recurrent event
by getting their UID and e_cal_client_get_object_sync /
e_cal_client_get_objects_for_uid_sync.
I still have to do a little more testing though.
Thank you for your kind support,
Best regards,
(BTW, I'm sorry about the CC of the last mail)
2017-02-03 11:20 GMT+01:00 Milan Crha <mcrha at redhat.com>:
> On Fri, 2017-02-03 at 10:49 +0100, Iñigo Martínez wrote:
>> I have tried the following. I checked if the ECalClient has support
>> for master object on recurrences using
>> e_cal_client_check_recurrences_no_master() and the result is 0, so I
>> should check if an icalcomponent is not master object in order to
>> ignore the RRULE. Is this correct?
>
> Hi,
> no, the correct way is "is this component a recurrence instance? then
> ignore RRULE & other recurrence properties". See
> e_cal_util_component_is_instance() and the other utility functions from
> libecal/e-cal-util.h.
>
>> If it is, the next question would
>> be, how do I get the master object of a recurrent event? I tried
>> icalcomponent_get_parent() without any success as the recurrent
>> events return no parent.
>
> You cannot do that with the component, you ask the calendar to give you
> the master object (you identify the object only by its UID, without RID
> (the RID stands for Recurrence ID, referring to RECURRENCE-ID property
> of the iCalendar object).
>
>> I tried the second approach also, the one using the
>> e_cal_recur_generate_instances_sync(). I used it in the following
>> way.
>> First I called e_cal_client_generate_instances:
>
> Wait a bit here. I'm still confused what you are trying to do. If it is
> something like "get me all the events in certain time range" and you
> use e_cal_client_generate_instances() for it, then why do you bother of
> re-doing the RRULE generation again? It does the
> e_cal_client_generate_instances() for you, even its name is "generate
> instances", which is somewhat self explanatory.
>
> I mean, either you do everything on your own, which means that you'll
> ask the ECalClient for objects, not for instances, or you'll use the
> API which generates the instances. If you ever thought of code
> duplication, then you might see a benefit in the later approach. Not
> talking that dealing with recurrences is a non trivial task, thus if
> you can reuse existing code, which is used by other applications too,
> then it makes more sense, also because it's well-tested.
> Hope it helps,
> Milan
>
> P.S.: You can reply only to the list, I am subscribed to it, otherwise
> I won't reply to your initial mail.
>
> _______________________________________________
> libical-devel mailing list
> libical-devel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libical-devel
More information about the libical-devel
mailing list