Libical API Documentation 4.0 UNRELEASED Go to the stable 3.0 documentation
Loading...
Searching...
No Matches
icalspanlist.c File Reference

Code that supports collections of free/busy spans of time. More...

Go to the source code of this file.

Functions

int * icalspanlist_as_freebusy_matrix (icalspanlist *spanlist, int delta_t)
icalcomponent * icalspanlist_as_vfreebusy (icalspanlist *sl, const char *organizer, const char *attendee)
void icalspanlist_dump (icalspanlist *sl)
void icalspanlist_free (icalspanlist *sl)
icalspanlist * icalspanlist_from_vfreebusy (icalcomponent *comp)
icalspanlist * icalspanlist_new (icalset *set, struct icaltimetype start, struct icaltimetype end)
struct icalperiodtype icalspanlist_next_free_time (icalspanlist *sl, struct icaltimetype t)

Detailed Description

Code that supports collections of free/busy spans of time.

Definition in file icalspanlist.c.

Function Documentation

◆ icalspanlist_as_freebusy_matrix()

int * icalspanlist_as_freebusy_matrix ( icalspanlist * spanlist,
int delta_t )

Returns an hour-by-hour array of free/busy times over a given period.

Parameters
spanlista pointer to a valid icalspanlist
delta_tthe time slice to divide by, in seconds. Default 3600.
Returns
A pointer to an array of integers containing the number of busy events in each delta_t time period. The final entry contains the value -1.

This calculation is somewhat tricky. This is due to the fact that the time range contains the start time, but does not contain the end time. To perform a proper calculation we subtract one second off the end times to get a true containing time.

Also note that if you supplying a spanlist that does not start or end on a time boundary divisible by delta_t you may get results that are not quite what you expect.

Definition at line 280 of file icalspanlist.c.

◆ icalspanlist_as_vfreebusy()

icalcomponent * icalspanlist_as_vfreebusy ( icalspanlist * sl,
const char * organizer,
const char * attendee )

Returns a VFREEBUSY component for a spanlist.

Parameters
sla pointer to a valid icalspanlist, from icalspanlist_new()
organizerthe organizer specified as "MAILTO:user@domain"
attendeethe attendee specified as "MAILTO:user@domain"
Returns
a pointer to an icalcomponent, NULL if the conversion failed.

This function returns a VFREEBUSY component for the given spanlist. The start time is mapped to DTSTART, the end time to DTEND. Each busy span is represented as a separate FREEBUSY entry. An attendee parameter is required, and organizer parameter is optional.

Definition at line 343 of file icalspanlist.c.

◆ icalspanlist_dump()

void icalspanlist_dump ( icalspanlist * sl)

(Debug) print out spanlist to STDOUT.

Parameters
sla pointer to a valid icalspanlist.

Definition at line 202 of file icalspanlist.c.

◆ icalspanlist_free()

void icalspanlist_free ( icalspanlist * sl)

Destructor.

Parameters
slA valid icalspanlist

Frees the memory associated with the spanlist.

Definition at line 183 of file icalspanlist.c.

◆ icalspanlist_from_vfreebusy()

icalspanlist * icalspanlist_from_vfreebusy ( icalcomponent * comp)

Constructs an icalspanlist from the VFREEBUSY component of an icalcomponent.

Parameters
compa pointer to a valid icalcomponent
Returns
a pointer to an icalspanlist or NULL if no VFREEBUSY section.

Definition at line 389 of file icalspanlist.c.

◆ icalspanlist_new()

icalspanlist * icalspanlist_new ( icalset * set,
struct icaltimetype start,
struct icaltimetype end )

Makes a free list from a set of VEVENT components.

Parameters
seta pointer to valid icalset containing VEVENTS
startthe free list starts at this date/time
endthe free list ends at this date/time
Returns
a spanlist corresponding to the VEVENTS

Given a set of components, a start time and an end time return a spanlist that contains the free/busy times. start and end should be in UTC.

Definition at line 81 of file icalspanlist.c.

◆ icalspanlist_next_free_time()

struct icalperiodtype icalspanlist_next_free_time ( icalspanlist * sl,
struct icaltimetype t )

Finds the next free time span in a spanlist.

Parameters
sla pointer to a valid icalspanlist to search
tthe time to start looking.

Given a spanlist and a time, finds the next period of free time.

Returns
an icalperiodtype representing the free type period; if no free time is available then an invalid icalperiodtype is returned.

Definition at line 216 of file icalspanlist.c.