Message replies using UTF-8
This commit is contained in:
parent
501ed89a2f
commit
b5dc098caf
@ -1211,42 +1211,24 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill Quote file in case the user wants to reply. Note that line
|
* Analyse this message to find the character encoding.
|
||||||
* wrapping is set lower then normal message read, to create room
|
|
||||||
* for the Quote> strings at the start of each line.
|
|
||||||
*/
|
*/
|
||||||
fn = calloc(PATH_MAX, sizeof(char));
|
if (Msg_Read(Num, 78)) {
|
||||||
snprintf(fn, PATH_MAX, "%s/%s/.quote", CFG.bbs_usersdir, exitinfo.Name);
|
if ((p = (char *)MsgText_First()) != NULL) {
|
||||||
if ((qf = fopen(fn, "w")) != NULL) {
|
do {
|
||||||
if (Msg_Read(Num, 75)) {
|
if ((p[0] == '\001') || (!strncmp(p, "SEEN-BY:", 8)) || (!strncmp(p, "AREA:", 5))) {
|
||||||
if ((p = (char *)MsgText_First()) != NULL)
|
if (strncmp(p, "\001CHRS: ", 7) == 0) {
|
||||||
do {
|
charset = xstrcpy(p + 7);
|
||||||
if ((p[0] == '\001') || (!strncmp(p, "SEEN-BY:", 8)) || (!strncmp(p, "AREA:", 5))) {
|
break;
|
||||||
/*
|
}
|
||||||
* While we are here, check for the ^aCHRS: kludge and set the used charset.
|
if (strncmp(p, "\001CHARSET: ", 10) == 0) {
|
||||||
*/
|
charset = xstrcpy(p + 10);
|
||||||
if (strncmp(p, "\001CHRS: ", 7) == 0) {
|
break;
|
||||||
charset = xstrcpy(p + 7);
|
}
|
||||||
}
|
}
|
||||||
if (strncmp(p, "\001CHARSET: ", 10) == 0) {
|
} while ((p = (char *)MsgText_Next()) != NULL);
|
||||||
charset = xstrcpy(p + 10);
|
|
||||||
}
|
|
||||||
if (Kludges) {
|
|
||||||
if (p[0] == '\001') {
|
|
||||||
p[0] = 'a';
|
|
||||||
fprintf(qf, "^%s\n", p);
|
|
||||||
} else
|
|
||||||
fprintf(qf, "%s\n", p);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
fprintf(qf, "%s\n", p);
|
|
||||||
} while ((p = (char *)MsgText_Next()) != NULL);
|
|
||||||
}
|
}
|
||||||
fclose(qf);
|
|
||||||
} else {
|
|
||||||
WriteError("$Can't open %s", p);
|
|
||||||
}
|
}
|
||||||
free(fn);
|
|
||||||
|
|
||||||
if (charset == NULL) {
|
if (charset == NULL) {
|
||||||
/*
|
/*
|
||||||
@ -1258,12 +1240,42 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
|
|||||||
} else {
|
} else {
|
||||||
charsin = xstrcpy(get_ic_ftn(find_ftn_charset(charset)));
|
charsin = xstrcpy(get_ic_ftn(find_ftn_charset(charset)));
|
||||||
}
|
}
|
||||||
|
chartran_init(charsin, get_ic_ftn(exitinfo.Charset), 'b');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to setup charset mapping if the charactersets are different.
|
* Fill Quote file in case the user wants to reply. Note that line
|
||||||
|
* wrapping is set lower then normal message read, to create room
|
||||||
|
* for the Quote> strings at the start of each line. The text is
|
||||||
|
* converted to the users local characterset so the reply can be
|
||||||
|
* done with the users prefered characterset.
|
||||||
*/
|
*/
|
||||||
chartran_init(charsin, get_ic_ftn(exitinfo.Charset), 'b');
|
fn = calloc(PATH_MAX, sizeof(char));
|
||||||
|
snprintf(fn, PATH_MAX, "%s/%s/.quote", CFG.bbs_usersdir, exitinfo.Name);
|
||||||
|
if ((qf = fopen(fn, "w")) != NULL) {
|
||||||
|
if (Msg_Read(Num, 75)) {
|
||||||
|
if ((p = (char *)MsgText_First()) != NULL) {
|
||||||
|
do {
|
||||||
|
if ((p[0] == '\001') || (!strncmp(p, "SEEN-BY:", 8)) || (!strncmp(p, "AREA:", 5))) {
|
||||||
|
if (Kludges) {
|
||||||
|
if (p[0] == '\001') {
|
||||||
|
p[0] = 'a';
|
||||||
|
fprintf(qf, "^%s\n", chartran(p));
|
||||||
|
} else {
|
||||||
|
fprintf(qf, "%s\n", chartran(p));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(qf, "%s\n", chartran(p));
|
||||||
|
}
|
||||||
|
} while ((p = (char *)MsgText_Next()) != NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(qf);
|
||||||
|
} else {
|
||||||
|
WriteError("$Can't open %s", p);
|
||||||
|
}
|
||||||
|
free(fn);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Show message header with charset mapping if needed.
|
* Show message header with charset mapping if needed.
|
||||||
*/
|
*/
|
||||||
|
@ -466,8 +466,8 @@ void user(void)
|
|||||||
Chg_Charset();
|
Chg_Charset();
|
||||||
}
|
}
|
||||||
|
|
||||||
setlocale(LC_CTYPE, getlocale(exitinfo.Charset));
|
// setlocale(LC_CTYPE, getlocale(exitinfo.Charset));
|
||||||
Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0));
|
// Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0));
|
||||||
|
|
||||||
GetLastUser();
|
GetLastUser();
|
||||||
StartTime = xstrcpy(GetLocalHM());
|
StartTime = xstrcpy(GetLocalHM());
|
||||||
|
Reference in New Issue
Block a user