$Log$
+Revision 523.1 2004/08/31 20:31:01 ajc
+* When saving VTODO (tasks), insert a UID if none is already present. Also
+ increment the sequence, or insert one if none is already present.
+
Revision 523.0 2004/08/31 03:02:37 ajc
* THIS IS 5.23
1998-12-03 Nathan Bryant <bryant@cs.usm.maine.edu>
* webserver.c: warning fix
+
icalproperty *prop;
icalcomponent *vtodo;
int created_new_vtodo = 0;
+ int i;
+ int sequence = 0;
if (supplied_vtodo != NULL) {
vtodo = supplied_vtodo;
icaltime_from_webform("due")
)
);
+
+ /* Give this task a UID if it doesn't have one. */
+ lprintf(9, "Give this task a UID if it doesn't have one.\n");
+ if (icalcomponent_get_first_property(vtodo,
+ ICAL_UID_PROPERTY) == NULL) {
+ generate_new_uid(buf);
+ icalcomponent_add_property(vtodo,
+ icalproperty_new_uid(buf)
+ );
+ }
+
+ /* Increment the sequence ID */
+ lprintf(9, "Increment the sequence ID\n");
+ while (prop = icalcomponent_get_first_property(vtodo,
+ ICAL_SEQUENCE_PROPERTY), (prop != NULL) ) {
+ i = icalproperty_get_sequence(prop);
+ lprintf(9, "Sequence was %d\n", i);
+ if (i > sequence) sequence = i;
+ icalcomponent_remove_property(vtodo, prop);
+ icalproperty_free(prop);
+ }
+ ++sequence;
+ lprintf(9, "New sequence is %d. Adding...\n", sequence);
+ icalcomponent_add_property(vtodo,
+ icalproperty_new_sequence(sequence)
+ );
+
/* Serialize it and save it to the message base */
serv_puts("ENT0 1|||4");