int format_type = 0;
int nhdr = 0;
int bq = 0;
+ char vcard_partnum[SIZ];
+ char *vcard_source = NULL;
strcpy(from, "");
strcpy(node, "");
strcpy(rfca, "");
strcpy(reply_to, "");
+ strcpy(vcard_partnum, "");
sprintf(buf, "MSG0 %ld", msgnum);
serv_puts(buf);
msgnum, mime_partnum);
}
+ if (!strcasecmp(mime_content_type, "text/x-vcard")) {
+ strcpy(vcard_partnum, mime_partnum);
+ }
+
}
}
wprintf("%s", mime_http);
free(mime_http);
}
+
+ if (strlen(vcard_partnum) > 0) {
+ vcard_source = load_mimepart(msgnum, vcard_partnum);
+ if (vcard_source != NULL) {
+ wprintf("vcard object length = %d<BR>\n",
+ strlen(vcard_source));
+ free(vcard_source);
+ }
+ }
+
}
#include <pthread.h>
#include <signal.h>
#include "webcit.h"
-#include "webserver.h"
#include "mime_parser.h"
/*
fstat(fileno(fp), &statbuf);
bytes = statbuf.st_size;
- lprintf(5, "Static: %s, %ld bytes\n", what, bytes);
+ fprintf(stderr, "Static: %s, %ld bytes\n", what, bytes);
wprintf("Content-length: %ld\n", (long) bytes);
wprintf("\n");
bigbuffer = malloc(bytes);
}
+/*
+ */
+char *load_mimepart(long msgnum, char *partnum)
+{
+ char buf[SIZ];
+ off_t bytes;
+ off_t thisblock;
+ off_t accomplished = 0L;
+ char content_type[SIZ];
+ char *content;
+
+ serv_printf("OPNA %ld|%s", msgnum, partnum);
+ serv_gets(buf);
+ if (buf[0] == '2') {
+ bytes = extract_long(&buf[4], 0);
+ extract(content_type, &buf[4], 3);
+
+ content = malloc(bytes + 1);
+
+ while (bytes > (off_t) 0) {
+ thisblock = bytes;
+ if (thisblock > 4096L) {
+ thisblock = 4096L;
+ }
+ if (thisblock > bytes) {
+ thisblock = bytes;
+ }
+ serv_printf("READ %ld|%ld", accomplished, thisblock);
+ serv_gets(buf);
+ if (buf[0] == '6') {
+ thisblock = extract_long(&buf[4], 0);
+ serv_read(&content[accomplished], (int) thisblock);
+ }
+ else {
+ memset(&content[accomplished], 0, thisblock);
+ }
+ bytes = bytes - thisblock;
+ accomplished = accomplished + thisblock;
+ }
+ serv_puts("CLOS");
+ serv_gets(buf);
+ content[accomplished] = 0; /* null terminate for good measure */
+ return(content);
+ }
+ else {
+ return(NULL);
+ }
+
+}
+
+
/*
* Convenience functions to display a page containing only a string
*/
char *encoding, void *userdata)
{
- lprintf(9, "UPLOAD HANDLER CALLED\n");
- lprintf(9, " name = %s\n", name);
- lprintf(9, "filename = %s\n", filename);
- lprintf(9, "encoding = %s\n", encoding);
- lprintf(9, " type = %s\n", cbtype);
- lprintf(9, " length = %ld\n", (long)length);
+ fprintf(stderr, "UPLOAD HANDLER CALLED\n");
+ fprintf(stderr, " name = %s\n", name);
+ fprintf(stderr, "filename = %s\n", filename);
+ fprintf(stderr, "encoding = %s\n", encoding);
+ fprintf(stderr, " type = %s\n", cbtype);
+ fprintf(stderr, " length = %ld\n", (long)length);
if (length > 0) {
WC->upload = malloc(length);
memcpy(WC->upload, content, length);
}
else {
- lprintf(1, "malloc() failed: %s\n",
+ fprintf(stderr, "malloc() failed: %s\n",
strerror(errno));
}
}
}
if (ContentLength > 0) {
- lprintf(5, "Content length: %d\n", ContentLength);
+ fprintf(stderr, "Content length: %d\n", ContentLength);
content = malloc(ContentLength + 1);
memset(content, 0, ContentLength+1);
BytesRead = 0;