From 506a091e4cbb8037a07862e67651299b2669c9a4 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 14 Aug 2005 14:35:36 +0000 Subject: [PATCH] More charset parsing updates --- lib/charset.c | 3 ++- lib/charset.map | 1 + mbfido/rfc2ftn.c | 20 ++++++++++++++------ mbnntp/rfc2ftn.c | 5 +++++ 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lib/charset.c b/lib/charset.c index dbd0e9a4..4ac19545 100644 --- a/lib/charset.c +++ b/lib/charset.c @@ -141,7 +141,7 @@ char *getrfcchrs(int val) 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_MAC: return (char *)"Macintosh"; case FTNC_KOI8_R: return (char *)"koi8-r"; case FTNC_CP936: return (char *)"hz-gb-2312"; default: return (char *)"iso-8859-1"; @@ -465,6 +465,7 @@ int charset_set_in_out(char *in, char *out) if (strcasecmp(pa->alias, out) == 0) out = pa->name; } + Syslog('m', "charset: aliases in=%s out=%s", in, out); /* Search for matching table */ for (pt = charset_table_list; pt; pt=pt->next) { diff --git a/lib/charset.map b/lib/charset.map index d10b307e..7dc8cb43 100644 --- a/lib/charset.map +++ b/lib/charset.map @@ -59,6 +59,7 @@ alias amiga iso-8859-1 alias ibmpc cp437 alias pc-8 cp437 alias mac mac +alias macinstosh mac # ---------------------------------------------------------------------------- diff --git a/mbfido/rfc2ftn.c b/mbfido/rfc2ftn.c index 51ae280c..0e46851f 100644 --- a/mbfido/rfc2ftn.c +++ b/mbfido/rfc2ftn.c @@ -252,13 +252,16 @@ int rfc2ftn(FILE *fp, faddr *recipient) ftnmsgid(p,&fmsg->reply_a, &fmsg->reply_n,fmsg->area); //Griffin - fmsg->reply_s=calloc(256,sizeof(char)); - findorigmsg(p,fmsg->reply_s); + fmsg->reply_s = calloc(256,sizeof(char)); - fmsg->to->name=calloc(strlen(Msg.From)+1,sizeof(char)); - strcpy(fmsg->to->name,Msg.From); - Syslog('m', "fmsg to-name %s",fmsg->to->name); - Syslog('m', "reply_s %s",fmsg->reply_s); + if (findorigmsg(p, fmsg->reply_s)) { + fmsg->to->name = calloc(strlen(Msg.From)+1, sizeof(char)); + strcpy(fmsg->to->name, Msg.From); + Syslog('m', "fmsg to-name %s", fmsg->to->name); + Syslog('m', "reply_s %s", fmsg->reply_s); + } else { + Syslog('m', "findorigmsg nothing found"); + } if (!chkftnmsgid(p)) { hash_update_s(&fmsg->reply_n, fmsg->area); @@ -318,6 +321,11 @@ int rfc2ftn(FILE *fp, faddr *recipient) } else { charset = xstrcpy(q + 8); } + /* + * Sometimes more information follows so there the charset looks like iso-8859-1; + */ + if (charset[strlen(charset)-1] == ';') + charset[strlen(charset)-1] = '\0'; Syslog('m', "Charset \"%s\"", printable(charset, 0)); } } diff --git a/mbnntp/rfc2ftn.c b/mbnntp/rfc2ftn.c index dac26d09..ed086bcb 100644 --- a/mbnntp/rfc2ftn.c +++ b/mbnntp/rfc2ftn.c @@ -277,6 +277,11 @@ int rfc2ftn(FILE *fp) } else { charset = xstrcpy(q + 8); } + /* + * Sometimes more information follows so there the charset looks like iso-8859-1; + */ + if (charset[strlen(charset)-1] == ';') + charset[strlen(charset)-1] = '\0'; Syslog('m', "Charset \"%s\"", printable(charset, 0)); } }