Merge pull request #4 from MagickaBBS/NewMenuSystem

New menu system
This commit is contained in:
Andrew Pamment 2017-04-13 09:08:49 +10:00 committed by GitHub
commit 1a13637a49
25 changed files with 1348 additions and 1137 deletions

View File

@ -29,7 +29,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd deps/cdk-5.0-20161210/ && $(MAKE)
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 bluewave.o hashmap/hashmap.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 bluewave.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -34,7 +34,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd deps/cdk-5.0-20161210/ && $(MAKE)
OBJ = deps/aha/aha.o 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 bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o
OBJ = deps/aha/aha.o 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 bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -30,7 +30,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && $(MAKE)
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 bluewave.o hashmap/hashmap.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 bluewave.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -34,7 +34,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && ./configure
cd deps/cdk-5.0-20161210/ && $(MAKE)
OBJ = deps/aha/aha.o 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 www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o
OBJ = deps/aha/aha.o 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 www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -29,7 +29,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses
cd deps/cdk-5.0-20161210/ && $(MAKE)
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 bluewave.o hashmap/hashmap.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 bluewave.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -34,7 +34,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses
cd deps/cdk-5.0-20161210/ && $(MAKE)
OBJ = deps/aha/aha.o 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 bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o
OBJ = deps/aha/aha.o 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 bluewave.o www.o www_email.o www_msgs.o www_last10.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View File

@ -8,7 +8,7 @@ ODOORS = deps/odoors/libs-`uname -s`/libODoors.a
JSMN = deps/jsmn/libjsmn.a
CDK = deps/cdk-5-20161210/libcdk.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 strings.o bluewave.o hashmap/hashmap.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 bluewave.o hashmap/hashmap.o menus.o
all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd

View File

@ -34,7 +34,7 @@ $(CDK):
cd deps/cdk-5.0-20161210/ && ./configure
cd deps/cdk-5.0-20161210/ && $(MAKE)
OBJ = deps/aha/aha.o 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 www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o
OBJ = deps/aha/aha.o 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 www.o www_email.o www_msgs.o www_last10.o bluewave.o hashmap/hashmap.o menus.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

BIN
ansis_default/logoff.ans Normal file

Binary file not shown.

21
bbs.c
View File

