aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-07-28 16:41:12 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-07-28 16:41:12 +0800
commite49e9cc1755266dade86ce33662ceff466f5ca07 (patch)
tree9c26f2dea9902aef6d691d70ddeee07293cba176 /calendar/cal-util
parent81207158058c5f5e4315e3b66f92a46aec64e5ae (diff)
downloadgsoc2013-evolution-e49e9cc1755266dade86ce33662ceff466f5ca07.tar.gz
gsoc2013-evolution-e49e9cc1755266dade86ce33662ceff466f5ca07.tar.zst
gsoc2013-evolution-e49e9cc1755266dade86ce33662ceff466f5ca07.zip
New file. Implements PalmPilot syncronization with the Gnome Calendar.
1999-07-28 Miguel de Icaza <miguel@gnu.org> * calendar-pilot-sync.c: New file. Implements PalmPilot syncronization with the Gnome Calendar. 1999-07-27 Miguel de Icaza <miguel@gnu.org> * calobj.c (ical_object_new_from_string): New function. Creates an iCalObject from a vCalendar string that is supposed to contain only one vEvent. * calendar.c: (calendar_save): Split this routine in two. * gnome-cal.c (gnome_calendar_new): Create the corba server here. * main.c: Include gnorba.h, and corba-cal-factory.h here (close_cmd): Kill the calendar server on shutdown. * calobj.c (load_recur_yearly_day): Added a fixme comment. WE need to handle intervals in the years. * calendar.c (calendar_object_find_in_list, calendar_object_find, calendar_object_find_todo, calendar_object_find_event): New functions for looking up information. * main.c (gnome_calendar_locate): New function. * corba-cal.c (calendar_create_object): New file. Implements the corba server. * calendar.c (calendar_object_changed): Flag pilot-status as changed. * calobj.c (ical_object_to_vobject): Save pilot information for syncing. (ical_object_create_from_vobject): Load syncing information for pilot. Do it in a way compatible with KOrganizer. 1999-07-26 Miguel de Icaza <miguel@gnu.org> * calobj.c (ical_object_create_from_vobject): Generate unique IDs on Vevents we load that lack it. WE need this for the old gnome calendar generated files (ie, before now :-). svn path=/trunk/; revision=1038
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/calobj.c62
-rw-r--r--calendar/cal-util/calobj.h11
2 files changed, 73 insertions, 0 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
index 2618470808..08c8d8c63a 100644
--- a/calendar/cal-util/calobj.c
+++ b/calendar/cal-util/calobj.c
@@ -47,6 +47,9 @@ ical_object_new (void)
ico->seq = -1;
ico->dtstamp = time (NULL);
ico->uid = ical_gen_uid ();
+
+ ico->pilot_id = 0;
+ ico->pilot_status = ICAL_PILOT_SYNC_MOD;
return ico;
}
@@ -372,6 +375,8 @@ load_recur_yearly_day (iCalObject *o, char **str)
{
/* Skip as we do not support multiple days and we do expect
* the dtstart to agree with the value on this field
+ *
+ * FIXME: we should support every-n-years
*/
skip_numbers (str);
}
@@ -782,6 +787,22 @@ ical_object_create_from_vobject (VObject *o, const char *object_name)
}
free (the_str);
}
+
+ /*
+ * Pilot
+ */
+ if (has (o, XPilotIdProp)){
+ ical->pilot_id = atoi (str_val (vo));
+ free (the_str);
+ } else
+ ical->pilot_id = 0;
+
+ if (has (o, XPilotStatusProp)){
+ ical->pilot_status = atoi (str_val (vo));
+ free (the_str);
+ } else
+ ical->pilot_status = ICAL_PILOT_SYNC_MOD;
+
return ical;
}
@@ -1047,6 +1068,17 @@ ical_object_to_vobject (iCalObject *ical)
addPropValue (alarm, VCProcedureNameProp, ical->palarm.data);
if ((alarm = save_alarm (o, &ical->malarm, ical)))
addPropValue (alarm, VCEmailAddressProp, ical->malarm.data);
+
+ /* Pilot */
+ {
+ char buffer [20];
+
+ sprintf (buffer, "%d", ical->pilot_id);
+ addPropValue (o, XPilotIdProp, buffer);
+ sprintf (buffer, "%d", ical->pilot_status);
+ addPropValue (o, XPilotStatusProp, buffer);
+ }
+
return o;
}
@@ -1426,3 +1458,33 @@ alarm_compute_offset (CalendarAlarm *a)
}
return a->offset;
}
+
+iCalObject *
+ical_object_new_from_string (const char *vcal_string)
+{
+ iCalObject *ical = NULL;
+ VObject *cal, *event;
+ VObjectIterator i;
+ char *object_name;
+
+ cal = Parse_MIME (vcal_string, strlen (vcal_string));
+
+ initPropIterator (&i, cal);
+
+ while (moreIteration (&i)){
+ event = nextVObject (&i);
+
+ object_name = vObjectName (event);
+
+ if (strcmp (object_name, VCEventProp) == 0){
+ ical = ical_object_create_from_vobject (event, object_name);
+ break;
+ }
+ }
+
+ cleanVObject (cal);
+ cleanStrTbl ();
+
+ return ical;
+}
+
diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h
index 9532b1325f..07ba3f1cc7 100644
--- a/calendar/cal-util/calobj.h
+++ b/calendar/cal-util/calobj.h
@@ -65,6 +65,12 @@ typedef struct {
int len;
} iCalValue;
+typedef enum {
+ ICAL_PILOT_SYNC_NONE = 0,
+ ICAL_PILOT_SYNC_MOD = 1,
+ ICAL_PILOT_SYNC_DEL = 3
+} iCalPilotState;
+
typedef struct {
int valid; /* true if the Geography was specified */
double latitude;
@@ -172,6 +178,10 @@ typedef struct {
int new;
void *user_data; /* Generic data pointer */
+
+ /* Pilot */
+ int pilot_status; /* Status information */
+ int pilot_id; /* Pilot ID */
} iCalObject;
/* The callback for the recurrence generator */
@@ -179,6 +189,7 @@ typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *);
iCalObject *ical_new (char *comment, char *organizer, char *summary);
iCalObject *ical_object_new (void);
+iCalObject *ical_object_new_from_string (const char *vcalendar_string);
void ical_object_destroy (iCalObject *ico);
iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name);
VObject *ical_object_to_vobject (iCalObject *ical);