From ba6e67df93bbe91662e89506ddba09445c2c4235 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Fri, 16 Jan 2004 18:15:14 +0000 Subject: [PATCH] return AUTH_REQUIRED error if we don't get a password from the 2004-01-16 Rodrigo Moya * libecal/e-cal.c (e_cal_open): return AUTH_REQUIRED error if we don't get a password from the authentication function. * backends/file/e-cal-backend-file.c (e_cal_backend_file_modify_object): store the old object before actually losing it. --- calendar/ChangeLog | 9 +++++++++ calendar/backends/file/e-cal-backend-file.c | 18 ++++++++++++------ calendar/libecal/e-cal.c | 4 ++++ calendar/libedata-cal/e-cal-backend-cache.c | 5 ++--- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 51985be..6a32f7c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2004-01-16 Rodrigo Moya + + * libecal/e-cal.c (e_cal_open): return AUTH_REQUIRED error if + we don't get a password from the authentication function. + + * backends/file/e-cal-backend-file.c + (e_cal_backend_file_modify_object): store the old object before + actually losing it. + 2004-01-16 JP Rosevear * libecal/e-cal.c: name space the idle data structs properly diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c index fccc188..3a4f095 100644 --- a/calendar/backends/file/e-cal-backend-file.c +++ b/calendar/backends/file/e-cal-backend-file.c @@ -1626,7 +1626,7 @@ e_cal_backend_file_create_object (ECalBackendSync *backend, EDataCal *cal, const static ECalBackendSyncStatus e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const char *calobj, - CalObjModType mod, char **old_object) + CalObjModType mod, char **old_object) { ECalBackendFile *cbfile; ECalBackendFilePrivate *priv; @@ -1666,7 +1666,7 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const /* Create the cal component */ comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomp); - + /* Set the last modified time on the component */ current = icaltime_from_timet (time (NULL), 0); e_cal_component_set_last_modified (comp, ¤t); @@ -1685,6 +1685,9 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const if (g_hash_table_lookup_extended (obj_data->recurrences, rid, &real_rid, &recurrence)) { + if (old_object) + *old_object = e_cal_component_get_as_string (recurrence); + /* remove the component from our data */ icalcomponent_remove_component (priv->icalcomp, e_cal_component_get_icalcomponent (recurrence)); @@ -1707,7 +1710,10 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend), old, new); - g_free (old); + if (old_object) + *old_object = old; + else + g_free (old); g_free (new); } @@ -1724,6 +1730,9 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const /* in this case, we blow away all recurrences, and start over with a clean component */ /* Remove the old version */ + if (old_object) + *old_object = e_cal_component_get_as_string (obj_data->full_object); + remove_component (cbfile, obj_data->full_object); /* Add the new object */ @@ -1733,9 +1742,6 @@ e_cal_backend_file_modify_object (ECalBackendSync *backend, EDataCal *cal, const save (cbfile); - if (old_object) - *old_object = e_cal_component_get_as_string (comp); - return GNOME_Evolution_Calendar_Success; } diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c index c473150..d8f2a2b 100644 --- a/calendar/libecal/e-cal.c +++ b/calendar/libecal/e-cal.c @@ -1448,6 +1448,10 @@ e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error) key = e_source_get_uri (priv->source); password = priv->auth_func (ecal, prompt, key, priv->auth_user_data); + if (!password) { + g_mutex_unlock (priv->mutex); + E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error); + } g_free (prompt); g_free (key); diff --git a/calendar/libedata-cal/e-cal-backend-cache.c b/calendar/libedata-cal/e-cal-backend-cache.c index 96f5650..a44fe4d 100644 --- a/calendar/libedata-cal/e-cal-backend-cache.c +++ b/calendar/libedata-cal/e-cal-backend-cache.c @@ -364,7 +364,7 @@ GSList * e_cal_backend_cache_get_components (ECalBackendCache *cache) { char *comp_str; - GSList *l,*list = NULL; + GSList *l, *list = NULL; icalcomponent *icalcomp; ECalComponent *comp = NULL; @@ -385,7 +385,6 @@ e_cal_backend_cache_get_components (ECalBackendCache *cache) } } + return list; } - - -- 2.7.4