Fixed header lines for posting news

This commit is contained in:
Michiel Broek 2005-08-13 19:51:32 +00:00
parent 3a2532e0e7
commit 8b21673eca
4 changed files with 736 additions and 731 deletions

View File

@ -9,6 +9,9 @@ v0.71.4 12-Aug-2005
Fixed a segfault when echomail.jam or netmail.jam is corrupted Fixed a segfault when echomail.jam or netmail.jam is corrupted
when scanning for outgoing mail. when scanning for outgoing mail.
mbsebbs:
Fixed headerlines for posting news.
v0.71.3 13-Jun-2005 - 12-Aug-2005 v0.71.3 13-Jun-2005 - 12-Aug-2005

View File

@ -146,6 +146,7 @@ int nntp_send(char *buf)
if (nntpsock == -1) if (nntpsock == -1)
return -1; return -1;
Syslog('m', "> %s", printable(buf, 0));
if (send(nntpsock, buf, strlen(buf), 0) != strlen(buf)) { if (send(nntpsock, buf, strlen(buf), 0) != strlen(buf)) {
WriteError("$NNTP: socket send failed"); WriteError("$NNTP: socket send failed");
if (errno == ENOTCONN || errno == EPIPE) { if (errno == ENOTCONN || errno == EPIPE) {
@ -195,6 +196,7 @@ char *nntp_receive(void)
buf[i] = '\0'; buf[i] = '\0';
} }
Syslog('m', "< %s", printable(buf, 0));
return buf; return buf;
} }

View File

