- if (!strncmp(buf,"Subject: ",9)) strcpy(subject,&buf[9]);
- if (!strncmp(buf,"Date: ",6)) now = conv_date(&buf[6]);
- if (!strncmp(buf,"From: ",6)) strcpy(from, &buf[6]);
- } while ( (strcmp(buf, ".")) && (strcmp(buf, "")) );
-
- process_rfc822_addr(from, userbuf, nodebuf, frombuf);
-
- /* now convert it to Citadel format */
- fprintf(temp,"P%s@%s%c", userbuf, nodebuf, 0);
- fprintf(temp,"E%s%c", userbuf, 0);
- fprintf(temp,"T%ld%c", now, 0);
- fprintf(temp,"A%s%c", frombuf, 0);
- fprintf(temp,"OMail%c", 0);
- fprintf(temp,"N%s%c", nodebuf, 0);
- if (dtype==REMOTE) {
- fprintf(temp,"D%s%c", destsys, 0);
- }
- fprintf(temp,"R%s%c", recp, 0);
- if (strlen(subject)>0) {
- fprintf(temp,"U%s%c", subject, 0);
+ if (!strncasecmp(buf, "Subject: ", 9))
+ strcpy(subject, &buf[9]);
+ else if (!strncasecmp(buf, "Date: ", 6)) {
+ now = parsedate(&buf[6]);
+ if (now < 0L) now = time(NULL);
+ }
+ else if (!strncasecmp(buf, "From: ", 6))
+ strcpy(from, &buf[6]);
+ else if (!strncasecmp(buf, "Content-type: ", 14))
+ strcpy(content_type, &buf[14]);
+ else if (!strncasecmp(buf, "From ", 5)) { /* ignore */
+ } else {
+ if (extra_headers == NULL) {
+ extra_headers = malloc(strlen(buf) + 2);
+ strcpy(extra_headers, "");
+ } else {
+ extra_headers = realloc(extra_headers,
+ (strlen(extra_headers) + strlen(buf) + 2));
+ }
+ strcat(extra_headers, buf);
+ strcat(extra_headers, "\n");