aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog40
-rw-r--r--calendar/Makefile.am2
-rw-r--r--calendar/cal-client/cal-client.c114
-rw-r--r--calendar/cal-client/cal-client.h5
-rw-r--r--calendar/cal-client/cal-listener.c1
-rw-r--r--calendar/cal-client/client-test.c118
-rw-r--r--calendar/cal-client/test.ics318
-rw-r--r--calendar/cal-util/cal-component.c56
-rw-r--r--calendar/cal-util/cal-component.h2
-rw-r--r--calendar/cal-util/cal-util.h3
-rw-r--r--calendar/pcs/Makefile.am2
-rw-r--r--calendar/pcs/cal-factory.c1
-rw-r--r--calendar/pcs/cal.c4
13 files changed, 542 insertions, 124 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 90e1618975..dd0c896950 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,33 @@
+2000-08-07 Federico Mena Quintero <federico@helixcode.com>
+
+ * cal-util/cal-component.c (cal_component_get_as_string): Doh,
+ libical owns the string's memory, so do not free it.
+
+ * cal-client/client-test.c (create_client): Connect to the destroy
+ signal of the client here.
+
+ * cal-client/test.ics: New test file, modified from Eric Busboom's
+ test file from RFC 2445.
+
+2000-08-05 Federico Mena Quintero <federico@helixcode.com>
+
+ * cal-client/client-test.c (dump_component): This was gone for
+ some reason.
+ (main): Load a new test file.
+
+2000-08-04 Federico Mena Quintero <federico@helixcode.com>
+
+ * cal-util/cal-component.c (cal_component_commit_sequence): New
+ function to commit changes to the SEQUENCE property.
+ (cal_component_get_as_string): Ensure that the sequence has been
+ committed.
+
+ * cal-client/cal-client.c (cal_client_get_object): Use
+ CalComponent instead of the old iCalObject.
+ (cal_client_update_object): Use iCalObject. Commit the SEQUENCE
+ property before stringifying the object and piping it over to the
+ Wombat.
+
2000-08-04 Seth Alves <alves@hungry.com>
* conduits/todo/todo-conduit.c (conduit_get_gpilot_conduit): if
@@ -9,6 +39,16 @@
* gui/calendar-commands.c (calendar_control_activate): unref.
+2000-08-02 Federico Mena Quintero <federico@helixcode.com>
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_uid_by_pilot_id):
+ Added stub for now.
+ (cal_backend_file_update_pilot_id): Likewise.
+
+ * pcs/Makefile.am (libpcs_a_SOURCES): Removed cal-backend-imc.[ch]
+ from the list of sources. The idea is to move vCalendar importing
+ to the GUI as a convenience function.
+
2000-08-02 Seth Alves <alves@hungry.com>
* pcs/cal-backend-imc.c (cal_backend_imc_update_pilot_id): call
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index d49e183677..82accbfda5 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = idl cal-util pcs cal-client gui
+SUBDIRS = idl cal-util pcs cal-client
#SUBDIRS = idl cal-util pcs cal-client gui conduits
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 5704769f7c..88685dd1aa 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -32,9 +32,6 @@
#include "cal-client.h"
#include "cal-listener.h"
-#include "cal-util/icalendar-save.h"
-#include "cal-util/icalendar.h"
-
/* Loading state for the calendar client */
@@ -272,6 +269,7 @@ cal_client_destroy (GtkObject *object)
priv->load_state = LOAD_STATE_NOT_LOADED;
g_free (priv);
+ client->priv = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -598,21 +596,22 @@ cal_client_get_n_objects (CalClient *client, CalObjType type)
/**
* cal_client_get_object:
* @client: A calendar client.
- * @uid: Unique identifier for a calendar object.
- * @ico: Return value for the calendar object.
+ * @uid: Unique identifier for a calendar component.
+ * @comp: Return value for the calendar component object.
*
- * Queries a calendar for a calendar object based on its unique identifier.
+ * Queries a calendar for a calendar component object based on its unique
+ * identifier.
*
* Return value: Result code based on the status of the operation.
**/
CalClientGetStatus
-cal_client_get_object (CalClient *client, const char *uid, iCalObject **ico)
+cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp)
{
CalClientPrivate *priv;
CORBA_Environment ev;
Evolution_Calendar_CalObj calobj_str;
CalClientGetStatus retval;
- CalObjFindStatus status;
+ icalcomponent *icalcomp;
g_return_val_if_fail (client != NULL, CAL_CLIENT_GET_NOT_FOUND);
g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_GET_NOT_FOUND);
@@ -621,10 +620,10 @@ cal_client_get_object (CalClient *client, const char *uid, iCalObject **ico)
g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, CAL_CLIENT_GET_NOT_FOUND);
g_return_val_if_fail (uid != NULL, CAL_CLIENT_GET_NOT_FOUND);
- g_return_val_if_fail (ico != NULL, CAL_CLIENT_GET_NOT_FOUND);
+ g_return_val_if_fail (comp != NULL, CAL_CLIENT_GET_NOT_FOUND);
retval = CAL_CLIENT_GET_NOT_FOUND;
- *ico = NULL;
+ *comp = NULL;
CORBA_exception_init (&ev);
calobj_str = Evolution_Calendar_Cal_get_object (priv->cal, uid, &ev);
@@ -637,68 +636,36 @@ cal_client_get_object (CalClient *client, const char *uid, iCalObject **ico)
goto out;
}
- status = ical_object_find_in_string (uid, calobj_str, ico);
+ icalcomp = icalparser_parse_string (calobj_str);
CORBA_free (calobj_str);
- switch (status) {
- case CAL_OBJ_FIND_SUCCESS:
- retval = CAL_CLIENT_GET_SUCCESS;
- break;
-
- case CAL_OBJ_FIND_SYNTAX_ERROR:
+ if (!icalcomp) {
retval = CAL_CLIENT_GET_SYNTAX_ERROR;
- break;
+ goto out;
+ }
- case CAL_OBJ_FIND_NOT_FOUND:
- retval = CAL_CLIENT_GET_NOT_FOUND;
- break;
+ *comp = cal_component_new ();
+ if (!cal_component_set_icalcomponent (*comp, icalcomp)) {
+ icalcomponent_free (icalcomp);
+ gtk_object_unref (GTK_OBJECT (*comp));
+ *comp = NULL;
- default:
- g_assert_not_reached ();
+ retval = CAL_CLIENT_GET_SYNTAX_ERROR;
+ goto out;
}
+ retval = CAL_CLIENT_GET_SUCCESS;
+
out:
CORBA_exception_free (&ev);
return retval;
-#if 0
- icalcomponent* comp = NULL;
- icalcomponent *subcomp;
- iCalObject *ical;
-
- /* convert the string into an iCalObject */
- (*ico) = NULL;
- if (obj_str == NULL) return CAL_CLIENT_GET_SYNTAX_ERROR;
- comp = icalparser_parse_string (obj_str);
- free (obj_str);
- if (!comp) return CAL_CLIENT_GET_SYNTAX_ERROR;
- subcomp = icalcomponent_get_first_component (comp, ICAL_ANY_COMPONENT);
- if (!subcomp) return CAL_CLIENT_GET_SYNTAX_ERROR;
-
- while (subcomp) {
- ical = ical_object_create_from_icalcomponent (subcomp);
- if (ical->type != ICAL_EVENT &&
- ical->type != ICAL_TODO &&
- ical->type != ICAL_JOURNAL) {
- g_warning ("Skipping unsupported iCalendar component");
- } else {
- if (strcasecmp (ical->uid, uid) == 0) {
- (*ico) = ical;
- (*ico)->ref_count = 1;
- return CAL_CLIENT_GET_SUCCESS;
- }
- }
- subcomp = icalcomponent_get_next_component (comp,
- ICAL_ANY_COMPONENT);
- }
-#endif
}
-
-
-CalClientGetStatus cal_client_get_uid_by_pilot_id (CalClient *client,
- unsigned long pilot_id,
- char **uid)
+CalClientGetStatus
+cal_client_get_uid_by_pilot_id (CalClient *client,
+ unsigned long pilot_id,
+ char **uid)
{
CalClientPrivate *priv;
CORBA_Environment ev;
@@ -897,6 +864,7 @@ cal_client_get_events_in_range (CalClient *client, time_t start, time_t end)
return events;
}
+#if 0
/* Translates the CORBA representation of an AlarmType */
static enum AlarmType
uncorba_alarm_type (Evolution_Calendar_AlarmType corba_type)
@@ -919,6 +887,7 @@ uncorba_alarm_type (Evolution_Calendar_AlarmType corba_type)
return ALARM_DISPLAY;
}
}
+#endif
/* Builds a GList of CalAlarmInstance structures from the CORBA sequence */
static GList *
@@ -938,7 +907,9 @@ build_alarm_instance_list (Evolution_Calendar_CalAlarmInstanceSeq *seq)
ai = g_new (CalAlarmInstance, 1);
ai->uid = g_strdup (corba_ai->uid);
+#if 0
ai->type = uncorba_alarm_type (corba_ai->type);
+#endif
ai->trigger = corba_ai->trigger;
ai->occur = corba_ai->occur;
@@ -1056,22 +1027,23 @@ cal_client_get_alarms_for_object (CalClient *client, const char *uid,
/**
* cal_client_update_object:
* @client: A calendar client.
- * @ico: A calendar object.
+ * @comp: A calendar component object.
*
- * Asks a calendar to update an object. Any existing object with the specified
- * UID will be replaced. The client program should not assume that the object
- * is actually in the server's storage until it has received the "obj_updated"
- * notification signal.
+ * Asks a calendar to update a component. Any existing component with the
+ * specified component's UID will be replaced. The client program should not
+ * assume that the object is actually in the server's storage until it has
+ * received the "obj_updated" notification signal.
*
- * Return value: TRUE on success, FALSE on specifying an invalid object.
+ * Return value: TRUE on success, FALSE on specifying an invalid component.
**/
gboolean
-cal_client_update_object (CalClient *client, iCalObject *ico)
+cal_client_update_object (CalClient *client, CalComponent *comp)
{
CalClientPrivate *priv;
CORBA_Environment ev;
gboolean retval;
char *obj_string;
+ const char *uid;
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
@@ -1079,15 +1051,17 @@ cal_client_update_object (CalClient *client, iCalObject *ico)
priv = client->priv;
g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, FALSE);
- g_return_val_if_fail (ico != NULL, FALSE);
- g_return_val_if_fail (ico->uid != NULL, FALSE);
+ g_return_val_if_fail (comp != NULL, FALSE);
retval = FALSE;
- obj_string = ical_object_to_string (ico);
+ cal_component_commit_sequence (comp);
+ obj_string = cal_component_get_as_string (comp);
+
+ cal_component_get_uid (comp, &uid);
CORBA_exception_init (&ev);
- Evolution_Calendar_Cal_update_object (priv->cal, ico->uid, obj_string, &ev);
+ Evolution_Calendar_Cal_update_object (priv->cal, uid, obj_string, &ev);
g_free (obj_string);
if (ev._major == CORBA_USER_EXCEPTION &&
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index 5dc30ddec2..e395fa2e46 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -24,6 +24,7 @@
#include <libgnome/gnome-defs.h>
#include <gtk/gtkobject.h>
+#include <cal-util/cal-component.h>
#include <cal-util/cal-util.h>
BEGIN_GNOME_DECLS
@@ -85,7 +86,7 @@ int cal_client_get_n_objects (CalClient *client, CalObjType type);
CalClientGetStatus cal_client_get_object (CalClient *client,
const char *uid,
- iCalObject **ico);
+ CalComponent **comp);
CalClientGetStatus cal_client_get_uid_by_pilot_id (CalClient *client,
unsigned long pilot_id,
@@ -105,7 +106,7 @@ gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid,
time_t start, time_t end,
GList **alarms);
-gboolean cal_client_update_object (CalClient *client, iCalObject *ico);
+gboolean cal_client_update_object (CalClient *client, CalComponent *comp);
gboolean cal_client_remove_object (CalClient *client, const char *uid);
diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c
index 884d64e8f9..d9a028b20d 100644
--- a/calendar/cal-client/cal-listener.c
+++ b/calendar/cal-client/cal-listener.c
@@ -184,6 +184,7 @@ cal_listener_destroy (GtkObject *object)
CORBA_exception_free (&ev);
g_free (priv);
+ listener->priv = NULL;
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
diff --git a/calendar/cal-client/client-test.c b/calendar/cal-client/client-test.c
index f8741f4539..7f79b58266 100644
--- a/calendar/cal-client/client-test.c
+++ b/calendar/cal-client/client-test.c
@@ -1,8 +1,29 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* Evolution calendar client - test program
+ *
+ * Copyright (C) 2000 Helix Code, Inc.
+ *
+ * Author: Federico Mena-Quintero <federico@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
#include <config.h>
#include <bonobo.h>
#include <gnome.h>
#include <cal-client/cal-client.h>
+
static CalClient *client1;
static CalClient *client2;
@@ -21,6 +42,26 @@ cl_printf (CalClient *client, const char *format, ...)
va_end (args);
}
+/* Dumps some interesting data from a component */
+static void
+dump_component (CalComponent *comp)
+{
+ const char *uid;
+ CalComponentText summary;
+
+ cal_component_get_uid (comp, &uid);
+
+ printf ("UID %s\n", uid);
+
+ cal_component_get_summary (comp, &summary);
+ if (summary.value)
+ printf ("\tSummary: `%s', altrep `%s'\n",
+ summary.value,
+ summary.altrep ? summary.altrep : "NONE");
+ else
+ printf ("\tNo summary\n");
+}
+
/* Lists the UIDs of objects in a calendar, called as an idle handler */
static gboolean
list_uids (gpointer data)
@@ -49,22 +90,20 @@ list_uids (gpointer data)
for (l = uids; l; l = l->next) {
char *uid;
- iCalObject *ico;
+ CalComponent *comp;
CalClientGetStatus status;
uid = l->data;
- status = cal_client_get_object (client, uid, &ico);
+ status = cal_client_get_object (client, uid, &comp);
if (status == CAL_CLIENT_GET_SUCCESS) {
printf ("------------------------------\n");
- dump_icalobject (ico);
+ dump_component (comp);
printf ("------------------------------\n");
+ gtk_object_unref (GTK_OBJECT (comp));
} else {
printf ("FAILED: %d\n", status);
}
-
- // cal_client_update_object (client, uid, calobj);
- // g_free (calobj);
}
}
@@ -98,32 +137,50 @@ obj_updated (CalClient *client, const char *uid, gpointer data)
cl_printf (client, "Object updated: %s\n", uid);
}
+/* Callback used when a client is destroyed */
+static void
+client_destroy_cb (GtkObject *object, gpointer data)
+{
+ if (CAL_CLIENT (object) == client1)
+ client1 = NULL;
+ else if (CAL_CLIENT (object) == client2)
+ client2 = NULL;
+ else
+ g_assert_not_reached ();
+
+ if (!client1 && !client2)
+ gtk_main_quit ();
+}
+
/* Creates a calendar client and tries to load the specified URI into it */
-static CalClient *
-create_client (const char *uri, gboolean load)
+static void
+create_client (CalClient **client, const char *uri, gboolean load)
{
- CalClient *client;
gboolean result;
- client = cal_client_new ();
- if (!client) {
+ *client = cal_client_new ();
+ if (!*client) {
g_message ("create_client(): could not create the client");
exit (1);
}
- gtk_signal_connect (GTK_OBJECT (client), "cal_loaded",
+ gtk_signal_connect (GTK_OBJECT (*client), "destroy",
+ client_destroy_cb,
+ NULL);
+
+ gtk_signal_connect (GTK_OBJECT (*client), "cal_loaded",
GTK_SIGNAL_FUNC (cal_loaded),
NULL);
- gtk_signal_connect (GTK_OBJECT (client), "obj_updated",
+ gtk_signal_connect (GTK_OBJECT (*client), "obj_updated",
GTK_SIGNAL_FUNC (obj_updated),
NULL);
printf ("Calendar loading `%s'...\n", uri);
if (load)
- result = cal_client_load_calendar (client, uri);
+ result = cal_client_load_calendar (*client, uri);
else
- result = cal_client_create_calendar (client, uri);
+ result = cal_client_create_calendar (*client, uri);
if (!result) {
g_message ("create_client(): failure when issuing calendar %s request `%s'",
@@ -131,23 +188,6 @@ create_client (const char *uri, gboolean load)
uri);
exit (1);
}
-
- return client;
-}
-
-/* Callback used when a client is destroyed */
-static void
-client_destroy_cb (GtkObject *object, gpointer data)
-{
- if (CAL_CLIENT (object) == client1)
- client1 = NULL;
- else if (CAL_CLIENT (object) == client2)
- client2 = NULL;
- else
- g_assert_not_reached ();
-
- if (!client1 && !client2)
- gtk_main_quit ();
}
#ifdef USING_OAF
@@ -195,17 +235,9 @@ main (int argc, char **argv)
exit (1);
}
- client1 = create_client ("/cvs/evolution/calendar/gui/test2.vcf", TRUE);
- gtk_signal_connect (GTK_OBJECT (client1), "destroy",
- client_destroy_cb,
- NULL);
-
- client2 = create_client ("/cvs/evolution/calendar/gui/test2.vcf", FALSE);
- gtk_signal_connect (GTK_OBJECT (client2), "destroy",
- client_destroy_cb,
- NULL);
+ create_client (&client1, "/cvs/evolution/calendar/cal-client/test.ics", TRUE);
+ create_client (&client2, "/cvs/evolution/calendar/cal-client/test.ics", FALSE);
bonobo_main ();
-
return 0;
}
diff --git a/calendar/cal-client/test.ics b/calendar/cal-client/test.ics
new file mode 100644
index 0000000000..128251ee11
--- /dev/null
+++ b/calendar/cal-client/test.ics
@@ -0,0 +1,318 @@
+BEGIN:VCALENDAR
+VERSION:2.0
+PRODID:-//hacksw/handcal//NONSGML v1.0//EN
+
+BEGIN:VEVENT
+DTSTART:19970714T170000Z
+DTEND:19970715T035959Z
+SUMMARY:Bastille Day Party
+END:VEVENT
+
+BEGIN:VEVENT
+UID:19970901T130000Z-123401@host.com
+DTSTAMP:19970901T1300Z
+DTSTART:19970903T163000Z
+DTEND:19970903T190000Z
+SUMMARY:Annual Employee Review
+CLASS:PRIVATE
+CATEGORIES:BUSINESS,HUMAN RESOURCES
+END:VEVENT
+
+BEGIN:VEVENT
+UID:19970901T130000Z-123402@host.com
+DTSTAMP:19970901T1300Z
+DTSTART:19970401T163000Z
+DTEND:19970402T010000Z
+SUMMARY:Laurel is in sensitivity awareness class.
+CLASS:PUBLIC
+CATEGORIES:BUSINESS,HUMAN RESOURCES
+TRANSP:TRANSPARENT
+END:VEVENT
+
+BEGIN:VEVENT
+UID:19970901T130000Z-123403@host.com
+DTSTAMP:19970901T1300Z
+DTSTART:19971102
+SUMMARY:Our Blissful Anniversary
+CLASS:CONFIDENTIAL
+CATEGORIES:ANNIVERSARY,PERSONAL,SPECIAL OCCASION
+RRULE:FREQ=YEARLY
+END:VEVENT
+
+BEGIN:VTODO
+UID:19970901T130000Z-123404@host.com
+DTSTAMP:19970901T1300Z
+DTSTART:19970415T133000Z
+DUE:19970416T045959Z
+SUMMARY:1996 Income Tax Preparation
+CLASS:CONFIDENTIAL
+CATEGORIES:FAMILY,FINANCE
+PRIORITY:1
+STATUS:NEEDS-ACTION
+END:VTODO
+
+BEGIN:VJOURNAL
+UID:19970901T130000Z-123405@host.com
+DTSTAMP:19970901T1300Z
+DTSTART;VALUE=DATE:19970317
+SUMMARY:Staff meeting minutes
+DESCRIPTION:1. Staff meeting: Participants include Joe\, Lisa
+ and Bob. Aurora project plans were reviewed. There is currently
+ no budget reserves for this project. Lisa will escalate to
+ management. Next meeting on Tuesday.\n
+ 2. Telephone Conference: ABC Corp. sales representative called
+ to discuss new printer. Promised to get us a demo by Friday.\n
+ 3. Henry Miller (Handsoff Insurance): Car was totaled by tree.
+ Is looking into a loaner car. 654-2323 (tel).
+END:VJOURNAL
+
+BEGIN:VFREEBUSY
+ORGANIZER:MAILTO:jane_doe@host1.com
+ATTENDEE:MAILTO:john_public@host2.com
+DTSTART:19971015T050000Z
+DTEND:19971016T050000Z
+DTSTAMP:19970901T083000Z
+END:VFREEBUSY
+
+BEGIN:VFREEBUSY
+ORGANIZER:MAILTO:jane_doe@host1.com
+ATTENDEE:MAILTO:john_public@host2.com
+DTSTAMP:19970901T100000Z
+FREEBUSY;VALUE=PERIOD:19971015T050000Z/PT8H30M,
+ 19971015T160000Z/PT5H30M,19971015T223000Z/PT6H30M
+URL:http://host2.com/pub/busy/jpublic-01.ifb
+COMMENT:This iCalendar file contains busy time information for
+ the next three months.
+END:VFREEBUSY
+
+BEGIN:VFREEBUSY
+ORGANIZER:jsmith@host.com
+DTSTART:19980313T141711Z
+DTEND:19980410T141711Z
+FREEBUSY:19980314T233000Z/19980315T003000Z
+FREEBUSY:19980316T153000Z/19980316T163000Z
+FREEBUSY:19980318T030000Z/19980318T040000Z
+URL:http://www.host.com/calendar/busytime/jsmith.ifb
+END:VFREEBUSY
+
+BEGIN:VTIMEZONE
+TZID:US-Eastern
+LAST-MODIFIED:19870101T000000Z
+BEGIN:STANDARD
+DTSTART:19971026T020000
+RDATE:19971026T020000
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19971026T020000
+RDATE:19970406T020000
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+
+BEGIN:VTIMEZONE
+TZID:US-Eastern
+LAST-MODIFIED:19870101T000000Z
+TZURL:http://zones.stds_r_us.net/tz/US-Eastern
+BEGIN:STANDARD
+DTSTART:19671029T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19870405T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+
+BEGIN:VTIMEZONE
+TZID:US--Fictitious-Eastern
+LAST-MODIFIED:19870101T000000Z
+BEGIN:STANDARD
+DTSTART:19671029T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19870405T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+
+BEGIN:VTIMEZONE
+TZID:US--Fictitious-Eastern
+LAST-MODIFIED:19870101T000000Z
+BEGIN:STANDARD
+DTSTART:19671029T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19870405T020000
+RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4;UNTIL=19980404T070000Z
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+BEGIN:DAYLIGHT
+DTSTART:19990424T020000
+RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=4
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+
+BEGIN:VALARM
+TRIGGER;VALUE=DATE-TIME:19970317T133000Z
+REPEAT:4
+DURATION:PT15M
+ACTION:AUDIO
+ATTACH;FMTTYPE=audio/basic:ftp://host.com/pub/sounds/bell-01.aud
+END:VALARM
+BEGIN:VALARM
+TRIGGER:-PT30M
+REPEAT:2
+DURATION:PT15M
+ACTION:DISPLAY
+DESCRIPTION:Breakfast meeting with executive\n
+ team at 8:30 AM EST.
+END:VALARM
+
+BEGIN:VALARM
+TRIGGER:-P2D
+ACTION:EMAIL
+ATTENDEE:MAILTO:john_doe@host.com
+SUMMARY:*** REMINDER: SEND AGENDA FOR WEEKLY STAFF MEETING ***
+DESCRIPTION:A draft agenda needs to be sent out to the attendees
+ to the weekly managers meeting (MGR-LIST). Attached is a
+ pointer the document template for the agenda file.
+ATTACH;FMTTYPE=application/binary:http://host.com/templates/agen
+ da.doc
+END:VALARM
+
+BEGIN:VALARM
+TRIGGER;VALUE=DATE-TIME:19980101T050000Z
+REPEAT:23
+DURATION:PT1H
+ACTION:PROCEDURE
+ATTACH;FMTTYPE=application/binary:ftp://host.com/novo-
+ procs/felizano.exe
+END:VALARM
+
+BEGIN:VTIMEZONE
+TZID:US-Eastern
+BEGIN:STANDARD
+DTSTART:19981025T020000
+RDATE:19981025T020000
+TZOFFSETFROM:-0400
+TZOFFSETTO:-0500
+TZNAME:EST
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:19990404T020000
+RDATE:19990404T020000
+TZOFFSETFROM:-0500
+TZOFFSETTO:-0400
+TZNAME:EDT
+END:DAYLIGHT
+END:VTIMEZONE
+
+BEGIN:VEVENT
+DTSTAMP:19980309T231000Z
+UID:guid-1.host1.com
+ORGANIZER;ROLE=CHAIR:MAILTO:mrbig@host.com
+ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:
+ MAILTO:employee-A@host.com
+DESCRIPTION:Project XYZ Review Meeting
+CATEGORIES:MEETING
+CLASS:PUBLIC
+CREATED:19980309T130000Z
+SUMMARY:XYZ Project Review
+DTSTART;TZID=US-Eastern:19980312T083000
+DTEND;TZID=US-Eastern:19980312T093000
+LOCATION:1CP Conference Room 4350
+END:VEVENT
+
+BEGIN:VEVENT
+DTSTAMP:19970324T1200Z
+SEQUENCE:0
+UID:uid3@host1.com
+ORGANIZER:MAILTO:jdoe@host1.com
+DTSTART:19970324T123000Z
+DTEND:19970324T210000Z
+CATEGORIES:MEETING,PROJECT
+CLASS:PUBLIC
+SUMMARY:Calendaring Interoperability Planning Meeting
+DESCRIPTION:Discuss how we can test c&s interoperability\n
+ using iCalendar and other IETF standards.
+LOCATION:LDB Lobby
+ATTACH;FMTTYPE=application/postscript:ftp://xyzCorp.com/pub/
+ conf/bkgrnd.ps
+END:VEVENT
+
+BEGIN:VTODO
+DTSTAMP:19980130T134500Z
+SEQUENCE:2
+UID:uid4@host1.com
+ORGANIZER:MAILTO:unclesam@us.gov
+ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:jqpublic@host.com
+DUE:19980415T235959
+STATUS:NEEDS-ACTION
+SUMMARY:Submit Income Taxes
+BEGIN:VALARM
+ACTION:AUDIO
+TRIGGER:19980403T120000
+ATTACH;FMTTYPE=audio/basic:http://host.com/pub/audio-
+ files/ssbanner.aud
+REPEAT:4
+DURATION:PT1H
+END:VALARM
+END:VTODO
+
+BEGIN:VJOURNAL
+DTSTAMP:19970324T120000Z
+UID:uid5@host1.com
+ORGANIZER:MAILTO:jsmith@host.com
+STATUS:DRAFT
+CLASS:PUBLIC
+CATEGORIES:Project Report, XYZ, Weekly Meeting
+DESCRIPTION:Project xyz Review Meeting Minutes\n
+ Agenda\n1. Review of project version 1.0 requirements.\n2.
+ Definition
+ of project processes.\n3. Review of project schedule.\n
+ Participants: John Smith\, Jane Doe\, Jim Dandy\n-It was
+ decided that the requirements need to be signed off by
+ product marketing.\n-Project processes were accepted.\n
+ -Project schedule needs to account for scheduled holidays
+ and employee vacation time. Check with HR for specific
+ dates.\n-New schedule will be distributed by Friday.\n-
+ Next weeks meeting is cancelled. No meeting until 3/23.
+END:VJOURNAL
+
+BEGIN:VFREEBUSY
+ORGANIZER:MAILTO:jsmith@host.com
+DTSTART:19980313T141711Z
+DTEND:19980410T141711Z
+FREEBUSY:19980314T233000Z/19980315T003000Z
+FREEBUSY:19980316T153000Z/19980316T163000Z
+FREEBUSY:19980318T030000Z/19980318T040000Z
+URL:http://www.host.com/calendar/busytime/jsmith.ifb
+END:VFREEBUSY
+END:VCALENDAR
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index b697b60389..0020c7d727 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -766,7 +766,9 @@ cal_component_get_vtype (CalComponent *comp)
* cal_component_get_as_string:
* @comp: A calendar component.
*
- * Gets the iCalendar string representation of a calendar component.
+ * Gets the iCalendar string representation of a calendar component. You should
+ * call cal_component_commit_sequence() before this function to ensure that the
+ * component's sequence number is consistent with the state of the object.
*
* Return value: String representation of the calendar component according to
* RFC 2445.
@@ -783,20 +785,64 @@ cal_component_get_as_string (CalComponent *comp)
priv = comp->priv;
g_return_val_if_fail (priv->icalcomp != NULL, NULL);
- /* Sigh, we dup and dup and dup and dup because of g_malloc() versus malloc()... */
+ /* Ensure that the user has committed the new SEQUENCE */
+ g_return_val_if_fail (priv->need_sequence_inc == FALSE, NULL);
+
+ /* We dup the string; libical owns that memory */
str = icalcomponent_as_ical_string (priv->icalcomp);
- if (str) {
+ if (str)
buf = g_strdup (str);
- free (str);
- } else
+ else
buf = NULL;
return buf;
}
/**
+ * cal_component_commit_sequence:
+ * @comp:
+ *
+ * Increments the sequence number property in a calendar component object if it
+ * needs it. This needs to be done when any of a number of properties listed in
+ * RFC 2445 change values, such as the start and end dates of a component.
+ *
+ * This function must be called before calling cal_component_get_as_string() to
+ * ensure that the component is fully consistent.
+ **/
+void
+cal_component_commit_sequence (CalComponent *comp)
+{
+ CalComponentPrivate *priv;
+
+ g_return_if_fail (comp != NULL);
+ g_return_if_fail (IS_CAL_COMPONENT (comp));
+
+ priv = comp->priv;
+ g_return_if_fail (priv->icalcomp != NULL);
+
+ if (!priv->need_sequence_inc)
+ return;
+
+ if (priv->sequence) {
+ int seq;
+
+ seq = icalproperty_get_sequence (priv->sequence);
+ icalproperty_set_sequence (priv->sequence, seq + 1);
+ } else {
+ /* The component had no SEQUENCE property, so assume that the
+ * default would have been zero. Since it needed incrementing
+ * anyways, we use a value of 1 here.
+ */
+ priv->sequence = icalproperty_new_sequence (1);
+ icalcomponent_add_property (priv->icalcomp, priv->sequence);
+ }
+
+ priv->need_sequence_inc = FALSE;
+}
+
+/**
* cal_component_get_uid:
* @comp: A calendar component object.
* @uid: Return value for the UID string.
diff --git a/calendar/cal-util/cal-component.h b/calendar/cal-util/cal-component.h
index 38b9e60aed..7c12d8a980 100644
--- a/calendar/cal-util/cal-component.h
+++ b/calendar/cal-util/cal-component.h
@@ -135,6 +135,8 @@ CalComponentVType cal_component_get_vtype (CalComponent *comp);
char *cal_component_get_as_string (CalComponent *comp);
+void cal_component_commit_sequence (CalComponent *comp);
+
void cal_component_get_uid (CalComponent *comp, const char **uid);
void cal_component_set_uid (CalComponent *comp, const char *uid);
diff --git a/calendar/cal-util/cal-util.h b/calendar/cal-util/cal-util.h
index 2859a406b3..154f4c2ad5 100644
--- a/calendar/cal-util/cal-util.h
+++ b/calendar/cal-util/cal-util.h
@@ -25,7 +25,6 @@
#include <libgnome/gnome-defs.h>
#include <time.h>
#include <glib.h>
-#include <cal-util/calobj.h>
BEGIN_GNOME_DECLS
@@ -45,7 +44,9 @@ void cal_obj_instance_list_free (GList *list);
/* Instance of an alarm trigger */
typedef struct {
char *uid; /* UID of object */
+#if 0
enum AlarmType type; /* Type of alarm */
+#endif
time_t trigger; /* Alarm trigger time */
time_t occur; /* Occurrence time */
} CalAlarmInstance;
diff --git a/calendar/pcs/Makefile.am b/calendar/pcs/Makefile.am
index 320e3f0a14..b435b90229 100644
--- a/calendar/pcs/Makefile.am
+++ b/calendar/pcs/Makefile.am
@@ -31,8 +31,6 @@ libpcs_a_SOURCES = \
cal-backend.h \
cal-backend-file.c \
cal-backend-file.h \
- cal-backend-imc.c \
- cal-backend-imc.h \
cal-common.h \
cal-factory.c \
cal-factory.h \
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c
index 9e663690db..ab19ccb8b3 100644
--- a/calendar/pcs/cal-factory.c
+++ b/calendar/pcs/cal-factory.c
@@ -21,6 +21,7 @@
#include <config.h>
#include <ctype.h>
+#include <stdio.h>
#include <gtk/gtksignal.h>
#include "cal.h"
#include "cal-backend.h"
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index cd94bb3a80..36791fefcd 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -345,6 +345,7 @@ Cal_get_events_in_range (PortableServer_Servant servant,
return seq;
}
+#if 0
/* Translates an enum AlarmType to its CORBA representation */
static Evolution_Calendar_AlarmType
corba_alarm_type (enum AlarmType type)
@@ -367,6 +368,7 @@ corba_alarm_type (enum AlarmType type)
return Evolution_Calendar_DISPLAY;
}
}
+#endif
/* Builds a CORBA sequence of alarm instances from a CalAlarmInstance list. */
static Evolution_Calendar_CalAlarmInstanceSeq *
@@ -393,7 +395,9 @@ build_alarm_instance_seq (GList *alarms)
corba_ai = &seq->_buffer[i];
corba_ai->uid = CORBA_string_dup (ai->uid);
+#if 0
corba_ai->type = corba_alarm_type (ai->type);
+#endif
corba_ai->trigger = ai->trigger;
corba_ai->occur = ai->occur;
}