Merge branch '0.1'
This commit is contained in:
commit
30caad395c
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ)
|
||||
$(CC) -o magicka -o $@ $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 $(JAMLIB) $(ZMODEM) -lutil
|
||||
$(CC) -o magicka -o $@ $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 $(JAMLIB) $(ZMODEM) -lutil
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
14
README.md
14
README.md
@ -1,7 +1,7 @@
|
||||
# MagickaBBS
|
||||
Linux/FreeBSD bulletin board system
|
||||
Linux/FreeBSD bulletin board system (Should also work on NetBSD and OpenBSD, if it doesn't it's a bug)
|
||||
|
||||
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
|
||||
As I lost the code to my initial 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, IRC, long filenames (gasp!) etc
|
||||
@ -16,19 +16,19 @@ If you want to install Magicka BBS, follow these steps.
|
||||
`cd MagickaBBS/jamlib`
|
||||
|
||||
|
||||
`make -f Makefile.linux`
|
||||
`make -f Makefile.linux` (Linux) `gmake -f Makefile.linux` (*BSD)
|
||||
|
||||
3. Build libzmodem
|
||||
|
||||
`cd MagickaBBS/Xmodem`
|
||||
|
||||
|
||||
`make`
|
||||
`make` (Linux) `gmake` (*BSD)
|
||||
|
||||
5. Build the BBS (You may have to adjust the Makefile for your system)
|
||||
|
||||
`gmake` (FreeBSD) `make` (Linux)
|
||||
|
||||
`make` (Linux) `gmake` (*BSD)
|
||||
|
||||
6. Copy the config-default directory to a config directory.
|
||||
|
||||
`cp -r config-default config`
|
||||
@ -46,3 +46,5 @@ If you want to install Magicka BBS, follow these steps.
|
||||
|
||||
10. Your BBS is now running on port 2300, log in and create yourself an account! (By default there is only one security level, you can add more,
|
||||
but you will need to use an SQLite Manager to modify users.sq3 and set security levels, as there is no user editor yet.
|
||||
|
||||
For information on how to configure your BBS, check the wiki https://github.com/apamment/MagickaBBS/wiki
|
||||
|
3
doors.c
3
doors.c
@ -200,6 +200,9 @@ void rundoor(int socket, struct user_record *user, char *cmd, int stdio) {
|
||||
disconnect(socket);
|
||||
return;
|
||||
}
|
||||
if (c == '\n' || c == '\0') {
|
||||
continue;
|
||||
}
|
||||
write(master, &c, 1);
|
||||
} else if (FD_ISSET(master, &fdset)) {
|
||||
len = read(master, &c, 1);
|
||||
|
19
email.c
19
email.c
@ -118,6 +118,7 @@ void show_email(int socket, struct user_record *user, int msgno) {
|
||||
int lines;
|
||||
char c;
|
||||
char *replybody;
|
||||
int chars;
|
||||
|
||||
sprintf(buffer, "%s/email.sq3", conf.bbs_path);
|
||||
|
||||
@ -160,18 +161,22 @@ void show_email(int socket, struct user_record *user, int msgno) {
|
||||
s_putstring(socket, "\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n");
|
||||
|
||||
lines = 0;
|
||||
chars = 0;
|
||||
|
||||
for (z=0;z<strlen(body);z++) {
|
||||
if (body[z] == '\r') {
|
||||
if (body[z] == '\r' || chars == 79) {
|
||||
chars = 0;
|
||||
s_putstring(socket, "\r\n");
|
||||
lines++;
|
||||
if (lines == 18) {
|
||||
s_putstring(socket, "Press a key to continue...\r\n");
|
||||
if (lines == 19) {
|
||||
s_putstring(socket, "Press a key to continue...");
|
||||
s_getc(socket);
|
||||
lines = 0;
|
||||
s_putstring(socket, "\e[5;1H\e[0J");
|
||||
}
|
||||
} else {
|
||||
s_putchar(socket, body[z]);
|
||||
chars++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,7 +187,11 @@ void show_email(int socket, struct user_record *user, int msgno) {
|
||||
sqlite3_finalize(res);
|
||||
if (tolower(c) == 'r') {
|
||||
if (subject != NULL) {
|
||||
sprintf(buffer, "RE: %s", subject);
|
||||
if (strncasecmp(buffer, "RE:", 3) != 0) {
|
||||
snprintf(buffer, 256, "RE: %s", subject);
|
||||
} else {
|
||||
snprintf(buffer, 256, "%s", subject);
|
||||
}
|
||||
free(subject);
|
||||
}
|
||||
subject = (char *)malloc(strlen(buffer) + 1);
|
||||
@ -299,7 +308,7 @@ void list_emails(int socket, struct user_record *user) {
|
||||
free(from);
|
||||
free(subject);
|
||||
|
||||
if (msgid % 22 && msgid != 0) {
|
||||
if (msgid % 22 == 0 && msgid != 0) {
|
||||
s_putstring(socket, "Enter # to read, Q to quit or Enter to continue\r\n");
|
||||
|
||||
s_readstring(socket, buffer, 5);
|
||||
|
@ -1,4 +1,4 @@
|
||||
CC = gcc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall
|
||||
CC = cc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall
|
||||
AR = ar -ru
|
||||
RM = rm -f
|
||||
|
||||
|
25
mail_menu.c
25
mail_menu.c
@ -283,13 +283,28 @@ char *external_editor(int socket, struct user_record *user, char *to, char *from
|
||||
// write msgtemp
|
||||
if (quote != NULL) {
|
||||
fptr = fopen(buffer, "w");
|
||||
fwrite(quote, strlen(quote), 1, fptr);
|
||||
for (i=0;i<strlen(quote);i++) {
|
||||
if (quote[i] == '\r') {
|
||||
fprintf(fptr, "\r\n");
|
||||
} else if (quote[i] == 0x1) {
|
||||
continue;
|
||||
} else if (quote[i] == '\e' && quote[i + 1] == '[') {
|
||||
while (strchr("ABCDEFGHIGJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", quote[i]) == NULL)
|
||||
i++;
|
||||
} else {
|
||||
fprintf(fptr, "%c", quote[i]);
|
||||
}
|
||||
}
|
||||
fclose(fptr);
|
||||
}
|
||||
sprintf(buffer, "%s/node%d/MSGINF", conf.bbs_path, mynode);
|
||||
fptr = fopen(buffer, "w");
|
||||
fprintf(fptr, "%s\r\n", user->loginname);
|
||||
fprintf(fptr, "%s\r\n", to);
|
||||
if (qfrom != NULL) {
|
||||
fprintf(fptr, "%s\r\n", qfrom);
|
||||
} else {
|
||||
fprintf(fptr, "%s\r\n", to);
|
||||
}
|
||||
fprintf(fptr, "%s\r\n", subject);
|
||||
fprintf(fptr, "0\r\n");
|
||||
if (email == 1) {
|
||||
@ -761,7 +776,11 @@ void read_message(int socket, struct user_record *user, struct msg_headers *msgh
|
||||
s_putstring(socket, "\r\nSorry, you are not allowed to post in this area\r\n");
|
||||
} else {
|
||||
if (msghs->msgs[mailno]->subject != NULL) {
|
||||
sprintf(buffer, "RE: %s", msghs->msgs[mailno]->subject);
|
||||
if (strncasecmp(msghs->msgs[mailno]->subject, "RE:", 3) != 0) {
|
||||
snprintf(buffer, 256, "RE: %s", msghs->msgs[mailno]->subject);
|
||||
} else {
|
||||
snprintf(buffer, 256, "%s", msghs->msgs[mailno]->subject);
|
||||
}
|
||||
}
|
||||
subject = (char *)malloc(strlen(buffer) + 1);
|
||||
strcpy(subject, buffer);
|
||||
|
Reference in New Issue
Block a user