From 1ad781c851f813207499f8bbfc5abe31eb491a09 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 13 Aug 2005 21:10:58 +0000 Subject: [PATCH] Fixed fido style from address for posting news --- ChangeLog | 1 + mbfido/ftn2rfc.c | 64 +++++++++++++++++++++++------------------------- mbfido/scan.c | 15 +++++++++--- 3 files changed, 44 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index ba1b2424..e4ff9ab1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ v0.71.4 12-Aug-2005 mbsebbs: Fixed headerlines for posting news. + Fixed fido style from address for posting news. v0.71.3 13-Jun-2005 - 12-Aug-2005 diff --git a/mbfido/ftn2rfc.c b/mbfido/ftn2rfc.c index cfc00c09..14a0ca87 100644 --- a/mbfido/ftn2rfc.c +++ b/mbfido/ftn2rfc.c @@ -1006,11 +1006,11 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl free(p); } - if (p) - sprintf(temp,"X-FTN-Sender: %s\n", ascinode(f,0xff)); - else - sprintf(temp,"From: %s\n", ascinode(f,0xff)); - Send(newsmode, temp); +// if (p) +// sprintf(temp,"X-FTN-Sender: %s\n", ascinode(f,0xff)); +// else +// sprintf(temp,"From: %s\n", ascinode(f,0xff)); +// Send(newsmode, temp); if ((p=hdr((char *)"Reply-To",msg))) { sprintf(temp,"Reply-To:%s",p); @@ -1214,14 +1214,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl } } -// sprintf(temp, "X-FTN-CHRS: %s\n", getchrs(incode)); -// Send(newsmode, temp); -// if (incode != outcode) { -// sprintf(temp, "X-FTN-ORIGCHRS: %s\n", getchrs(outcode)); -// Send(newsmode, temp); -// } -// charset = getcharset(incode); - if ((p=hdr((char *)"Mime-Version",msg))) { sprintf(temp,(char *)"Mime-Version:%s",p); Send(newsmode, temp); @@ -1231,9 +1223,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl } else if ((p=hdr((char *)"Mime-Version",kmsg))) { sprintf(temp,(char *)"Mime-Version: %s",p); Send(newsmode, temp); -// } else if ((charset) && (incode != CHRS_NOTSET)) { -// sprintf(temp,"Mime-Version: 1.0\n"); -// Send(newsmode, temp); } if ((p=hdr((char *)"Content-Type",msg))) { @@ -1245,12 +1234,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl } else if ((p=hdr((char *)"Content-Type",kmsg))) { sprintf(temp,"Content-Type: %s",p); Send(newsmode, temp); -// } else if ((charset) && (incode != CHRS_NOTSET)) { -// if ((p=hdr((char *)"FSCHTML",kmsg)) || (p=hdr((char *)"HTML",kmsg))) -// sprintf(temp,"Content-Type: text/html; charset=%s\n",charset); -// else -// sprintf(temp,"Content-Type: text/plain; charset=%s\n",charset); -// Send(newsmode, temp); } if ((p=hdr((char *)"Content-Length",msg))) { @@ -1271,16 +1254,6 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl sprintf(temp,"Content-Transfer-Encoding: %s",p); else if ((p=hdr((char *)"Content-Transfer-Encoding",kmsg))) sprintf(temp,"Content-Transfer-Encoding: %s",p); -// else if ((charset) && (incode == CHRS_ISO_8859_1_QP)) -// sprintf(temp,"Content-Transfer-Encoding: quoted-printable\n"); -// else if ((charset) && (incode != CHRS_NOTSET)) { -// if ((incode == CHRS_ASCII || incode == CHRS_UTF_7)) -// sprintf(temp,"Content-Transfer-Encoding: 7bit\n"); -// else if (strncasecmp(charset,"iso-2022-",9) == 0) -// sprintf(temp,"Content-Transfer-Encoding: 7bit\n"); -// else -// sprintf(temp,"Content-Transfer-Encoding: 8bit\n"); /* all others are 8 bit */ -// } if (temp[0]) Send(newsmode, temp); @@ -1314,9 +1287,34 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl } } + /* + * Convert some ftn kludges to rfc. We should not have these but + * GoldED posts news with plain ftn kludges as rfc headers. + */ + if ((p = hdr((char *)"CHRS", msg))) { + sprintf(temp, "X-FTN-CHARS:%s", p); + Send(newsmode, temp); + } + if ((p = hdr((char *)"MSGID", msg))) { + sprintf(temp, "X-FTN-MSGID:%s", p); + Send(newsmode, temp); + } + if ((p = hdr((char *)"PID", msg))) { + sprintf(temp, "X-FTN-PID:%s", p); + Send(newsmode, temp); + } + if ((p = hdr((char *)"TZUTC", msg))) { + sprintf(temp, "X-FTN-TZUTC:%s", p); + Send(newsmode, temp); + } + Syslog('m', "=== starting qmsg loop"); for (qmsg = msg; qmsg; qmsg = qmsg->next) { - if (strcasecmp(qmsg->key,"X-Body-Start") && + if (strcasecmp(qmsg->key,"CHRS") && + strcasecmp(qmsg->key,"MSGID") && + strcasecmp(qmsg->key,"PID") && + strcasecmp(qmsg->key,"TZUTC") && + strcasecmp(qmsg->key,"X-Body-Start") && strcasecmp(qmsg->key,"X-PcBoard-FROM") && strcasecmp(qmsg->key,"X-PcBoard-SUBJECT") && strcasecmp(qmsg->key,"X-PcBoard-PACKOUT") && diff --git a/mbfido/scan.c b/mbfido/scan.c index aa6515a2..bbcff9fa 100644 --- a/mbfido/scan.c +++ b/mbfido/scan.c @@ -683,7 +683,7 @@ void ExportEcho(sysconnect L, unsigned long MsgNum, fa_list **sbl) void ExportNews(unsigned long MsgNum, fa_list **sbl) { char *p; - int seenlen, oldnet, flags = 0; + int i, seenlen, oldnet, flags = 0; char sbe[16]; fa_list *tmpl; FILE *qp; @@ -695,7 +695,7 @@ void ExportNews(unsigned long MsgNum, fa_list **sbl) Syslog('m', "Msg.From %s", Msg.From); Syslog('m', "Msg.FromAddress %s", Msg.FromAddress); Syslog('m', "Msg.To %s", Msg.To); - Syslog('m', "Msg.ToAdrress", Msg.ToAddress); + Syslog('m', "Msg.ToAddress", Msg.ToAddress); flags |= (Msg.Private) ? M_PVT : 0; from = fido2faddr(msgs.Aka); @@ -703,7 +703,16 @@ void ExportNews(unsigned long MsgNum, fa_list **sbl) /* * Add name with echo to news gate. */ - from->name = xstrcpy(Msg.From); + p = calloc(256, sizeof(char)); + strcpy(p, Msg.From); + for (i = 0; i < strlen(p); i++) { + if (p[i] == '@') { + p[i] = '\0'; + break; + } + } + from->name = xstrcpy(p); + free(p); Syslog('m', "from %s", ascinode(from, 0xff)); dest = NULL;