aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-util
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-01 08:30:46 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-01 08:30:46 +0800
commit65e2dca7eb2786ea75ae3f07171281896334d7e2 (patch)
tree1cfe66f4c3180a721afba86693517a330b65a256 /calendar/cal-util
parent0d8c9252ca14c3aa0e63ca7d807d5a569597e247 (diff)
downloadgsoc2013-evolution-65e2dca7eb2786ea75ae3f07171281896334d7e2.tar.gz
gsoc2013-evolution-65e2dca7eb2786ea75ae3f07171281896334d7e2.tar.zst
gsoc2013-evolution-65e2dca7eb2786ea75ae3f07171281896334d7e2.zip
Calendar objects as defined by the iCalendar IETF draft. Calendar holder
Calendar objects as defined by the iCalendar IETF draft. Calendar holder for Calendar Objects. -mig&fed svn path=/trunk/; revision=79
Diffstat (limited to 'calendar/cal-util')
-rw-r--r--calendar/cal-util/calobj.c48
-rw-r--r--calendar/cal-util/calobj.h100
2 files changed, 148 insertions, 0 deletions
diff --git a/calendar/cal-util/calobj.c b/calendar/cal-util/calobj.c
new file mode 100644
index 0000000000..87dd8db78d
--- /dev/null
+++ b/calendar/cal-util/calobj.c
@@ -0,0 +1,48 @@
+/*
+ * Calendar objects implementations.
+ * Copyright (C) 1998 the Free Software Foundation
+ *
+ * Authors:
+ * Miguel de Icaza (miguel@gnu.org)
+ * Federico Mena (federico@gimp.org)
+ */
+#include "calobj.h"
+
+iCalObject *
+ical_object_new (void)
+{
+ iCalObject *ico;
+
+ ico = g_new0 (iCalObject);
+
+ ico->seq = -1;
+ ico->dtstamp = time (NULL);
+
+ return ico;
+}
+
+iCalObject *
+ical_new (char *comment, char *organizer, char *summary)
+{
+ iCalObject *ico;
+
+ ico = ical_object_new ();
+
+ ico->comment = g_strdup (comment);
+ ico->organizer = g_strdup (organizer);
+ ico->summary = g_strdup (summary);
+
+ return ico;
+}
+
+#define free_if_defined(x) if (x){ g_free (x); x = 0; }
+
+void
+ical_object_destroy (iCalObject *ico)
+{
+ free_if_defined (ico->comment);
+ free_if_defined (ico->organizer);
+ free_if_defined (ico->summary);
+
+ g_free (ico);
+}
diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h
new file mode 100644
index 0000000000..fda3a1e4b5
--- /dev/null
+++ b/calendar/cal-util/calobj.h
@@ -0,0 +1,100 @@
+/*
+ * Internal representation of a Calendar object. This is modeled after the
+ * iCalendar/vCalendar specificiation
+ *
+ * Authors: Miguel de Icaza (miguel@gnu.org), Federico Mena (federico@gimp.org).
+ */
+#ifndef CALOBJ_H
+#define CALOBJ_H
+
+BEGIN_GNOME_DECLS
+
+typedef struct {
+ char *alarm_audio_file;
+ char *alarm_script;
+ char *alarm_email;
+ char *alarm_text; /* Text to be displayed */
+} CalendarAlarm;
+
+/* Calendar object type */
+typedef enum {
+ ICAL_EVENT,
+ ICAL_TODO,
+ ICAL_JOURNAL,
+ ICAL_FBREQUEST,
+ ICAL_FBREPLY,
+ ICAL_BUSYTIME,
+ ICAL_TIMEZONE
+} iCalType;
+
+/* For keys that might contain binary or text/binary */
+typedef struct {
+ char *data;
+ int len;
+} iCalValue;
+
+typedef struct {
+ int valid; /* true if the Geography was specified */
+ double latitude;
+ double longitude;
+} iCalGeo;
+
+typedef enum {
+ ICAL_OPAQUE,
+ ICAL_TRANSPARENT
+};
+
+typedef char NotYet;
+
+/*
+ * This describes an iCalendar object, note that we never store durations, instead we
+ * always compute the end time computed from the start + duration.
+ */
+typedef struct {
+ iCalType type;
+
+ GList *attach; /* type: one or more URIs or binary data */
+ GList *attendee; /* type: CAL-ADDRESS */
+ GList *categories; /* type: one or more TEXT */
+ char *class;
+
+ char *comment; /* we collapse one or more TEXTs into one */
+ time_t completed;
+ time_t created;
+ GList *contact; /* type: one or more TEXT */
+ char *description;
+ time_t dtstamp;
+ time_t dtstart;
+ time_t dtend;
+ GList *exdate; /* type: one or more time_t's */
+ GList *exrule; /* type: one or more RECUR */
+ iCalGeo geo;
+ time_t last_mod;
+ char *location;
+ char *organizer;
+ int percent;
+ int priority;
+ char *rstatus; /* request status for freebusy */
+ GList *related; /* type: one or more TEXT */
+ GList *resources; /* type: one or more TEXT */
+ GList *rdate; /* type: one or more recurrence date */
+ GList *rrule; /* type: one or more recurrence rules */
+ int seq;
+ char *status;
+ char *summary;
+ iCalTransp transp;
+ char *uid;
+ char *url;
+ time_t recurid;
+
+ /* VALARM objects are always inside another object, never alone */
+ CalendarAlarm *alarm;
+} iCalObject;
+
+iCalObject *ical_new (char *comment, char *organizer, char *summary);
+iCalObject *ical_object_new (void);
+
+END_GNOME_DECLS
+
+#endif
+