projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6024050
)
* More cleanup prep for freebusy overhaul
author
Art Cancro
<ajc@citadel.org>
Mon, 29 Dec 2008 16:59:57 +0000
(16:59 +0000)
committer
Art Cancro
<ajc@citadel.org>
Mon, 29 Dec 2008 16:59:57 +0000
(16:59 +0000)
citadel/modules/calendar/serv_calendar.c
patch
|
blob
|
history
diff --git
a/citadel/modules/calendar/serv_calendar.c
b/citadel/modules/calendar/serv_calendar.c
index 432f9d51b2d64efd8f1736975c7dd94d7b3dc726..d5df3a666195ea92aa759bd84cf7de55a3e53615 100644
(file)
--- a/
citadel/modules/calendar/serv_calendar.c
+++ b/
citadel/modules/calendar/serv_calendar.c
@@
-316,7
+316,8
@@
void ical_send_a_reply(icalcomponent *request, char *action) {
/*
* Callback function for mime parser that hunts for calendar content types
/*
* Callback function for mime parser that hunts for calendar content types
- * and turns them into calendar objects
+ * and turns them into calendar objects. If something is found, it is placed
+ * in ird->cal, and the caller now owns that memory and is responsible for freeing it.
*/
void ical_locate_part(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
*/
void ical_locate_part(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset, size_t length, char *encoding,
@@
-1229,12
+1230,12
@@
void ical_conflicts(long msgnum, char *partnum) {
void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal, icalcomponent *cal) {
icalproperty *p;
icalvalue *v;
void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal, icalcomponent *cal) {
icalproperty *p;
icalvalue *v;
- struct icalperiodtype
my
_period;
+ struct icalperiodtype
this_event
_period;
if (!top_level_cal) return;
if (!cal) cal = top_level_cal;
if (!top_level_cal) return;
if (!cal) cal = top_level_cal;
-
my
_period = icalperiodtype_null_period();
+
this_event
_period = icalperiodtype_null_period();
/* Convert all time zones to UTC (FIXME this won't work with recurring events) */
if (icalcomponent_isa(cal) != ICAL_VCALENDAR_COMPONENT) {
/* Convert all time zones to UTC (FIXME this won't work with recurring events) */
if (icalcomponent_isa(cal) != ICAL_VCALENDAR_COMPONENT) {
@@
-1267,17
+1268,17
@@
void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal, icalc
/* Convert the DTSTART and DTEND properties to an icalperiod. */
p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY);
if (p != NULL) {
/* Convert the DTSTART and DTEND properties to an icalperiod. */
p = icalcomponent_get_first_property(cal, ICAL_DTSTART_PROPERTY);
if (p != NULL) {
-
my
_period.start = icalproperty_get_dtstart(p);
+
this_event
_period.start = icalproperty_get_dtstart(p);
}
p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY);
if (p != NULL) {
}
p = icalcomponent_get_first_property(cal, ICAL_DTEND_PROPERTY);
if (p != NULL) {
-
my
_period.end = icalproperty_get_dtstart(p);
+
this_event
_period.end = icalproperty_get_dtstart(p);
}
/* Now add it. */
icalcomponent_add_property(fb,
}
/* Now add it. */
icalcomponent_add_property(fb,
- icalproperty_new_freebusy(
my
_period)
+ icalproperty_new_freebusy(
this_event
_period)
);
/* Make sure the DTSTART property of the freebusy *list* is set to
);
/* Make sure the DTSTART property of the freebusy *list* is set to
@@
-1329,11
+1330,11
@@
void ical_add_to_freebusy(icalcomponent *fb, icalcomponent *top_level_cal, icalc
*
*/
void ical_freebusy_backend(long msgnum, void *data) {
*
*/
void ical_freebusy_backend(long msgnum, void *data) {
- icalcomponent *
cal
;
+ icalcomponent *
fb
;
struct CtdlMessage *msg = NULL;
struct ical_respond_data ird;
struct CtdlMessage *msg = NULL;
struct ical_respond_data ird;
- cal = (icalcomponent *)data;
+ fb = (icalcomponent *)data; /* User-supplied data will be the VFREEBUSY component */
msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) return;
@@
-1348,12
+1349,10
@@
void ical_freebusy_backend(long msgnum, void *data) {
);
CtdlFreeMessage(msg);
);
CtdlFreeMessage(msg);
- if (ird.cal == NULL) return;
-
- ical_add_to_freebusy(cal, ird.cal, NULL);
-
- /* Now free the memory. */
- icalcomponent_free(ird.cal);
+ if (ird.cal) {
+ ical_add_to_freebusy(fb, ird.cal, NULL); /* Add VEVENT times to VFREEBUSY */
+ icalcomponent_free(ird.cal);
+ }
}
}