#include "tools.h"
#include "mime_parser.h"
#include "html.h"
+#include "genstamp.h"
#define desired_section ((char *)CtdlGetUserData(SYM_DESIRED_SECTION))
#define ma ((struct ma_info *)CtdlGetUserData(SYM_MA_INFO))
if (is_valid_message(msg) == 0) return;
for (i = 0; i < 256; ++i)
- if (msg->cm_fields[i] != NULL)
+ if (msg->cm_fields[i] != NULL) {
+ lprintf(9, "phreeing %c\n", i);
phree(msg->cm_fields[i]);
+ }
msg->cm_magic = 0; /* just in case */
+ lprintf(9, "phreeing msg\n");
phree(msg);
}
int do_proto, /* do Citadel protocol responses? */
int crlf /* Use CRLF newlines instead of LF? */
) {
- int a, i, k;
+ int i, k;
char buf[1024];
- time_t xtime;
CIT_UBYTE ch;
char allkeys[256];
char display_name[256];
char snode[256];
char lnode[256];
char mid[256];
+ char datestamp[256];
/* */
lprintf(7, "CtdlOutputMsg() msgnum=%ld, mode=%d\n",
if (i == 'A') {
strcpy(luser, mptr);
- } else if (i == 'P') {
- cprintf("Path: %s%s", mptr, nl);
- for (a = 0; a < strlen(mptr); ++a) {
- if (mptr[a] == '!') {
- strcpy(mptr, &mptr[a + 1]);
- a = 0;
- }
- }
strcpy(suser, mptr);
- } else if (i == 'U')
+ }
+ else if (i == 'P') {
+ cprintf("Path: %s%s", mptr, nl);
+ }
+ else if (i == 'U')
cprintf("Subject: %s%s", mptr, nl);
else if (i == 'I')
strcpy(mid, mptr);
else if (i == 'R')
cprintf("To: %s%s", mptr, nl);
else if (i == 'T') {
- xtime = atol(mptr);
- cprintf("Date: %s", asctime(localtime(&xtime)));
+ generate_rfc822_datestamp(datestamp,
+ atol(mptr) );
+ cprintf("Date: %s%s", datestamp, nl);
}
}
}
}
+ for (i=0; i<strlen(suser); ++i) {
+ suser[i] = tolower(suser[i]);
+ if (!isalnum(suser[i])) suser[i]='_';
+ }
+
if (mode == MT_RFC822) {
if (!strcasecmp(snode, NODENAME)) {
strcpy(snode, FQDN);
if (mode == MT_CITADEL)
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);
}
instr = mallok(2048);
sprintf(instr,
"Content-type: %s\n\nmsgid|%ld\nsubmitted|%ld\n"
+ "bounceto|%s@%s\n"
"remote|%s|0||\n",
- SPOOLMIME, newmsgid, time(NULL), recipient );
+ SPOOLMIME, newmsgid, time(NULL),
+ msg->cm_fields['A'], msg->cm_fields['N'],
+ recipient );
imsg = mallok(sizeof(struct CtdlMessage));
memset(imsg, 0, sizeof(struct CtdlMessage));