@ -269,6 +269,8 @@ void Send(int newsmode, char *outstr)
unsigned long crc; unsigned long crc;
fwrite(outstr, 1, strlen(outstr), nfp); fwrite(outstr, 1, strlen(outstr), nfp);
Syslog('m', "+ %s\n", printable(outstr, 0));
if (newsmode) { if (newsmode) {
Striplf(outstr); Striplf(outstr);
if (strncmp(outstr, (char*)"Message-ID: ", 12) == 0) { if (strncmp(outstr, (char*)"Message-ID: ", 12) == 0) {
@ -468,7 +470,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} }
fputs(buf,fp); fputs(buf,fp);
} }
} }
Syslog('M', "Message input end ==============="); Syslog('M', "Message input end ===============");
@ -544,18 +545,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} }
} }
/*
* A hack for TerMail
*/
// p = hdr((char *)"PID", kmsg);
// if ((p) && (!strncmp(p, "TerMail", 7)) && (outcode == defaultrfcchar))
// outcode = defaultftnchar;
// if (dirtyoutcode != CHRS_NOTSET)
// outcode = dirtyoutcode;
// if (pgpsigned)
// incode = outcode;
if (kmsg && !strcmp(kmsg->key,"AREA")) { if (kmsg && !strcmp(kmsg->key,"AREA")) {
/* /*
* The msgs record is already loaded. * The msgs record is already loaded.
@ -563,11 +552,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
newsgroup = xstrcpy(msgs.Newsgroup); newsgroup = xstrcpy(msgs.Newsgroup);
if (strlen(msgs.Distribution)) if (strlen(msgs.Distribution))
distribution = xstrcpy(msgs.Distribution); distribution = xstrcpy(msgs.Distribution);
// if (strlen(msgs.Moderator)) {
// moderator = xstrcpy(msgs.Moderator);
// if (msgs.MsgKinds == USEMOD)
// modtype = 1;
// }
Syslog('M', "newsgroup %s, distribution %s", printable(newsgroup, 0), printable(distribution, 0)); Syslog('M', "newsgroup %s, distribution %s", printable(newsgroup, 0), printable(distribution, 0));
newsmode = TRUE; newsmode = TRUE;
if ((modtype == 1) && (!hdr((char *)"Approved",msg)) && if ((modtype == 1) && (!hdr((char *)"Approved",msg)) &&
@ -692,8 +676,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
substitute(buf); substitute(buf);
Syslog('+', "mail from %s to %s",ascfnode(f,0x7f),buf); Syslog('+', "mail from %s to %s",ascfnode(f,0x7f),buf);
To = xstrcpy(buf); To = xstrcpy(buf);
// if (p)
// free(p);
p = NULL; p = NULL;
p = hdr((char *)"Return-Path",msg); p = hdr((char *)"Return-Path",msg);
@ -870,14 +852,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} }
} }
// for (tmpml=approve;tmpml;tmpml=tmpml->next) {
// if ((strncmp(newsgroup,tmpml->prefix, strlen(tmpml->prefix)) == 0)) {
// modtype=2;
// moderator=xstrcpy(tmpml->address);
// break;
// }
// }
if ((p=hdr((char *)"Approved",msg))) { if ((p=hdr((char *)"Approved",msg))) {
sprintf(temp,"Approved:%s",p); sprintf(temp,"Approved:%s",p);
Send(newsmode, temp); Send(newsmode, temp);
@ -894,16 +868,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} else { /* if newsmode */ } else { /* if newsmode */
now = time(NULL); now = time(NULL);
// if (CFG.EmailMode == E_NOISP) {
// /*
// * Probaly not needed as messages for systems without ISP never get here.
// * Perhaps only news to moderators.
// */
// Syslog('m', "We should not be here");
// sprintf(temp, "From %s!%s %s", ascinode(f,0x3f), ascinode(f,0x40), ctime(&mdate));
// Send(FALSE, temp);
// }
Syslog('m', "Should send Received: header for mbfido"); Syslog('m', "Should send Received: header for mbfido");
sprintf(temp, "Received: from %s\n", ascinode(f, 0x3f)); sprintf(temp, "Received: from %s\n", ascinode(f, 0x3f));
Send(FALSE, temp); Send(FALSE, temp);
@ -1128,10 +1092,10 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
sprintf(temp,"Message-ID: %s",p); sprintf(temp,"Message-ID: %s",p);
else if ((p=hdr((char *)"Message-ID",kmsg))) else if ((p=hdr((char *)"Message-ID",kmsg)))
sprintf(temp,"Message-ID: %s",p); sprintf(temp,"Message-ID: %s",p);
else if ((p=hdr((char *)"RFCID",kmsg))) else if ((p=hdr((char *)"RFCID",kmsg))) {
if ((p[0]=='<')) { if ((p[0]=='<')) {
/* "^aRFCID: <local@machine>" */ /* "^aRFCID: <local@machine>" */
if ((p[strlen(p)-2]=='>')) if ((p[strlen(p)-2]=='>')) {
sprintf(temp,"Message-ID: %s",p); sprintf(temp,"Message-ID: %s",p);
/* "^aRFCID: <local@machine" */ /* "^aRFCID: <local@machine" */
/* I saw it on some IntToss gated articles /* I saw it on some IntToss gated articles
@ -1139,7 +1103,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
* like that, because in the majority of IntToss gated * like that, because in the majority of IntToss gated
* articles it is "^aRFCID: local@machine" * articles it is "^aRFCID: local@machine"
*/ */
else { } else {
p[strlen(p)-1]='\0'; p[strlen(p)-1]='\0';
sprintf(temp,"Message-ID: %s>\n",p); sprintf(temp,"Message-ID: %s>\n",p);
} }
@ -1147,14 +1111,16 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} else { } else {
p[strlen(p)-1]='\0'; p[strlen(p)-1]='\0';
sprintf(temp,"Message-ID: <%s>\n",p); sprintf(temp,"Message-ID: <%s>\n",p);
}
} else if ((p=hdr((char *)"ORIGID",kmsg))) { } else if ((p=hdr((char *)"ORIGID",kmsg))) {
sprintf(temp,"Message-ID: %s",p); sprintf(temp,"Message-ID: %s",p);
} else if ((p = hdr((char *)"MSGID",kmsg))) { } else if ((p = hdr((char *)"MSGID",kmsg))) {
q = rfcmsgid(p, bestaka); q = rfcmsgid(p, bestaka);
sprintf(temp,"Message-ID: %s\n", q); sprintf(temp,"Message-ID: %s\n", q);
free(q); free(q);
} else } else {
sprintf(temp,"Message-ID: <%lu@%s.ftn>\n", mdate^(subj?str_crc32(subj):0L), ascinode(f,0x1f)); sprintf(temp,"Message-ID: <%lu@%s.ftn>\n", mdate^(subj?str_crc32(subj):0L), ascinode(f,0x1f));
}
Send(newsmode, temp); Send(newsmode, temp);
if (newsmode) { if (newsmode) {
@ -1348,6 +1314,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} }
} }
Syslog('m', "=== starting qmsg loop");
for (qmsg = msg; qmsg; qmsg = qmsg->next) { for (qmsg = msg; qmsg; qmsg = qmsg->next) {
if (strcasecmp(qmsg->key,"X-Body-Start") && if (strcasecmp(qmsg->key,"X-Body-Start") &&
strcasecmp(qmsg->key,"X-PcBoard-FROM") && strcasecmp(qmsg->key,"X-PcBoard-FROM") &&
@ -1384,6 +1351,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
Send(newsmode, temp); Send(newsmode, temp);
} }
} }
Syslog('m', "=== ending qmsg loop");
if ((p=compose_flags(flags,hdr((char *)"FLAGS",kmsg)))) { if ((p=compose_flags(flags,hdr((char *)"FLAGS",kmsg)))) {
sprintf(temp,"X-FTN-FLAGS:%s\n",p); sprintf(temp,"X-FTN-FLAGS:%s\n",p);
@ -1391,6 +1359,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
free(p); free(p);
} }
Syslog('m', "=== starting qmsg loop 2");
for (qmsg = kmsg; qmsg; qmsg = qmsg->next) { for (qmsg = kmsg; qmsg; qmsg = qmsg->next) {
if (strcasecmp(qmsg->key,"INTL") && if (strcasecmp(qmsg->key,"INTL") &&
strcasecmp(qmsg->key,"FMPT") && strcasecmp(qmsg->key,"FMPT") &&
@ -1477,6 +1446,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
} }
} }
} }
Syslog('m', "=== ending qmsg loop 2");
if (newsmode) { if (newsmode) {
fa_list *tmpl,*ptl=NULL; fa_list *tmpl,*ptl=NULL;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Utilities for message handling. * Purpose ...............: Utilities for message handling.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2004 * Copyright (C) 1997-2005
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -152,6 +152,27 @@ void Close_Msgbase(char *Base)
} }
char *getrfcchrs(int val)
{
switch (val) {
case FTNC_NONE: return (char *)"iso-8859-1";
case FTNC_CP437: return (char *)"cp437";
case FTNC_CP850: return (char *)"cp850";
case FTNC_CP865: return (char *)"cp865";
case FTNC_CP866: return (char *)"cp866";
case FTNC_CP852: return (char *)"cp852";
case FTNC_CP895: return (char *)"cp895";
case FTNC_LATIN_1: return (char *)"iso-8859-1";
case FTNC_LATIN_2: return (char *)"iso-8859-2";
case FTNC_LATIN_5: return (char *)"iso-8859-5";
case FTNC_MAC: return (char *)"MAC 2";
case FTNC_KOI8_R: return (char *)"koi8-r";
case FTNC_CP936: return (char *)"hz-gb-2312";
default: return (char *)"iso-8859-1";
}
}
void Add_Headkludges(faddr *dest, int IsReply) void Add_Headkludges(faddr *dest, int IsReply)
{ {
@ -202,17 +223,26 @@ void Add_Headkludges(faddr *dest, int IsReply)
for (i = 0; i < strlen(temp2); i++) for (i = 0; i < strlen(temp2); i++)
if (temp2[i] == ' ') if (temp2[i] == ' ')
temp2[i] = '_'; temp2[i] = '_';
sprintf(temp, "\001From: %s@%s (%s)", temp2, ascinode(Node, 0x2f), Msg.From); // sprintf(temp, "\001From: %s@%s (%s)", temp2, ascinode(Node, 0x2f), Msg.From);
sprintf(temp, "\001From: %s", Msg.From);
MsgText_Add2(temp); MsgText_Add2(temp);
sprintf(temp, "\001Subject: %s", Msg.Subject); sprintf(temp, "\001Subject: %s", Msg.Subject);
MsgText_Add2(temp); MsgText_Add2(temp);
sprintf(temp, "\001Sender: %s@%s (%s)", temp2, ascinode(Node, 0x2f), Msg.From); // sprintf(temp, "\001Sender: %s@%s (%s)", temp2, ascinode(Node, 0x2f), Msg.From);
sprintf(temp, "\001Sender: %s", Msg.From);
MsgText_Add2(temp); MsgText_Add2(temp);
free(temp2); free(temp2);
tidy_faddr(Node); tidy_faddr(Node);
MsgText_Add2((char *)"\001To: All"); MsgText_Add2((char *)"\001To: All");
MsgText_Add2((char *)"\001MIME-Version: 1.0"); MsgText_Add2((char *)"\001MIME-Version: 1.0");
MsgText_Add2((char *)"\001Content-Type: text/plain"); if (exitinfo.Charset != FTNC_NONE) {
sprintf(temp, "\001Content-Type: text/plain; charset=%s", getrfcchrs(exitinfo.Charset));
} else if (msgs.Charset != FTNC_NONE) {
sprintf(temp, "\001Content-Type: text/plain; charset=%s", getrfcchrs(msgs.Charset));
} else {
sprintf(temp, "\001Content-Type: text/plain; charset=iso8859-1");
}
MsgText_Add2(temp);
MsgText_Add2((char *)"\001Content-Transfer-Encoding: 8bit"); MsgText_Add2((char *)"\001Content-Transfer-Encoding: 8bit");
sprintf(temp, "\001X-Mailreader: MBSE BBS %s", VERSION); sprintf(temp, "\001X-Mailreader: MBSE BBS %s", VERSION);
MsgText_Add2(temp); MsgText_Add2(temp);