More charset parsing updates

This commit is contained in:
Michiel Broek 2005-08-14 14:35:36 +00:00
parent 1b9bb9deb4
commit 506a091e4c
4 changed files with 22 additions and 7 deletions

View File

@ -141,7 +141,7 @@ char *getrfcchrs(int val)
case FTNC_LATIN_1: return (char *)"iso-8859-1"; case FTNC_LATIN_1: return (char *)"iso-8859-1";
case FTNC_LATIN_2: return (char *)"iso-8859-2"; case FTNC_LATIN_2: return (char *)"iso-8859-2";
case FTNC_LATIN_5: return (char *)"iso-8859-5"; 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_KOI8_R: return (char *)"koi8-r";
case FTNC_CP936: return (char *)"hz-gb-2312"; case FTNC_CP936: return (char *)"hz-gb-2312";
default: return (char *)"iso-8859-1"; 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) if (strcasecmp(pa->alias, out) == 0)
out = pa->name; out = pa->name;
} }
Syslog('m', "charset: aliases in=%s out=%s", in, out);
/* Search for matching table */ /* Search for matching table */
for (pt = charset_table_list; pt; pt=pt->next) { for (pt = charset_table_list; pt; pt=pt->next) {

View File

@ -59,6 +59,7 @@ alias amiga iso-8859-1
alias ibmpc cp437 alias ibmpc cp437
alias pc-8 cp437 alias pc-8 cp437
alias mac mac alias mac mac
alias macinstosh mac
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------

View File

@ -252,13 +252,16 @@ int rfc2ftn(FILE *fp, faddr *recipient)
ftnmsgid(p,&fmsg->reply_a, &fmsg->reply_n,fmsg->area); ftnmsgid(p,&fmsg->reply_a, &fmsg->reply_n,fmsg->area);
//Griffin //Griffin
fmsg->reply_s=calloc(256,sizeof(char)); fmsg->reply_s = calloc(256,sizeof(char));
findorigmsg(p,fmsg->reply_s);
fmsg->to->name=calloc(strlen(Msg.From)+1,sizeof(char)); if (findorigmsg(p, fmsg->reply_s)) {
strcpy(fmsg->to->name,Msg.From); fmsg->to->name = calloc(strlen(Msg.From)+1, sizeof(char));
Syslog('m', "fmsg to-name %s",fmsg->to->name); strcpy(fmsg->to->name, Msg.From);
Syslog('m', "reply_s %s",fmsg->reply_s); 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)) { if (!chkftnmsgid(p)) {
hash_update_s(&fmsg->reply_n, fmsg->area); hash_update_s(&fmsg->reply_n, fmsg->area);
@ -318,6 +321,11 @@ int rfc2ftn(FILE *fp, faddr *recipient)
} else { } else {
charset = xstrcpy(q + 8); 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)); Syslog('m', "Charset \"%s\"", printable(charset, 0));
} }
} }

View File

@ -277,6 +277,11 @@ int rfc2ftn(FILE *fp)
} else { } else {
charset = xstrcpy(q + 8); 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)); Syslog('m', "Charset \"%s\"", printable(charset, 0));
} }
} }