Updates to files, mail and users

This commit is contained in:
Andrew Pamment 2016-04-03 15:26:25 +10:00
parent e47028813f
commit a42e527f26
4 changed files with 18 additions and 23 deletions

View File

@ -4,20 +4,9 @@ Linux/FreeBSD bulletin board system
As I lost the code to my initail BBS flea, I've decided to start over from scratch and this time I'm using git hub so I dont
lose it again!
Magicka is meant to be a modern (haha) BBS system, using modern technologies, like Sqlite, XMPP, long filenames (gasp!) etc
Magicka is meant to be a modern (haha) BBS system, using modern technologies, like Sqlite, IRC, long filenames (gasp!) etc
while still retaining the classic BBS feel. ANSI & Telnet, and good old ZModem.
I plan to work on things in this order:
* Mail System (using JAM LIB for compatability) (Mostly Done)
* External Door Support (Mostly Done)
* File Systems
* Everything else..
#### Magicka BBS is not yet complete!!
If you want to install Magicka BBS, follow these steps.
1. Ensure you have git, c compiler, sqlite-dev and gnu make

12
files.c
View File

@ -472,18 +472,20 @@ void list_files(int socket, struct user_record *user) {
} else {
file_unit = 'b';
}
sprintf(buffer, "\e[1;30m[\e[1;34m%3d\e[1;30m] \e[1;33m%3ddloads \e[1;36m%4d%c \e[1;37m%-58s\r\n \e[0;32m", i, files_e[i]->dlcount, file_size, file_unit, basename(files_e[i]->filename));
sprintf(buffer, "\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_putstring(socket, buffer);
lines++;
lines+=3;
for (j=0;j<strlen(files_e[i]->description);j++) {
if (files_e[i]->description[j] == '\n') {
s_putstring(socket, "\r\n");
lines++;
if (lines % 22 == 0 && lines != 0) {
if (lines >= 18) {
lines = 0;
while (1) {
s_putstring(socket, "\r\n\e[0mEnter # to tag, Q to quit, Enter to continue: ");
s_readstring(socket, buffer, 5);
if (strlen(buffer) == 0) {
s_putstring(socket, "\r\n");
break;
} else if (tolower(buffer[0]) == 'q') {
for (z=0;z<files_c;z++) {
@ -600,7 +602,7 @@ int file_menu(int socket, struct user_record *user) {
sprintf(prompt, " %d. %s\r\n", i, conf.file_directories[i]->name);
s_putstring(socket, prompt);
}
if (i != 0 && i % 22 == 0) {
if (i != 0 && i % 20 == 0) {
s_putstring(socket, "Press any key to continue...\r\n");
c = s_getc(socket);
}
@ -626,7 +628,7 @@ int file_menu(int socket, struct user_record *user) {
sprintf(prompt, " %d. %s\r\n", i, conf.file_directories[user->cur_file_dir]->file_subs[i]->name);
s_putstring(socket, prompt);
if (i != 0 && i % 22 == 0) {
if (i != 0 && i % 20 == 0) {
s_putstring(socket, "Press any key to continue...\r\n");
c = s_getc(socket);
}

View File

@ -1186,7 +1186,7 @@ int mail_menu(int socket, struct user_record *user) {
}
s_putstring(socket, buffer);
if ((j - i) != 0 && (j - i) % 22 == 0) {
if ((j - i) != 0 && (j - i) % 20 == 0) {
sprintf(buffer, "(#) Read Message # (Q) Quit (ENTER) Continue\r\n");
s_putstring(socket, buffer);
s_readstring(socket, buffer, 6);
@ -1202,6 +1202,7 @@ int mail_menu(int socket, struct user_record *user) {
break;
}
}
s_putstring(socket, "\e[2J\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m");
}
}
@ -1236,7 +1237,7 @@ int mail_menu(int socket, struct user_record *user) {
sprintf(buffer, " %d. %s\r\n", i, conf.mail_conferences[i]->name);
s_putstring(socket, buffer);
}
if (i != 0 && i % 22 == 0) {
if (i != 0 && i % 20 == 0) {
s_putstring(socket, "Press any key to continue...\r\n");
c = s_getc(socket);
}
@ -1263,7 +1264,7 @@ int mail_menu(int socket, struct user_record *user) {
sprintf(buffer, " %d. %s\r\n", i, conf.mail_conferences[user->cur_mail_conf]->mail_areas[i]->name);
s_putstring(socket, buffer);
}
if (i != 0 && i % 22 == 0) {
if (i != 0 && i % 20 == 0) {
s_putstring(socket, "Press any key to continue...\r\n");
c = s_getc(socket);
}

View File

@ -208,8 +208,8 @@ struct user_record *check_user_pass(int socket, char *loginname, char *password)
user->timeleft = sqlite3_column_int(res, 9);
user->cur_mail_conf = sqlite3_column_int(res, 10);
user->cur_mail_area = sqlite3_column_int(res, 11);
user->cur_file_dir = sqlite3_column_int(res, 12);
user->cur_file_sub = sqlite3_column_int(res, 13);
user->cur_file_dir = sqlite3_column_int(res, 13);
user->cur_file_sub = sqlite3_column_int(res, 12);
user->timeson = sqlite3_column_int(res, 14);
if (strcmp(password, user->password) != 0) {
@ -381,7 +381,10 @@ struct user_record *new_user(int socket) {
s_putstring(socket, "Sorry, that name is reserved.\r\n");
continue;
}
if (strcasecmp(buffer, "all") == 0) {
s_putstring(socket, "Sorry, that name is reserved.\r\n");
continue;
}
user->loginname = strdup(buffer);
nameok = check_user(user->loginname);
if (!nameok) {