* This file contains functions which handle all of the CalDAV "REPORT" queries
* specified in RFC4791 section 7.
*
* This file contains functions which handle all of the CalDAV "REPORT" queries
* specified in RFC4791 section 7.
*
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
int i;
// syslog(LOG_DEBUG, "CALDAV ELEMENT START: <%s> %d", el, crp->tag_nesting_level);
int i;
// syslog(LOG_DEBUG, "CALDAV ELEMENT START: <%s> %d", el, crp->tag_nesting_level);
- for (i=0; attr[i] != NULL; i+=2) {
- syslog(LOG_DEBUG, " Attribute '%s' = '%s'", attr[i], attr[i+1]);
+ for (i = 0; attr[i] != NULL; i += 2) {
+ syslog(LOG_DEBUG, " Attribute '%s' = '%s'", attr[i], attr[i + 1]);
}
// syslog(LOG_DEBUG, "CALDAV ELEMENT END : <%s> %d", el, crp->tag_nesting_level);
}
// syslog(LOG_DEBUG, "CALDAV ELEMENT END : <%s> %d", el, crp->tag_nesting_level);
- if ( (!strcasecmp(el, "DAV::href")) || (!strcasecmp(el, "DAV:href")) ) {
- if (crp->Hrefs == NULL) { // append crp->Chardata to crp->Hrefs
+ if ((!strcasecmp(el, "DAV::href")) || (!strcasecmp(el, "DAV:href"))) {
+ if (crp->Hrefs == NULL) { // append crp->Chardata to crp->Hrefs
StrBufAppendBufPlain(crp->Hrefs, HKEY("|"), 0);
}
StrBufAppendBuf(crp->Hrefs, crp->Chardata, 0);
}
StrBufAppendBufPlain(crp->Hrefs, HKEY("|"), 0);
}
StrBufAppendBuf(crp->Hrefs, crp->Chardata, 0);
}
- if (crp->Chardata != NULL) { // Tag is closed; chardata is now out of scope.
- FreeStrBuf(&crp->Chardata); // Free the buffer.
+ if (crp->Chardata != NULL) { // Tag is closed; chardata is now out of scope.
+ FreeStrBuf(&crp->Chardata); // Free the buffer.
* NOTE: this function expects that "MSGP text/calendar" was issued at the beginning
* of a REPORT operation to set our preferred MIME type to calendar data.
*/
* NOTE: this function expects that "MSGP text/calendar" was issued at the beginning
* of a REPORT operation to set our preferred MIME type to calendar data.
*/
}
while (ctdl_readline(c, buf, sizeof(buf)), strcmp(buf, "000")) {
}
while (ctdl_readline(c, buf, sizeof(buf)), strcmp(buf, "000")) {
* Called by caldav_report() to output a single item.
* Our policy is to throw away the list of properties the client asked for, and just send everything.
*/
* Called by caldav_report() to output a single item.
* Our policy is to throw away the list of properties the client asked for, and just send everything.
*/
-caldav_response(struct http_transaction *h, struct ctdlsession *c, StrBuf *ReportOut, StrBuf *ThisHref)
+void caldav_response(struct http_transaction *h, struct ctdlsession *c, StrBuf * ReportOut, StrBuf * ThisHref)
unescape_input(unescaped_euid);
StrBufAppendPrintf(ReportOut, "<D:response>");
unescape_input(unescaped_euid);
StrBufAppendPrintf(ReportOut, "<D:response>");
- StrBufAppendPrintf(ReportOut, "<D:href>");
- StrBufXMLEscAppend(ReportOut, ThisHref, NULL, 0, 0);
- StrBufAppendPrintf(ReportOut, "</D:href>");
- StrBufAppendPrintf(ReportOut, "<D:propstat>");
+ StrBufAppendPrintf(ReportOut, "<D:href>");
+ StrBufXMLEscAppend(ReportOut, ThisHref, NULL, 0, 0);
+ StrBufAppendPrintf(ReportOut, "</D:href>");
+ StrBufAppendPrintf(ReportOut, "<D:propstat>");
- StrBufAppendPrintf(ReportOut, "<D:status>");
- StrBufAppendPrintf(ReportOut, "HTTP/1.1 200 OK");
- StrBufAppendPrintf(ReportOut, "</D:status>");
- StrBufAppendPrintf(ReportOut, "<D:prop>");
- StrBufAppendPrintf(ReportOut, "<D:getetag>");
- StrBufAppendPrintf(ReportOut, "%ld", msgnum);
- StrBufAppendPrintf(ReportOut, "</D:getetag>");
- StrBufAppendPrintf(ReportOut, "<C:calendar-data>");
- StrBufXMLEscAppend(ReportOut, Caldata, NULL, 0, 0);
- StrBufAppendPrintf(ReportOut, "</C:calendar-data>");
- StrBufAppendPrintf(ReportOut, "</D:prop>");
+ StrBufAppendPrintf(ReportOut, "<D:status>");
+ StrBufAppendPrintf(ReportOut, "HTTP/1.1 200 OK");
+ StrBufAppendPrintf(ReportOut, "</D:status>");
+ StrBufAppendPrintf(ReportOut, "<D:prop>");
+ StrBufAppendPrintf(ReportOut, "<D:getetag>");
+ StrBufAppendPrintf(ReportOut, "%ld", msgnum);
+ StrBufAppendPrintf(ReportOut, "</D:getetag>");
+ StrBufAppendPrintf(ReportOut, "<C:calendar-data>");
+ StrBufXMLEscAppend(ReportOut, Caldata, NULL, 0, 0);
+ StrBufAppendPrintf(ReportOut, "</C:calendar-data>");
+ StrBufAppendPrintf(ReportOut, "</D:prop>");
- StrBufAppendPrintf(ReportOut, "<D:status>");
- StrBufAppendPrintf(ReportOut, "HTTP/1.1 404 not found");
- StrBufAppendPrintf(ReportOut, "</D:status>");
+ StrBufAppendPrintf(ReportOut, "<D:status>");
+ StrBufAppendPrintf(ReportOut, "HTTP/1.1 404 not found");
+ StrBufAppendPrintf(ReportOut, "</D:status>");
XML_SetElementHandler(xp, caldav_xml_start, caldav_xml_end);
XML_SetCharacterDataHandler(xp, caldav_xml_chardata);
XML_SetUserData(xp, &crp);
XML_SetElementHandler(xp, caldav_xml_start, caldav_xml_end);
XML_SetCharacterDataHandler(xp, caldav_xml_chardata);
XML_SetUserData(xp, &crp);
XML_Parse(xp, h->request_body, h->request_body_length, 1);
XML_ParserFree(xp);
XML_Parse(xp, h->request_body, h->request_body_length, 1);
XML_ParserFree(xp);
syslog(LOG_DEBUG, "CalDAV REPORT type is: %d", crp.report_type);
StrBuf *ReportOut = NewStrBuf();
StrBufAppendPrintf(ReportOut, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
syslog(LOG_DEBUG, "CalDAV REPORT type is: %d", crp.report_type);
StrBuf *ReportOut = NewStrBuf();
StrBufAppendPrintf(ReportOut, "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
StrBuf *ThisHref = NewStrBuf();
const char *pvset = NULL;
while (StrBufExtract_NextToken(ThisHref, crp.Hrefs, &pvset, '|') >= 0) {
StrBuf *ThisHref = NewStrBuf();
const char *pvset = NULL;
while (StrBufExtract_NextToken(ThisHref, crp.Hrefs, &pvset, '|') >= 0) {