e-cal-check-timezones: Evolution-Data-Server Reference Manual

## e-cal-check-timezones e-cal-check-timezones |

## Functions

gboolean | e_cal_client_check_timezones_sync ()
ICalTimezone * | e_cal_client_tzlookup_cb ()
ECalClientTzlookupICalCompData * | e_cal_client_tzlookup_icalcomp_data_new ()
ECalClientTzlookupICalCompData * | e_cal_client_tzlookup_icalcomp_data_copy ()
void | e_cal_client_tzlookup_icalcomp_data_free ()
ICalComponent * | e_cal_client_tzlookup_icalcomp_data_get_icalcomponent ()
ICalTimezone * | e_cal_client_tzlookup_icalcomp_cb ()
const gchar * | e_cal_match_tzid ()

## Types and Values

| ECalClientTzlookupICalCompData

## Object Hierarchy

        GBoxed
        ╰── ECalClientTzlookupICalCompData

## Description

## Functions

### e_cal_client_check_timezones_sync ()

    gboolean
    e_cal_client_check_timezones_sync (ICalComponent *vcalendar,
                                       GSList *icalcomps,
                                       ECalRecurResolveTimezoneCb tzlookup,
                                       gpointer tzlookup_data,
                                       GCancellable *cancellable,
                                       GError **error);

This function cleans up VEVENT, VJOURNAL, VTODO and VTIMEZONE items which are to be imported into Evolution.

Using VTIMEZONE definitions is problematic because they cannot be updated properly when timezone definitions change. They are also incomplete (for compatibility reason only one set of rules for summer saving changes can be included, even if different rules apply in different years). This function looks for matches of the used TZIDs against system timezones and replaces such TZIDs with the corresponding system timezone. This works for TZIDs containing a location (found via a fuzzy string search) and for Outlook TZIDs (via a hard-coded lookup table).

Some programs generate broken meeting invitations with TZID, but without including the corresponding VTIMEZONE. Importing such invitations unchanged causes problems later on (meeting displayed incorrectly, `e_cal_component_get_as_string()` fails). The situation where this occurred in the past (found by a SyncEvolution user) is now handled via the location based mapping.

If this mapping fails, this function also deals with VTIMEZONE conflicts: such conflicts occur when the calendar already contains an old VTIMEZONE definition with the same TZID, but different summer saving rules. Replacing the VTIMEZONE potentially breaks displaying of old events, whereas not replacing it breaks the new events (the behavior in Evolution <= 2.22.1).

The way this problem is resolved by renaming the new VTIMEZONE definition until the TZID is unique. A running count is appended to the TZID. All items referencing the renamed TZID are adapted accordingly.

#### Parameters

vcalendar | a VCALENDAR containing a list of VTIMEZONE and arbitrary other components, in arbitrary order: these other components are modified by this call |
icalcomps | a list of ICalComponent instances which also have to be patched; may be `NULL`. | [element-type ICalComponent][nullable]
tzlookup | a callback function which is called to retrieve a calendar's VTIMEZONE definition; the returned definition is *not* freed by `e_cal_client_check_timezones()` NULL indicates that no such timezone exists or an error occurred. | [scope call]
tzlookup_data | an arbitrary pointer which is passed through to the `tzlookup` function. | [closure tzlookup]
cancellable | a GCancellable to use in `tzlookup` function |
error | an error description in case of a failure |

#### Returns

`TRUE` if successful, `FALSE` otherwise.

Since: 3.34

### e_cal_client_tzlookup_cb ()

    ICalTimezone *
    e_cal_client_tzlookup_cb (const gchar *tzid,
                              gpointer ecalclient,
                              GCancellable *cancellable,
                              GError **error);

An implementation of the ECalRecurResolveTimezoneCb callback which clients can use. Calls `e_cal_client_get_timezone_sync()`.

The returned timezone object, if not `NULL`, is owned by the `ecalclient` .

#### Parameters

tzid | ID of the timezone to lookup |
ecalclient | a valid ECalClient pointer. | [type ECalClient]
cancellable | an optional GCancellable to use, or `NULL` |
error | an error description in case of a failure |

