[evolution-patches] Fix for the some of the recurrence issues and bug #273057 [exchange calendar]
- From: pchenthill <pchenthill novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] Fix for the some of the recurrence issues and bug #273057 [exchange calendar]
- Date: Wed, 01 Mar 2006 23:52:14 +0530
Hi,
Have attached the patch. The patch fixes the following issues,
1) If more than one instance is modified, all others except the latest detached instance are removed.
2) 1) Holds good while removing a paticular instance.
3) Accepting a instance of a recurring meeting with no master object does not create the object on the server.
4) Fixes a crash in discard_alarms.
5) the bug #273057.
thanks, Chenthill.
? .patch_recur_connector.diff.swo
? 273057.diff
? 327305.diff
? 330663.diff
? a
? aa
? aaa
? bak
? cal_loading.diff
? cal_loading1.diff
? core.10695
? core.14292
? core.14760
? core.17665
? core.28663
? core.6673
? dd
? depcomp
? evolution-exchange-zip
? patch_bak
? patch_cal.diff
? patch_recur_connector.diff
? patch_recur_updated.diff
? temp
? tmp
? tt
? calendar/.e-cal-backend-exchange-tasks.c.swo
? calendar/a
? calendar/aa
? calendar/patch_backup
? calendar/temp
? calendar/zz
? camel/aa
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-exchange/ChangeLog,v
retrieving revision 1.471
diff -u -p -r1.471 ChangeLog
--- ChangeLog 27 Feb 2006 14:57:09 -0000 1.471
+++ ChangeLog 1 Mar 2006 17:59:10 -0000
@@ -1,3 +1,29 @@
+2006-03-01 Chenthill Palanisamy <pchenthill novell com>
+
+ Fixes #273057 and problems in modification and deletion
+ of instances, Accepting exception instances from mail.
+ * calendar/e-cal-backend-exchange-calendar.c:
+ (create_object): Use update_x_properties to remove the X_MOD_PROPS. Server
+ would not allow us to create the object if they are present.
+ (update_x_properties): Add the properties to the list and later remove
+ them all, so that all of them are removed.
+ (modify_object_with_href): Added a parameter to pass the right rid while removing
+ an instance. Set the start and end times of the master object and remove the recurrence
+ id while modifying all instances. Add all the instance to the VCalendar component, else
+ the excluded ones would be removed from the server.
+ (modify_object):
+ (remove_object)
+ (book_resource): Pass the additional parameter as NULL.
+ (receive_objects): Set the CalObjMod property correctly when updates
+ for meetings are accepted.
+ (discard_alarm): Free the component inside only when its needed.
+ * calendar/e-cal-backend-exchange-tasks.c: (modify_task_object):
+ * calendar/e-cal-backend-exchange.h:
+ * calendar/e-cal-backend-exchange.c:
+ (e_cal_backend_exchange_add_object): Do not set exception dates.
+ (e_cal_backend_exchange_modify_object): Added a boolean variable to indicate
+ the removal of an instance.
+
2006-02-27 Sushma Rai <rsushma novell com>
* configure.in : Bumped the version to 2.5.92
Index: calendar/e-cal-backend-exchange-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-calendar.c,v
retrieving revision 1.52
diff -u -p -r1.52 e-cal-backend-exchange-calendar.c
--- calendar/e-cal-backend-exchange-calendar.c 27 Feb 2006 10:53:42 -0000 1.52
+++ calendar/e-cal-backend-exchange-calendar.c 1 Mar 2006 17:59:10 -0000
@@ -55,13 +55,14 @@ static ECalBackendExchange *parent_class
#define d(x)
-static ECalBackendSyncStatus modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, const char *calobj, CalObjModType mod, char **old_object, const char *href);
+static ECalBackendSyncStatus modify_object_with_href (ECalBackendSync *backend, EDataCal *cal, const char *calobj, CalObjModType mod, char **old_object, char **new_object, const char *href, const char *rid_to_remove);
static icalproperty *find_attendee_prop (icalcomponent *ical_comp, const char *address);
static gboolean check_owner_partstatus_for_declined (ECalBackendSync *backend,
icalcomponent *icalcomp);
gboolean check_for_send_options (icalcomponent *icalcomp, E2kProperties *props);
+static void update_x_properties (ECalBackendExchange *cbex, ECalComponent *comp);
static void
add_timezones_from_comp (ECalBackendExchange *cbex, icalcomponent *icalcomp)
@@ -692,8 +693,8 @@ create_object (ECalBackendSync *backend,
icalcomponent_kind kind;
icalproperty *icalprop;
const char *temp_comp_uid;
- char *busystatus, *insttype, *allday, *importance, *lastmod;
- struct icaltimetype current, startt;
+ char *lastmod;
+ struct icaltimetype current;
char *location, *ru_header;
ECalComponent *comp;
char *body, *body_crlf, *msg;
@@ -752,51 +753,6 @@ create_object (ECalBackendSync *backend,
/* Send options */
send_options = check_for_send_options (icalcomp, props);
- /*set X-MICROSOFT-CDO properties*/
- busystatus = "BUSY";
- icalprop = icalcomponent_get_first_property (icalcomp,
- ICAL_TRANSP_PROPERTY);
- if (icalprop) {
- icalproperty_transp transp_val = icalproperty_get_transp (icalprop);
- if (transp_val == ICAL_TRANSP_TRANSPARENT)
- busystatus = "FREE";
- }
-
- if (e_cal_util_component_has_recurrences (icalcomp))
- insttype = "1";
- else
- insttype = "0";
-
- startt = icalcomponent_get_dtstart (icalcomp);
- if(icaltime_is_date (startt))
- allday = "TRUE";
- else
- allday = "FALSE";
-
- importance = "1";
- icalprop = icalcomponent_get_first_property (icalcomp,
- ICAL_PRIORITY_PROPERTY);
- if (icalprop) {
- int prio = icalproperty_get_priority (icalprop);
- importance = prio < 5 ? "2" : prio > 5 ? "0" : "1";
- }
-
- icalprop = icalproperty_new_x (busystatus);
- icalproperty_set_x_name (icalprop, "X-MICROSOFT-CDO-BUSYSTATUS");
- icalcomponent_add_property (icalcomp, icalprop);
-
- icalprop = icalproperty_new_x (insttype);
- icalproperty_set_x_name (icalprop, "X-MICROSOFT-CDO-INSTTYPE");
- icalcomponent_add_property (icalcomp, icalprop);
-
- icalprop = icalproperty_new_x (allday);
- icalproperty_set_x_name (icalprop, "X-MICROSOFT-CDO-ALLDAYEVENT");
- icalcomponent_add_property (icalcomp, icalprop);
-
- icalprop = icalproperty_new_x (importance);
- icalproperty_set_x_name (icalprop, "X-MICROSOFT-CDO-IMPORTANCE");
- icalcomponent_add_property (icalcomp, icalprop);
-
/*set created and last_modified*/
current = icaltime_from_timet (time (NULL), 0);
icalcomponent_add_property (icalcomp, icalproperty_new_created (current));
@@ -818,6 +774,8 @@ create_object (ECalBackendSync *backend,
attach_body = build_msg (E_CAL_BACKEND_EXCHANGE (cbexc), comp, summary, &boundary);
attach_body_crlf = e_cal_backend_exchange_lf_to_crlf (attach_body);
}
+
+ update_x_properties (E_CAL_BACKEND_EXCHANGE (cbexc), comp);
cbdata = g_new0 (struct _cb_data, 1);
cbdata->be = backend;
@@ -944,6 +902,7 @@ update_x_properties (ECalBackendExchange
int *priority;
const char *busystatus, *insttype, *allday, *importance;
int prop_set = 0;
+ GSList *props = NULL, *l = NULL;
e_cal_component_get_transparency (comp, &transp);
if (transp == E_CAL_COMPONENT_TRANSP_TRANSPARENT)
@@ -998,12 +957,22 @@ update_x_properties (ECalBackendExchange
icalproperty_set_x (icalprop, importance);
prop_set |= IMPORTANCE;
} else if (!strcmp (x_name, "X-MICROSOFT-CDO-MODPROPS")) {
- icalcomponent_remove_property (icalcomp, icalprop);
+ props = g_slist_append (props, icalprop);
}
icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
}
+ /* Remove all CDO-MODPROPS properties, else server would return error for the operation
+ performed */
+ for (l = props; l != NULL; l = l->next) {
+ icalprop = l->data;
+ icalcomponent_remove_property (icalcomp, icalprop);
+ icalproperty_free (icalprop);
+ }
+
+ g_slist_free (props);
+
/* Now set the ones that weren't set. */
if (!(prop_set & BUSYSTATUS)) {
icalprop = icalproperty_new_x (busystatus);
@@ -1030,8 +999,6 @@ update_x_properties (ECalBackendExchange
}
}
-
-
static ECalBackendSyncStatus
modify_object (ECalBackendSync *backend, EDataCal *cal,
const char *calobj, CalObjModType mod,
@@ -1039,13 +1006,13 @@ modify_object (ECalBackendSync *backend,
{
d(printf ("ecbexc_modify_object(%p, %p, %d, %s)", backend, cal, mod, *old_object ? *old_object : NULL));
- return modify_object_with_href (backend, cal, calobj, mod, old_object, NULL);
+ return modify_object_with_href (backend, cal, calobj, mod, old_object, new_object, NULL, NULL);
}
static ECalBackendSyncStatus
modify_object_with_href (ECalBackendSync *backend, EDataCal *cal,
const char *calobj, CalObjModType mod,
- char **old_object, const char *href)
+ char **old_object, char **new_object, const char *href, const char *rid_to_remove)
{
ECalBackendExchangeCalendar *cbexc;
ECalBackendExchangeComponent *ecomp;
@@ -1068,6 +1035,9 @@ modify_object_with_href (ECalBackendSync
gboolean send_options;
E2kContext *ctx;
E2kProperties *props = e2k_properties_new ();
+ GList *l = NULL;
+ struct icaltimetype inst_rid;
+ gboolean remove = FALSE;
cbexc = E_CAL_BACKEND_EXCHANGE_CALENDAR (backend);
@@ -1079,6 +1049,9 @@ modify_object_with_href (ECalBackendSync
return GNOME_Evolution_Calendar_InvalidObject;
}
+ if (rid_to_remove)
+ remove = TRUE;
+
icalcomp = icalparser_parse_string (calobj);
if (!icalcomp)
return GNOME_Evolution_Calendar_InvalidObject;
@@ -1090,8 +1063,12 @@ modify_object_with_href (ECalBackendSync
return GNOME_Evolution_Calendar_InvalidObject;
}
comp_uid = icalcomponent_get_uid (icalcomp);
- if (mod == CALOBJ_MOD_THIS)
+
+ if (!remove)
key_rid = icalcomponent_get_recurrenceid (icalcomp);
+ else
+ key_rid = icaltime_from_string (rid_to_remove);
+
ecomp = get_exchange_comp (E_CAL_BACKEND_EXCHANGE (cbexc), comp_uid);
@@ -1104,7 +1081,47 @@ modify_object_with_href (ECalBackendSync
summary = icalcomponent_get_summary (icalcomp);
if (!summary)
summary = "";
+
+ /* If rid is present and mod is ALL we need to set the times of the master object */
+ if ((mod == CALOBJ_MOD_ALL) && e_cal_util_component_has_recurrences (icalcomp) && !icaltime_is_null_time (key_rid)) {
+ icaltimetype start;
+
+ start = icalcomponent_get_dtstart (icalcomp);
+
+ if (!key_rid.zone)
+ key_rid.zone = start.zone;
+
+ /* This means its a instance generated from master object. So replace
+ the dates stored dates from the master object */
+
+ if (icaltime_compare_date_only (start, key_rid) == 0) {
+ icaltimetype m_end, m_start, end;
+ icalproperty *prop;
+
+ m_start = icalcomponent_get_dtstart (ecomp->icomp);
+ m_end = icalcomponent_get_dtend (ecomp->icomp);
+ end = icalcomponent_get_dtend (icalcomp);
+ if (icaltime_compare (start, key_rid) != 0) {
+ icaltimetype end = icalcomponent_get_dtend (icalcomp);
+
+ m_start.hour = start.hour;
+ m_start.minute = start.minute;
+ m_start.second = start.second;
+
+ m_end.hour = end.hour;
+ m_end.minute = end.minute;
+ m_end.second = end.second;
+ }
+ icalcomponent_set_dtstart (icalcomp, m_start);
+ icalcomponent_set_dtend (icalcomp, m_end);
+
+ prop = icalcomponent_get_first_property (icalcomp, ICAL_RECURRENCEID_PROPERTY);
+ icalcomponent_remove_property (icalcomp, prop);
+ icalproperty_free (prop);
+ }
+ }
+
updated_ecomp = e_cal_component_new ();
e_cal_component_set_icalcomponent (updated_ecomp, icalcomp);
@@ -1239,10 +1256,45 @@ modify_object_with_href (ECalBackendSync
g_free (real_comp_str);
icalcomponent_foreach_tzid (real_icalcomp, add_timezone_cb, cbdata);
- if (mod == CALOBJ_MOD_THIS) {
- icalcomponent_add_component (cbdata->vcal_comp, icalcomponent_new_clone (ecomp->icomp));
+
+ /* Master object should be added first */
+ if (!remove && mod == CALOBJ_MOD_ALL)
+ icalcomponent_add_component (cbdata->vcal_comp, real_icalcomp);
+
+
+ /* We need to add all the instances to the VCalendar component while sending to
+ the server, so that we don't lose any detached instances */
+ if (ecomp->icomp && mod == CALOBJ_MOD_THIS) {
+ icalcomponent_add_component (cbdata->vcal_comp, icalcomponent_new_clone (ecomp->icomp));
+ }
+
+ for (l = ecomp->instances; l != NULL; l = l->next) {
+ icalcomponent *icomp = l->data;
+
+ inst_rid = icalcomponent_get_recurrenceid (icomp);
+ if (icaltime_compare (inst_rid, key_rid) == 0) {
+ cached_ecomp = e_cal_component_new ();
+
+ e_cal_component_set_icalcomponent (cached_ecomp,
+ icalcomponent_new_clone (l->data));
+ if (remove) {
+ icalcomponent_free (l->data);
+ l = g_list_remove_link (ecomp->instances, l);
+ if (!l)
+ break;
+ }
+
+ continue;
+ } else {
+ icalcomponent_add_component (cbdata->vcal_comp, icalcomponent_new_clone (icomp));
+ }
}
- icalcomponent_add_component (cbdata->vcal_comp, real_icalcomp);
+
+ if (!cached_ecomp && remove)
+ *new_object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+
+ if (!remove && mod == CALOBJ_MOD_THIS)
+ icalcomponent_add_component (cbdata->vcal_comp, real_icalcomp);
body = icalcomponent_as_ical_string (cbdata->vcal_comp);
body_crlf = e_cal_backend_exchange_lf_to_crlf (body);
@@ -1293,31 +1345,11 @@ modify_object_with_href (ECalBackendSync
g_free (from);
g_free (body_crlf);
- if (mod == CALOBJ_MOD_THIS) {
- GList *l;
- struct icaltimetype inst_rid, key_rid;
-
- for (l = ecomp->instances; l ; l = l->next) {
- inst_rid = icalcomponent_get_recurrenceid (l->data);
- if (icaltime_compare (inst_rid, key_rid) == 0) {
- cached_ecomp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (cached_ecomp,
- icalcomponent_new_clone (l->data));
- break;
- }
- }
-
- } else {
- cached_ecomp = e_cal_component_new ();
- e_cal_component_set_icalcomponent (cached_ecomp, icalcomponent_new_clone (ecomp->icomp));
- }
if (cached_ecomp) {
e_cal_component_commit_sequence (cached_ecomp);
*old_object = e_cal_component_get_as_string (cached_ecomp);
- } else {
- *old_object = e_cal_component_get_as_string (updated_ecomp);
}
-
+
ctx = exchange_account_get_context (E_CAL_BACKEND_EXCHANGE (cbexc)->account);
/* PUT the iCal object in the Exchange server */
@@ -1334,8 +1366,11 @@ modify_object_with_href (ECalBackendSync
if (E2K_HTTP_STATUS_IS_SUCCESSFUL (http_status))
e_cal_backend_exchange_modify_object (E_CAL_BACKEND_EXCHANGE (cbexc),
- real_icalcomp, mod);
+ e_cal_component_get_icalcomponent (real_ecomp), mod, remove);
+ if (!remove)
+ *new_object = e_cal_component_get_as_string (real_ecomp);
+
g_free (msg);
g_object_unref (real_ecomp);
g_object_unref (updated_ecomp);
@@ -1360,7 +1395,7 @@ remove_object (ECalBackendSync *backend,
E2kHTTPStatus status;
E2kContext *ctx;
ECalComponent *comp;
- char *calobj, *obj;
+ char *calobj, *obj = NULL;
struct icaltimetype time_rid;
ECalBackendSyncStatus ebs_status;
@@ -1388,18 +1423,26 @@ remove_object (ECalBackendSync *backend,
e_cal_component_commit_sequence (comp);
*old_object = e_cal_component_get_as_string (comp);
}
-
- if (mod == CALOBJ_MOD_THIS && rid && *rid) {
+
+ /*TODO How handle multiple detached intances with no master object ?*/
+ if (mod == CALOBJ_MOD_THIS && rid && *rid && ecomp->icomp) {
+ char *new_object = NULL;
+
/*remove a single instance of a recurring event and modify */
time_rid = icaltime_from_string (rid);
e_cal_util_remove_instances (ecomp->icomp, time_rid, mod);
calobj = (char *) icalcomponent_as_ical_string (ecomp->icomp);
- ebs_status = modify_object (backend, cal, calobj, mod, &obj, NULL);
+ ebs_status = modify_object_with_href (backend, cal, calobj, mod, &obj, &new_object, NULL, rid);
g_object_unref (comp);
if (ebs_status != GNOME_Evolution_Calendar_Success)
goto error;
+ if (obj) {
+ g_free (*old_object);
+ *old_object = obj;
+ }
- g_free (obj);
+ g_free (new_object);
+
return ebs_status;
}
g_object_unref (comp);
@@ -1483,22 +1526,28 @@ receive_objects (ECalBackendSync *backen
old_object, NULL);
} else {
struct icaltimetype time_rid;
+ char *new_object = NULL;
+ CalObjModType mod = CALOBJ_MOD_ALL;
if (rid) {
time_rid = icaltime_from_string (rid);
e_cal_util_remove_instances (ecomp->icomp, time_rid, CALOBJ_MOD_THIS);
}
+ if (e_cal_util_component_is_instance (subcomp))
+ mod = CALOBJ_MOD_THIS;
+
icalobj = (char *) icalcomponent_as_ical_string (subcomp);
status = modify_object_with_href (backend, cal, icalobj,
- CALOBJ_MOD_THIS,
- &old_object, NULL);
+ mod,
+ &old_object, &new_object, NULL, NULL);
d(printf ("Modify this particular instance : %s\n", rid));
d(printf ("Modify object : %s\n", icalobj));
if (status != GNOME_Evolution_Calendar_Success)
goto error;
e_cal_backend_notify_object_modified (E_CAL_BACKEND (backend),
- old_object, icalobj);
+ old_object, new_object);
+ g_free (new_object);
d(printf ("Notify that the new object after modication is : %s\n", icalobj));
}
@@ -1584,7 +1633,7 @@ book_resource (ECalBackendExchange *cbex
const char *access_prop = NULL, *meeting_prop = NULL, *cal_uid = NULL;
gboolean bookable;
char *top_uri = NULL, *cal_uri = NULL, *returned_uid = NULL;
- char *startz, *endz, *href = NULL, *old_object = NULL, *calobj = NULL;
+ char *startz, *endz, *href = NULL, *old_object = NULL, *calobj = NULL, *new_object = NULL;
E2kRestriction *rn;
int nresult;
ECalBackendExchangeBookingResult retval = E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR;
@@ -1765,11 +1814,11 @@ book_resource (ECalBackendExchange *cbex
/* status = e_cal_component_update (comp, method, FALSE ); */
if (ecomp) {
/* Use the PUT method to create the meeting item in the resource's calendar. */
- status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, CALOBJ_MOD_THIS, &old_object, href);
+ status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, CALOBJ_MOD_THIS, &old_object, &new_object, href, NULL);
if (status == GNOME_Evolution_Calendar_Success) {
/* Need this to update the participation status of the resource
in the organizer's calendar. */
- status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, CALOBJ_MOD_THIS, &old_object, NULL);
+ status = modify_object_with_href (E_CAL_BACKEND_SYNC (cbex), cal, calobj, CALOBJ_MOD_THIS, &old_object, &new_object, NULL, NULL);
} else {
retval = E_CAL_BACKEND_EXCHANGE_BOOKING_ERROR;
goto cleanup;
@@ -1779,6 +1828,7 @@ book_resource (ECalBackendExchange *cbex
retval = E_CAL_BACKEND_EXCHANGE_BOOKING_OK;
}
g_free (old_object);
+ g_free (new_object);
} else {
status = create_object (E_CAL_BACKEND_SYNC (cbex), cal, &calobj, &returned_uid);
if (status == GNOME_Evolution_Calendar_Success) {
@@ -1988,7 +2038,7 @@ discard_alarm (ECalBackendSync *backend,
ECalBackendExchangeComponent *ecbexcomp;
ECalComponent *ecomp;
char *ecomp_str;
- icalcomponent *icalcomp;
+ icalcomponent *icalcomp = NULL;
g_return_val_if_fail (E_IS_CAL_BACKEND_EXCHANGE_CALENDAR (backend),
GNOME_Evolution_Calendar_InvalidObject);
@@ -2019,13 +2069,13 @@ discard_alarm (ECalBackendSync *backend,
ecomp_str = e_cal_component_get_as_string (ecomp);
icalcomp = icalparser_parse_string (ecomp_str);
if (!e_cal_backend_exchange_modify_object ( cbex,
- icalcomp, CALOBJ_MOD_ALL)) {
+ icalcomp, CALOBJ_MOD_ALL, FALSE)) {
result = GNOME_Evolution_Calendar_OtherError;
}
+ icalcomponent_free (icalcomp);
g_free (ecomp_str);
}
g_object_unref (ecomp);
- icalcomponent_free (icalcomp);
return result;
}
Index: calendar/e-cal-backend-exchange-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-tasks.c,v
retrieving revision 1.22
diff -u -p -r1.22 e-cal-backend-exchange-tasks.c
--- calendar/e-cal-backend-exchange-tasks.c 27 Feb 2006 10:53:42 -0000 1.22
+++ calendar/e-cal-backend-exchange-tasks.c 1 Mar 2006 17:59:11 -0000
@@ -1240,7 +1240,7 @@ modify_task_object (ECalBackendSync *bac
status = put_body(new_comp, e2kctx, NULL, ecalbexcomp->href, from_name, from_addr,
attach_body_crlf, boundary, NULL);
if (E2K_HTTP_STATUS_IS_SUCCESSFUL (status))
- e_cal_backend_exchange_modify_object (ecalbex, icalcomp, mod);
+ e_cal_backend_exchange_modify_object (ecalbex, icalcomp, mod, FALSE);
}
icalcomponent_free (icalcomp);
return GNOME_Evolution_Calendar_Success;
Index: calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.62
diff -u -p -r1.62 e-cal-backend-exchange.c
--- calendar/e-cal-backend-exchange.c 27 Feb 2006 10:53:42 -0000 1.62
+++ calendar/e-cal-backend-exchange.c 1 Mar 2006 17:59:11 -0000
@@ -601,8 +601,6 @@ e_cal_backend_exchange_add_object (ECalB
ecomp->instances = g_list_prepend (ecomp->instances,
icalcomponent_new_clone (comp));
- if (ecomp->icomp)
- e_cal_util_remove_instances (ecomp->icomp, rid, CALOBJ_MOD_THIS);
}
} else
ecomp->icomp = icalcomponent_new_clone (comp);
@@ -647,7 +645,8 @@ discard_detached_instance (ECalBackendEx
gboolean
e_cal_backend_exchange_modify_object (ECalBackendExchange *cbex,
icalcomponent *comp,
- CalObjModType mod)
+ CalObjModType mod,
+ gboolean discard_detached)
{
ECalBackendExchangeComponent *ecomp;
const char *uid;
@@ -665,11 +664,12 @@ e_cal_backend_exchange_modify_object (EC
if (!ecomp)
return FALSE;
- if (mod == CALOBJ_MOD_ALL || icaltime_is_null_time (rid)) {
+ if (mod == CALOBJ_MOD_ALL || icaltime_is_null_time (rid) || discard_detached) {
icalcomponent_free (ecomp->icomp);
ecomp->icomp = icalcomponent_new_clone (comp);
+ if (discard_detached && !icaltime_is_null_time (rid))
+ discard_detached_instance (ecomp, rid);
} else {
- discard_detached_instance (ecomp, rid);
ecomp->instances = g_list_prepend (ecomp->instances,
icalcomponent_new_clone (comp));
}
Index: calendar/e-cal-backend-exchange.h
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.h,v
retrieving revision 1.12
diff -u -p -r1.12 e-cal-backend-exchange.h
--- calendar/e-cal-backend-exchange.h 17 Aug 2005 07:17:49 -0000 1.12
+++ calendar/e-cal-backend-exchange.h 1 Mar 2006 17:59:11 -0000
@@ -65,7 +65,8 @@ gboolean e_cal_backend_exchange_add_obj
icalcomponent *comp);
gboolean e_cal_backend_exchange_modify_object (ECalBackendExchange *cbex,
icalcomponent *comp,
- CalObjModType mod);
+ CalObjModType mod,
+ gboolean remove_detached);
gboolean e_cal_backend_exchange_remove_object (ECalBackendExchange *cbex,
const char *uid);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.565
diff -u -p -r1.565 ChangeLog
--- ChangeLog 28 Feb 2006 12:16:32 -0000 1.565
+++ ChangeLog 1 Mar 2006 17:57:31 -0000
@@ -1,3 +1,12 @@
+2006-03-01 Chenthill Palanisamy <pchenthill novell com>
+
+ * libedata-cal/e-cal-backend-sync.c:
+ (_e_cal_backend_remove_object): Do not get the object
+ backend again. Use the provided new and old object.
+ * libedata-cal/e-cal-backend.c:
+ (e_cal_backend_notify_object_removed): Need not check
+ if the query matches for removing an item.
+
2006-02-28 Chenthill Palanisamy <pchenthill novell com>
Fixes #332726
Index: libedata-cal/e-cal-backend-sync.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend-sync.c,v
retrieving revision 1.18
diff -u -p -r1.18 e-cal-backend-sync.c
--- libedata-cal/e-cal-backend-sync.c 11 Oct 2005 07:56:20 -0000 1.18
+++ libedata-cal/e-cal-backend-sync.c 1 Mar 2006 17:57:33 -0000
@@ -719,22 +719,18 @@ _e_cal_backend_remove_object (ECalBacken
if (status == GNOME_Evolution_Calendar_Success) {
char *calobj = NULL;
- if (e_cal_backend_sync_get_object (E_CAL_BACKEND_SYNC (backend), cal, uid, NULL, &calobj)
- == GNOME_Evolution_Calendar_Success) {
- e_data_cal_notify_object_modified (cal, status, old_object, calobj);
- g_free (calobj);
- } else {
- ECalComponentId *id = g_new0 (ECalComponentId, 1);
- id->uid = g_strdup (uid);
-
- if (mod == CALOBJ_MOD_THIS)
- id->rid = g_strdup (rid);
+ ECalComponentId *id = g_new0 (ECalComponentId, 1);
+ id->uid = g_strdup (uid);
+ if (mod == CALOBJ_MOD_THIS)
+ id->rid = g_strdup (rid);
+
+ if (!object)
e_data_cal_notify_object_removed (cal, status, id, old_object, object);
+ else
+ e_data_cal_notify_object_modified (cal, status, old_object, object);
- e_cal_component_free_id (id);
-
- }
+ e_cal_component_free_id (id);
} else
e_data_cal_notify_object_removed (cal, status, NULL, old_object, object);
Index: libedata-cal/e-cal-backend.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/libedata-cal/e-cal-backend.c,v
retrieving revision 1.23
diff -u -p -r1.23 e-cal-backend.c
--- libedata-cal/e-cal-backend.c 11 Oct 2005 07:56:21 -0000 1.23
+++ libedata-cal/e-cal-backend.c 1 Mar 2006 17:57:34 -0000
@@ -1319,8 +1319,7 @@ e_cal_backend_notify_object_removed (ECa
if (object == NULL) {
/* if object == NULL, it means the object has been completely
removed from the backend */
- if (e_data_cal_view_object_matches (query, old_object))
- e_data_cal_view_notify_objects_removed_1 (query, id);
+ e_data_cal_view_notify_objects_removed_1 (query, id);
} else
match_query_and_notify (query, old_object, object);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]