$Log$
+ Revision 605.12 2003/03/10 05:38:21 ajc
+ * Tweaks to msgbase.c and imap_fetch.c to fix slightly incorrect byte counts
+ reported in the numerous variations of IMAP FETCH. This silences a number of
+ error messages reported by Pine.
+
Revision 605.11 2003/03/10 03:40:08 ajc
* Fixed bug that caused segv when <R>eplying to certain messages
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
-
fflush(fp);
ftruncate(fileno(fp), ftell(fp));
fflush(fp);
- fprintf(fp, "\r\n"); /* add the trailing newline */
rewind(fp);
phree(which_fields);
phree(boiled_headers);
imap_strip_headers(tmp, section);
}
+ /*
+ * Strip it down if the client asked for everything _except_ headers.
+ */
+ else if (!strncasecmp(section, "TEXT", 4)) {
+ CtdlRedirectOutput(tmp, -1);
+ CtdlOutputPreLoadedMsg(msg, msgnum, MT_RFC822,
+ HEADERS_NONE, 0, 1);
+ CtdlRedirectOutput(NULL, -1);
+ }
+
/*
* Anything else must be a part specifier.
* (Note value of 1 passed as 'dont_decode' so client gets it encoded)
FILE *tmp;
char buf[1024];
long lines = 0L;
- long bytes = 0L;
+ long start_of_body = 0L;
+ long body_bytes = 0L;
/* For non-RFC822 (ordinary Citadel) messages, this is short and
* sweet...
CtdlRedirectOutput(NULL, -1);
rewind(tmp);
- while (fgets(buf, sizeof buf, tmp) != NULL) ++lines;
- bytes = ftell(tmp);
+ while (fgets(buf, sizeof buf, tmp) != NULL) {
+ ++lines;
+ if ((!strcmp(buf, "\r\n")) && (start_of_body == 0L)) {
+ start_of_body = ftell(tmp);
+ }
+ }
+ body_bytes = ftell(tmp) - start_of_body;
fclose(tmp);
cprintf("BODYSTRUCTURE (\"TEXT\" \"PLAIN\" "
"(\"CHARSET\" \"US-ASCII\") NIL NIL "
- "\"7BIT\" %ld %ld)", bytes, lines);
+ "\"7BIT\" %ld %ld)", body_bytes, lines);
return;
}
char *mptr;
char *nl; /* newline string */
int suppress_f = 0;
+ int subject_found = 0;
/* buffers needed for RFC822 translation */
char suser[SIZ];
cprintf("Path: %s%s", mptr, nl);
}
****/
- else if (i == 'U')
+ 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 == 'H')
}
}
}
+ if (subject_found == 0) {
+ cprintf("Subject: (no subject)%s", nl);
+ }
}
for (i=0; i<strlen(suser); ++i) {
}
cprintf("Organization: %s%s", lnode, nl);
+
+ /* Blank line signifying RFC822 end-of-headers */
+ cprintf("%s", nl);
}
/* end header processing loop ... at this point, we're in the text */
if ( (mode == MT_CITADEL) || (mode == MT_MIME) ) {
if (do_proto) cprintf("text\n");
}
- if (mode == MT_RFC822) {
- if (TheMessage->cm_fields['U'] == NULL) {
- cprintf("Subject: (no subject)%s", nl);
- }
- cprintf("%s", nl);
- }
/* If the format type on disk is 1 (fixed-format), then we want
* everything to be output completely literally ... regardless of
err_printf("Can't save config - out of memory!\n");
logoff(ipc, 1);
}
- for (i = 0; i < num_recs; i++) {
+ if (num_recs) for (i = 0; i < num_recs; i++) {
strcat(resp, recs[i]);
strcat(resp, "\n");
}
/* ********** Important fields */
/* *************** Semi-important fields */
/* * Message text (MUST be last) */
-#define FORDER "IPTAFONHRDBCEGJKLQSUVWXYZM"
+#define FORDER "IPTAFONHRDBCEGJKLQSVWXYZUM"
#endif /* SERVER_H */