Added Russion support

This commit is contained in:
Michiel Broek 2005-01-14 19:52:12 +00:00
parent 7a3b700eac
commit bb9fd9dcb8
8 changed files with 68 additions and 19 deletions

View File

@ -51,4 +51,4 @@ Przemyslaw Kwiatkowski 2:480/127@fidonet
Phil Kimble kimerud@users.sourceforge.net 1:14/200@fidonet
David Gonzalez skynetbbs@007mundo.com 4:930/1@fidonet
Malte Tychsen 2:240/9350@fidonet
Dmitry Komissaroff rsprog@mail.ru

View File

@ -18,6 +18,8 @@ v0.71.1 28-Nov-2004
Added port to OpenBSD, is under test (and doesn't work).
Code cleanup so that compile stops on unknown OSes and CPUs
instead of missing code parts.
Added Unix codepage KOI8-R (Russian) and patches from Dmitry
Komissaroff.
mbsebbs:
The creation of the mailout semafore is now after the hangup
@ -28,6 +30,8 @@ v0.71.1 28-Nov-2004
Made zmodem-8k downloads work again.
Some small buffer protections added in addfile.
Fixed keyboad input for all bigendian machines.
Patches from Dmitry Komissaroff to make charset translation
work on message subject lines.
mbnewuser:
During hangup we set sighup to ignore.
@ -66,6 +70,10 @@ v0.71.1 28-Nov-2004
is fresh created.
Changed X-JAM kludges to X-FTN kludges to make it compatible
with the rest of the gates.
Patches from Dmitry Komissaroff to make charset translation
work on message subject lines. It will now also send the right
charset of the user in the charset header line so that the
client will show the message in the users charset.
mbsetup:
Added support for XxxxBSD console port.

View File

@ -113,6 +113,7 @@ void auth_pass(char *cmd)
while (fread(&usrconfig, usrconfighdr.recsize, 1, fp) == 1) {
if (strcmp(usrconfig.Name, username) == 0) {
FoundName = TRUE;
usercharset=usrconfig.Charset;
break;
}
grecno++;

View File

@ -105,6 +105,27 @@ char *make_msgid(char *msgid)
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";
default: return (char *)"iso-8859-1";
}
}
/*
* ARTICLE
* BODY
@ -173,10 +194,12 @@ void command_abhs(char *buf)
return;
}
/*
* Setup a default translation
* Setup a charset translation
*/
charset_set_in_out((char *)"x-ibmpc", (char *)"iso-8859-1");
charset_set_in_out(getrfcchrs(msgs.Charset),getrfcchrs(usercharset));
if (Msg_Read(art, 75)) {
@ -192,7 +215,9 @@ void command_abhs(char *buf)
send_nntp("Path: MBNNTP!not-for-mail");
send_nntp("From: %s <%s>", Msg.From, Msg.FromAddress);
send_nntp("Newsgroups: %s", currentgroup);
send_nntp("Subject: %s", Msg.Subject);
char *subj;
asprintf(&subj,"Subject: %s", Msg.Subject);
send_xlat(subj);
send_nntp("Date: %s", rfcdate(Msg.Written + (gmt_offset((time_t)0) * 60)));
send_nntp("Message-ID: %s", make_msgid(Msg.Msgid));
if (strlen(Msg.Replyid))
@ -213,7 +238,7 @@ void command_abhs(char *buf)
}
send_nntp("MIME-Version: 1.0");
send_nntp("Content-Type: text/plain; charset=iso-8859-1; format=fixed");
send_nntp("Content-Type: text/plain; charset=%s; format=fixed", getrfcchrs(usercharset));
send_nntp("Content-Transfer-Encoding: 8bit");
}

View File

@ -3,6 +3,8 @@
/* $Id$ */
int usercharset;
void send_nntp(const char *, ...);
#ifndef USE_NEWSGATE

View File

