aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorPeter Teichman <teichman@src.gnome.org>1999-08-02 15:20:18 +0800
committerPeter Teichman <teichman@src.gnome.org>1999-08-02 15:20:18 +0800
commit9a87a9ff789115cfa55316b14dea6393cd4e9bce (patch)
tree69ffd230a851801b57bbebaeb8dace29e23c5636 /calendar/gui
parentf812a77ab63149367d289b9aea02ca7e813c7058 (diff)
downloadgsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar.gz
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar.bz2
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar.lz
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar.xz
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.tar.zst
gsoc2013-evolution-9a87a9ff789115cfa55316b14dea6393cd4e9bce.zip
do deletion of appointments correctly, when they are deleted on the pilot
* calendar-pilot-sync.c (sync_pilot): do deletion of appointments correctly, when they are deleted on the pilot (conduit_free_Appointment): protect against double-freeing parts of the Appointment structure (update_record): all-day events from the pilot are handled a bit more reasonably svn path=/trunk/; revision=1063
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-pilot-sync.c37
1 files changed, 31 insertions, 6 deletions
diff --git a/calendar/gui/calendar-pilot-sync.c b/calendar/gui/calendar-pilot-sync.c
index 12f15d33ad..9461278e8b 100644
--- a/calendar/gui/calendar-pilot-sync.c
+++ b/calendar/gui/calendar-pilot-sync.c
@@ -56,6 +56,18 @@ const struct poptOption calendar_sync_options [] = {
{ NULL, '\0', 0, NULL, 0 }
};
+static void
+conduit_free_Appointment (struct Appointment *a)
+{
+ /* free_Appointment is brain-dead with respect to guarding against
+ double-frees */
+
+ free_Appointment (a);
+ a->exception = 0;
+ a->description = 0;
+ a->note = 0;
+}
+
static int
setup_connection (void)
{
@@ -156,8 +168,21 @@ update_record (GNOME_Calendar_Repository repo, int id, struct Appointment *a, in
/*
* Begin and end
*/
+
+ if (a->event)
+ {
+ /* turn day-long events into a full day's appointment */
+ a->begin.tm_sec = 0;
+ a->begin.tm_min = 0;
+ a->begin.tm_hour = 6;
+
+ a->end.tm_sec = 0;
+ a->end.tm_min = 0;
+ a->end.tm_hour = 10;
+ }
+
obj->dtstart = mktime (&a->begin);
- obj->dtend = mktime (&a->end);
+ obj->dtend = mktime (&a->end);
/* Special case: daily repetitions are converted to a multi-day event */
if (a->repeatType == repeatDaily){
@@ -455,7 +480,7 @@ sync_object_to_pilot (GNOME_Calendar_Repository repo, iCalObject *obj, int pilot
GNOME_Calendar_Repository_update_pilot_id (repo, obj->uid, new_id, ICAL_PILOT_SYNC_NONE, &ev);
- free_Appointment (a);
+ conduit_free_Appointment (a);
g_free (a);
}
@@ -546,9 +571,10 @@ sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
/* If the object was deleted, remove it from the database */
if (attr & dlpRecAttrDeleted){
- printf ("Deleting\n");
+ printf ("Deleting id %ld\n", id);
delete_record (repo, id);
- free_Appointment (&a);
+ conduit_free_Appointment (&a);
+ dlp_DeleteRecord (pilot_fd, db, 0, id);
continue;
}
@@ -559,8 +585,7 @@ sync_pilot (GNOME_Calendar_Repository repo, int pilot_fd)
printf ("updating record\n");
update_record (repo, id, &a, attr);
}
-
- free_Appointment (&a);
+ conduit_free_Appointment (&a);
}
}