aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-11-12 09:40:59 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-11-12 09:40:59 +0800
commit6a06e2ee66a6bcd538291c92bedc71de1a890f92 (patch)
treefa32ad731a13dfb0989baa39ffb51d494af0ea59
parent44d3f6715ae3aa7b46cbf9d8991eff11c60dcc17 (diff)
downloadgsoc2013-evolution-6a06e2ee66a6bcd538291c92bedc71de1a890f92.tar.gz
gsoc2013-evolution-6a06e2ee66a6bcd538291c92bedc71de1a890f92.tar.zst
gsoc2013-evolution-6a06e2ee66a6bcd538291c92bedc71de1a890f92.zip
recurrence expansion callback for free/busy (create_user_free_busy):
2001-11-11 JP Rosevear <jpr@ximian.com> * pcs/cal-backend-file.c (free_busy_instance): recurrence expansion callback for free/busy (create_user_free_busy): expand recurrences and use date/time values for dtstart and dtend svn path=/trunk/; revision=14670
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/pcs/cal-backend-file.c62
2 files changed, 51 insertions, 18 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 863403d649..6e809e8598 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,12 @@
2001-11-11 JP Rosevear <jpr@ximian.com>
+ * pcs/cal-backend-file.c (free_busy_instance): recurrence
+ expansion callback for free/busy
+ (create_user_free_busy): expand recurrences and use date/time
+ values for dtstart and dtend
+
+2001-11-11 JP Rosevear <jpr@ximian.com>
+
* gui/e-meeting-model.h: new protos
* gui/e-meeting-model.c (e_meeting_model_get_zone): accessor
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index f1480a4b1d..424912e87b 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -1217,6 +1217,36 @@ cal_backend_file_get_objects_in_range (CalBackend *backend, CalObjType type,
return event_list;
}
+static gboolean
+free_busy_instance (CalComponent *comp,
+ time_t instance_start,
+ time_t instance_end,
+ gpointer data)
+{
+ icalcomponent *vfb = data;
+ icalproperty *prop;
+ icalparameter *param;
+ struct icalperiodtype ipt;
+ icaltimezone *utc_zone;
+
+ utc_zone = icaltimezone_get_utc_timezone ();
+
+ ipt.start = icaltime_from_timet_with_zone (instance_start, FALSE, utc_zone);
+ ipt.end = icaltime_from_timet_with_zone (instance_end, FALSE, utc_zone);
+ ipt.duration = icaldurationtype_null_duration ();
+
+ /* add busy information to the vfb component */
+ prop = icalproperty_new (ICAL_FREEBUSY_PROPERTY);
+ icalproperty_set_freebusy (prop, ipt);
+
+ param = icalparameter_new_fbtype (ICAL_FBTYPE_BUSY);
+ icalproperty_add_parameter (prop, param);
+
+ icalcomponent_add_property (vfb, prop);
+
+ return TRUE;
+}
+
static icalcomponent *
create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *cn,
time_t start, time_t end)
@@ -1225,7 +1255,8 @@ create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *
GList *uids;
GList *l;
icalcomponent *vfb;
-
+ icaltimezone *utc_zone;
+
priv = cbfile->priv;
/* create the (unique) VFREEBUSY object that we'll return */
@@ -1242,8 +1273,9 @@ create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *
if (prop != NULL)
icalcomponent_add_property (vfb, prop);
}
- icalcomponent_set_dtstart (vfb, icaltime_from_timet (start, 1));
- icalcomponent_set_dtend (vfb, icaltime_from_timet (end, 1));
+ utc_zone = icaltimezone_get_utc_timezone ();
+ icalcomponent_set_dtstart (vfb, icaltime_from_timet_with_zone (start, FALSE, utc_zone));
+ icalcomponent_set_dtend (vfb, icaltime_from_timet_with_zone (end, FALSE, utc_zone));
/* add all objects in the given interval */
@@ -1251,10 +1283,8 @@ create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *
CALOBJ_TYPE_ANY, start, end);
for (l = uids; l != NULL; l = l->next) {
CalComponent *comp;
- icalcomponent *icalcomp;
- icalparameter *param;
+ icalcomponent *icalcomp, *vcalendar_comp;
icalproperty *prop;
- struct icalperiodtype ipt;
char *uid = (char *) l->data;
/* get the component from our internal list */
@@ -1276,18 +1306,14 @@ create_user_free_busy (CalBackendFile *cbfile, const char *address, const char *
continue;
}
- ipt.start = icalcomponent_get_dtstart (icalcomp);
- ipt.end = icalcomponent_get_dtend (icalcomp);
- ipt.duration = icalcomponent_get_duration (icalcomp);
-
- /* add busy information to the vfb component */
- prop = icalproperty_new (ICAL_FREEBUSY_PROPERTY);
- icalproperty_set_freebusy (prop, ipt);
-
- param = icalparameter_new_fbtype (ICAL_FBTYPE_BUSY);
- icalproperty_add_parameter (prop, param);
-
- icalcomponent_add_property (vfb, prop);
+ vcalendar_comp = icalcomponent_get_parent (icalcomp);
+ cal_recur_generate_instances (comp, start, end,
+ free_busy_instance,
+ vfb,
+ resolve_tzid,
+ vcalendar_comp,
+ priv->default_zone);
+
}
cal_obj_uid_list_free (uids);