Added character set chanage to the bbs

This commit is contained in:
Michiel Broek
2004-02-24 22:09:27 +00:00
parent 1d91200972
commit ce30494be0
20 changed files with 128 additions and 37 deletions

View File

@@ -976,3 +976,64 @@ void Chg_OLR_ExtInfo()
}
/*
* Change character set.
*/
void Chg_Charset()
{
int i;
char *temp;
temp = calloc(81, sizeof(char));
ReadExitinfo();
Syslog('+', "Old character set %s", getchrs(exitinfo.Charset));
while(TRUE) {
colour(CFG.HiliteF, CFG.HiliteB);
/* Select your preferred character set */
printf("\n%s\n\n", (char *) Language(23));
colour(LIGHTBLUE, BLACK);
for (i = (FTNC_NONE + 1); i <= FTNC_MAXCHARS; i++) {
colour(LIGHTBLUE, BLACK);
printf("%2d ", i);
colour(LIGHTCYAN, BLACK);
printf("%-9s ", getchrs(i));
colour(LIGHTMAGENTA, BLACK);
printf("%s\n", getchrsdesc(i));
}
colour(CFG.HiliteF, CFG.HiliteB);
/* Select character set (Enter to Quit): */
printf("\n%s", (char *) Language(24));
fflush(stdout);
Getnum(temp, 2);
if (((strcmp(temp, "")) == 0) && (exitinfo.Charset != FTNC_NONE)) {
free(temp);
return;
}
i = atoi(temp);
if ((i > FTNC_NONE) && (i <= FTNC_MAXCHARS)) {
exitinfo.Charset = i;
Syslog('+', "New character set %s", getchrs(exitinfo.Charset));
WriteExitinfo();
free(temp);
colour(LIGHTGREEN, BLACK);
/* Character set now set to: */
printf("\n\n%s%s\n\n", (char *) Language(25), getchrs(i));
Pause();
return;
}
Enter(2);
/* Invalid selection, please try again! */
pout(LIGHTRED, BLACK, (char *) Language(265));
Enter(2);
}
}

View File

@@ -1,6 +1,7 @@
#ifndef _CHANGE_H
#define _CHANGE_H
/* $Id$ */
int Chg_Language(int); /* Change language */
void Chg_Password(void); /* Change BBS Password */
@@ -23,6 +24,7 @@ void Chg_DOB(void); /* Change Date of Birth */
void Chg_Protocol(void); /* Change default transfer protocol. */
void Set_Protocol(char *); /* Set default protocol */
void Chg_OLR_ExtInfo(void); /* Set OLR Extended Info */
void Chg_Charset(void); /* Change character set */
#endif

View File

@@ -552,6 +552,10 @@ void ControlCodeU(int ch)
printf("%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
break;
case '9':
printf("%s", getchrs(exitinfo.Charset));
break;
default:
printf(" ");
}

View File

@@ -657,6 +657,10 @@ void DoMenu(int Type)
Chg_OLR_ExtInfo();
break;
case 321:
Chg_Charset();
break;
case 401:
Oneliner_Add();
break;

View File

@@ -448,6 +448,13 @@ void user()
if (! InitExitinfo())
Good_Bye(MBERR_INIT_ERROR);
/*
* If user has not set a preferred character set, force this
*/
if (exitinfo.Charset == FTNC_NONE) {
Chg_Charset();
}
GetLastUser();
StartTime = xstrcpy(GetLocalHM());
ChangeHomeDir(exitinfo.Name, exitinfo.Email);