@ -821,15 +821,17 @@ tryagain:
}
record_last10_callers(user);
// main menu
main_menu(user);
menu_system(conf.root_menu);
do_logout();
dolog("%s is logging out, on node %d", user->loginname, mynode);
broadcast("%s is logging out, on node %d", user->loginname, mynode);
disconnect("Log out");
}
int do_logout() {
void do_logout() {
char buffer[256];
struct stat s;
lua_State *L;
@ -857,28 +859,15 @@ int do_logout() {
}
if (do_internal_logout == 1) {
s_printf(get_string(53));
c = s_getc();
if (tolower(c) == 'y') {
s_displayansi("goodbye");
ret = 1;
} else {
ret = 0;
}
} else {
lua_getglobal(L, "logout");
result = lua_pcall(L, 0, 1, 0);
result = lua_pcall(L, 0, 0, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
lua_close(L);
return 0;
}
ret = lua_tointeger(L, -1);
lua_pop(L, 1);
lua_close(L);
}
return ret;
}
void runbbs(int socket, char *ip) {

31
bbs.h
View File

@ -43,7 +43,6 @@ struct text_file {
struct door_config {
char *name;
char key;
char *command;
int stdio;
};
@ -140,6 +139,8 @@ struct bbs_config {
int bwave_max_msgs;
struct fido_addr *main_aka;
char *root_menu;
char *menu_path;
char *external_editor_cmd;
int external_editor_stdio;
int fork;
@ -235,7 +236,7 @@ extern char s_getc();
extern void disconnect(char *calledby);
extern void display_info();
extern void display_last10_callers(struct user_record *user);
extern int do_logout();
extern void do_logout();
extern void gen_salt(char **s);
extern char *hash_sha256(char *pass, char *salt);
@ -245,21 +246,28 @@ extern struct user_record *new_user();
extern struct user_record *check_user_pass(char *loginname, char *password);
extern void list_users(struct user_record *user);
extern void main_menu(struct user_record *user);
extern void display_bulletins();
extern void display_textfiles();
extern s_JamBase *open_jam_base(char *path);
extern void free_message_headers(struct msg_headers *msghs);
extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user);
extern void mail_scan(struct user_record *user);
extern int mail_menu(struct user_record *user);
extern char *editor(struct user_record *user, char *quote, int qlen, char *from, int email);
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email);
extern int msg_is_to(struct user_record *user, char *addressed_to, char *address, int type, int rn, int msgconf);
extern int msg_is_from(struct user_record *user, char *addressed_from, char *address, int type, int rn, int msgconf);
extern unsigned long generate_msgid();
extern void read_mail(struct user_record *user);
extern void list_messages(struct user_record *user);
extern void choose_conference(struct user_record *user);
extern void choose_area(struct user_record *user);
extern void next_mail_conf(struct user_record *user);
extern void prev_mail_conf(struct user_record *user);
extern void next_mail_area(struct user_record *user);
extern void prev_mail_area(struct user_record *user);
extern void post_message(struct user_record *user);
extern int door_menu(struct user_record *user);
extern void rundoor(struct user_record *user, char *cmd, int stdio);
extern void runexternal(struct user_record *user, char *cmd, int stdio, char **argv, char *cwd, int raw);
@ -271,13 +279,22 @@ extern int mail_getemailcount(struct user_record *user);
extern void send_email(struct user_record *user);
extern void list_emails(struct user_record *user);
extern int file_menu(struct user_record *user);
extern void download_zmodem(struct user_record *user, char *filename);
extern void settings_menu(struct user_record *user);
extern void upload_zmodem(struct user_record *user, char *upload_p);
extern int ttySetRaw(int fd, struct termios *prevTermios);
extern int do_upload(struct user_record *user, char *final_path);
extern int do_download(struct user_record *user, char *file);
extern void choose_directory(struct user_record *user);
extern void choose_subdir(struct user_record *user);
extern void list_files(struct user_record *user);
extern void upload(struct user_record *user);
extern void download(struct user_record *user);
extern void clear_tagged_files();
extern void next_file_dir(struct user_record *user);
extern void prev_file_dir(struct user_record *user);
extern void next_file_sub(struct user_record *user);
extern void prev_file_sub(struct user_record *user);
extern void lua_push_cfunctions(lua_State *L);

View File

@ -27,6 +27,7 @@ Broadcast Address = 192.168.1.255
IP Guard Enable = true
IP Guard Timeout = 120
IP Guard Tries = 4
Root Menu = main.mnu
[paths]
Config Path = /home/andrew/MagickaBBS/config
@ -39,6 +40,7 @@ Log Path = /home/andrew/MagickaBBS/logs
Script Path = /home/andrew/MagickaBBS/scripts
Echomail Semaphore = /home/andrew/MagickaBBS/echomail.out
Netmail Semaphore = /home/andrew/MagickaBBS/netmail.out
Menu Path = /home/andrew/MagickaBBS/menus
[mail conferences]
Local Mail = config/localmail.ini

View File

@ -1,6 +1,4 @@
[Test Door]
; the key to press in the door menu must not be Q or G not case sensitive
key = 0
; the command is passed node number as first argument
; and socket number as second argument.
command = /home/andrew/MagickaBBS/doors/rundoor.sh

82
doors.c
View File

@ -382,85 +382,3 @@ void runexternal(struct user_record *user, char *cmd, int stdio, char *argv[], c
}
timeoutpaused = 0;
}
int door_menu(struct user_record *user) {
int doquit = 0;
int dodoors = 0;
char buffer[256];
int i;
char c;
struct stat s;
int do_internal_menu = 0;
char *lRet;
lua_State *L;
int result;
if (conf.script_path != NULL) {
sprintf(buffer, "%s/doors.lua", conf.script_path);
if (stat(buffer, &s) == 0) {
L = luaL_newstate();
luaL_openlibs(L);
lua_push_cfunctions(L);
luaL_loadfile(L, buffer);
do_internal_menu = 0;
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
while (!dodoors) {
if (do_internal_menu == 1) {
s_displayansi("doors");
s_printf(get_string(52), user->timeleft);
c = s_getc();
} else {
lua_getglobal(L, "menu");
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
lua_close(L);
continue;
}
lRet = (char *)lua_tostring(L, -1);
lua_pop(L, 1);
c = lRet[0];
}
switch(tolower(c)) {
case 'q':
dodoors = 1;
break;
case 'g':
{
doquit = do_logout();
dodoors = doquit;
}
break;
default:
{
for (i=0;i<conf.door_count;i++) {
if (tolower(c) == tolower(conf.doors[i]->key)) {
dolog("%s is launched door %s, on node %d", user->loginname, conf.doors[i]->name, mynode);
rundoor(user, conf.doors[i]->command, conf.doors[i]->stdio);
dolog("%s is returned from door %s, on node %d", user->loginname, conf.doors[i]->name, mynode);
break;
}
}
}
break;
}
}
if (do_internal_menu == 0) {
lua_close(L);
}
return doquit;
}

178
files.c
View File

@ -1072,70 +1072,40 @@ void list_files(struct user_record *user) {
}
}
int file_menu(struct user_record *user) {
int doquit = 0;
int dofiles = 0;
char c;
void choose_subdir(struct user_record *user) {
int i;
char c;
int j;
char prompt[256];
struct stat s;
int do_internal_menu = 0;
char *lRet;
lua_State *L;
int result;
char prompt[6];
if (conf.script_path != NULL) {
sprintf(prompt, "%s/filemenu.lua", conf.script_path);
if (stat(prompt, &s) == 0) {
L = luaL_newstate();
luaL_openlibs(L);
lua_push_cfunctions(L);
luaL_loadfile(L, prompt);
do_internal_menu = 0;
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
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);
while (!dofiles) {
if (do_internal_menu == 1) {
s_displayansi("filemenu");
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 {
lua_getglobal(L, "menu");
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
lua_close(L);
continue;
}
lRet = (char *)lua_tostring(L, -1);
lua_pop(L, 1);
c = lRet[0];
}
switch(tolower(c)) {
case 27:
{
c = s_getc();
if (c == 91) {
if (i != 0 && i % 20 == 0) {
s_printf(get_string(6));
c = s_getc();
}
}
break;
case 'i':
{
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(get_string(83));
} else {
s_printf("\r\n");
user->cur_file_sub = j;
}
}
}
void choose_directory(struct user_record *user) {
int i;
char c;
int j;
char prompt[6];
s_printf(get_string(77));
for (i=0;i<conf.file_directory_count;i++) {
if (conf.file_directories[i]->sec_level <= user->sec_level) {
@ -1158,49 +1128,10 @@ int file_menu(struct user_record *user) {
user->cur_file_sub = 0;
}
}
}
break;
case 's':
{
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(get_string(6));
c = s_getc();
}
}
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(get_string(83));
} else {
s_printf("\r\n");
user->cur_file_sub = j;
}
}
}
break;
case 'l':
list_files(user);
break;
case 'u':
{
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(get_string(84));
}
}
break;
case 'd':
download(user);
break;
case 'c':
{
void clear_tagged_files() {
int i;
// Clear tagged files
if (tagged_count > 0) {
for (i=0;i<tagged_count;i++) {
@ -1209,11 +1140,10 @@ int file_menu(struct user_record *user) {
free(tagged_files);
tagged_count = 0;
}
}
break;
case '}':
{
}
void next_file_dir(struct user_record *user) {
int i;
for (i=user->cur_file_dir;i<conf.file_directory_count;i++) {
if (i + 1 == conf.file_directory_count) {
i = -1;
@ -1224,10 +1154,10 @@ int file_menu(struct user_record *user) {
break;
}
}
}
break;
case '{':
{
}
void prev_file_dir(struct user_record *user) {
int i;
for (i=user->cur_file_dir;i>=0;i--) {
if (i - 1 == -1) {
i = conf.file_directory_count;
@ -1238,39 +1168,23 @@ int file_menu(struct user_record *user) {
break;
}
}
}
break;
case ']':
{
}
void next_file_sub(struct user_record *user) {
int i;
i=user->cur_file_sub;
if (i + 1 == conf.file_directories[user->cur_file_dir]->file_sub_count) {
i = -1;
}
user->cur_file_sub = i + 1;
}
break;
case '[':
{
}
void prev_file_sub(struct user_record *user) {
int i;
i=user->cur_file_sub;
if (i - 1 == -1) {
i = conf.file_directories[user->cur_file_dir]->file_sub_count;
}
user->cur_file_sub = i - 1;
}
break;
case 'q':
dofiles = 1;
break;
case 'g':
{
doquit = do_logout();
dofiles = doquit;
}
break;
}
}
if (do_internal_menu == 0) {
lua_close(L);
}
return doquit;
}

View File

@ -1777,99 +1777,15 @@ void read_message(struct user_record *user, struct msg_headers *msghs, int mailn
}
}
int mail_menu(struct user_record *user) {
int doquit = 0;
int domail = 0;
char c;
char buffer[256];
char buffer2[256];
int i;
int j;
int z;
int k;
void read_mail(struct user_record *user) {
struct msg_headers *msghs;
s_JamBase *jb;
s_JamMsgHeader jmh;
s_JamSubPacket* jsp;
s_JamSubfield jsf;
s_JamLastRead jlr;
int all_unread;
int i;
int k;
char buffer[7];
struct tm msg_date;
char *subject;
char *from;
char *to;
char *msg;
int closed;
struct fido_addr *from_addr = NULL;
struct stat s;
int do_internal_menu = 0;
char *lRet;
lua_State *L;
int result;
int sem_fd;
int all_unread = 0;
int redraw;
int start;
if (conf.script_path != NULL) {
sprintf(buffer, "%s/mailmenu.lua", conf.script_path);
if (stat(buffer, &s) == 0) {
L = luaL_newstate();
luaL_openlibs(L);
lua_push_cfunctions(L);
luaL_loadfile(L, buffer);
do_internal_menu = 0;
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
while (!domail) {
if (do_internal_menu == 1) {
s_displayansi("mailmenu");
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 {
lua_getglobal(L, "menu");
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
lua_close(L);
continue;
}
lRet = (char *)lua_tostring(L, -1);
lua_pop(L, 1);
c = lRet[0];
}
switch(tolower(c)) {
case 27:
{
c = s_getc();
if (c == 91) {
c = s_getc();
}
}
break;
case '!':
{
mail_scan(user);
}
break;
case 'd':
{
s_printf("\r\n");
// list mail in message base
msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
@ -1877,7 +1793,7 @@ int mail_menu(struct user_record *user) {
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
if (!jb) {
dolog("Error opening JAM base.. %s", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
break;
return;
} else {
all_unread = 0;
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
@ -1914,13 +1830,29 @@ int mail_menu(struct user_record *user) {
if (msghs != NULL) {
free_message_headers(msghs);
}
}
break;
case 'p':
{
}
void post_message(struct user_record *user) {
char *subject;
char *from;
char *to;
char *msg;
int closed;
struct fido_addr *from_addr = NULL;
char buffer[256];
char buffer2[256];
int z;
int sem_fd;
s_JamBase *jb;
s_JamMsgHeader jmh;
s_JamSubPacket* jsp;
s_JamSubfield jsf;
s_JamLastRead jlr;
if (user->sec_level < conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->write_sec_level) {
s_printf(get_string(113));
break;
return;
}
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NEWSGROUP_AREA) {
sprintf(buffer, "ALL");
@ -1935,7 +1867,7 @@ 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(get_string(55));
break;
return;
}
}
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NETMAIL_AREA) {
@ -1945,12 +1877,12 @@ int mail_menu(struct user_record *user) {
from_addr = parse_fido_addr(buffer2);
if (!from_addr) {
s_printf(get_string(122));
break;
return;
} else {
if (from_addr->zone == 0 && from_addr->net == 0 && from_addr->node == 0 && from_addr->point == 0) {
free(from_addr);
s_printf(get_string(122));
break;
return;
}
s_printf(get_string(123), from_addr->zone, from_addr->net, from_addr->node, from_addr->point);
}
@ -1965,7 +1897,7 @@ int mail_menu(struct user_record *user) {
if (from_addr != NULL) {
free(from_addr);
}
break;
return;
}
subject = strdup(buffer);
@ -1987,7 +1919,7 @@ int mail_menu(struct user_record *user) {
free(msg);
free(to);
free(subject);
break;
return;
}
JAM_ClearMsgHeader( &jmh );
@ -2067,7 +1999,6 @@ int mail_menu(struct user_record *user) {
sprintf(buffer, "%d:%d/%d", conf.mail_conferences[user->cur_mail_conf]->fidoaddr->zone,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->net,
conf.mail_conferences[user->cur_mail_conf]->fidoaddr->node);
}
jsf.LoID = JAMSFLD_OADDRESS;
jsf.HiID = 0;
@ -2126,7 +2057,7 @@ int mail_menu(struct user_record *user) {
}
if (z != 0) {
JAM_CloseMB(jb);
break;
return;
}
if (JAM_AddMessage(jb, &jmh, jsp, (char *)msg, strlen(msg))) {
@ -2153,10 +2084,23 @@ int mail_menu(struct user_record *user) {
}
free(to);
free(subject);
}
break;
case 'l':
{
}
void list_messages(struct user_record *user) {
struct msg_headers *msghs;
s_JamBase *jb;
int all_unread;
s_JamLastRead jlr;
char buffer[256];
int i;
int k;
int j;
int start;
int closed;
int redraw;
struct tm msg_date;
char c;
s_printf("\r\n");
// list mail in message base
msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
@ -2164,7 +2108,7 @@ int mail_menu(struct user_record *user) {
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
if (!jb) {
dolog("Error opening JAM base.. %s", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
break;
return;
} else {
all_unread = 0;
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
@ -2311,10 +2255,15 @@ int mail_menu(struct user_record *user) {
} else {
s_printf(get_string(130));
}
}
break;
case 'c':
{
}
void choose_conference(struct user_record *user) {
int i;
int j;
char c;
char buffer[6];
s_printf(get_string(131));
for (i=0;i<conf.mail_conference_count;i++) {
if (conf.mail_conferences[i]->sec_level <= user->sec_level) {
@ -2337,10 +2286,14 @@ int mail_menu(struct user_record *user) {
user->cur_mail_area = 0;
}
}
}
break;
case 'a':
{
}
void choose_area(struct user_record *user) {
int i;
int j;
char c;
char buffer[6];
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) {
@ -2362,33 +2315,11 @@ int mail_menu(struct user_record *user) {
user->cur_mail_area = j;
}
}
}
break;
case 'q':
{
domail = 1;
}
break;
case 'g':
{
doquit = do_logout();
domail = doquit;
}
break;
case 'e':
{
send_email(user);
}
break;
case 'r':
{
// Read your email...
s_printf("\r\n");
list_emails(user);
}
break;
case '}':
{
}
void next_mail_conf(struct user_record *user) {
int i;
for (i=user->cur_mail_conf;i<conf.mail_conference_count;i++) {
if (i + 1 == conf.mail_conference_count) {
i = -1;
@ -2399,10 +2330,10 @@ int mail_menu(struct user_record *user) {
break;
}
}
}
break;
case '{':
{
}
void prev_mail_conf(struct user_record *user) {
int i;
for (i=user->cur_mail_conf;i>=0;i--) {
if (i - 1 == -1) {
i = conf.mail_conference_count;
@ -2413,10 +2344,10 @@ int mail_menu(struct user_record *user) {
break;
}
}
}
break;
case ']':
{
}
void next_mail_area(struct user_record *user) {
int i;
for (i=user->cur_mail_area;i<conf.mail_conferences[user->cur_mail_conf]->mail_area_count;i++) {
if (i + 1 == conf.mail_conferences[user->cur_mail_conf]->mail_area_count) {
i = -1;
@ -2426,10 +2357,10 @@ int mail_menu(struct user_record *user) {
break;
}
}
}
break;
case '[':
{
}
void prev_mail_area(struct user_record *user) {
int i;
for (i=user->cur_mail_area;i>=0;i--) {
if (i - 1 == -1) {
i = conf.mail_conferences[user->cur_mail_conf]->mail_area_count;
@ -2439,24 +2370,6 @@ int mail_menu(struct user_record *user) {
break;
}
}
}
break;
case 'b':
{
bwave_create_packet();
}
break;
case 'u':
{
bwave_upload_reply();
}
break;
}
}
if (do_internal_menu == 0) {
lua_close(L);
}
return doquit;
}
void mail_scan(struct user_record *user) {

17
main.c
View File

@ -202,9 +202,7 @@ static int door_config_handler(void* user, const char* section, const char* name
for (i=0;i<conf->door_count;i++) {
if (strcasecmp(conf->doors[i]->name, section) == 0) {
// found it
if (strcasecmp(name, "key") == 0) {
conf->doors[i]->key = value[0];
} else if (strcasecmp(name, "command") == 0) {
if (strcasecmp(name, "command") == 0) {
conf->doors[i]->command = strdup(value);
} else if (strcasecmp(name, "stdio") == 0) {
if (strcasecmp(value, "true") == 0) {
@ -227,9 +225,7 @@ static int door_config_handler(void* user, const char* section, const char* name
conf->doors[conf->door_count]->name = strdup(section);
if (strcasecmp(name, "key") == 0) {
conf->doors[conf->door_count]->key = value[0];
} else if (strcasecmp(name, "command") == 0) {
if (strcasecmp(name, "command") == 0) {
conf->doors[conf->door_count]->command = strdup(value);
} else if (strcasecmp(name, "stdio") == 0) {
if (strcasecmp(value, "true") == 0) {
@ -481,6 +477,8 @@ static int handler(void* user, const char* section, const char* name,
conf->ipguard_timeout = atoi(value);
} else if (strcasecmp(name, "ip guard tries") == 0) {
conf->ipguard_tries = atoi(value);
} else if (strcasecmp(name, "root menu") == 0) {
conf->root_menu = strdup(value);
}
} else if (strcasecmp(section, "paths") == 0){
if (strcasecmp(name, "ansi path") == 0) {
@ -503,6 +501,8 @@ static int handler(void* user, const char* section, const char* name,
conf->www_path = strdup(value);
} else if (strcasecmp(name, "config path") == 0) {
conf->config_path = strdup(value);
} else if (strcasecmp(name, "menu path") == 0) {
conf->menu_path = strdup(value);
}
} else if (strcasecmp(section, "mail conferences") == 0) {
if (conf->mail_conference_count == 0) {
@ -1166,6 +1166,11 @@ int main(int argc, char **argv) {
exit(-1);
}
if (conf.root_menu == NULL) {
fprintf(stderr, "Root Menu must be set in your bbs ini!\n");
exit(-1);
}
// Load mail Areas
for (i=0;i<conf.mail_conference_count;i++) {
if (ini_parse(conf.mail_conferences[i]->path, mail_area_handler, conf.mail_conferences[i]) <0) {

View File

@ -10,76 +10,28 @@
extern struct bbs_config conf;
void main_menu(struct user_record *user) {
int doquit = 0;
char c;
char buffer[256];
void display_bulletins() {
int i;
char buffer[PATH_MAX];
struct stat s;
int do_internal_menu = 0;
char *lRet;
lua_State *L;
int result;
i = 0;
if (conf.script_path != NULL) {
sprintf(buffer, "%s/mainmenu.lua", conf.script_path);
if (stat(buffer, &s) == 0) {
L = luaL_newstate();
luaL_openlibs(L);
lua_push_cfunctions(L);
luaL_loadfile(L, buffer);
do_internal_menu = 0;
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
} else {
do_internal_menu = 1;
}
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
while (!doquit) {
if (do_internal_menu == 1) {
s_displayansi("mainmenu");
s_printf(get_string(142), user->timeleft);
c = s_getc();
} else {
lua_getglobal(L, "menu");
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_internal_menu = 1;
lua_close(L);
continue;
}
lRet = (char *)lua_tostring(L, -1);
lua_pop(L, 1);
c = lRet[0];
while (stat(buffer, &s) == 0) {
sprintf(buffer, "bulletin%d", i);
s_displayansi(buffer);
s_printf(get_string(6));
s_getc();
i++;
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
}
}
void display_textfiles() {
int i;
char buffer[5];
switch(tolower(c)) {
case 27:
{
c = s_getc();
if (c == 91) {
c = s_getc();
}
}
break;
case 'o':
{
automessage_write(user);
}
break;
case 'a':
{
if (conf.text_file_count > 0) {
while(1) {
@ -110,71 +62,4 @@ void main_menu(struct user_record *user) {
s_printf(get_string(6));
s_getc();
}
}
break;
case 'c':
{
chat_system(user);
}
break;
case 'l':
{
bbs_list(user);
}
break;
case 'u':
{
list_users(user);
}
break;
case 'b':
{
i = 0;
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
while (stat(buffer, &s) == 0) {
sprintf(buffer, "bulletin%d", i);
s_displayansi(buffer);
s_printf(get_string(6));
s_getc();
i++;
sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i);
}
}
break;
case '1':
{
display_last10_callers(user);
}
break;
case 'd':
{
doquit = door_menu(user);
}
break;
case 'm':
{
doquit = mail_menu(user);
}
break;
case 'g':
{
doquit = do_logout();
}
break;
case 't':
{
doquit = file_menu(user);
}
break;
case 's':
{
settings_menu(user);
}
break;
}
}
if (do_internal_menu == 0) {
lua_close(L);
}
}

431
menus.c Normal file
View File

@ -0,0 +1,431 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "bbs.h"
#include "lua/lua.h"
#include "lua/lualib.h"
#include "lua/lauxlib.h"
#define MENU_SUBMENU 1
#define MENU_LOGOFF 2
#define MENU_PREVMENU 3
#define MENU_AUTOMESSAGEWRITE 4
#define MENU_TEXTFILES 5
#define MENU_CHATSYSTEM 6
#define MENU_BBSLIST 7
#define MENU_LISTUSERS 8
#define MENU_BULLETINS 9
#define MENU_LAST10 10
#define MENU_SETTINGS 11
#define MENU_DOOR 12
#define MENU_MAILSCAN 13
#define MENU_READMAIL 14
#define MENU_POSTMESSAGE 15
#define MENU_CHOOSEMAILCONF 16
#define MENU_CHOOSEMAILAREA 17
#define MENU_SENDEMAIL 18
#define MENU_LISTEMAIL 19
#define MENU_NEXTMAILCONF 20
#define MENU_PREVMAILCONF 21
#define MENU_NEXTMAILAREA 22
#define MENU_PREVMAILAREA 23
#define MENU_BLUEWAVEDOWN 24
#define MENU_BLUEWAVEUP 25
#define MENU_CHOOSEFILEDIR 26
#define MENU_CHOOSEFILESUB 27
#define MENU_LISTFILES 28
#define MENU_UPLOAD 29
#define MENU_DOWNLOAD 30
#define MENU_CLEARTAGGEDFILES 31
#define MENU_NEXTFILEDIR 32
#define MENU_PREVFILEDIR 33
#define MENU_NEXTFILESUB 34
#define MENU_PREVFILESUB 35
#define MENU_LISTMESSAGES 36
extern struct bbs_config conf;
extern struct user_record *gUser;
extern int mynode;
struct menu_item {
char hotkey;
int command;
char *data;
};
int menu_system(char *menufile) {
FILE *fptr;
char buffer[PATH_MAX];
int menu_items = 0;
struct menu_item **menu;
char *lua_script;
int do_lua_menu;
char *ansi_file;
int i;
int j;
struct stat s;
char *lRet;
lua_State *L;
int result;
int doquit = 0;
char c;
if (menufile[0] == '/') {
snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
} else {
snprintf(buffer, PATH_MAX, "%s/%s.mnu", conf.menu_path, menufile);
}
fptr = fopen(buffer, "r");
if (!fptr) {
s_printf("Error opening menu file! %s\r\n", menufile);
return 0;
}
lua_script = NULL;
ansi_file = NULL;
fgets(buffer, 256, fptr);
while (!feof(fptr)) {
chomp(buffer);
if (strncasecmp(buffer, "HOTKEY", 6) == 0) {
menu_items++;
if (menu_items == 1) {
menu = (struct menu_item **)malloc(sizeof(struct menu_item *));
} else {
menu = (struct menu_item **)realloc(menu, sizeof(struct menu_item *) * (menu_items));
}
menu[menu_items-1] = (struct menu_item *)malloc(sizeof(struct menu_item));
menu[menu_items-1]->hotkey = buffer[7];
menu[menu_items-1]->data = NULL;
} else if (strncasecmp(buffer, "COMMAND", 7) == 0 && menu_items > 0) {
if (strncasecmp(&buffer[8], "SUBMENU", 7) == 0) {
menu[menu_items-1]->command = MENU_SUBMENU;
} else if (strncasecmp(&buffer[8], "LOGOFF", 6) == 0) {
menu[menu_items-1]->command = MENU_LOGOFF;
} else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) {
menu[menu_items-1]->command = MENU_PREVMENU;
} else if (strncasecmp(&buffer[8], "AUTOMESSAGE_WRITE", 17) == 0) {
menu[menu_items-1]->command = MENU_AUTOMESSAGEWRITE;
} else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) {
menu[menu_items-1]->command = MENU_TEXTFILES;
} else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) {
menu[menu_items-1]->command = MENU_CHATSYSTEM;
} else if (strncasecmp(&buffer[8], "BBSLIST", 7) == 0) {
menu[menu_items-1]->command = MENU_BBSLIST;
} else if (strncasecmp(&buffer[8], "LISTUSERS", 9) == 0) {
menu[menu_items-1]->command = MENU_LISTUSERS;
} else if (strncasecmp(&buffer[8], "BULLETINS", 9) == 0) {
menu[menu_items-1]->command = MENU_BULLETINS;
} else if (strncasecmp(&buffer[8], "LAST10CALLERS", 13) == 0) {
menu[menu_items-1]->command = MENU_LAST10;
} else if (strncasecmp(&buffer[8], "SETTINGS", 8) == 0) {
menu[menu_items-1]->command = MENU_SETTINGS;
} else if (strncasecmp(&buffer[8], "RUNDOOR", 7) == 0) {
menu[menu_items-1]->command = MENU_DOOR;
} else if (strncasecmp(&buffer[8], "MAILSCAN", 8) == 0) {
menu[menu_items-1]->command = MENU_MAILSCAN;
} else if (strncasecmp(&buffer[8], "READMAIL", 8) == 0) {
menu[menu_items-1]->command = MENU_READMAIL;
} else if (strncasecmp(&buffer[8], "POSTMESSAGE", 11) == 0) {
menu[menu_items-1]->command = MENU_POSTMESSAGE;
} else if (strncasecmp(&buffer[8], "CHOOSEMAILCONF", 14) == 0) {
menu[menu_items-1]->command = MENU_CHOOSEMAILCONF;
} else if (strncasecmp(&buffer[8], "CHOOSEMAILAREA", 14) == 0) {
menu[menu_items-1]->command = MENU_CHOOSEMAILAREA;
} else if (strncasecmp(&buffer[8], "SENDEMAIL", 9) == 0) {
menu[menu_items-1]->command = MENU_SENDEMAIL;
} else if (strncasecmp(&buffer[8], "LISTEMAIL", 9) == 0) {
menu[menu_items-1]->command = MENU_LISTEMAIL;
} else if (strncasecmp(&buffer[8], "NEXTMAILCONF", 12) == 0) {
menu[menu_items-1]->command = MENU_NEXTMAILCONF;
} else if (strncasecmp(&buffer[8], "PREVMAILCONF", 12) == 0) {
menu[menu_items-1]->command = MENU_PREVMAILCONF;
} else if (strncasecmp(&buffer[8], "NEXTMAILAREA", 12) == 0) {
menu[menu_items-1]->command = MENU_NEXTMAILAREA;
} else if (strncasecmp(&buffer[8], "PREVMAILAREA", 12) == 0) {
menu[menu_items-1]->command = MENU_PREVMAILAREA;
} else if (strncasecmp(&buffer[8], "BLUEWAVEDOWNLOAD", 16) == 0) {
menu[menu_items-1]->command = MENU_BLUEWAVEDOWN;
} else if (strncasecmp(&buffer[8], "BLUEWAVEUPLOAD", 14) == 0) {
menu[menu_items-1]->command = MENU_BLUEWAVEUP;
} else if (strncasecmp(&buffer[8], "CHOOSEFILEDIR", 13) == 0) {
menu[menu_items-1]->command = MENU_CHOOSEFILEDIR;
} else if (strncasecmp(&buffer[8], "CHOOSEFILESUB", 13) == 0) {
menu[menu_items-1]->command = MENU_CHOOSEFILESUB;
} else if (strncasecmp(&buffer[8], "LISTFILES", 9) == 0) {
menu[menu_items-1]->command = MENU_LISTFILES;
} else if (strncasecmp(&buffer[8], "UPLOAD", 6) == 0) {
menu[menu_items-1]->command = MENU_UPLOAD;
} else if (strncasecmp(&buffer[8], "DOWNLOAD", 8) == 0) {
menu[menu_items-1]->command = MENU_DOWNLOAD;
} else if (strncasecmp(&buffer[8], "CLEARTAGGED", 11) == 0) {
menu[menu_items-1]->command = MENU_CLEARTAGGEDFILES;
} else if (strncasecmp(&buffer[8], "NEXTFILEDIR", 11) == 0) {
menu[menu_items-1]->command = MENU_NEXTFILEDIR;
} else if (strncasecmp(&buffer[8], "PREVFILEDIR", 11) == 0) {
menu[menu_items-1]->command = MENU_PREVFILEDIR;
} else if (strncasecmp(&buffer[8], "NEXTFILESUB", 11) == 0) {
menu[menu_items-1]->command = MENU_NEXTFILESUB;
} else if (strncasecmp(&buffer[8], "PREVFILESUB", 11) == 0) {
menu[menu_items-1]->command = MENU_PREVFILESUB;
} else if (strncasecmp(&buffer[8], "LISTMESSAGES", 12) == 0) {
menu[menu_items-1]->command = MENU_LISTMESSAGES;
}
} else if (strncasecmp(buffer, "DATA", 4) == 0) {
menu[menu_items-1]->data = strdup(&buffer[5]);
} else if (strncasecmp(buffer, "LUASCRIPT", 9) == 0) {
if (lua_script != NULL) {
free(lua_script);
}
lua_script = strdup(&buffer[10]);
} else if (strncasecmp(buffer, "ANSIFILE", 8) == 0) {
if (ansi_file != NULL) {
free(ansi_file);
}
ansi_file = strdup(&buffer[9]);
}
fgets(buffer, 256, fptr);
}
fclose(fptr);
do_lua_menu = 0;
if (lua_script != NULL) {
if (conf.script_path != NULL && lua_script[0] != '/') {
snprintf(buffer, PATH_MAX, "%s/%s.lua", conf.script_path, lua_script);
do_lua_menu = 1;
} else if (lua_script[0] == '/') {
snprintf(buffer, PATH_MAX, "%s.lua", lua_script);
do_lua_menu = 1;
}
if (do_lua_menu) {
if (stat(buffer, &s) == 0) {
L = luaL_newstate();
luaL_openlibs(L);
lua_push_cfunctions(L);
luaL_loadfile(L, buffer);
do_lua_menu = 1;
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_lua_menu = 0;
}
} else {
do_lua_menu = 0;
}
}
}
while (!doquit) {
if (do_lua_menu == 0) {
if (ansi_file != NULL) {
s_displayansi(ansi_file);
}
s_printf(get_string(142), gUser->timeleft);
c = s_getc();
} else {
lua_getglobal(L, "menu");
result = lua_pcall(L, 0, 1, 0);
if (result) {
dolog("Failed to run script: %s", lua_tostring(L, -1));
do_lua_menu = 0;
lua_close(L);
continue;
}
lRet = (char *)lua_tostring(L, -1);
lua_pop(L, 1);
c = lRet[0];
}
for (i=0;i<menu_items;i++) {
if (tolower(menu[i]->hotkey) == tolower(c)) {
switch(menu[i]->command) {
case MENU_SUBMENU:
doquit = menu_system(menu[i]->data);
if (doquit == 1) {
// free menus
if (do_lua_menu) {
lua_close(L);
}
if (lua_script != NULL) {
free(lua_script);
}
if (ansi_file != NULL) {
free(ansi_file);
}
for (i=0;i<menu_items;i++) {
if (menu[i]->data != NULL) {
free(menu[i]->data);
}
free(menu[i]);
}
free(menu);
return doquit;
}
break;
case MENU_LOGOFF:
if (do_lua_menu) {
lua_close(L);
}
if (lua_script != NULL) {
free(lua_script);
}
if (ansi_file != NULL) {
free(ansi_file);
}
for (i=0;i<menu_items;i++) {
if (menu[i]->data != NULL) {
free(menu[i]->data);
}
free(menu[i]);
}
free(menu);
return 1;
case MENU_PREVMENU:
if (do_lua_menu) {
lua_close(L);
}
if (lua_script != NULL) {
free(lua_script);
}
if (ansi_file != NULL) {
free(ansi_file);
}
for (i=0;i<menu_items;i++) {
if (menu[i]->data != NULL) {
free(menu[i]->data);
}
free(menu[i]);
}
free(menu);
return 0;
case MENU_AUTOMESSAGEWRITE:
automessage_write(gUser);
break;
case MENU_TEXTFILES:
display_textfiles();
break;
case MENU_CHATSYSTEM:
chat_system(gUser);
break;
case MENU_BBSLIST:
bbs_list(gUser);
break;
case MENU_LISTUSERS:
list_users(gUser);
break;
case MENU_BULLETINS:
display_bulletins();
break;
case MENU_LAST10:
display_last10_callers(gUser);
break;
case MENU_SETTINGS:
settings_menu(gUser);
break;
case MENU_DOOR:
{
for (j=0;j<conf.door_count;j++) {
if (strcasecmp(menu[i]->data, conf.doors[j]->name) == 0) {
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[j]->name, mynode);
rundoor(gUser, conf.doors[j]->command, conf.doors[j]->stdio);
dolog("%s returned from door %s, on node %d", gUser->loginname, conf.doors[j]->name, mynode);
break;
}
}
}
break;
case MENU_MAILSCAN:
mail_scan(gUser);
break;
case MENU_READMAIL:
read_mail(gUser);
break;
case MENU_POSTMESSAGE:
post_message(gUser);
break;
case MENU_CHOOSEMAILCONF:
choose_conference(gUser);
break;
case MENU_CHOOSEMAILAREA:
choose_area(gUser);
break;
case MENU_SENDEMAIL:
send_email(gUser);
break;
case MENU_LISTEMAIL:
list_emails(gUser);
break;
case MENU_NEXTMAILCONF:
next_mail_conf(gUser);
break;
case MENU_PREVMAILCONF:
prev_mail_conf(gUser);
break;
case MENU_NEXTMAILAREA:
next_mail_area(gUser);
break;
case MENU_PREVMAILAREA:
prev_mail_area(gUser);
break;
case MENU_BLUEWAVEDOWN:
bwave_create_packet();
break;
case MENU_BLUEWAVEUP:
bwave_upload_reply();
break;
case MENU_CHOOSEFILEDIR:
choose_directory(gUser);
break;
case MENU_CHOOSEFILESUB:
choose_subdir(gUser);
break;
case MENU_LISTFILES:
list_files(gUser);
break;
case MENU_UPLOAD:
if (gUser->sec_level >= conf.file_directories[gUser->cur_file_dir]->file_subs[gUser->cur_file_sub]->upload_sec_level) {
upload(gUser);
} else {
s_printf(get_string(84));
}
break;
case MENU_DOWNLOAD:
download(gUser);
break;
case MENU_CLEARTAGGEDFILES:
clear_tagged_files();
break;
case MENU_NEXTFILEDIR:
next_file_dir(gUser);
break;
case MENU_PREVFILEDIR:
prev_file_dir(gUser);
break;
case MENU_NEXTFILESUB:
next_file_sub(gUser);
break;
case MENU_PREVFILESUB:
prev_file_sub(gUser);
break;
case MENU_LISTMESSAGES:
list_messages(gUser);
break;
}
break;
}
}
}
// free menus;
return doquit;
}

9
menus_default/doors.mnu Normal file
View File

@ -0,0 +1,9 @@
LUASCRIPT doors
ANSIFILE doors
HOTKEY Q
COMMAND PREVMENU
HOTKEY G
COMMAND SUBMENU
DATA logoff

39
menus_default/file.mnu Normal file
View File

@ -0,0 +1,39 @@
LUASCRIPT filemenu
ANSIFILE filemenu
HOTKEY I
COMMAND CHOOSEFILEDIR
HOTKEY S
COMMAND CHOOSEFILESUB
HOTKEY L
COMMAND LISTFILES
HOTKEY U
COMMAND UPLOAD
HOTKEY D
COMMAND DOWNLOAD
HOTKEY C
COMMAND CLEARTAGGED
HOTKEY }
COMMAND NEXTFILEDIR
HOTKEY {
COMMAND PREVFILEDIR
HOTKEY ]
COMMAND NEXTFILESUB
HOTKEY [
COMMAND PREVFILESUB
HOTKEY Q
COMMAND PREVMENU
HOTKEY G
COMMAND SUBMENU
DATA logoff

7
menus_default/logoff.mnu Normal file
View File

@ -0,0 +1,7 @@
ANSIFILE logoff
HOTKEY Y
COMMAND LOGOFF
HOTKEY N
COMMAND PREVMENU

51
menus_default/mail.mnu Normal file
View File

@ -0,0 +1,51 @@
LUASCRIPT mailmenu
ANSIFILE mailmenu
HOTKEY !
COMMAND MAILSCAN
HOTKEY D
COMMAND READMAIL
HOTKEY P
COMMAND POSTMESSAGE
HOTKEY L
COMMAND LISTMESSAGES
HOTKEY C
COMMAND CHOOSEMAILCONF
HOTKEY A
COMMAND CHOOSEMAILAREA
HOTKEY Q
COMMAND PREVMENU
HOTKEY G
COMMAND SUBMENU
DATA logoff
HOTKEY E
COMMAND SENDEMAIL
HOTKEY R
COMMAND LISTEMAIL
HOTKEY }
COMMAND NEXTMAILCONF
HOTKEY {
COMMAND PREVMAILCONF
HOTKEY ]
COMMAND NEXTMAILAREA
HOTKEY [
COMMAND PREVMAILAREA
HOTKEY B
COMMAND BLUEWAVEDOWNLOAD
HOTKEY U
COMMAND BLUEWAVEUPLOAD

42
menus_default/main.mnu Normal file
View File

@ -0,0 +1,42 @@
LUASCRIPT mainmenu
ANSIFILE mainmenu
HOTKEY O
COMMAND AUTOMESSAGE_WRITE
HOTKEY A
COMMAND TEXTFILES
HOTKEY C
COMMAND CHATSYSTEM
HOTKEY L
COMMAND BBSLIST
HOTKEY U
COMMAND LISTUSERS
HOTKEY B
COMMAND BULLETINS
HOTKEY 1
COMMAND LAST10CALLERS
HOTKEY D
COMMAND SUBMENU
DATA doors
HOTKEY M
COMMAND SUBMENU
DATA mail
HOTKEY T
COMMAND SUBMENU
DATA file
HOTKEY S
COMMAND SETTINGS
HOTKEY G
COMMAND SUBMENU
DATA logoff

View File

@ -1,13 +1,4 @@
function logout()
bbs_write_string("\r\n\r\nAre you sure you want to logoff (Y/N) ? ");
cmd = bbs_read_char();
if (cmd == "n" or cmd == "N") then
return 0;
end
bbs_display_ansi("goodbye");
return 1;
end