From a42e527f26e70a4be523eac2597f574b13143bf0 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sun, 3 Apr 2016 15:26:25 +1000 Subject: [PATCH] Updates to files, mail and users --- README.md | 13 +------------ files.c | 12 +++++++----- mail_menu.c | 7 ++++--- users.c | 9 ++++++--- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index dea8fd5..9340c24 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/files.c b/files.c index 06ea86a..5830ae1 100644 --- a/files.c +++ b/files.c @@ -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;jdescription);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;zname); 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); } diff --git a/mail_menu.c b/mail_menu.c index c5d189d..859444e 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -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); } diff --git a/users.c b/users.c index ac070cb..547bf44 100644 --- a/users.c +++ b/users.c @@ -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) {