Recurrent Events

Milan Crha mcrha at redhat.com
Fri Feb 3 02:20:09 PST 2017


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. 



More information about the libical-devel mailing list