Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- ECal.isodate_from_time_t(t)¶
- Parameters:
t (
int
) – A time value.- Returns:
String with the ISO 8601 representation of the UTC time.
- Return type:
Creates an ISO 8601 UTC representation from a time value.
- ECal.match_tzid(tzid)¶
- Parameters:
tzid (
str
) – a timezone ID- Returns:
The matching TZID, or
None
if none found or for UTC- Return type:
Matches tzid against the system timezone definitions and returns the matching TZID, or
None
if none foundNew in version 2.24.
- ECal.recur_describe_recurrence(icalcomp, week_start_day, flags)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
week_start_day (
GLib.DateWeekday
) – a day when the week startsflags (
int
) – bit-or ofECal.RecurDescribeRecurrenceFlags
- Returns:
a newly allocated string, which describes the recurrence of the icalcomp, or
None
, when the icalcomp doesn’t recur or the recurrence is too complicated to describe, also according to given flags.- Return type:
Describes some simple types of recurrences in a human-readable and localized way. The flags influence the output format and what to do when the icalcomp contains more complicated recurrence, some which the function cannot describe.
The week_start_day is used for weekly recurrences, to start the list of selected days at that day.
Uses
EDataServer.time_format_date_and_time
() to format the date/time value in the string. CallECal.recur_describe_recurrence_ex
() with a custom formatting function.Free the returned string with
GLib.free
(), when no longer needed.New in version 3.30.
- ECal.recur_describe_recurrence_ex(icalcomp, week_start_day, flags, datetime_fmt_func)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
week_start_day (
GLib.DateWeekday
) – a day when the week startsflags (
int
) – bit-or ofECal.RecurDescribeRecurrenceFlags
datetime_fmt_func (
ECal.RecurFormatDateTimeFunc
orNone
) – formatting function for date/time value
- Returns:
a newly allocated string, which describes the recurrence of the icalcomp, or
None
, when the icalcomp doesn’t recur or the recurrence is too complicated to describe, also according to given flags.- Return type:
Describes some simple types of recurrences in a human-readable and localized way. The flags influence the output format and what to do when the icalcomp contains more complicated recurrence, some which the function cannot describe.
The week_start_day is used for weekly recurrences, to start the list of selected days at that day.
If datetime_fmt_func is
None
, theEDataServer.time_format_date_and_time
() is used to format data/time value.Free the returned string with
GLib.free
(), when no longer needed.New in version 3.38.
- ECal.recur_ensure_end_dates(comp, refresh, tz_cb, tz_cb_data, cancellable)¶
- Parameters:
comp (
ECal.Component
) – anECal.Component
tz_cb (
ECal.RecurResolveTimezoneCb
) – function to call to resolve timezonescancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
- Return type:
This recalculates the end dates for recurrence & exception rules which use the COUNT property. If refresh is
True
it will recalculate all enddates for rules which use COUNT. If refresh isFalse
, it will only calculate the enddate if it hasn’t already been set. It returnsTrue
if the component was changed, i.e. if the component should be saved at some point. We store the enddate in theECal.EVOLUTION_ENDDATE_PARAMETER
parameter of the RRULE or EXRULE.New in version 2.32.
- ECal.recur_generate_instances_sync(icalcomp, interval_start, interval_end, callback, callback_user_data, get_tz_callback, get_tz_callback_user_data, default_timezone, cancellable)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
interval_start (
ICalGLib.Time
) – an interval start, for which generate instancesinterval_end (
ICalGLib.Time
) – an interval end, for which generate instancescallback (
ECal.RecurInstanceCb
orNone
) – a callback to be called for each instancecallback_user_data (
object
orNone
) – user data for callbackget_tz_callback (
ECal.RecurResolveTimezoneCb
orNone
) – a callback to call when resolving timezoneget_tz_callback_user_data (
object
orNone
) – user data for get_tz_callbackdefault_timezone (
ICalGLib.Timezone
) – a defaultICalGLib.Timezone
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
; can beNone
- Raises:
- Returns:
True
if successful (when all instances had been returned),False
otherwise.- Return type:
Calls the given callback function for each occurrence of the event that intersects the range between the given start and end times (the end time is not included). Note that the occurrences may start before the given start time.
If the callback routine returns
False
the occurrence generation stops.The start and end times are required valid times, start before end time.
The get_tz_callback is used to resolve references to timezones. It is passed a TZID and should return the
ICalGLib.Timezone
* corresponding to that TZID. We need to do this as we access timezones in different ways on the client & server.The default_timezone argument is used for DTSTART or DTEND properties that are DATE values or do not have a TZID (i.e. floating times).
New in version 3.20.
- ECal.recur_get_localized_nth(nth)¶
- Parameters:
nth (
int
) – the nth index, counting from zero- Returns:
Localized text for the nth position, counting from zero, which means for ‘0’ it’ll return “1st”, for ‘1’ it’ll return “2nd” and so on, up to 30, when it’ll return “31st”.
- Return type:
New in version 3.28.
- ECal.recur_obtain_enddate(ir, prop, zone, convert_end_date)¶
- Parameters:
ir (
ICalGLib.Recurrence
) –prop (
ICalGLib.Property
) –zone (
ICalGLib.Timezone
) –convert_end_date (
bool
) –
- Return type:
- ECal.system_timezone_get_location()¶
-
Fetches the system timezone location string.
Note: Since 3.4 the returned timezone location is either
None
or an equivalent within known libical timezones.The returned string should be freed with
GLib.free
().New in version 2.28.
- ECal.time_add_day(time, days)¶
- Parameters:
- Returns:
a time_t value containing time plus the days added.
- Return type:
Adds a day onto the time, using local time. Note that if clocks go forward due to daylight savings time, there are some non-existent local times, so the hour may be changed to make it a valid time. This also means that it may not be wise to keep calling
ECal.time_add_day
() to step through a certain period - if the hour gets changed to make it valid time, any further calls toECal.time_add_day
() will also return this hour, which may not be what you want.
- ECal.time_add_day_with_zone(time, days, zone)¶
- Parameters:
time (
int
) – A time_t value.days (
int
) – Number of days to add.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
a time_t value containing time plus the days added.
- Return type:
Adds or subtracts a number of days to/from the given time_t value, using the given timezone. NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_add_month_with_zone(time, months, zone)¶
- Parameters:
time (
int
) – A time_t value.months (
int
) – Number of months to add.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
a time_t value containing time plus the months added.
- Return type:
Adds or subtracts a number of months to/from the given time_t value, using the given timezone.
If the day would be off the end of the month (e.g. adding 1 month to 30th January, would lead to an invalid day, 30th February), it moves it down to the last day in the month, e.g. 28th Feb (or 29th in a leap year.)
NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_add_week(time, weeks)¶
- Parameters:
- Returns:
a time_t value containing time plus the weeks added.
- Return type:
Adds the given number of weeks to a time value.
- ECal.time_add_week_with_zone(time, weeks, zone)¶
- Parameters:
time (
int
) – A time_t value.weeks (
int
) – Number of weeks to add.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
a time_t value containing time plus the weeks added.
- Return type:
Adds or subtracts a number of weeks to/from the given time_t value, using the given timezone. NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_day_begin(t)¶
- Parameters:
t (
int
) – A time_t value.- Returns:
the time corresponding to the beginning of the day.
- Return type:
Returns the start of the day, according to the local time.
- ECal.time_day_begin_with_zone(time, zone)¶
- Parameters:
time (
int
) – A time_t value.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
the beginning of the day.
- Return type:
Returns the start of the day containing the given time_t, using the given timezone. NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_day_end(t)¶
- Parameters:
t (
int
) – A time_t value.- Returns:
the time corresponding to the end of the day.
- Return type:
Returns the end of the day, according to the local time.
- ECal.time_day_end_with_zone(time, zone)¶
- Parameters:
time (
int
) – A time_t value.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
the end of the day.
- Return type:
Returns the end of the day containing the given time_t, using the given timezone. (The end of the day is the start of the next day.) NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_day_of_week(day, month, year)¶
- Parameters:
- Returns:
the day of the week for the given date.
- Return type:
Returns the day of the week for the specified date, 0 (Sun) to 6 (Sat). For the days that were removed on the Gregorian reformation, it returns Thursday. Year is the normal year, e.g. 2001. Month is 0 to 11.
- ECal.time_day_of_year(day, month, year)¶
- Parameters:
- Returns:
the day of the year.
- Return type:
Returns the 1-based day number within the year of the specified date. Year is the normal year, e.g. 2001. Month is 0 to 11.
- ECal.time_days_in_month(year, month)¶
- Parameters:
- Returns:
number of days in the given month/year.
- Return type:
Returns the number of days in the month. Year is the normal year, e.g. 2001. Month is 0 (Jan) to 11 (Dec).
- ECal.time_from_isodate(str)¶
- Parameters:
str (
str
) – Date/time value in ISO 8601 format.- Returns:
Time_t corresponding to the specified ISO string. Note that we only allow UTC times at present.
- Return type:
Converts an ISO 8601 UTC time string into a time_t value.
- ECal.time_is_leap_year(year)¶
- Parameters:
year (
int
) – The year.- Returns:
- Return type:
Returns whether the specified year is a leap year. Year is the normal year, e.g. 2001.
- ECal.time_leap_years_up_to(year)¶
-
Returns the number of leap years since year 1 up to (but not including) the specified year. Year is the normal year, e.g. 2001.
- ECal.time_month_begin_with_zone(time, zone)¶
- Parameters:
time (
int
) – A time_t value.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
the beginning of the month.
- Return type:
Returns the start of the month containing the given time_t, using the given timezone. NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_to_gdate_with_zone(date, time, zone)¶
- Parameters:
Converts a time_t value to a
GLib.Date
structure using the specified timezone. This is analogous toGLib.Date.set_time
() but takes the timezone into account.
- ECal.time_week_begin_with_zone(time, week_start_day, zone)¶
- Parameters:
time (
int
) – A time_t value.week_start_day (
int
) – Day to use as the starting of the week.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
the beginning of the week.
- Return type:
Returns the start of the week containing the given time_t, using the given timezone. week_start_day should use the same values as mktime(), i.e. 0 (Sun) to 6 (Sat). NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.time_year_begin_with_zone(time, zone)¶
- Parameters:
time (
int
) – A time_t value.zone (
ICalGLib.Timezone
) – Timezone to use.
- Returns:
the beginning of the year.
- Return type:
Returns the start of the year containing the given time_t, using the given timezone. NOTE: this function is only here to make the transition to the timezone functions easier. New code should use
ICalGLib.Time
values andICalGLib.Time.adjust
() to add or subtract days, hours, minutes & seconds.
- ECal.util_add_timezones_from_component(vcal_comp, icalcomp)¶
- Parameters:
vcal_comp (
ICalGLib.Component
) – A VCALENDAR component.icalcomp (
ICalGLib.Component
) – An iCalendar component, of any type.
Adds VTIMEZONE components to a VCALENDAR for all tzid’s in the given icalcomp.
- ECal.util_clamp_vtimezone(vtimezone, from_, to)¶
- Parameters:
vtimezone (
ICalGLib.Component
) – a VTIMEZONE component to modifyfrom (
ICalGLib.Time
) – anICalGLib.Time
for the minimum timeto (
ICalGLib.Time
orNone
) – until which time to clamp, orNone
for infinity
- Returns:
a VTIMEZONE component to modify
- Return type:
vtimezone:
ICalGLib.Component
Modifies the vtimezone to include only subcomponents influencing the passed-in time interval between from and to.
New in version 3.40.
- ECal.util_clamp_vtimezone_by_component(vtimezone, component)¶
- Parameters:
vtimezone (
ICalGLib.Component
) – a VTIMEZONE component to modifycomponent (
ICalGLib.Component
) – anICalGLib.Component
to read the times from
- Returns:
a VTIMEZONE component to modify
- Return type:
vtimezone:
ICalGLib.Component
Similar to
ECal.util_clamp_vtimezone
(), only reads the clamp times from the component.New in version 3.40.
- ECal.util_component_dup_x_property(icalcomp, x_name)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
x_name (
str
) – name of the X property
- Returns:
Newly allocated value of the first x_name X property in icalcomp, or
None
, if not found.- Return type:
Searches for an X property named x_name within X properties of icalcomp and returns its value as a newly allocated string. Free it with
GLib.free
(), when no longer needed.New in version 3.34.
- ECal.util_component_find_property_for_locale(icalcomp, prop_kind, locale)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
prop_kind (
ICalGLib.PropertyKind
) – anICalGLib.PropertyKind
to traverse
- Returns:
a property of kind prop_kind for the locale,
None
if no such property is set on the comp.- Return type:
Searches properties of kind prop_kind in the icalcomp and returns one, which is usable for the locale. When locale is
None
, the current locale is assumed. If no such property for the locale exists either the one with no language parameter or the first found is returned.Free the returned non-
None
ICalGLib.Property
withGObject.Object.unref
(), when no longer needed.New in version 3.46.
- ECal.util_component_find_property_for_locale_filtered(icalcomp, prop_kind, locale, func, *user_data)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
prop_kind (
ICalGLib.PropertyKind
) – anICalGLib.PropertyKind
to traversefunc (
ECal.UtilFilterPropertyFunc
orNone
) – anECal.UtilFilterPropertyFunc
, to determine whether a property can be considered
- Returns:
a property of kind prop_kind for the locale,
None
if no such property is set on the comp.- Return type:
Searches properties of kind prop_kind in the icalcomp, which can be filtered by the func, and returns one, which is usable for the locale. When locale is
None
, the current locale is assumed. If no such property for the locale exists either the one with no language parameter or the first found is returned.The func is called before checking of the applicability for the locale. When the func is
None
, all the properties of the prop_kind are considered.Free the returned non-
None
ICalGLib.Property
withGObject.Object.unref
(), when no longer needed.New in version 3.52.
- ECal.util_component_find_x_property(icalcomp, x_name)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
x_name (
str
) – name of the X property
- Returns:
the first X
ICalGLib.Property
named x_name, orNone
, when none found.- Return type:
Searches for an X property named x_name within X properties of icalcomp and returns it. Free the non-
None
object withGObject.Object.unref
(), when no longer needed.New in version 3.34.
- ECal.util_component_get_recurid_as_string(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
- Returns:
a RECURRENCEID property as string, or
None
, when the icalcomp is not an instance. Free the returned string withGLib.free
(), when no longer needed.- Return type:
New in version 3.34.
- ECal.util_component_has_alarms(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks whether an
ICalGLib.Component
has any alarm.
- ECal.util_component_has_attendee(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks if an
ICalGLib.Component
has any attendees.
- ECal.util_component_has_organizer(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks whether an
ICalGLib.Component
has an organizer.
- ECal.util_component_has_property(icalcomp, prop_kind)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
prop_kind (
ICalGLib.PropertyKind
) – a property kind to look for, as anICalGLib.PropertyKind
- Returns:
whether the icalcomp has a property of prop_kind
- Return type:
Returns, whether the icalcomp has a property of prop_kind. To check for a specific X property use
ECal.util_component_has_x_property
().New in version 3.34.
- ECal.util_component_has_rdates(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks if an
ICalGLib.Component
has recurrence dates.
- ECal.util_component_has_recurrences(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks if an
ICalGLib.Component
has recurrence dates or rules.
- ECal.util_component_has_rrules(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks if an
ICalGLib.Component
has recurrence rules.
- ECal.util_component_has_x_property(icalcomp, x_name)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
x_name (
str
) – name of the X property
- Returns:
whether the icalcomp contains X property named x_name
- Return type:
Returns, whether the icalcomp contains X property named x_name. To check for standard property use
ECal.util_component_has_property
().New in version 3.34.
- ECal.util_component_is_instance(icalcomp)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
.- Returns:
- Return type:
Checks whether an
ICalGLib.Component
is an instance of a recurring appointment.
- ECal.util_component_remove_property_by_kind(icalcomp, kind, all)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
kind (
ICalGLib.PropertyKind
) – the kind of the property to removeall (
bool
) –True
to remove all, orFalse
to remove only the first property of the kind
- Returns:
How many properties had been removed.
- Return type:
Removes all or only the first property of kind kind in icalcomp.
New in version 3.30.
- ECal.util_component_remove_x_property(icalcomp, x_name)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
x_name (
str
) – name of the X property
- Returns:
True
, when any such had been found and removed,False
otherwise.- Return type:
Removes the first X property named x_name in icalcomp.
New in version 3.34.
- ECal.util_component_set_x_property(icalcomp, x_name, value)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – anICalGLib.Component
x_name (
str
) – name of the X property
Sets a value of the first X property named x_name in icalcomp, if any such already exists, or adds a new property with this name and value. As a special case, if value is
None
, then removes the first X property named x_name from icalcomp instead.New in version 3.34.
- ECal.util_conflict_resolution_to_operation_flags(conflict_resolution)¶
- Parameters:
conflict_resolution (
EDataServer.ConflictResolution
) – anEDataServer.ConflictResolution
- Returns:
a bit-or of
ECal.OperationFlags
, corresponding to the conflict_resolution- Return type:
Encodes the
EDataServer.ConflictResolution
into the bit-or ofECal.OperationFlags
. The returned value can be bit-or-ed with otherECal.OperationFlags
values.New in version 3.34.
- ECal.util_construct_instance(icalcomp, rid)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – A recurringICalGLib.Component
rid (
ICalGLib.Time
) – The RECURRENCE-ID to construct a component for
- Returns:
the instance as a new
ICalGLib.Component
, orNone
.- Return type:
This checks that rid indicates a valid recurrence of icalcomp, and if so, generates a copy of icalcomp containing a RECURRENCE-ID of rid.
Free the returned non-
None
component withGObject.Object.unref
(), when no longer needed.
- ECal.util_copy_timezone(zone)¶
- Parameters:
zone (
ICalGLib.Timezone
) – anICalGLib.Timezone
- Returns:
a copy of the zone
- Return type:
Copies the zone together with its inner component and returns it as a new
ICalGLib.Timezone
object. Free it withGObject.Object.unref
(), when no longer needed.New in version 3.34.
- ECal.util_diff_categories(old_comp, new_comp)¶
- Parameters:
old_comp (
ICalGLib.Component
orNone
) – an oldICalGLib.Component
, orNone
new_comp (
ICalGLib.Component
orNone
) – a newICalGLib.Component
, orNone
- Returns:
- out_added:
a
GLib.HashTable
with added categories- out_removed:
a
GLib.HashTable
with removed categories
- Return type:
Compares list of categories on the old_comp with the list of categories on the new_comp and fills out_added categories and out_removed categories accordingly, as if the old_comp is replaced with the new_comp. When either of the components is
None
, it’s considered as having no categories set. Rather than returning emptyGLib.HashTable
, the return argument is set toNone
when there are no added/removed categories.The key of the hash table is the category string, the value is an integer (1). There is used the hash table only for speed.
The returned
GLib.HashTable
-s should be freed withGLib.HashTable.unref
(), when no longer needed.New in version 3.48.
- ECal.util_email_addresses_equal(email1, email2)¶
- Parameters:
- Returns:
True
, when the email1 equals to email2- Return type:
Compares two email addresses and returns whether they are equal. Each address can contain a “mailto:” prefix. The two addresses match only if they are non-
None
and non-empty. The address itself is compared case insensitively.New in version 3.50.
- ECal.util_foreach_category(comp, func, *user_data)¶
- Parameters:
comp (
ICalGLib.Component
) – anICalGLib.Component
func (
ECal.UtilForeachCategoryFunc
) – anECal.UtilForeachCategoryFunc
callback to call for each category
Calls func for each category stored in the comp.
New in version 3.48.
- ECal.util_generate_alarms_for_comp(comp, start, end, omit, resolve_tzid, user_data, default_timezone)¶
- Parameters:
comp (
ECal.Component
) – TheECal.Component
to generate alarms fromstart (
int
) – Start timeend (
int
) – End timeomit (
ECal.ComponentAlarmAction
) – Alarm types to omitresolve_tzid (
ECal.RecurResolveTimezoneCb
) – Callback for resolving timezonesuser_data (
object
orNone
) – Data to be passed to the resolve_tzid callbackdefault_timezone (
ICalGLib.Timezone
) – The timezone used to resolve DATE and floating DATE-TIME values.
- Returns:
a list of all the alarms found for the given component in the given time range.
- Return type:
Generates alarm instances for a calendar component. Returns the instances structure, or
None
if no alarm instances occurred in the specified time range. Free the returned structure with e_cal_component_alarms_free(), when no longer needed.
- ECal.util_generate_alarms_for_list(comps, start, end, omit, resolve_tzid, user_data, default_timezone)¶
- Parameters:
comps ([
ECal.Component
]) – List ofECal.Component
sstart (
int
) – Start timeend (
int
) – End timeomit (
ECal.ComponentAlarmAction
) – Alarm types to omitresolve_tzid (
ECal.RecurResolveTimezoneCb
) – Callback for resolving timezonesuser_data (
object
orNone
) – Data to be passed to the resolve_tzid callbackdefault_timezone (
ICalGLib.Timezone
) – The timezone used to resolve DATE and floating DATE-TIME values.
- Returns:
the number of elements it added to the list
- comp_alarms:
List to be returned
- Return type:
(
int
, comp_alarms: [ECal.ComponentAlarms
])
Iterates through all the components in the comps list and generates alarm instances for them; putting them in the comp_alarms list. Free the comp_alarms with g_slist_free_full (comp_alarms, e_cal_component_alarms_free);, when no longer neeed.
- ECal.util_generate_alarms_for_uid_sync(client, uid, start, end, omit, resolve_tzid, user_data, default_timezone, def_reminder_before_start_seconds, cancellable)¶
- Parameters:
client (
object
orNone
) – anECal.Client
uid (
str
) – a component UID to generate alarms forstart (
int
) – start timeend (
int
) – end timeomit (
ECal.ComponentAlarmAction
) – alarm types to omitresolve_tzid (
ECal.RecurResolveTimezoneCb
) – Callback for resolving timezonesuser_data (
object
orNone
) – Data to be passed to the resolve_tzid callbackdefault_timezone (
ICalGLib.Timezone
) – The timezone used to resolve DATE and floating DATE-TIME valuesdef_reminder_before_start_seconds (
int
) – add default reminder before start in seconds, when not negative valuecancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
a list of all the alarms found for the given component in the given time range.
- Return type:
Generates alarm instances for a calendar component with UID uid, which is stored within the client. In contrast to
ECal.util_generate_alarms_for_comp
(), this function handles detached instances of recurring events properly.The def_reminder_before_start_seconds, if not negative, causes addition of an alarm, which will trigger a “display” alarm these seconds before start of the event.
Returns the instances structure, or
None
if no alarm instances occurred in the specified time range. Free the returned structure with e_cal_component_alarms_free(), when no longer needed.New in version 3.48.
- ECal.util_get_attendee_email(attendee)¶
- Parameters:
attendee (
ECal.ComponentAttendee
orNone
) – anECal.ComponentAttendee
- Returns:
email of the attendee, or
None
- Return type:
Returns an attendee email, without the “mailto:” prefix, if the attendee has it set. The email can be read from an “EMAIL” parameter, if present.
New in version 3.50.
- ECal.util_get_component_occur_times(comp, tz_cb, tz_cb_data, default_timezone, kind)¶
- Parameters:
comp (
ECal.Component
) – anECal.Component
tz_cb (
ECal.RecurResolveTimezoneCb
) – TheECal.RecurResolveTimezoneCb
to calltz_cb_data (
object
orNone
) – User data to be passed to the tz_cb callbackdefault_timezone (
ICalGLib.Timezone
) – The default timezonekind (
ICalGLib.ComponentKind
) – the type of component, indicated with anICalGLib.ComponentKind
- Returns:
- out_start:
Location to store the start time
- out_end:
Location to store the end time
- Return type:
Find out when the component starts and stops, being careful about recurrences.
New in version 2.32.
- ECal.util_get_default_name_and_address(registry)¶
- Parameters:
registry (
EDataServer.SourceRegistry
) – anEDataServer.SourceRegistry
- Returns:
True
if out_name and/or out_address were set- Return type:
Returns the real name and email address of the default mail identity, if available. If no default mail identity is available, out_name and out_address are set to
None
and the function returnsFalse
.New in version 3.50.
- ECal.util_get_organizer_email(organizer)¶
- Parameters:
organizer (
ECal.ComponentOrganizer
orNone
) – anECal.ComponentOrganizer
- Returns:
email of the organizer, or
None
- Return type:
Returns an organizer email, without the “mailto:” prefix, if the organizer has it set. The email can be read from an “EMAIL” parameter, if present.
New in version 3.50.
- ECal.util_get_property_email(prop)¶
- Parameters:
prop (
ICalGLib.Property
) – anICalGLib.Property
- Returns:
email of the prop, or
None
- Return type:
Returns an prop email, without the “mailto:” prefix, if the prop has it set. The email can be read from an “EMAIL” parameter, if present. Otherwise the prop can be only of type
ICalGLib.PropertyKind.ORGANIZER_PROPERTY
orICalGLib.PropertyKind.ATTENDEE_PROPERTY
.See also:
ECal.util_get_organizer_email
(),ECal.util_get_attendee_email
()New in version 3.50.
- ECal.util_get_system_timezone()¶
- Returns:
The
ICalGLib.Timezone
object of the system timezone, orNone
on an error.- Return type:
Fetches system timezone
ICalGLib.Timezone
object.The returned pointer is
Camel.part
of the built-in timezones and should not be freed.New in version 2.28.
- ECal.util_get_system_timezone_location()¶
-
Fetches system timezone localtion string.
New in version 2.28.
- ECal.util_has_alarms_in_range(comp, start, end, omit, resolve_tzid, user_data, default_timezone)¶
- Parameters:
comp (
ECal.Component
) – anECal.Component
to check alarms forstart (
int
) – start timeend (
int
) – end timeomit (
ECal.ComponentAlarmAction
) – alarm types to omitresolve_tzid (
ECal.RecurResolveTimezoneCb
) – Callback for resolving timezonesuser_data (
object
orNone
) – Data to be passed to the resolve_tzid callbackdefault_timezone (
ICalGLib.Timezone
) – The timezone used to resolve DATE and floating DATE-TIME values.
- Returns:
True
, when the #comp has any alarms in the given time interval- Return type:
Checks whether the comp has any alarms in the given time interval.
New in version 3.48.
- ECal.util_icaltime_to_tm(itt)¶
- Parameters:
itt (
ICalGLib.Time
) – AnICalGLib.Time
- Returns:
The converted time as a struct tm. All fields will be set properly except for tm.tm_yday.
- Return type:
Converts an
ICalGLib.Time
into a GLibc’s struct tm.New in version 2.22.
- ECal.util_icaltime_to_tm_with_zone(itt, from_zone, to_zone)¶
- Parameters:
itt (
ICalGLib.Time
) – A time value.from_zone (
ICalGLib.Timezone
) – Source timezone.to_zone (
ICalGLib.Timezone
) – Destination timezone.
- Returns:
The converted time as a struct tm. All fields will be set properly except for tm.tm_yday.
- Return type:
Converts a time value from one timezone to another, and returns a struct tm representation of the time.
New in version 2.22.
- ECal.util_init_recur_task_sync(vtodo, cal_client, cancellable)¶
- Parameters:
vtodo (
ICalGLib.Component
) – a VTODO componentcal_client (
ECal.Client
) – anECal.Client
to which the vtodo belongscancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
Whether succeeded.
- Return type:
Initializes properties of a recurring vtodo, like normalizing the Due date and eventually the Start date. The function does nothing when the vtodo is not recurring.
The function doesn’t change LAST-MODIFIED neither the SEQUENCE property, it’s up to the caller to do it.
Note the cal_client, cancellable and error is used only for timezone resolution. The function doesn’t store the vtodo to the cal_client, it only updates the vtodo component.
New in version 3.30.
- ECal.util_inline_local_attachments_sync(component, cancellable)¶
- Parameters:
component (
ICalGLib.Component
) – anICalGLib.Component
to work withcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
Whether succeeded.
- Return type:
Changes all URL attachments which point to a local file in component to inline attachments, aka adds the file content into the component. It also populates FILENAME parameter on the attachment.
New in version 3.40.
- ECal.util_is_first_instance(comp, rid, tz_cb, *tz_cb_data)¶
- Parameters:
comp (
ECal.Component
) – anECal.Component
instancerid (
ICalGLib.Time
) – a recurrence IDtz_cb (
ECal.RecurResolveTimezoneCb
) – TheECal.RecurResolveTimezoneCb
to calltz_cb_data (
object
orNone
) – User data to be passed to the tz_cb callback
- Returns:
Whether the rid identifies the first instance of comp.
- Return type:
Returns whether the given rid is the first instance of the recurrence defined in the comp.
New in version 3.16.
- ECal.util_mark_task_complete_sync(vtodo, completed_time, cal_client, cancellable)¶
- Parameters:
vtodo (
ICalGLib.Component
) – a VTODO componentcompleted_time (
int
) – completed time to set, or (time_t) -1 to use current timecal_client (
ECal.Client
) – anECal.Client
to which the vtodo belongscancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
Whether succeeded.
- Return type:
Marks the vtodo as complete with eventual update of other properties. This is useful also for recurring tasks, for which it moves the vtodo into the next occurrence according to the recurrence rule.
When the vtodo is marked as completed, then the existing COMPLETED date-time is preserved if exists, otherwise it’s set either to completed_time, or to the current time, when the completed_time is (time_t) -1.
The function doesn’t change LAST-MODIFIED neither the SEQUENCE property, it’s up to the caller to do it.
Note the cal_client, cancellable and error is used only for timezone resolution. The function doesn’t store the vtodo to the cal_client, it only updates the vtodo component.
New in version 3.30.
- ECal.util_new_component(kind)¶
- Parameters:
kind (
ICalGLib.ComponentKind
) – Kind of the component to create, asICalGLib.ComponentKind
.- Returns:
the newly created component.
- Return type:
Creates a new
ICalGLib.Component
of the specified kind. Free it withGObject.Object.unref
(), when no longer needed.
- ECal.util_new_top_level()¶
- Returns:
the newly created top level component.
- Return type:
Creates a new VCALENDAR component. Free it with
GObject.Object.unref
(), when no longer needed.
- ECal.util_normalize_rrule_until_value(icalcomp, ttuntil, tz_cb, *tz_cb_data)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – AnICalGLib.Component
ttuntil (
ICalGLib.Time
) – An UNTIL value to validatetz_cb (
ECal.RecurResolveTimezoneCb
) – TheECal.RecurResolveTimezoneCb
to calltz_cb_data (
object
orNone
) – User data to be passed to the tz_cb callback
Makes sure the ttuntil value matches the value type with the DTSTART value, as required by RFC 5545 section 3.3.10. Uses tz_cb with tz_cb_data to resolve time zones when needed.
New in version 3.38.
- ECal.util_operation_flags_to_conflict_resolution(flags)¶
- Parameters:
flags (
int
) – bit-or ofECal.OperationFlags
- Returns:
an
EDataServer.ConflictResolution
as stored in the flags- Return type:
Decodes the
EDataServer.ConflictResolution
from the bit-or ofECal.OperationFlags
.New in version 3.34.
- ECal.util_parse_ics_file(filename)¶
- Parameters:
filename (
str
) – Name of the file to be parsed.- Returns:
a newly created
ICalGLib.Component
, orNone
, if the file doesn’t contain a valid iCalendar object.- Return type:
Parses the given file, and, if it contains a valid iCalendar object, parse it and return a new
ICalGLib.Component
.Free the returned non-
None
component withGObject.Object.unref
(), when no longer needed.
- ECal.util_parse_ics_string(string)¶
- Parameters:
string (
str
) – iCalendar string to be parsed.- Returns:
a newly created
ICalGLib.Component
, orNone
, if the string isn’t a valid iCalendar string.- Return type:
Parses an iCalendar string and returns a new
ICalGLib.Component
representing that string. Note that this function deals with multiple VCALENDAR’s in the string, something that Mozilla used to do and which libical does not support.Free the returned non-
None
component withGObject.Object.unref
(), when no longer needed.
- ECal.util_priority_from_string(string)¶
- Parameters:
string (
str
) – A string representing the PRIORITY value.- Returns:
the priority (0-9) or -1 if the priority string is not valid.
- Return type:
Converts a translated priority string to an iCalendar priority value.
- ECal.util_priority_to_string(priority)¶
- Parameters:
priority (
int
) – Priority value.- Returns:
a string representing the PRIORITY value. This value is a constant, so it should never be freed.
- Return type:
Converts an iCalendar PRIORITY value to a translated string. Any unknown priority value (i.e. not 0-9) will be returned as “” (undefined).
- ECal.util_property_has_parameter(prop, param_kind)¶
- Parameters:
prop (
ICalGLib.Property
) – anICalGLib.Property
param_kind (
ICalGLib.ParameterKind
) – a parameter kind to look for, as anICalGLib.ParameterKind
- Returns:
whether the prop has a parameter of prop_kind
- Return type:
Returns, whether the prop has a parameter of param_kind.
New in version 3.34.
- ECal.util_remove_instances(icalcomp, rid, mod)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – A (recurring)ICalGLib.Component
rid (
ICalGLib.Time
) – The base RECURRENCE-ID to removemod (
ECal.ObjModType
) – How to interpret rid
Removes one or more instances from icalcomp according to rid and mod.
Deprecated since version 3.38: Use
ECal.util_remove_instances_ex
() instead, with provided timezone resolve function.
- ECal.util_remove_instances_ex(icalcomp, rid, mod, tz_cb, *tz_cb_data)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – A (recurring)ICalGLib.Component
rid (
ICalGLib.Time
) – The base RECURRENCE-ID to removemod (
ECal.ObjModType
) – How to interpret ridtz_cb (
ECal.RecurResolveTimezoneCb
) – TheECal.RecurResolveTimezoneCb
to calltz_cb_data (
object
orNone
) – User data to be passed to the tz_cb callback
Removes one or more instances from icalcomp according to rid and mod. Uses tz_cb with tz_cb_data to resolve time zones when needed.
New in version 3.38.
- ECal.util_seconds_to_string(seconds)¶
- Parameters:
seconds (
int
) – actual time, in seconds- Returns:
a newly allocated string with localized description of the given time in seconds.
- Return type:
Converts time, in seconds, into a string representation readable by humans and localized into the current locale. This can be used to convert event duration to string or similar use cases.
Free the returned string with
GLib.free
(), when no longer needed.New in version 3.30.
- ECal.util_set_alarm_acknowledged(component, auid, when)¶
- Parameters:
component (
ECal.Component
) – anECal.Component
auid (
str
) – an alarm UID to modifywhen (
int
) – a time, in UTC, when to set the acknowledged property, or 0 for the current time
- Returns:
Whether succeeded.
- Return type:
Sets the ACKNOWLEDGED property on the component's alarm with UID auid to the time when (in UTC), or to the current time, when the when is 0.
New in version 3.40.
- ECal.util_split_at_instance(icalcomp, rid, master_dtstart)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – A (recurring)ICalGLib.Component
rid (
ICalGLib.Time
) – The base RECURRENCE-ID to removemaster_dtstart (
ICalGLib.Time
orNone
) – The DTSTART of the master object
- Returns:
the split icalcomp, or
None
.- Return type:
Splits a recurring icalcomp into two at time rid. The returned
ICalGLib.Component
is modified icalcomp which contains recurrences beginning at rid, inclusive. The instance identified by rid should exist. The master_dtstart can be a null time, then it is read from the icalcomp.Use
ECal.util_remove_instances_ex
() withECal.ObjModType.THIS_AND_FUTURE
mode on the icalcomp to remove the overlapping interval from it, if needed.Free the returned non-
None
component withGObject.Object.unref
(), when done with it.New in version 3.16.
Deprecated since version 3.38: Use
ECal.util_split_at_instance_ex
() instead, with provided timezone resolve function.
- ECal.util_split_at_instance_ex(icalcomp, rid, master_dtstart, tz_cb, *tz_cb_data)¶
- Parameters:
icalcomp (
ICalGLib.Component
) – A (recurring)ICalGLib.Component
rid (
ICalGLib.Time
) – The base RECURRENCE-ID to removemaster_dtstart (
ICalGLib.Time
orNone
) – The DTSTART of the master objecttz_cb (
ECal.RecurResolveTimezoneCb
) – TheECal.RecurResolveTimezoneCb
to calltz_cb_data (
object
orNone
) – User data to be passed to the tz_cb callback
- Returns:
the split icalcomp, or
None
.- Return type:
Splits a recurring icalcomp into two at time rid. The returned
ICalGLib.Component
is modified icalcomp which contains recurrences beginning at rid, inclusive. The instance identified by rid should exist. The master_dtstart can be a null time, then it is read from the icalcomp.Uses tz_cb with tz_cb_data to resolve time zones when needed.
Use
ECal.util_remove_instances_ex
() withECal.ObjModType.THIS_AND_FUTURE
mode on the icalcomp to remove the overlapping interval from it, if needed.Free the returned non-
None
component withGObject.Object.unref
(), when done with it.New in version 3.38.
- ECal.util_strip_mailto(address)¶
- Parameters:
address (
str
orNone
) – an address with or without “mailto:” prefix- Returns:
the address without the “mailto:” prefix
- Return type:
Strips “mailto:” prefix from the address, if present. The returned pointer is either the address or a shifted position within the address.
New in version 3.50.
- ECal.util_tm_to_icaltime(tm, is_date)¶
- Parameters:
- Returns:
The converted time as an
ICalGLib.Time
.- Return type:
Converts a struct tm into an
ICalGLib.Time
. Free the returned object withGObject.Object.unref
(), when no longer needed.New in version 2.22.