calendar-server: Read timezone from the calendar, not its timezone cache
The calendar's timezone cache holds only timezones already received or added to the calendar, thus when asking it for a timezone for "the first time", it returns NULL and a wrong timezone is used instead. The get_timezone() does not do any I/O when the timezone is already cached on the client side, thus it's fine to use it. This could exhibit with non-recurring events, which use custom time zones, in which case the event is shown in a wrong time. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2145>
This commit is contained in:
parent
6765fac76a
commit
42b3b85460
@ -123,7 +123,6 @@ get_time_from_property (ECalClient *cal,
|
||||
{
|
||||
ICalProperty *prop;
|
||||
ICalTime *itt;
|
||||
ICalParameter *param;
|
||||
ICalTimezone *timezone = NULL;
|
||||
|
||||
prop = i_cal_component_get_first_property (icomp, prop_kind);
|
||||
@ -132,17 +131,24 @@ get_time_from_property (ECalClient *cal,
|
||||
|
||||
itt = get_prop_func (prop);
|
||||
|
||||
param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
|
||||
if (param)
|
||||
timezone = e_timezone_cache_get_timezone (E_TIMEZONE_CACHE (cal), i_cal_parameter_get_tzid (param));
|
||||
else if (i_cal_time_is_utc (itt))
|
||||
if (i_cal_time_is_utc (itt))
|
||||
timezone = i_cal_timezone_get_utc_timezone ();
|
||||
else
|
||||
{
|
||||
ICalParameter *param;
|
||||
|
||||
param = i_cal_property_get_first_parameter (prop, I_CAL_TZID_PARAMETER);
|
||||
if (param && !e_cal_client_get_timezone_sync (cal, i_cal_parameter_get_tzid (param), &timezone, NULL, NULL))
|
||||
print_debug ("Failed to get timezone '%s'\n", i_cal_parameter_get_tzid (param));
|
||||
|
||||
g_clear_object (¶m);
|
||||
}
|
||||
|
||||
if (timezone == NULL)
|
||||
timezone = default_zone;
|
||||
|
||||
i_cal_time_set_timezone (itt, timezone);
|
||||
|
||||
g_clear_object (¶m);
|
||||
g_clear_object (&prop);
|
||||
|
||||
*out_itt = itt;
|
||||
|
Loading…
Reference in New Issue
Block a user