@ -450,7 +450,7 @@ int Read_a_Email(unsigned long Num)
if (Kludges) {
pout(LIGHTGRAY, BLACK, p);
Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE))
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE, FALSE))
break;
}
} else {
@ -460,7 +460,7 @@ int Read_a_Email(unsigned long Num)
colour(CFG.HiliteF, CFG.HiliteB);
PUTSTR(p);
Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE))
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE, FALSE))
break;
}
} while ((p = (char *)MsgText_Next()) != NULL);

View File

@ -79,8 +79,7 @@ extern int LC_Wrote; /* Lastcaller info write message */
/*
* Internal prototypes
*/
void ShowMsgHdr(void); /* Show message header */
void ShowMsgHdr(int Conv); /* Show message header */
int Read_a_Msg(unsigned long Num, int);/* Read a message */
int Export_a_Msg(unsigned long Num);/* Export message to homedir */
int ReadPanel(void); /* Read panel bar */
@ -892,13 +891,13 @@ int Save_Msg(int IsReply, faddr *Dest)
/*
* Show message header screen top for reading messages.
*/
void ShowMsgHdr()
void ShowMsgHdr(int Conv)
{
static char Buf1[35], Buf2[35], Buf3[81];
char msg[81];
struct tm *tm;
time_t now;
int color;
int color, i;
Buf1[0] = '\0';
Buf2[0] = '\0';
@ -986,7 +985,18 @@ void ShowMsgHdr()
/* Subject : */
pout(YELLOW, BLACK, (char *) Language(210));
pout(GREEN, BLACK, Msg.Subject);
colour(GREEN, BLACK);
if (Conv) {
/*
* Try to translate character sets
*/
for (i = 0; i < strlen(Msg.Subject); i++) {
PUTSTR(charset_map_c(Msg.Subject[i], FALSE));
}
} else {
PUTSTR(Msg.Subject);
}
Enter(1);
colour(CFG.HiliteF, CFG.HiliteB);
@ -1207,7 +1217,6 @@ int Read_a_Msg(unsigned long Num, int UpdateLR)
sleep(3);
return FALSE;
}
ShowMsgHdr();
/*
* Fill Quote file in case the user wants to reply. Note that line
@ -1263,6 +1272,10 @@ int Read_a_Msg(unsigned long Num, int UpdateLR)
if (charsin && charsout && strcmp(charsout, charsin)) {
UseIconv = charset_set_in_out(charsin, charsout);
}
/*
* Show message header with charset mapping if needed.
*/
ShowMsgHdr(UseIconv);
/*
* Show message text
@ -1275,7 +1288,7 @@ int Read_a_Msg(unsigned long Num, int UpdateLR)
if (Kludges) {
pout(LIGHTGRAY, BLACK, p);
Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE))
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE, UseIconv))
break;
}
} else {
@ -1296,7 +1309,7 @@ int Read_a_Msg(unsigned long Num, int UpdateLR)
Enter(1);
}
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE))
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE, UseIconv))
break;
}
} while ((p = (char *)MsgText_Next()) != NULL);
@ -1933,7 +1946,7 @@ void Delete_Msg()
/*
* Check linecounter for reading messages.
*/
int CheckLine(int FG, int BG, int Email)
int CheckLine(int FG, int BG, int Email, int Conv)
{
int x, z;
@ -1960,7 +1973,7 @@ int CheckLine(int FG, int BG, int Email)
if (Email)
ShowEmailHdr();
else
ShowMsgHdr();
ShowMsgHdr(Conv);
colour(FG, BG);
}
return FALSE;

View File

@ -9,7 +9,7 @@
int LC(int); /* More prompt for reading messages */
int Edit_Msg(void); /* Edit a message */
int Ext_Edit(void); /* External Message editor */
int CheckLine(int, int, int); /* Check linecounter for read */
int CheckLine(int, int, int, int); /* Check linecounter for read */
void SysopComment(char *); /* Comment to Sysop */
void Post_Msg(void); /* Post a message */
void Read_Msgs(void); /* Read Messages */