Move Strings into a String file so they can be customized

This commit is contained in:
Andrew Pamment 2016-08-14 19:56:15 +10:00
parent 89ba901b18
commit 86e39b7522
19 changed files with 837 additions and 560 deletions

View File

@ -5,7 +5,7 @@ JAMLIB = jamlib/jamlib.a
ZMODEM = Xmodem/libzmodem.a
LUA = lua/liblua.a
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -5,7 +5,7 @@ JAMLIB = jamlib/jamlib.a
ZMODEM = Xmodem/libzmodem.a
LUA = lua/liblua.a
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -5,7 +5,7 @@ JAMLIB = jamlib/jamlib.a
ZMODEM = Xmodem/libzmodem.a
LUA = lua/liblua.a
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -5,7 +5,7 @@ JAMLIB = jamlib/jamlib.a
ZMODEM = Xmodem/libzmodem.a
LUA = lua/liblua.a
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o
OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

64
bbs.c
View File

@ -132,7 +132,7 @@ void timer_handler(int signum) {
gUser->timeleft--;
if (gUser->timeleft <= 0) {
s_printf("\r\n\r\nSorry, you're out of time today..\r\n");
s_printf(get_string(0));
disconnect("Out of Time");
}
@ -142,7 +142,7 @@ void timer_handler(int signum) {
usertimeout--;
}
if (usertimeout <= 0) {
s_printf("\r\n\r\nTimeout waiting for input..\r\n");
s_printf(get_string(1));
disconnect("Timeout");
}
}
@ -372,8 +372,8 @@ void display_last10_callers(struct user_record *user) {
struct tm l10_time;
FILE *fptr = fopen("last10.dat", "rb");
s_printf("\r\n\e[1;37mLast 10 callers:\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\r\n");
s_printf(get_string(2));
s_printf(get_string(3));
if (fptr != NULL) {
@ -390,10 +390,10 @@ void display_last10_callers(struct user_record *user) {
for (z=0;z<i;z++) {
localtime_r(&callers[z].time, &l10_time);
s_printf("\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d\e[0m\r\n", callers[z].name, callers[z].location, l10_time.tm_hour, l10_time.tm_min, l10_time.tm_mday, l10_time.tm_mon + 1, l10_time.tm_year - 100);
s_printf(get_string(4), callers[z].name, callers[z].location, l10_time.tm_hour, l10_time.tm_min, l10_time.tm_mday, l10_time.tm_mon + 1, l10_time.tm_year - 100);
}
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf("Press any key to continue...\r\n");
s_printf(get_string(5));
s_printf(get_string(6));
s_getc();
}
@ -402,16 +402,16 @@ void display_info() {
uname(&name);
s_printf("\r\n\r\n\e[1;37mSystem Information\r\n");
s_printf("\e[1;30m----------------------------------------------\r\n");
s_printf("\e[1;32mBBS Name : \e[1;37m%s\r\n", conf.bbs_name);
s_printf("\e[1;32mSysOp Name : \e[1;37m%s\r\n", conf.sysop_name);
s_printf("\e[1;32mNode : \e[1;37m%d\r\n", mynode);
s_printf("\e[1;32mBBS Version : \e[1;37mMagicka %d.%d (%s)\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_STR);
s_printf("\e[1;32mSystem : \e[1;37m%s (%s)\r\n", name.sysname, name.machine);
s_printf("\e[1;30m----------------------------------------------\e[0m\r\n");
s_printf(get_string(7));
s_printf(get_string(8));
s_printf(get_string(9), conf.bbs_name);
s_printf(get_string(10), conf.sysop_name);
s_printf(get_string(11), mynode);
s_printf(get_string(12), VERSION_MAJOR, VERSION_MINOR, VERSION_STR);
s_printf(get_string(13), name.sysname, name.machine);
s_printf(get_string(14));
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
}
@ -430,11 +430,11 @@ void automessage_write(struct user_record *user) {
timen = time(NULL);
localtime_r(&timen, &timenow);
sprintf(automsg, "Automessage Posted by %s @ %s", user->loginname, asctime(&timenow));
sprintf(automsg, get_string(15), user->loginname, asctime(&timenow));
automsg[strlen(automsg) - 1] = '\r';
automsg[strlen(automsg)] = '\n';
s_printf("\r\nEnter your message (4 lines):\r\n");
s_printf(get_string(16));
for (i=0;i<4;i++) {
s_printf("\r\n%d: ", i);
s_readstring(buffer, 75);
@ -474,9 +474,9 @@ void automessage_display() {
dolog("Error opening automessage.txt");
}
} else {
s_printf("No automessage!\r\n");
s_printf(get_string(17));
}
s_printf("\e[0mPress any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
}
@ -541,7 +541,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
}
if (mynode == 0) {
s_printf("Sorry, all nodes are in use. Please try later\r\n");
s_printf(get_string(18));
if (!ssh) {
close(socket);
}
@ -566,8 +566,8 @@ void runbbs_real(int socket, char *ip, int ssh) {
s_displayansi("issue");
if (!ssh) {
s_printf("\e[0mEnter your Login Name or NEW to create an account\r\n");
s_printf("Login:> ");
s_printf(get_string(19));
s_printf(get_string(20));
s_readstring(buffer, 25);
@ -575,11 +575,11 @@ void runbbs_real(int socket, char *ip, int ssh) {
user = new_user();
gUser = user;
} else {
s_printf("\r\nPassword:> ");
s_printf(get_string(21));
s_readpass(password, 16);
user = check_user_pass(buffer, password);
if (user == NULL) {
s_printf("\r\nIncorrect Login.\r\n");
s_printf(get_string(22));
disconnect("Incorrect Login");
}
@ -597,7 +597,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
if (strcasecmp(user->loginname, buffer) == 0) {
fclose(nodefile);
s_printf("\r\nYou are already logged in.\r\n");
s_printf(get_string(23));
disconnect("Already Logged in");
}
fclose(nodefile);
@ -607,7 +607,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
} else {
if (gUser != NULL) {
user = gUser;
s_printf("\e[0mWelcome back %s. Press enter to log in...\r\n", gUser->loginname);
s_printf(get_string(24), gUser->loginname);
s_getc();
for (i=1;i<=conf.nodes;i++) {
sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, i);
@ -621,14 +621,14 @@ void runbbs_real(int socket, char *ip, int ssh) {
if (strcasecmp(user->loginname, buffer) == 0) {
fclose(nodefile);
s_printf("\r\nYou are already logged in.\r\n");
s_printf(get_string(23));
disconnect("Already Logged in");
}
fclose(nodefile);
}
}
} else {
s_printf("\e[0mWelcome to %s! Press enter to create an account...\r\n", conf.bbs_name);
s_printf(get_string(25), conf.bbs_name);
s_getc();
gUser = new_user();
user = gUser;
@ -687,7 +687,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
while (stat(buffer, &s) == 0) {
sprintf(buffer, "bulletin%d", i);
s_displayansi(buffer);
s_printf("\e[0mPress any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
i++;
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
@ -703,9 +703,9 @@ void runbbs_real(int socket, char *ip, int ssh) {
// check email
i = mail_getemailcount(user);
if (i > 0) {
s_printf("\r\nYou have %d e-mail(s) in your inbox.\r\n", i);
s_printf(get_string(26), i);
} else {
s_printf("\r\nYou have no e-mail.\r\n");
s_printf(get_string(27));
}
mail_scan(user);

5
bbs.h
View File

@ -96,7 +96,7 @@ struct bbs_config {
int ssh_port;
char *ssh_dsa_key;
char *ssh_rsa_key;
char *string_file;
char *irc_server;
int irc_port;
char *irc_channel;
@ -192,4 +192,7 @@ extern int file_menu(struct user_record *user);
extern void settings_menu(struct user_record *user);
extern void lua_push_cfunctions(lua_State *L);
extern void load_strings();
extern char *get_string(int offset);
#endif

View File

@ -28,22 +28,22 @@ void add_bbs(struct user_record *user) {
sqlite3_stmt *res;
int rc;
s_printf("\r\n\e[1;37mEnter the BBS Name: \e[0m");
s_printf(get_string(28));
s_readstring(bbsname, 18);
s_printf("\r\n\e[1;37mEnter the Sysop's Name: \e[0m");
s_printf(get_string(29));
s_readstring(sysop, 16);
s_printf("\r\n\e[1;37mEnter the Telnet URL: \e[0m");
s_printf(get_string(30));
s_readstring(telnet, 38);
s_printf("\r\nYou entered:\r\n");
s_printf("\e[1;30m----------------------------------------------\e[0m\r\n");
s_printf("\e[1;37mBBS Name: \e[1;32m%s\r\n", bbsname);
s_printf("\e[1;37mSysop: \e[1;32m%s\r\n", sysop);
s_printf("\e[1;37mTelnet URL: \e[1;32m%s\r\n", telnet);
s_printf("\e[1;30m----------------------------------------------\e[0m\r\n");
s_printf("Is this correct? (Y/N) :");
s_printf(get_string(31));
s_printf(get_string(32));
s_printf(get_string(33), bbsname);
s_printf(get_string(34), sysop);
s_printf(get_string(35), telnet);
s_printf(get_string(36));
s_printf(get_string(37));
c = s_getc();
if (tolower(c) == 'y') {
@ -93,9 +93,9 @@ void add_bbs(struct user_record *user) {
}
sqlite3_finalize(res);
sqlite3_close(db);
s_printf("\r\n\e[1;32mAdded!\e[0m\r\n");
s_printf(get_string(38));
} else {
s_printf("\r\n\e[1;31mAborted!\e[0m\r\n");
s_printf(get_string(39));
}
}
@ -109,7 +109,7 @@ void delete_bbs(struct user_record *user) {
int i;
char c;
s_printf("\r\nPlease enter the id of the BBS you want to delete: ");
s_printf(get_string(40));
s_readstring(buffer, 5);
i = atoi(buffer);
@ -125,11 +125,11 @@ void delete_bbs(struct user_record *user) {
sqlite3_bind_int(res, 2, user->id);
} else {
sqlite3_close(db);
s_printf("\r\nThere are no BBSes in the list yet!\r\n");
s_printf(get_string(41));
return;
}
if (sqlite3_step(res) == SQLITE_ROW) {
s_printf("\r\nAre you sure you want to delete %s?\r\n", sqlite3_column_text(res, 0));
s_printf(get_string(42), sqlite3_column_text(res, 0));
sqlite3_finalize(res);
c = s_getc();
if (tolower(c) == 'y') {
@ -138,18 +138,18 @@ void delete_bbs(struct user_record *user) {
sqlite3_bind_int(res, 1, i);
} else {
sqlite3_close(db);
s_printf("\r\nThere are no BBSes in the list yet!\r\n");
s_printf(get_string(41));
return;
}
sqlite3_step(res);
s_printf("\r\n\e[1;32mDeleted!\e[0m\r\n");
s_printf(get_string(43));
sqlite3_finalize(res);
} else {
s_printf("\r\n\e[1;32mAborted!\e[0m\r\n");
s_printf(get_string(39));
}
} else {
sqlite3_finalize(res);
s_printf("\r\nThat BBS entry either doesn't exist or wasn't created by you.\r\n");
s_printf(get_string(44));
}
sqlite3_close(db);
}
@ -173,27 +173,27 @@ void list_bbses() {
rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
if (rc != SQLITE_OK) {
sqlite3_close(db);
s_printf("\r\nThere are no BBSes in the list yet!\r\n");
s_printf(get_string(41));
return;
}
i = 0;
s_printf("\r\n\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(45));
while (sqlite3_step(res) == SQLITE_ROW) {
s_printf("\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;37m%-18s \e[1;33m%-16s \e[1;32m%-37s\e[0m\r\n", sqlite3_column_int(res, 0), sqlite3_column_text(res, 1), sqlite3_column_text(res, 2), sqlite3_column_text(res, 3));
s_printf(get_string(46), sqlite3_column_int(res, 0), sqlite3_column_text(res, 1), sqlite3_column_text(res, 2), sqlite3_column_text(res, 3));
i++;
if (i == 20) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
i = 0;
}
}
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(47));
sqlite3_finalize(res);
sqlite3_close(db);
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
}
@ -202,7 +202,7 @@ void bbs_list(struct user_record *user) {
char c;
while(!doquit) {
s_printf("\r\n\e[1;32mBBS Listings: \e[1;37m(\e[1;33mL\e[1;37m) \e[1;32mList, \e[1;37m(\e[1;33mA\e[1;37m) \e[1;32mAdd \e[1;37m(\e[1;33mD\e[1;37m) \e[1;32mDelete \e[1;37m(\e[1;33mQ\e[1;37m) \e[1;32mQuit\e[0m\r\n");
s_printf(get_string(48));
c = s_getc();

View File

@ -121,7 +121,7 @@ void chat_system(struct user_record *user) {
memset(inputbuffer, 0, 80);
if (conf.irc_server == NULL) {
s_putstring("\r\nSorry, Chat is not supported on this system.\r\n");
s_putstring(get_string(49));
return;
}
row_at = 0;
@ -282,7 +282,7 @@ void chat_system(struct user_record *user) {
for (i=line_at+1;i<22;i++) {
s_putstring("\r\n");
}
s_putstring("\e[1;45;37m Type /Quit to Exit\e[K\e[0m\r\n");
s_putstring(get_string(50));
if (inputbuffer_at > 0) {
s_putstring(inputbuffer);
}

View File

@ -18,6 +18,7 @@ SSH DSA Key = /home/andrew/MagickaBBS/keys/ssh_host_dsa_key
SSH RSA Key = /home/andrew/MagickaBBS/keys/ssh_host_rsa_key
[paths]
String File = /home/andrew/MagickaBBS/magicka.strings
PID File = /home/andrew/MagickaBBS/magicka.pid
ANSI Path = /home/andrew/MagickaBBS/ansis
BBS Path = /home/andrew/MagickaBBS

View File

@ -241,7 +241,7 @@ void rundoor(struct user_record *user, char *cmd, int stdio) {
sprintf(buffer, "%s %d %d", cmd, mynode, gSocket);
system(buffer);
} else {
s_printf("Non-STDIO door support on SSH is currently broken...\r\n");
s_printf(get_string(51));
}
}
timeoutpaused = 0;
@ -283,7 +283,7 @@ int door_menu(struct user_record *user) {
if (do_internal_menu == 1) {
s_displayansi("doors");
s_printf("\e[0m\r\nTL: %dm :> ", user->timeleft);
s_printf(get_string(52), user->timeleft);
c = s_getc();
} else {
@ -305,7 +305,7 @@ int door_menu(struct user_record *user) {
break;
case 'g':
{
s_printf("\r\nAre you sure you want to log off? (Y/N)");
s_printf(get_string(53));
c = s_getc();
if (tolower(c) == 'y') {
doquit = 1;

41
email.c
View File

@ -27,24 +27,24 @@ void send_email(struct user_record *user) {
char *isql = "INSERT INTO email (sender, recipient, subject, body, date, seen) VALUES(?, ?, ?, ?, ?, 0)";
char *err_msg = 0;
s_printf("\r\nTO: ");
s_printf(get_string(54));
s_readstring(buffer, 16);
if (strlen(buffer) == 0) {
s_printf("\r\nAborted\r\n");
s_printf(get_string(39));
return;
}
if (check_user(buffer)) {
s_printf("\r\n\r\nInvalid Username\r\n");
s_printf(get_string(55));
return;
}
recipient = strdup(buffer);
s_printf("\r\nSUBJECT: ");
s_printf(get_string(56));
s_readstring(buffer, 25);
if (strlen(buffer) == 0) {
free(recipient);
s_printf("\r\nAborted\r\n");
s_printf(get_string(39));
return;
}
subject = strdup(buffer);
@ -150,14 +150,13 @@ void show_email(struct user_record *user, int msgno) {
date = (time_t)sqlite3_column_int(res, 4);
s_printf("\e[2J\e[1;32mFrom : \e[1;37m%s\r\n", sender);
s_printf("\e[1;32mSubject : \e[1;37m%s\r\n", subject);
s_printf(get_string(57), sender);
s_printf(get_string(58), subject);
localtime_r(&date, &msg_date);
sprintf(buffer, "\e[1;32mDate : \e[1;37m%s", asctime(&msg_date));
sprintf(buffer, "%s", asctime(&msg_date));
buffer[strlen(buffer) - 1] = '\0';
strcat(buffer, "\r\n");
s_printf(buffer);
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(59), buffer);
s_printf(get_string(60));
lines = 0;
chars = 0;
@ -168,7 +167,7 @@ void show_email(struct user_record *user, int msgno) {
s_printf("\r\n");
lines++;
if (lines == 19) {
s_printf("\e[1;37mPress a key to continue...\e[0m");
s_printf(get_string(6));
s_getc();
lines = 0;
s_printf("\e[5;1H\e[0J");
@ -193,7 +192,7 @@ void show_email(struct user_record *user, int msgno) {
}
sqlite3_step(res);
s_printf("\e[1;37mPress \e[1;36mR\e[1;37m to reply, \e[1;36mD\e[1;37m to delete \e[1;36mEnter\e[1;37m to quit...\e[0m\r\n");
s_printf(get_string(61));
c = s_getc();
if (tolower(c) == 'r') {
if (subject != NULL) {
@ -293,12 +292,12 @@ void list_emails(struct user_record *user) {
dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
sqlite3_finalize(res);
sqlite3_close(db);
s_printf("\r\nYou have no email\r\n");
s_printf(get_string(62));
return;
}
msgid = 0;
s_printf("\e[2J\e[1;37;44m[MSG#] Subject From Date \r\n\e[0m");
s_printf(get_string(63));
while (sqlite3_step(res) == SQLITE_ROW) {
from = strdup((char *)sqlite3_column_text(res, 0));
subject = strdup((char *)sqlite3_column_text(res, 1));
@ -306,15 +305,15 @@ void list_emails(struct user_record *user) {
date = (time_t)sqlite3_column_int(res, 3);
localtime_r(&date, &msg_date);
if (seen == 0) {
s_printf("\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-39.39s \e[1;32m%-16.16s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n", msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
s_printf(get_string(64), msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
} else {
s_printf("\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-39.39s \e[1;32m%-16.16s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n", msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
s_printf(get_string(65), msgid + 1, subject, from, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
}
free(from);
free(subject);
if (msgid % 22 == 0 && msgid != 0) {
s_printf("\e[1;37mEnter \e[1;36m# \e[1;37mto read, \e[1;36mQ \e[1;37mto quit or \e[1;36mEnter\e[1;37m to continue\e[0m\r\n");
s_printf(get_string(66));
s_readstring(buffer, 5);
if (strlen(buffer) > 0) {
if (tolower(buffer[0]) == 'q') {
@ -329,14 +328,14 @@ void list_emails(struct user_record *user) {
return;
}
}
s_printf("\e[2J\e[1;37;44m[MSG#] Subject From Date \r\n\e[0m");
s_printf(get_string(63));
}
msgid++;
}
if (msgid == 0) {
s_printf( "\r\nYou have no email\r\n");
s_printf(get_string(62));
} else {
s_printf("\e[1;37mEnter \e[1;36m# \e[1;37mto read, or \e[1;36mEnter\e[1;37m to quit\e[0m\r\n");
s_printf(get_string(67));
s_readstring(buffer, 5);
if (strlen(buffer) > 0) {
msgtoread = atoi(buffer) - 1;

48
files.c
View File

@ -467,7 +467,7 @@ void list_files(struct user_record *user) {
if (rc != SQLITE_OK) {
sqlite3_finalize(res);
sqlite3_close(db);
s_printf("\r\nNo files in this area!\r\n");
s_printf(get_string(68));
return;
}
@ -492,7 +492,7 @@ void list_files(struct user_record *user) {
sqlite3_close(db);
if (files_c == 0) {
s_printf("\r\nNo files in this area!\r\n");
s_printf(get_string(68));
return;
}
s_printf("\r\n");
@ -510,7 +510,7 @@ void list_files(struct user_record *user) {
} else {
file_unit = 'b';
}
s_printf("\r\n\r\n\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;33m%3ddloads \e[1;36m%4d%c \e[1;37m%-56s\r\n \e[0;32m", i, files_e[i]->dlcount, file_size, file_unit, basename(files_e[i]->filename));
s_printf(get_string(69), i, files_e[i]->dlcount, file_size, file_unit, basename(files_e[i]->filename));
lines+=3;
for (j=0;j<strlen(files_e[i]->description);j++) {
if (files_e[i]->description[j] == '\n') {
@ -519,7 +519,7 @@ void list_files(struct user_record *user) {
if (lines >= 18) {
lines = 0;
while (1) {
s_printf("\r\n\e[0mEnter # to tag, Q to quit, Enter to continue: ");
s_printf(get_string(70));
s_readstring(buffer, 5);
if (strlen(buffer) == 0) {
s_printf("\r\n");
@ -552,18 +552,18 @@ void list_files(struct user_record *user) {
}
tagged_files[tagged_count] = strdup(files_e[z]->filename);
tagged_count++;
s_printf("\r\nTagged %s\r\n", basename(files_e[z]->filename));
s_printf(get_string(71), basename(files_e[z]->filename));
} else {
s_printf("\r\nAlready Tagged\r\n");
s_printf(get_string(72));
}
} else {
s_printf("\r\nSorry, you don't have permission to download from this area\r\n");
s_printf(get_string(73));
}
}
}
}
} else {
s_printf(" \e[0;32m");
s_printf(get_string(74));
}
} else {
s_putchar(files_e[i]->description[j]);
@ -571,7 +571,7 @@ void list_files(struct user_record *user) {
}
}
while (1) {
s_printf("\r\n\e[0mEnter # to tag, Enter to quit: ");
s_printf(get_string(75));
s_readstring(buffer, 5);
if (strlen(buffer) == 0) {
for (z=0;z<files_c;z++) {
@ -601,12 +601,12 @@ void list_files(struct user_record *user) {
}
tagged_files[tagged_count] = strdup(files_e[z]->filename);
tagged_count++;
s_printf("\r\nTagged %s\r\n", basename(files_e[z]->filename));
s_printf(get_string(71), basename(files_e[z]->filename));
} else {
s_printf("\r\nAlready Tagged\r\n");
s_printf(get_string(72));
}
} else {
s_printf("\r\nSorry, you don't have permission to download from this area\r\n");
s_printf(get_string(73));
}
}
}
@ -650,7 +650,7 @@ int file_menu(struct user_record *user) {
if (do_internal_menu == 1) {
s_displayansi("filemenu");
s_printf("\e[0m\r\nDir: (%d) %s\r\nSub: (%d) %s\r\nTL: %dm :> ", user->cur_file_dir, conf.file_directories[user->cur_file_dir]->name, user->cur_file_sub, conf.file_directories[user->cur_file_dir]->file_subs[user->cur_file_sub]->name, user->timeleft);
s_printf(get_string(76), user->cur_file_dir, conf.file_directories[user->cur_file_dir]->name, user->cur_file_sub, conf.file_directories[user->cur_file_dir]->file_subs[user->cur_file_sub]->name, user->timeleft);
c = s_getc();
} else {
@ -669,22 +669,22 @@ int file_menu(struct user_record *user) {
switch(tolower(c)) {
case 'i':
{
s_printf("\r\n\r\nFile Directories:\r\n\r\n");
s_printf(get_string(77));
for (i=0;i<conf.file_directory_count;i++) {
if (conf.file_directories[i]->sec_level <= user->sec_level) {
s_printf(" %d. %s\r\n", i, conf.file_directories[i]->name);
s_printf(get_string(78), i, conf.file_directories[i]->name);
}
if (i != 0 && i % 20 == 0) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
c = s_getc();
}
}
s_printf("Enter the directory number: ");
s_printf(get_string(79));
s_readstring(prompt, 5);
if (tolower(prompt[0]) != 'q') {
j = atoi(prompt);
if (j < 0 || j >= conf.file_directory_count || conf.file_directories[j]->sec_level > user->sec_level) {
s_printf("\r\nInvalid directory number!\r\n");
s_printf(get_string(80));
} else {
s_printf("\r\n");
user->cur_file_dir = j;
@ -695,21 +695,21 @@ int file_menu(struct user_record *user) {
break;
case 's':
{
s_printf("\r\n\r\nFile Subdirectories:\r\n\r\n");
s_printf(get_string(81));
for (i=0;i<conf.file_directories[user->cur_file_dir]->file_sub_count;i++) {
s_printf(" %d. %s\r\n", i, conf.file_directories[user->cur_file_dir]->file_subs[i]->name);
if (i != 0 && i % 20 == 0) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
c = s_getc();
}
}
s_printf("Enter the sub directory number: ");
s_printf(get_string(82));
s_readstring(prompt, 5);
if (tolower(prompt[0]) != 'q') {
j = atoi(prompt);
if (j < 0 || j >= conf.file_directories[user->cur_file_dir]->file_sub_count) {
s_printf("\r\nInvalid sub directiry number!\r\n");
s_printf(get_string(83));
} else {
s_printf("\r\n");
user->cur_file_sub = j;
@ -725,7 +725,7 @@ int file_menu(struct user_record *user) {
if (user->sec_level >= conf.file_directories[user->cur_file_dir]->file_subs[user->cur_file_sub]->upload_sec_level) {
upload(user);
} else {
s_printf("Sorry, you don't have permission to upload in this Sub\r\n");
s_printf(get_string(84));
}
}
break;
@ -796,7 +796,7 @@ int file_menu(struct user_record *user) {
break;
case 'g':
{
s_printf("\r\nAre you sure you want to log off? (Y/N)");
s_printf(get_string(53));
c = s_getc();
if (tolower(c) == 'y') {
dofiles = 1;

186
magicka.strings Normal file
View File

@ -0,0 +1,186 @@
\r\n\r\nSorry, you're out of time today..\r\n
\r\n\r\nTimeout waiting for input..\r\n
\r\n\e[1;37mLast 10 callers:\r\n
\e[1;30m-------------------------------------------------------------------------------\r\n
\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d\e[0m\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;37mPress any key to continue...\e[0m\r\n
\r\n\r\n\e[1;37mSystem Information\r\n
\e[1;30m----------------------------------------------\r\n
\e[1;32mBBS Name : \e[1;37m%s\r\n
\e[1;32mSysOp Name : \e[1;37m%s\r\n
\e[1;32mNode : \e[1;37m%d\r\n
\e[1;32mBBS Version : \e[1;37mMagicka %d.%d (%s)\r\n
\e[1;32mSystem : \e[1;37m%s (%s)\r\n
\e[1;30m----------------------------------------------\e[0m\r\n
Automessage Posted by %s @ %s
\r\nEnter your message (4 lines):\r\n
No automessage!\r\n
Sorry, all nodes are in use. Please try later\r\n
\e[0mEnter your Login Name or NEW to create an account\r\n
Login:>
\r\nPassword:>
\r\nIncorrect Login.\r\n
\r\nYou are already logged in.\r\n
\e[0mWelcome back %s. Press enter to log in...\r\n
\e[0mWelcome to %s! Press enter to create an account...\r\n
\r\nYou have %d e-mail(s) in your inbox.\r\n
\r\nYou have no e-mail.\r\n
\r\n\e[1;37mEnter the BBS Name: \e[0m
\r\n\e[1;37mEnter the Sysop's Name: \e[0m
\r\n\e[1;37mEnter the Telnet URL: \e[0m
\r\nYou entered:\r\n
\e[1;30m----------------------------------------------\e[0m\r\n
\e[1;37mBBS Name: \e[1;32m%s\r\n
\e[1;37mSysop: \e[1;32m%s\r\n
\e[1;37mTelnet URL: \e[1;32m%s\r\n
\e[1;30m----------------------------------------------\e[0m\r\n
Is this correct? (Y/N) :
\r\n\e[1;32mAdded!\e[0m\r\n
\r\n\e[1;31mAborted!\e[0m\r\n
\r\nPlease enter the id of the BBS you want to delete:
\r\nThere are no BBSes in the list yet!\r\n
\r\nAre you sure you want to delete %s?\r\n
\r\n\e[1;32mDeleted!\e[0m\r\n
\r\nThat BBS entry either doesn't exist or wasn't created by you.\r\n
\r\n\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;37m%-18s \e[1;33m%-16s \e[1;32m%-37s\e[0m\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\r\n\e[1;32mBBS Listings: \e[1;37m(\e[1;33mL\e[1;37m) \e[1;32mList, \e[1;37m(\e[1;33mA\e[1;37m) \e[1;32mAdd \e[1;37m(\e[1;33mD\e[1;37m) \e[1;32mDelete \e[1;37m(\e[1;33mQ\e[1;37m) \e[1;32mQuit\e[0m\r\n
\r\nSorry, Chat is not supported on this system.\r\n
\e[1;45;37m Type /Quit to Exit\e[K\e[0m\r\n
Non-STDIO door support on SSH is currently broken...\r\n
\e[0m\r\nTL: %dm :>
\r\nAre you sure you want to log off? (Y/N)
\r\nTO:
\r\n\r\nInvalid Username\r\n
\r\nSUBJECT:
\e[2J\e[1;32mFrom : \e[1;37m%s\r\n
\e[1;32mSubject : \e[1;37m%s\r\n
\e[1;32mDate : \e[1;37m%s\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;37mPress \e[1;36mR\e[1;37m to reply, \e[1;36mD\e[1;37m to delete \e[1;36mEnter\e[1;37m to quit...\e[0m\r\n
\r\nYou have no email\r\n
\e[2J\e[1;37;44m[MSG#] Subject From Date \r\n\e[0m
\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-39.39s \e[1;32m%-16.16s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n
\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-39.39s \e[1;32m%-16.16s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n
\e[1;37mEnter \e[1;36m# \e[1;37mto read, \e[1;36mQ \e[1;37mto quit or \e[1;36mEnter\e[1;37m to continue\e[0m\r\n
\e[1;37mEnter \e[1;36m# \e[1;37mto read, or \e[1;36mEnter\e[1;37m to quit\e[0m\r\n
\r\nNo files in this area!\r\n
\r\n\r\n\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;33m%3ddloads \e[1;36m%4d%c \e[1;37m%-56s\r\n \e[0;32m
\r\n\e[0mEnter # to tag, Q to quit, Enter to continue:
\r\nTagged %s\r\n
\r\nAlready Tagged\r\n
\r\nSorry, you don't have permission to download from this area\r\n
\e[0;32m
\r\n\e[0mEnter # to tag, Enter to quit:
\e[0m\r\nDir: (%d) %s\r\nSub: (%d) %s\r\nTL: %dm :>
\r\n\r\nFile Directories:\r\n\r\n
%d. %s\r\n
Enter the directory number:
\r\nInvalid directory number!\r\n
\r\n\r\nFile Subdirectories:\r\n\r\n
Enter the sub directory number:
\r\nInvalid sub directory number!\r\n
Sorry, you don't have permission to upload in this Sub\r\n
\r\nUse external editor? (Y/N)
\r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m
\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s
\r\nNo message to quote!\r\n
\r\nQuote from Line:
\r\nQuote to Line:
Quoting Cancelled\r\n
\e[1;33m\r\nHELP\r\n
/S - Save Message\r\n
/A - Abort Message\r\n
/Q - Quote Message\r\n
/E - Edit (Rewrite) Line\r\n
/D - Delete Line\r\n
/I - Insert Line\r\n
/L - Relist Message\r\n\e[0m
\r\nWhich line do you want to delete?
\r\nWhich line do you want to edit?
\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m
\r\nInsert before which line?
\e[2J\e[1;32mFrom : \e[1;37m%s (%d:%d/%d.%d)\r\n
\e[2J\e[1;32mFrom : \e[1;37m%s\r\n
\e[1;32mTo : \e[1;37m%-27.27s \e[1;32mConf : \e[1;37m%-27.27s\r\n
\e[1;32mSubject : \e[1;37m%-27.27s \e[1;32mArea : \e[1;37m%-27.27s\r\n
\e[1;32mDate : \e[1;37m%s \e[1;32mMsgNo : \e[1;37m%4d of %4d\r\n
\e[1;32mAttribs : \e[1;37m%s\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\r\n\e[1;37mPress \e[1;36mR \e[1;37mto reply, \e[1;36mQ \e[1;37mto quit, \e[1;36mB \e[1;37mto go Back, \e[1;36mSPACE \e[1;37mfor Next Mesage...
\r\nSorry, you are not allowed to post in this area\r\n
\r\n\r\nReplying to: %s\r\n
Change Subject? (Y/N)
\r\nNew subject:
\r\nOk, not changing the subject line...
\r\n\r\nNo more messages\r\n
\e[0m\r\nConf: (%d) %s\r\nArea: (%d) %s\r\nTL: %dm :>
Read message [1-%d] or N for New:
\r\nADDR:
\r\n\r\nInvalid Address\r\n
\r\nMailing to %d:%d/%d.%d\r\n
\r\nMailing to @%d\r\n
Start at message [1-%d] or N for New?
\e[2J\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m
\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n
\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n
(#) Read Message # (Q) Quit (ENTER) Continue\r\n
\r\nThere is no mail in this area\r\n
\r\n\r\nMail Conferences:\r\n\r\n
%d. %s\r\n
Enter the conference number:
\r\nInvalid conference number!\r\n
\r\n\r\nMail Areas:\r\n\r\n
%d. %s\r\n
Enter the area number:
\r\nInvalid area number!\r\n
\r\nScan for new mail? (Y/N) :
\r\n\e[1;32m%d. %s\e[0m\r\n
\e[1;37m --> %d. %s (%d new)\e[0m\r\n
\r\n\e[0mTL: %dm :>
\r\n\e[1;32mText Files Collection\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;37m%s\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
Enter the number of a text file to display or Q to quit:
\r\nSorry, there are no text files to display\r\n
\e[2J\e[1;32mYour Settings\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[0;36mP. \e[1;37mPassword (\e[1;33mNot Shown\e[1;37m)\r\n
\e[0;36mL. \e[1;37mLocation (\e[1;33m%s\e[1;37m)\r\n
\e[0;36mQ. \e[1;37mQuit to Main Menu\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\r\nEnter your current password:
\r\nEnter your new password (8 chars min):
\r\nPassword Changed!\r\n
\r\nPassword too short!\r\n
\r\nPassword Incorrect!\r\n
\r\nEnter your new location:
\e[2J\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
User Name Location Times On\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%5d\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\r\nWhat is your login name:
Sorry, that name is too short.\r\n
Sorry, invalid character, can only use alpha characters.\r\n
Sorry, that name is reserved.\r\n
Sorry, that name is in use.\r\n
What is your first name:
What is your last name:
What is your e-mail address:
Where are you located:
What password would you like (at least 8 characters):
You Entered:\r\n
-------------------------------------\r\n
Login Name:
\r\nFirst Name:
\r\nLast Name:
\r\nE-mail:
\r\nLocation:
\r\n-------------------------------------\r\n
Is this Correct? (Y/N)
\e[1;37mPress any key to continue...\e[0m

View File

@ -344,7 +344,7 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
if (conf.external_editor_cmd != NULL) {
s_printf("\r\nUse external editor? (Y/N) ");
s_printf(get_string(85));
c = s_getc();
if (tolower(c) == 'y') {
@ -524,11 +524,11 @@ char *editor(struct user_record *user, char *quote, char *from, int email) {
}
}
}
s_printf("\r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m");
s_printf(get_string(86));
s_printf(get_string(87));
while(!doquit) {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", lines, next_line_buffer);
s_printf(get_string(88), lines, next_line_buffer);
strcpy(linebuffer, next_line_buffer);
s_readstring(&linebuffer[strlen(next_line_buffer)], 70 - strlen(next_line_buffer));
memset(next_line_buffer, 0, 70);
@ -610,17 +610,17 @@ char *editor(struct user_record *user, char *quote, char *from, int email) {
return NULL;
} else if (toupper(linebuffer[1]) == 'Q') {
if (quote == NULL) {
s_printf("\r\nNo message to quote!\r\n");
s_printf(get_string(89));
} else {
s_printf("\r\n");
for (i=0;i<quotelines;i++) {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", i, quotecontent[i]);
s_printf(get_string(88), i, quotecontent[i]);
}
s_printf("\r\nQuote from Line: ");
s_printf(get_string(90));
s_readstring(buffer, 5);
qfrom = atoi(buffer);
s_printf("\r\nQuote to Line: ");
s_printf(get_string(91));
s_readstring(buffer, 5);
qto = atoi(buffer);
s_printf("\r\n");
@ -632,7 +632,7 @@ char *editor(struct user_record *user, char *quote, char *from, int email) {
qfrom = 0;
}
if (qfrom > qto) {
s_printf("Quoting Cancelled\r\n");
s_printf(get_string(92));
}
for (i=qfrom;i<=qto;i++) {
@ -646,38 +646,38 @@ char *editor(struct user_record *user, char *quote, char *from, int email) {
lines++;
}
s_printf("\r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m");
s_printf(get_string(86));
s_printf(get_string(87));
for (i=0;i<lines;i++) {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", i, content[i]);
s_printf(get_string(88), i, content[i]);
}
}
} else if (toupper(linebuffer[1]) == 'L') {
s_printf("\r\n\e[1;32mMagicka Internal Editor, Type \e[1;37m/S \e[1;32mto save, \e[1;37m/A \e[1;32mto abort and \e[1;37m/? \e[1;32mfor help\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m");
s_printf(get_string(86));
s_printf(get_string(87));
for (i=0;i<lines;i++) {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", i, content[i]);
s_printf(get_string(88), i, content[i]);
}
} else if (linebuffer[1] == '?') {
s_printf("\e[1;33m\r\nHELP\r\n");
s_printf("/S - Save Message\r\n");
s_printf("/A - Abort Message\r\n");
s_printf("/Q - Quote Message\r\n");
s_printf("/E - Edit (Rewrite) Line\r\n");
s_printf("/D - Delete Line\r\n");
s_printf("/I - Insert Line\r\n");
s_printf("/L - Relist Message\r\n\e[0m");
s_printf(get_string(93));
s_printf(get_string(94));
s_printf(get_string(95));
s_printf(get_string(96));
s_printf(get_string(97));
s_printf(get_string(98));
s_printf(get_string(99));
s_printf(get_string(100));
} else if (toupper(linebuffer[1]) == 'D') {
s_printf("\r\nWhich line do you want to delete? ");
s_printf(get_string(101));
s_readstring(buffer, 6);
if (strlen(buffer) == 0) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
z = atoi(buffer);
if (z < 0 || z >= lines) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
for (i=z;i<lines-1;i++) {
free(content[i]);
@ -689,33 +689,33 @@ char *editor(struct user_record *user, char *quote, char *from, int email) {
}
}
} else if (toupper(linebuffer[1]) == 'E') {
s_printf("\r\nWhich line do you want to edit? ");
s_printf(get_string(102));
s_readstring(buffer, 6);
if (strlen(buffer) == 0) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
z = atoi(buffer);
if (z < 0 || z >= lines) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m%s", z, content[z]);
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m", z);
s_printf(get_string(88), z, content[z]);
s_printf(get_string(103), z);
s_readstring(linebuffer, 70);
free(content[z]);
content[z] = strdup(linebuffer);
}
}
} else if (toupper(linebuffer[1]) == 'I') {
s_printf("\r\nInsert before which line? ");
s_printf(get_string(104));
s_readstring(buffer, 6);
if (strlen(buffer) == 0) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
z = atoi(buffer);
if (z < 0 || z >= lines) {
s_printf("\r\nAborted...\r\n");
s_printf(get_string(39));
} else {
s_printf("\r\n\e[1;30m[\e[1;34m%3d\e[1;30m]: \e[0m", z);
s_printf(get_string(103), z);
s_readstring(linebuffer, 70);
lines++;
content = (char **)realloc(content, sizeof(char *) * lines);
@ -799,19 +799,19 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
if (msghs->msgs[mailno]->oaddress != NULL && conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO) {
from_addr = parse_fido_addr(msghs->msgs[mailno]->oaddress);
s_printf("\e[2J\e[1;32mFrom : \e[1;37m%s (%d:%d/%d.%d)\r\n", msghs->msgs[mailno]->from, from_addr->zone, from_addr->net, from_addr->node, from_addr->point);
s_printf(get_string(105), msghs->msgs[mailno]->from, from_addr->zone, from_addr->net, from_addr->node, from_addr->point);
free(from_addr);
} else {
s_printf("\e[2J\e[1;32mFrom : \e[1;37m%s\r\n", msghs->msgs[mailno]->from);
s_printf(get_string(106), msghs->msgs[mailno]->from);
}
s_printf("\e[1;32mTo : \e[1;37m%-27.27s \e[1;32mConf : \e[1;37m%-27.27s\r\n", msghs->msgs[mailno]->to, conf.mail_conferences[user->cur_mail_conf]->name);
s_printf("\e[1;32mSubject : \e[1;37m%-27.27s \e[1;32mArea : \e[1;37m%-27.27s\r\n", msghs->msgs[mailno]->subject, conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name);
s_printf(get_string(107), msghs->msgs[mailno]->to, conf.mail_conferences[user->cur_mail_conf]->name);
s_printf(get_string(108), msghs->msgs[mailno]->subject, conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name);
localtime_r((time_t *)&msghs->msgs[mailno]->msg_h->DateWritten, &msg_date);
sprintf(buffer, "\e[1;32mDate : \e[1;37m%s", asctime(&msg_date));
sprintf(buffer, "%s", asctime(&msg_date));
buffer[strlen(buffer) - 1] = '\0';
s_printf("%s \e[1;32mMsgNo : \e[1;37m%4d of %4d\r\n", buffer, mailno + 1, msghs->msg_count);
s_printf("\e[1;32mAttribs : \e[1;37m%s\r\n", (msghs->msgs[mailno]->msg_h->Attribute & MSG_SENT ? "SENT" : ""));
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(109), buffer, mailno + 1, msghs->msg_count);
s_printf(get_string(110), (msghs->msgs[mailno]->msg_h->Attribute & MSG_SENT ? "SENT" : ""));
s_printf(get_string(111));
body = (char *)malloc(msghs->msgs[mailno]->msg_h->TxtLen);
@ -867,7 +867,7 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
}
lines++;
if (lines >= 17) {
s_printf("\e[1;37mPress a key to continue...\e[0m");
s_printf(get_string(185));
s_getc();
lines = 0;
s_printf("\e[7;1H\e[0J");
@ -939,14 +939,14 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
}
}
s_printf("\r\n\e[1;37mPress \e[1;36mR \e[1;37mto reply, \e[1;36mQ \e[1;37mto quit, \e[1;36mB \e[1;37mto go Back, \e[1;36mSPACE \e[1;37mfor Next Mesage...");
s_printf(get_string(112));
c = s_getc();
if (tolower(c) == 'r') {
JAM_CloseMB(jb);
if (user->sec_level < conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->write_sec_level) {
s_printf("\r\nSorry, you are not allowed to post in this area\r\n");
s_printf(get_string(113));
} else {
if (msghs->msgs[mailno]->subject != NULL) {
if (strncasecmp(msghs->msgs[mailno]->subject, "RE:", 3) != 0) {
@ -958,17 +958,17 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
subject = (char *)malloc(strlen(buffer) + 1);
strcpy(subject, buffer);
s_printf("\r\n\r\nReplying to: %s\r\n", subject);
s_printf("Change Subject? (Y/N) ");
s_printf(get_string(114), subject);
s_printf(get_string(115));
c = s_getc();
if (tolower(c) == 'y') {
s_printf("\r\nNew subject: ");
s_printf(get_string(116));
s_readstring(buffer, 25);
if (strlen(buffer) == 0) {
s_printf("\r\nOk, not changing the subject line...");
s_printf(get_string(117));
} else {
free(subject);
subject = (char *)malloc(strlen(buffer) + 1);
@ -1232,7 +1232,7 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
} else if (c == ' ') {
mailno++;
if (mailno >= msghs->msg_count) {
s_printf("\r\n\r\nNo more messages\r\n");
s_printf(get_string(118));
doquit = 1;
}
} else if (tolower(c) == 'b') {
@ -1304,7 +1304,7 @@ int mail_menu(struct user_record *user) {
s_displayansi("mailmenu");
s_printf("\e[0m\r\nConf: (%d) %s\r\nArea: (%d) %s\r\nTL: %dm :> ", user->cur_mail_conf, conf.mail_conferences[user->cur_mail_conf]->name, user->cur_mail_area, conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name, user->timeleft);
s_printf(get_string(119), user->cur_mail_conf, conf.mail_conferences[user->cur_mail_conf]->name, user->cur_mail_area, conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->name, user->timeleft);
c = s_getc();
} else {
@ -1344,7 +1344,7 @@ int mail_menu(struct user_record *user) {
all_unread = 1;
}
JAM_CloseMB(jb);
s_printf("Read message [1-%d] or N for New: ", msghs->msg_count);
s_printf(get_string(120), msghs->msg_count);
s_readstring(buffer, 6);
@ -1377,13 +1377,13 @@ int mail_menu(struct user_record *user) {
case 'p':
{
if (user->sec_level < conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->write_sec_level) {
s_printf("\r\nSorry, you are not allowed to post in this area\r\n");
s_printf(get_string(113));
break;
}
if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_WWIV && conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_ECHOMAIL_AREA) {
sprintf(buffer, "ALL");
} else {
s_printf("\r\nTO: ");
s_printf(get_string(54));
s_readstring(buffer, 16);
}
if (strlen(buffer) == 0) {
@ -1392,41 +1392,41 @@ int mail_menu(struct user_record *user) {
if (conf.mail_conferences[user->cur_mail_conf]->networked == 0 && strcasecmp(buffer, "ALL") != 0) {
if (check_user(buffer)) {
s_printf("\r\n\r\nInvalid Username\r\n");
s_printf(get_string(55));
break;
}
}
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NETMAIL_AREA) {
s_printf("\r\nADDR: ");
s_printf(get_string(121));
s_readstring(buffer2, 32);
if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_FIDO) {
from_addr = parse_fido_addr(buffer2);
if (!from_addr) {
s_printf("\r\n\r\nInvalid Address\r\n");
s_printf(get_string(122));
break;
} else {
if (from_addr->zone == 0 && from_addr->net == 0 && from_addr->node == 0 && from_addr->point == 0) {
free(from_addr);
s_printf("\r\n\r\nInvalid Address\r\n");
s_printf(get_string(122));
break;
}
s_printf(buffer2, "\r\nMailing to %d:%d/%d.%d\r\n", from_addr->zone, from_addr->net, from_addr->node, from_addr->point);
s_printf(get_string(123), from_addr->zone, from_addr->net, from_addr->node, from_addr->point);
}
} else if (conf.mail_conferences[user->cur_mail_conf]->nettype == NETWORK_WWIV) {
wwiv_to = atoi(buffer2);
if (wwiv_to == 0) {
s_printf("\r\n\r\nInvalid Address\r\n");
s_printf(get_string(122));
break;
} else {
s_printf("\r\nMailing to @%d\r\n", wwiv_to);
s_printf(get_string(124), wwiv_to);
}
}
}
to = strdup(buffer);
s_printf("\r\nSUBJECT: ");
s_printf(get_string(56));
s_readstring(buffer, 25);
if (strlen(buffer) == 0) {
s_printf("\r\nAborted!\r\n");
s_printf(get_string(39));
free(to);
if (from_addr != NULL) {
free(from_addr);
@ -1657,7 +1657,7 @@ int mail_menu(struct user_record *user) {
all_unread = 1;
}
JAM_CloseMB(jb);
s_printf("Start at message [1-%d] or N for New? ", msghs->msg_count);
s_printf(get_string(125), msghs->msg_count);
s_readstring(buffer, 6);
if (tolower(buffer[0]) == 'n') {
@ -1679,18 +1679,18 @@ int mail_menu(struct user_record *user) {
}
}
closed = 0;
s_printf("\e[2J\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m");
s_printf(get_string(126));
for (j=i-1;j<msghs->msg_count;j++) {
localtime_r((time_t *)&msghs->msgs[j]->msg_h->DateWritten, &msg_date);
if (msghs->msgs[j]->msg_no > jlr.HighReadMsg || all_unread) {
s_printf("\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n", j + 1, msghs->msgs[j]->subject, msghs->msgs[j]->from, msghs->msgs[j]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
s_printf(get_string(127), j + 1, msghs->msgs[j]->subject, msghs->msgs[j]->from, msghs->msgs[j]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
} else {
s_printf("\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[0m\r\n", j + 1, msghs->msgs[j]->subject, msghs->msgs[j]->from, msghs->msgs[j]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
s_printf(get_string(128), j + 1, msghs->msgs[j]->subject, msghs->msgs[j]->from, msghs->msgs[j]->to, msg_date.tm_hour, msg_date.tm_min, msg_date.tm_mday, msg_date.tm_mon + 1, msg_date.tm_year - 100);
}
if ((j - (i - 1)) != 0 && (j - (i - 1)) % 20 == 0) {
s_printf("(#) Read Message # (Q) Quit (ENTER) Continue\r\n");
s_printf(get_string(129));
s_readstring(buffer, 6);
if (tolower(buffer[0]) == 'q') {
@ -1704,12 +1704,12 @@ int mail_menu(struct user_record *user) {
break;
}
}
s_printf("\e[2J\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m");
s_printf(get_string(126));
}
}
if (closed == 0) {
s_printf("(#) Read Message # (ENTER) Quit\r\n");
s_printf(get_string(129));
s_readstring(buffer, 6);
if (strlen(buffer) > 0) {
z = atoi(buffer);
@ -1724,28 +1724,28 @@ int mail_menu(struct user_record *user) {
free_message_headers(msghs);
}
} else {
s_printf("\r\nThere is no mail in this area\r\n");
s_printf(get_string(130));
}
}
break;
case 'c':
{
s_printf("\r\n\r\nMail Conferences:\r\n\r\n");
s_printf(get_string(131));
for (i=0;i<conf.mail_conference_count;i++) {
if (conf.mail_conferences[i]->sec_level <= user->sec_level) {
s_printf(" %d. %s\r\n", i, conf.mail_conferences[i]->name);
s_printf(get_string(132), i, conf.mail_conferences[i]->name);
}
if (i != 0 && i % 20 == 0) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
c = s_getc();
}
}
s_printf("Enter the conference number: ");
s_printf(get_string(133));
s_readstring(buffer, 5);
if (tolower(buffer[0]) != 'q') {
j = atoi(buffer);
if (j < 0 || j >= conf.mail_conference_count || conf.mail_conferences[j]->sec_level > user->sec_level) {
s_printf("\r\nInvalid conference number!\r\n");
s_printf(get_string(134));
} else {
s_printf("\r\n");
user->cur_mail_conf = j;
@ -1756,22 +1756,22 @@ int mail_menu(struct user_record *user) {
break;
case 'a':
{
s_printf("\r\n\r\nMail Areas:\r\n\r\n");
s_printf(get_string(135));
for (i=0;i<conf.mail_conferences[user->cur_mail_conf]->mail_area_count;i++) {
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[i]->read_sec_level <= user->sec_level) {
s_printf(" %d. %s\r\n", i, conf.mail_conferences[user->cur_mail_conf]->mail_areas[i]->name);
s_printf(get_string(136), i, conf.mail_conferences[user->cur_mail_conf]->mail_areas[i]->name);
}
if (i != 0 && i % 20 == 0) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
c = s_getc();
}
}
s_printf("Enter the area number: ");
s_printf(get_string(137));
s_readstring(buffer, 5);
if (tolower(buffer[0]) != 'q') {
j = atoi(buffer);
if (j < 0 || j >= conf.mail_conferences[user->cur_mail_conf]->mail_area_count || conf.mail_conferences[user->cur_mail_conf]->mail_areas[j]->read_sec_level > user->sec_level) {
s_printf("\r\nInvalid area number!\r\n");
s_printf(get_string(138));
} else {
s_printf("\r\n");
user->cur_mail_area = j;
@ -1786,7 +1786,7 @@ int mail_menu(struct user_record *user) {
break;
case 'g':
{
s_printf("\r\nAre you sure you want to log off? (Y/N)");
s_printf(get_string(53));
c = s_getc();
if (tolower(c) == 'y') {
domail = 1;
@ -1878,7 +1878,7 @@ void mail_scan(struct user_record *user) {
int j;
int lines = 0;
s_printf("\r\nScan for new mail? (Y/N) : ");
s_printf(get_string(139));
c = s_getc();
if (tolower(c) == 'y') {
@ -1886,10 +1886,10 @@ void mail_scan(struct user_record *user) {
if (conf.mail_conferences[i]->sec_level > user->sec_level) {
continue;
}
s_printf("\r\n\e[1;32m%d. %s\e[0m\r\n", i, conf.mail_conferences[i]->name);
s_printf(get_string(140), i, conf.mail_conferences[i]->name);
lines+=2;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
lines = 0;
}
@ -1915,10 +1915,10 @@ void mail_scan(struct user_record *user) {
msghs = read_message_headers(i, j, user);
if (msghs != NULL) {
if (msghs->msg_count > 0) {
s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
lines = 0;
}
@ -1926,10 +1926,10 @@ void mail_scan(struct user_record *user) {
free_message_headers(msghs);
}
} else {
s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs);
s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, jbh.ActiveMsgs);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
lines = 0;
}
@ -1941,10 +1941,10 @@ void mail_scan(struct user_record *user) {
if (msghs != NULL) {
if (msghs->msg_count > 0) {
if (msghs->msgs[msghs->msg_count-1]->msg_no > jlr.HighReadMsg) {
s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msgs[msghs->msg_count-1]->msg_no - jlr.HighReadMsg);
s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msgs[msghs->msg_count-1]->msg_no - jlr.HighReadMsg);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
lines = 0;
}
@ -1953,10 +1953,10 @@ void mail_scan(struct user_record *user) {
free_message_headers(msghs);
}
} else {
s_printf("\e[1;37m --> %d. %s (%d new)\e[0m\r\n", j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg);
s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, (jbh.ActiveMsgs - 1) - jlr.HighReadMsg);
lines++;
if (lines == 22) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
lines = 0;
}
@ -1969,7 +1969,7 @@ void mail_scan(struct user_record *user) {
JAM_CloseMB(jb);
}
}
s_printf("\r\nPress any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
}
}

5
main.c
View File

@ -311,6 +311,8 @@ static int handler(void* user, const char* section, const char* name,
conf->netmail_sem = strdup(value);
} else if (strcasecmp(name, "pid file") == 0) {
conf->pid_file = strdup(value);
} else if (strcasecmp(name, "string file") == 0) {
conf->string_file = strdup(value);
}
} else if (strcasecmp(section, "mail conferences") == 0) {
if (conf->mail_conference_count == 0) {
@ -738,6 +740,7 @@ int main(int argc, char **argv) {
conf.echomail_sem = NULL;
conf.netmail_sem = NULL;
conf.telnet_port = 0;
conf.string_file = NULL;
// Load BBS data
if (ini_parse(argv[1], handler, &conf) <0) {
@ -764,6 +767,8 @@ int main(int argc, char **argv) {
exit(-1);
}
load_strings();
if (conf.fork) {
if (stat(conf.pid_file, &s) == 0) {
fprintf(stderr, "Magicka already running or stale pid file at: %s\n", conf.pid_file);

View File

@ -47,7 +47,7 @@ void main_menu(struct user_record *user) {
s_displayansi("mainmenu");
s_printf("\r\n\e[0mTL: %dm :> ", user->timeleft);
s_printf(get_string(142), user->timeleft);
c = s_getc();
} else {
@ -75,21 +75,21 @@ void main_menu(struct user_record *user) {
if (conf.text_file_count > 0) {
while(1) {
s_printf("\r\n\e[1;32mText Files Collection\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(143));
s_printf(get_string(144));
for (i=0;i<conf.text_file_count;i++) {
s_printf("\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;37m%s\r\n", i, conf.text_files[i]->name);
s_printf(get_string(145), i, conf.text_files[i]->name);
}
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf("Enter the number of a text file to display or Q to quit: ");
s_printf(get_string(146));
s_printf(get_string(147));
s_readstring(buffer, 4);
if (tolower(buffer[0]) != 'q') {
i = atoi(buffer);
if (i >= 0 && i < conf.text_file_count) {
s_printf("\r\n");
s_displayansi_p(conf.text_files[i]->path);
s_printf("Press any key to continue...");
s_printf(get_string(6));
s_getc();
s_printf("\r\n");
}
@ -98,8 +98,8 @@ void main_menu(struct user_record *user) {
}
}
} else {
s_printf("\r\nSorry, there are no text files to display\r\n");
s_printf("Press any key to continue...\r\n");
s_printf(get_string(148));
s_printf(get_string(6));
s_getc();
}
}
@ -127,7 +127,7 @@ void main_menu(struct user_record *user) {
while (stat(buffer, &s) == 0) {
sprintf(buffer, "bulletin%d", i);
s_displayansi(buffer);
s_printf("\e[0mPress any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
i++;
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
@ -151,7 +151,7 @@ void main_menu(struct user_record *user) {
break;
case 'g':
{
s_printf("\r\nAre you sure you want to log off? (Y/N)");
s_printf(get_string(53));
c = s_getc();
if (tolower(c) == 'y') {
doquit = 1;

View File

@ -11,23 +11,23 @@ void settings_menu(struct user_record *user) {
char *hash;
while (!dosettings) {
s_printf("\e[2J\e[1;32mYour Settings\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf("\e[0;36mP. \e[1;37mPassword (\e[1;33mNot Shown\e[1;37m)\r\n");
s_printf("\e[0;36mL. \e[1;37mLocation (\e[1;33m%s\e[1;37m)\r\n", user->location);
s_printf("\e[0;36mQ. \e[1;37mQuit to Main Menu\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(149));
s_printf(get_string(150));
s_printf(get_string(151));
s_printf(get_string(152), user->location);
s_printf(get_string(153));
s_printf(get_string(154));
c = s_getc();
switch(tolower(c)) {
case 'p':
{
s_printf("\r\nEnter your current password: ");
s_printf(get_string(155));
s_readpass(buffer, 16);
hash = hash_sha256(buffer, user->salt);
if (strcmp(hash, user->password) == 0) {
s_printf("\r\nEnter your new password (8 chars min): ");
s_printf(get_string(156));
s_readstring(buffer, 16);
if (strlen(buffer) >= 8) {
free(user->password);
@ -37,18 +37,18 @@ void settings_menu(struct user_record *user) {
user->password = hash_sha256(buffer, user->salt);
save_user(user);
s_printf("\r\nPassword Changed!\r\n");
s_printf(get_string(157));
} else {
s_printf("\r\nPassword too short!\r\n");
s_printf(get_string(158));
}
} else {
s_printf("\r\nPassword Incorrect!\r\n");
s_printf(get_string(159));
}
}
break;
case 'l':
{
s_printf("\r\nEnter your new location: ");
s_printf(get_string(160));
s_readstring(buffer, 32);
free(user->location);
user->location = (char *)malloc(strlen(buffer) + 1);

83
strings.c Normal file
View File

@ -0,0 +1,83 @@
#include "bbs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
extern struct bbs_config conf;
char *undefined = "Undefined String";
char **strings;
int string_count;
void chomp(char *string) {
while ((string[strlen(string)-1] == '\r' || string[strlen(string)-1] == '\n') && strlen(string)) {
string[strlen(string)-1] = '\0';
}
}
char *parse_newlines(char *string) {
char *newstring = (char *)malloc(strlen(string) + 1);
int pos = 0;
int i;
for (i=0;i<strlen(string);i++) {
if (string[i] == '\\') {
if (i < strlen(string) - 1) {
i++;
if (string[i] == 'n') {
newstring[pos++] = '\n';
} else if (string[i] == 'r') {
newstring[pos++] = '\r';
} else if (string[i] == '\\') {
newstring[pos++] = '\\';
} else if (string[i] == 'e') {
newstring[pos++] = '\e';
}
newstring[pos] = '\0';
}
} else {
newstring[pos++] = string[i];
newstring[pos] = '\0';
}
}
return newstring;
}
char *get_string(int offset) {
if (offset >= string_count) {
return undefined;
}
return strings[offset];
}
void load_strings() {
FILE *fptr;
char buffer[1024];
if (conf.string_file == NULL) {
fprintf(stderr, "Strings file can not be undefined!\n");
exit(-1);
}
fptr = fopen(conf.string_file, "r");
if (!fptr) {
fprintf(stderr, "Unable to open strings file!\n");
exit(-1);
}
string_count = 0;
fgets(buffer, 1024, fptr);
while (!feof(fptr)) {
chomp(buffer);
if (string_count == 0) {
strings = (char **)malloc(sizeof(char *));
} else {
strings = (char **)realloc(strings, sizeof(char *) * (string_count + 1));
}
strings[string_count] = parse_newlines(buffer);
string_count++;
fgets(buffer, 1024, fptr);
}
fclose(fptr);
}

58
users.c
View File

@ -345,25 +345,25 @@ void list_users(struct user_record *user) {
sqlite3_close(db);
exit(1);
}
s_printf("\e[2J\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf("User Name Location Times On\r\n");
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(161));
s_printf(get_string(162));
s_printf(get_string(163));
i = 0;
while (sqlite3_step(res) == SQLITE_ROW) {
s_printf("\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%5d\r\n", sqlite3_column_text(res, 0), sqlite3_column_text(res, 1), sqlite3_column_int(res, 2));
s_printf(get_string(164), sqlite3_column_text(res, 0), sqlite3_column_text(res, 1), sqlite3_column_int(res, 2));
i++;
if (i == 20) {
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
i = 0;
}
}
s_printf("\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
s_printf(get_string(165));
sqlite3_finalize(res);
sqlite3_close(db);
s_printf("Press any key to continue...\r\n");
s_printf(get_string(6));
s_getc();
}
@ -422,17 +422,17 @@ struct user_record *new_user() {
passok = 0;
nameok = 0;
do {
s_printf("\r\nWhat is your login name: ");
s_printf(get_string(166));
s_readstring(buffer, 16);
s_printf("\r\n");
if (strlen(buffer) < 3) {
s_printf("Sorry, that name is too short.\r\n");
s_printf(get_string(167));
continue;
}
for (i=0;i<strlen(buffer);i++) {
if (!(tolower(buffer[i]) >= 97 && tolower(buffer[i]) <= 122)) {
s_printf("Sorry, invalid character, can only use alpha characters.\r\n");
s_printf(get_string(168));
nameok = 1;
break;
}
@ -442,77 +442,77 @@ struct user_record *new_user() {
continue;
}
if (strcasecmp(buffer, "unknown") == 0) {
s_printf("Sorry, that name is reserved.\r\n");
s_printf(get_string(169));
continue;
}
if (strcasecmp(buffer, "all") == 0) {
s_printf("Sorry, that name is reserved.\r\n");
s_printf(get_string(169));
continue;
}
if (strcasecmp(buffer, "new") == 0) {
s_printf("Sorry, that name is reserved.\r\n");
s_printf(get_string(169));
continue;
}
user->loginname = strdup(buffer);
nameok = check_user(user->loginname);
if (!nameok) {
s_printf("Sorry, that name is in use.\r\n");
s_printf(get_string(170));
free(user->loginname);
memset(buffer, 0, 256);
}
} while (!nameok);
s_printf("What is your first name: ");
s_printf(get_string(171));
memset(buffer, 0, 256);
s_readstring(buffer, 32);
s_printf("\r\n");
user->firstname = strdup(buffer);
s_printf("What is your last name: ");
s_printf(get_string(172));
memset(buffer, 0, 256);
s_readstring(buffer, 32);
s_printf("\r\n");
user->lastname = strdup(buffer);
s_printf("What is your e-mail address: ");
s_printf(get_string(173));
memset(buffer, 0, 256);
s_readstring(buffer, 64);
s_printf("\r\n");
user->email = strdup(buffer);
s_printf("Where are you located: ");
s_printf(get_string(174));
memset(buffer, 0, 256);
s_readstring(buffer, 32);
s_printf("\r\n");
user->location = strdup(buffer);
do {
s_printf("What password would you like (at least 8 characters): ");
s_printf(get_string(175));
memset(buffer, 0, 256);
s_readstring(buffer, 16);
s_printf("\r\n");
if (strlen(buffer) >= 8) {
passok = 1;
} else {
s_printf("Password too short!\r\n");
s_printf(get_string(158));
}
} while (!passok);
gen_salt(&user->salt);
user->password = hash_sha256(buffer, user->salt);
s_printf("You Entered:\r\n");
s_printf("-------------------------------------\r\n");
s_printf("Login Name: ");
s_printf(get_string(176));
s_printf(get_string(177));
s_printf(get_string(178));
s_printf(user->loginname);
s_printf("\r\nFirst Name: ");
s_printf(get_string(179));
s_printf(user->firstname);
s_printf("\r\nLast Name: ");
s_printf(get_string(180));
s_printf(user->lastname);
s_printf("\r\nE-mail: ");
s_printf(get_string(181));
s_printf(user->email);
s_printf("\r\nLocation: ");
s_printf(get_string(182));
s_printf(user->location);
s_printf("\r\n-------------------------------------\r\n");
s_printf("Is this Correct? (Y/N)");
s_printf(get_string(183));
s_printf(get_string(184));
c = s_getchar();
while (tolower(c) != 'y' && tolower(c) != 'n') {
c = s_getchar();