- if (mode == MT_RFC822) {
- for (i = 0; i < 256; ++i) {
- if (TheMessage->cm_fields[i]) {
- mptr = mpptr = TheMessage->cm_fields[i];
-
- if (i == 'A') {
- safestrncpy(luser, mptr, sizeof luser);
- safestrncpy(suser, mptr, sizeof suser);
- }
- else if (i == 'Y') {
- if ((flags & QP_EADDR) != 0) {
- mptr = qp_encode_email_addrs(mptr);
- }
- sanitize_truncated_recipient(mptr);
- cprintf("CC: %s%s", mptr, nl);
- }
- else if (i == 'P') {
- cprintf("Return-Path: %s%s", mptr, nl);
- }
- else if (i == 'L') {
- cprintf("List-ID: %s%s", mptr, nl);
- }
- else if (i == 'V') {
- if ((flags & QP_EADDR) != 0)
- mptr = qp_encode_email_addrs(mptr);
- cprintf("Envelope-To: %s%s", mptr, nl);
- }
- else if (i == 'U') {
- cprintf("Subject: %s%s", mptr, nl);
- subject_found = 1;
- }
- else if (i == 'I')
- safestrncpy(mid, mptr, sizeof mid);
- else if (i == 'F')
- safestrncpy(fuser, mptr, sizeof fuser);
- /* else if (i == 'O')
- cprintf("X-Citadel-Room: %s%s",
- mptr, nl); */
- else if (i == 'N')
- safestrncpy(snode, mptr, sizeof snode);
- else if (i == 'R')
- {
- if (haschar(mptr, '@') == 0)
- {
- sanitize_truncated_recipient(mptr);
- cprintf("To: %s@%s", mptr, config.c_fqdn);
- cprintf("%s", nl);
- }
- else
- {
- if ((flags & QP_EADDR) != 0) {
- mptr = qp_encode_email_addrs(mptr);
- }
- sanitize_truncated_recipient(mptr);
- cprintf("To: %s", mptr);
- cprintf("%s", nl);
- }
- }
- else if (i == 'T') {
- datestring(datestamp, sizeof datestamp,
- atol(mptr), DATESTRING_RFC822);
- cprintf("Date: %s%s", datestamp, nl);
- }
- else if (i == 'W') {
- cprintf("References: ");
- k = num_tokens(mptr, '|');
- for (j=0; j<k; ++j) {
- extract_token(buf, mptr, j, '|', sizeof buf);
- cprintf("<%s>", buf);
- if (j == (k-1)) {
- cprintf("%s", nl);
- }
- else {
- cprintf(" ");
- }
- }
- }
- if (mptr != mpptr)
- free (mptr);
- }
- }
- if (subject_found == 0) {
- cprintf("Subject: (no subject)%s", nl);
- }
- }