### Function

# ECal Client check_timezones_sync

since: 3.34

#### Declaration [src]

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

#### Description [src]

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.

Available since: 3.34

#### Parameters

`vcalendar`

  Type: `None`

  A VCALENDAR containing a list of VTIMEZONE and arbitrary other components, in arbitrary order: these other components are modified by this call.

  The data is owned by the caller of the function.

`icalcomps`

  Type: A list of `ICalComponent*`

  A list of `ICalComponent` instances which also have to be patched; may be `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`tzlookup`

  Type: `ECalRecurResolveTimezoneCb`

  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.

`tzlookup_data`

  Type: `gpointer`

  An arbitrary pointer which is passed through to the `tzlookup` function.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`cancellable`

  Type: `GCancellable`

  A `GCancellable` to use in `tzlookup` function.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` if successful, `FALSE` otherwise.