#### Returns

A timezone object, or `NULL` on failure or when not found.

[transfer none][nullable]

Since: 3.34

### e_cal_client_tzlookup_icalcomp_data_new ()

    ECalClientTzlookupICalCompData *
    e_cal_client_tzlookup_icalcomp_data_new
                                   (ICalComponent *icomp);

Constructs a new ECalClientTzlookupICalCompData, which can be used as a lookup_data argument of `e_cal_client_tzlookup_icalcomp_cb()`. Free it with `e_cal_client_tzlookup_icalcomp_data_free()`, when no longer needed.

#### Parameters

icomp | an ICalComponent |

#### Returns

a new ECalClientTzlookupICalCompData.

[transfer full]

Since: 3.34

### e_cal_client_tzlookup_icalcomp_data_copy ()

    ECalClientTzlookupICalCompData *
    e_cal_client_tzlookup_icalcomp_data_copy
                                   (const ECalClientTzlookupICalCompData *lookup_data);

Copies given ECalClientTzlookupICalCompData structure. When the `lookup_data` is `NULL`, simply returns `NULL` as well.

#### Parameters

lookup_data | source ECalClientTzlookupICalCompData, or `NULL`. | [nullable]

#### Returns

copy of the `lookup_data` . Free the returned structure with `e_cal_client_tzlookup_icalcomp_data_free()`, when no longer needed.

[transfer full][nullable]

Since: 3.34

### e_cal_client_tzlookup_icalcomp_data_free ()

    void
    e_cal_client_tzlookup_icalcomp_data_free
                                   (ECalClientTzlookupICalCompData *lookup_data);

Frees previously allocated ECalClientTzlookupICalCompData structure with `e_cal_client_tzlookup_icalcomp_data_new()` or `e_cal_client_tzlookup_icalcomp_data_copy()`. The function does nothing when `lookup_data` is `NULL`.

#### Parameters

lookup_data | an ECalClientTzlookupICalCompData, or `NULL`. | [nullable]

Since: 3.34

### e_cal_client_tzlookup_icalcomp_data_get_icalcomponent ()

    ICalComponent *
    e_cal_client_tzlookup_icalcomp_data_get_icalcomponent
                                   (const ECalClientTzlookupICalCompData *lookup_data);

#### Parameters

lookup_data | an ECalClientTzlookupICalCompData |

#### Returns

The ICalComponent associated with the `lookup_data` .

[transfer none]

Since: 3.34

### e_cal_client_tzlookup_icalcomp_cb ()

    ICalTimezone *
    e_cal_client_tzlookup_icalcomp_cb (const gchar *tzid,
                                       gpointer lookup_data,
                                       GCancellable *cancellable,
                                       GError **error);

An implementation of the ECalRecurResolveTimezoneCb callback which backends can use. Searches for the timezone in an `ICalComponent` associated with the `lookup_data` `ECalClientTzlookupICalCompData`.

The returned timezone object is owned by the `lookup_data` .

#### Parameters

tzid | ID of the timezone to lookup |
lookup_data | an ECalClientTzlookupICalCompData strcture, created with `e_cal_client_tzlookup_icalcomp_data_new()`. | [type ECalClientTzlookupICalCompData]
cancellable | an optional GCancellable to use, or `NULL` |
error | an error description in case of a failure |

#### Returns

A timezone object, or `NULL`, if not found inside `lookup_data` 's ICalComponent.

[transfer none][nullable]

Since: 3.34

### e_cal_match_tzid ()

    const gchar *
    e_cal_match_tzid (const gchar *tzid);

Matches `tzid` against the system timezone definitions and returns the matching TZID, or `NULL` if none found

#### Parameters

tzid | a timezone ID |

Since: 2.24

## Types and Values

### ECalClientTzlookupICalCompData

    typedef struct _ECalClientTzlookupICalCompData ECalClientTzlookupICalCompData;

Contains data used as lookup_data of `e_cal_client_tzlookup_icalcomp_cb()`.

Since: 3.34