#include "webcit.h"
#include "webserver.h"
-#ifndef HAVE_ICAL_H
+#ifndef WEBCIT_WITH_CALENDAR_SERVICE
/*
* Handler stubs for builds with no calendar library available
"</i><br>\n");
}
-#else /* HAVE_ICAL_H */
+#else /* WEBCIT_WITH_CALENDAR_SERVICE */
/****** End of handler stubs. Everything below this line is real. ******/
/*
* Process a calendar object
* ...at this point it's already been deserialized by cal_process_attachment()
+ *
*/
void cal_process_object(icalcomponent *cal,
int recursion_level,
"<IMG ALIGN=CENTER "
"SRC=\"/static/vcalendar.gif\">"
" "
- "<B>Meeting invitation</B>
- </TD></TR>\n"
+ "<B>Meeting invitation</B>"
+ "</TD></TR>\n"
);
break;
case ICAL_METHOD_REPLY:
"<IMG ALIGN=CENTER "
"SRC=\"/static/vcalendar.gif\">"
" "
- "<B>Attendee's reply to your invitation</B>
- </TD></TR>\n"
+ "<B>Attendee's reply to your invitation</B>"
+ "</TD></TR>\n"
);
break;
case ICAL_METHOD_PUBLISH:
"<IMG ALIGN=CENTER "
"SRC=\"/static/vcalendar.gif\">"
" "
- "<B>Published event</B>
- </TD></TR>\n"
+ "<B>Published event</B>"
+ "</TD></TR>\n"
);
break;
default:
wprintf("<TR><TD><B>Attendee:</B></TD><TD>");
strcpy(buf, icalproperty_get_attendee(p));
if (!strncasecmp(buf, "MAILTO:", 7)) {
+
+ /* screen name or email address */
strcpy(buf, &buf[7]);
striplt(buf);
escputs(buf);
+ wprintf(" ");
+
+ /* participant status */
+ partstat_as_string(buf, p);
+ escputs(buf);
}
- /* FIXME add status */
wprintf("</TD></TR>\n");
}
output_headers(3);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
- "<FONT SIZE=+1 COLOR=\"FFFFFF\""
- "<B>Respond to meeting request</B>"
- "</FONT></TD></TR></TABLE><BR>\n"
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+ "<SPAN CLASS=\"titlebar\">Respond to meeting request</SPAN>"
+ "</TD></TR></TABLE><BR>\n"
);
serv_printf("ICAL respond|%s|%s|%s|",
output_headers(3);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
- "<FONT SIZE=+1 COLOR=\"FFFFFF\""
- "<B>Update your calendar with this RSVP</B>"
- "</FONT></TD></TR></TABLE><BR>\n"
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+ "<SPAN CLASS=\"titlebar\">"
+ "Update your calendar with this RSVP</SPAN>"
+ "</TD></TR></TABLE><BR>\n"
);
serv_printf("ICAL handle_rsvp|%s|%s|%s|",
icalproperty *p;
p = icalcomponent_get_first_property(vtodo, ICAL_SUMMARY_PROPERTY);
- wprintf("<LI><A HREF=\"/display_edit_task?msgnum=%ld\">", msgnum);
+ wprintf("<A HREF=\"/display_edit_task?msgnum=%ld&taskrm=", msgnum);
+ urlescputs(WC->wc_roomname);
+ wprintf("\">");
if (p != NULL) {
escputs((char *)icalproperty_get_comment(p));
}
- wprintf("</A>\n");
+ wprintf("</A><BR>\n");
}
/*
* Display a task by itself (for editing)
+ *
*/
void display_edit_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
icalcomponent *vtodo;
if (supplied_vtodo != NULL) {
vtodo = supplied_vtodo;
+
+ /* If we're looking at a fully encapsulated VCALENDAR
+ * rather than a VTODO component, attempt to use the first
+ * relevant VTODO subcomponent. If there is none, the
+ * NULL returned by icalcomponent_get_first_component() will
+ * tell the next iteration of this function to create a
+ * new one.
+ */
+ if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
+ display_edit_individual_task(
+ icalcomponent_get_first_component(
+ vtodo, ICAL_VTODO_COMPONENT
+ ), msgnum
+ );
+ return;
+ }
}
else {
vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT);
}
output_headers(3);
- wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=007700><TR><TD>"
- "<FONT SIZE=+1 COLOR=\"FFFFFF\""
- "<B>Edit task</B>"
- "</FONT></TD></TR></TABLE><BR>\n"
+ wprintf("<TABLE WIDTH=100%% BORDER=0 BGCOLOR=\"#444455\"><TR><TD>"
+ "<SPAN CLASS=\"titlebar\">Edit task</SPAN>"
+ "</TD></TR></TABLE><BR>\n"
);
wprintf("<FORM METHOD=\"POST\" ACTION=\"/save_task\">\n");
/*
* Save an edited task
+ *
*/
void save_individual_task(icalcomponent *supplied_vtodo, long msgnum) {
char buf[SIZ];
if (supplied_vtodo != NULL) {
vtodo = supplied_vtodo;
+ /* If we're looking at a fully encapsulated VCALENDAR
+ * rather than a VTODO component, attempt to use the first
+ * relevant VTODO subcomponent. If there is none, the
+ * NULL returned by icalcomponent_get_first_component() will
+ * tell the next iteration of this function to create a
+ * new one.
+ */
+ if (icalcomponent_isa(vtodo) == ICAL_VCALENDAR_COMPONENT) {
+ save_individual_task(
+ icalcomponent_get_first_component(
+ vtodo, ICAL_VTODO_COMPONENT
+ ), msgnum
+ );
+ return;
+ }
}
else {
vtodo = icalcomponent_new(ICAL_VTODO_COMPONENT);
* type, we load the message and hunt for that MIME type. If found, we load
* the relevant part, deserialize it into a libical component, filter it for
* the requested object type, and feed it to the specified handler.
+ *
*/
void display_using_handler(long msgnum,
char *mimetype,
void display_edit_task(void) {
long msgnum = 0L;
+ /* Force change the room if we have to */
+ if (strlen(bstr("taskrm")) > 0) {
+ gotoroom(bstr("taskrm"), 0);
+ }
+
msgnum = atol(bstr("msgnum"));
if (msgnum > 0L) {
/* existing task */
}
}
-#endif /* HAVE_ICAL_H */
+
+
+
+
+/*
+ * freebusy display (for client software)
+ */
+void do_freebusy(char *req) {
+ char who[SIZ];
+ char buf[SIZ];
+ char *fb;
+
+ extract_token(who, req, 1, ' ');
+ if (!strncasecmp(who, "/freebusy/", 10)) {
+ strcpy(who, &who[10]);
+ }
+ unescape_input(who);
+
+ if ( (!strcasecmp(&who[strlen(who)-4], ".vcf"))
+ || (!strcasecmp(&who[strlen(who)-4], ".vfb")) ) {
+ who[strlen(who)-4] = 0;
+ }
+
+ lprintf(9, "freebusy requested for <%s>\n", who);
+ serv_printf("ICAL freebusy|%s", who);
+ serv_gets(buf);
+
+ if (buf[0] != '1') {
+ wprintf("HTTP/1.0 404 %s\n", &buf[4]);
+ output_headers(0);
+ wprintf("Content-Type: text/plain\n");
+ wprintf("\n");
+ wprintf("%s\n", &buf[4]);
+ return;
+ }
+
+ fb = read_server_text();
+ http_transmit_thing(fb, strlen(fb), "text/calendar", 0);
+ free(fb);
+}
+
+
+
+#endif /* WEBCIT_WITH_CALENDAR_SERVICE */