#include "webcit.h"
#include "webserver.h"
#include "groupdav.h"
-#include "mime_parser.h"
/*
serv_puts("ICAL getics");
serv_getln(buf, sizeof buf);
if (buf[0] != '1') {
- wprintf("HTTP/1.1 404 not found\r\n");
+ hprintf("HTTP/1.1 404 not found\r\n");
groupdav_common_headers();
- wprintf(
- "Content-Type: text/plain\r\n"
- "\r\n"
- "%s\r\n",
+ hprintf("Content-Type: text/plain\r\n");
+ wprintf("%s\r\n",
&buf[4]
- );
+ );/// TODO: do we need to end-burst here?
return;
}
- wprintf("HTTP/1.1 200 OK\r\n");
+ hprintf("HTTP/1.1 200 OK\r\n");
groupdav_common_headers();
- wprintf("Content-type: text/calendar; charset=UTF-8\r\n");
+ hprintf("Content-type: text/calendar; charset=UTF-8\r\n");
begin_burst();
while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
wprintf("%s\r\n", buf);
*/
void extract_preferred(char *name, char *filename, char *partnum, char *disp,
void *content, char *cbtype, char *cbcharset,
- size_t length, char *encoding, void *userdata)
+ size_t length, char *encoding, char *cbid, void *userdata)
{
struct epdata *epdata = (struct epdata *)userdata;
int hit = 0;
if (!IsEmptyStr(cbcharset)) {
safestrncpy(epdata->charset, cbcharset, sizeof epdata->charset);
}
- wprintf("Content-type: %s; charset=%s\r\n", cbtype, epdata->charset);
+ hprintf("Content-type: %s; charset=%s\r\n", cbtype, epdata->charset);
begin_burst();
- client_write(content, length);
+ StrBufAppendBufPlain(WC->WBuf, content, length, 0);
end_burst();
}
}
* /groupdav/room_name/euid (GroupDAV)
* /groupdav/room_name (webcal)
*/
-void groupdav_get(char *dav_pathname) {
+void groupdav_get(const char *dav_pathname) {
char dav_roomname[1024];
char dav_uid[1024];
long dav_msgnum = (-1);
struct epdata epdata;
if (num_tokens(dav_pathname, '/') < 3) {
- wprintf("HTTP/1.1 404 not found\r\n");
+ hprintf("HTTP/1.1 404 not found\r\n");
groupdav_common_headers();
- wprintf(
- "Content-Type: text/plain\r\n"
- "\r\n"
- "The object you requested was not found.\r\n"
- );
+ hprintf("Content-Type: text/plain\r\n");
+ wprintf("The object you requested was not found.\r\n");
+ end_burst();
return;
}
gotoroom(dav_roomname);
}
if (strcasecmp(WC->wc_roomname, dav_roomname)) {
- wprintf("HTTP/1.1 404 not found\r\n");
+ hprintf("HTTP/1.1 404 not found\r\n");
groupdav_common_headers();
- wprintf(
- "Content-Type: text/plain\r\n"
- "\r\n"
- "There is no folder called \"%s\" on this server.\r\n",
- dav_roomname
- );
+ hprintf("Content-Type: text/plain\r\n");
+ wprintf("There is no folder called \"%s\" on this server.\r\n",
+ dav_roomname);
+ end_burst();
return;
}
serv_printf("MSG2 %ld", dav_msgnum);
serv_getln(buf, sizeof buf);
if (buf[0] != '1') {
- wprintf("HTTP/1.1 404 not found\r\n");
+ hprintf("HTTP/1.1 404 not found\r\n");
groupdav_common_headers();
- wprintf(
- "Content-Type: text/plain\r\n"
- "\r\n"
- "Object \"%s\" was not found in the \"%s\" folder.\r\n",
+ hprintf("Content-Type: text/plain\r\n");
+ wprintf("Object \"%s\" was not found in the \"%s\" folder.\r\n",
dav_uid,
- dav_roomname
- );
+ dav_roomname);
+ end_burst();
return;
}
/* Output headers common to single or multi part messages */
- wprintf("HTTP/1.1 200 OK\r\n");
+ hprintf("HTTP/1.1 200 OK\r\n");
groupdav_common_headers();
- wprintf("etag: \"%ld\"\r\n", dav_msgnum);
- wprintf("Date: %s\r\n", date);
+ hprintf("etag: \"%ld\"\r\n", dav_msgnum);
+ hprintf("Date: %s\r\n", date);
memset(&epdata, 0, sizeof(struct epdata));
safestrncpy(epdata.charset, charset, sizeof epdata.charset);
ptr = msgtext;
endptr = &msgtext[msglen];
- wprintf("Content-type: %s; charset=%s\r\n", content_type, charset);
+ hprintf("Content-type: %s; charset=%s\r\n", content_type, charset);
in_body = 0;
do {