aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c70
-rw-r--r--calendar/cal-client/cal-client.h1
2 files changed, 71 insertions, 0 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 65c0c4aea4..7b5f248d85 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -1,3 +1,4 @@
+
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Evolution calendar client
*
@@ -800,6 +801,75 @@ cal_client_get_uids (CalClient *client, CalObjType type)
return uids;
}
+/* Builds a GList of CalObjChange structures from the CORBA sequence */
+static GList *
+build_change_list (Evolution_Calendar_CalObjChangeSeq *seq)
+{
+ GList *list;
+ int i;
+
+ /* Create the list in reverse order */
+ list = NULL;
+ for (i = 0; i < seq->_length; i++) {
+ Evolution_Calendar_CalObjChange *corba_coc;
+ CalObjChange *coc;
+
+ corba_coc = &seq->_buffer[i];
+ coc = g_new (CalObjChange, 1);
+
+ coc->uid = g_strdup (corba_coc->uid);
+ coc->type = corba_coc->type;
+
+ list = g_list_prepend (list, coc);
+ }
+
+ list = g_list_reverse (list);
+ return list;
+}
+
+/**
+ * cal_client_get_changed_uids:
+ * @client: A calendar client.
+ * @type: Bitmask with types of objects to return.
+ *
+ * Queries a calendar for a list of unique identifiers corresponding to calendar
+ * objects whose type matches one of the types specified in the @type flags.
+ *
+ * Return value: A list of strings that are the sought UIDs.
+ **/
+GList *
+cal_client_get_changed_uids (CalClient *client, CalObjType type, time_t since)
+{
+ CalClientPrivate *priv;
+ CORBA_Environment ev;
+ Evolution_Calendar_CalObjChangeSeq *seq;
+ int t;
+ GList *changes;
+
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
+
+ priv = client->priv;
+ g_return_val_if_fail (priv->load_state == LOAD_STATE_LOADED, NULL);
+
+ t = corba_obj_type (type);
+ CORBA_exception_init (&ev);
+
+ seq = Evolution_Calendar_Cal_get_changed_uids (priv->cal, t, since, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("cal_client_get_changed_uids(): could not get the list of changes");
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ changes = build_change_list (seq);
+ CORBA_free (seq);
+
+ return changes;
+}
+
/* FIXME: Not used? */
#if 0
/* Builds a GList of CalObjInstance structures from the CORBA sequence */
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index 6747c7488e..9853c63e2c 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -101,6 +101,7 @@ void cal_client_update_pilot_id (CalClient *client, char *uid,
unsigned long pilot_status);
GList *cal_client_get_uids (CalClient *client, CalObjType type);
+GList *cal_client_get_changed_uids (CalClient *client, CalObjType type, time_t since);
GList *cal_client_get_objects_in_range (CalClient *client, CalObjType type,
time_t start, time_t end);