chaining menu commands
This commit is contained in:
parent
91b7fa1de5
commit
e8640d2230
630
src/menus.c
630
src/menus.c
@ -66,8 +66,9 @@ extern int mynode;
|
|||||||
|
|
||||||
struct menu_item {
|
struct menu_item {
|
||||||
char hotkey;
|
char hotkey;
|
||||||
int command;
|
int *command;
|
||||||
char *data;
|
char **data;
|
||||||
|
int command_count;
|
||||||
int seclevel;
|
int seclevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ int menu_system(char *menufile) {
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
|
int m;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
char *lRet;
|
char *lRet;
|
||||||
lua_State *L;
|
lua_State *L;
|
||||||
@ -125,117 +127,131 @@ int menu_system(char *menufile) {
|
|||||||
}
|
}
|
||||||
menu[menu_items-1] = (struct menu_item *)malloc(sizeof(struct menu_item));
|
menu[menu_items-1] = (struct menu_item *)malloc(sizeof(struct menu_item));
|
||||||
menu[menu_items-1]->hotkey = buffer[7];
|
menu[menu_items-1]->hotkey = buffer[7];
|
||||||
menu[menu_items-1]->command = 0;
|
menu[menu_items-1]->command = NULL;
|
||||||
menu[menu_items-1]->data = NULL;
|
menu[menu_items-1]->data = NULL;
|
||||||
|
menu[menu_items-1]->command_count = 0;
|
||||||
menu[menu_items-1]->seclevel = 0;
|
menu[menu_items-1]->seclevel = 0;
|
||||||
} else if (strncasecmp(buffer, "COMMAND", 7) == 0 && menu_items > 0) {
|
} else if (strncasecmp(buffer, "COMMAND", 7) == 0 && menu_items > 0) {
|
||||||
|
if (menu[menu_items-1]->command_count == 0) {
|
||||||
|
menu[menu_items-1]->command = (int *)malloc(sizeof(int));
|
||||||
|
menu[menu_items-1]->data = (char **)malloc(sizeof(char *));
|
||||||
|
} else {
|
||||||
|
menu[menu_items-1]->command = (int *)realloc(menu[menu_items-1]->command, sizeof(int) * (menu[menu_items-1]->command_count + 1));
|
||||||
|
menu[menu_items-1]->data = (char **)realloc(menu[menu_items-1]->data, sizeof(char *) * (menu[menu_items-1]->command_count + 1));
|
||||||
|
}
|
||||||
|
menu[menu_items-1]->command_count++;
|
||||||
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = 0;
|
||||||
|
menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] = NULL;
|
||||||
if (strncasecmp(&buffer[8], "SUBMENU", 7) == 0) {
|
if (strncasecmp(&buffer[8], "SUBMENU", 7) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SUBMENU;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SUBMENU;
|
||||||
} else if (strncasecmp(&buffer[8], "LOGOFF", 6) == 0) {
|
} else if (strncasecmp(&buffer[8], "LOGOFF", 6) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LOGOFF;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LOGOFF;
|
||||||
} else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_PREVMENU;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMENU;
|
||||||
} else if (strncasecmp(&buffer[8], "AUTOMESSAGE", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "AUTOMESSAGE", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_AUTOMESSAGE;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_AUTOMESSAGE;
|
||||||
} else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_TEXTFILES;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_TEXTFILES;
|
||||||
} else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) {
|
} else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CHATSYSTEM;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHATSYSTEM;
|
||||||
} else if (strncasecmp(&buffer[8], "BBSLIST", 7) == 0) {
|
} else if (strncasecmp(&buffer[8], "BBSLIST", 7) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BBSLIST;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BBSLIST;
|
||||||
} else if (strncasecmp(&buffer[8], "LISTUSERS", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "LISTUSERS", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LISTUSERS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTUSERS;
|
||||||
} else if (strncasecmp(&buffer[8], "BULLETINS", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "BULLETINS", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BULLETINS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BULLETINS;
|
||||||
} else if (strncasecmp(&buffer[8], "LAST10CALLERS", 13) == 0) {
|
} else if (strncasecmp(&buffer[8], "LAST10CALLERS", 13) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LAST10;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LAST10;
|
||||||
} else if (strncasecmp(&buffer[8], "SETTINGS", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "SETTINGS", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SETTINGS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SETTINGS;
|
||||||
} else if (strncasecmp(&buffer[8], "RUNDOOR", 7) == 0) {
|
} else if (strncasecmp(&buffer[8], "RUNDOOR", 7) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_DOOR;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOOR;
|
||||||
} else if (strncasecmp(&buffer[8], "MAILSCAN", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "MAILSCAN", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_MAILSCAN;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_MAILSCAN;
|
||||||
} else if (strncasecmp(&buffer[8], "READMAIL", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "READMAIL", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_READMAIL;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_READMAIL;
|
||||||
} else if (strncasecmp(&buffer[8], "POSTMESSAGE", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "POSTMESSAGE", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_POSTMESSAGE;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_POSTMESSAGE;
|
||||||
} else if (strncasecmp(&buffer[8], "CHOOSEMAILCONF", 14) == 0) {
|
} else if (strncasecmp(&buffer[8], "CHOOSEMAILCONF", 14) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CHOOSEMAILCONF;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEMAILCONF;
|
||||||
} else if (strncasecmp(&buffer[8], "CHOOSEMAILAREA", 14) == 0) {
|
} else if (strncasecmp(&buffer[8], "CHOOSEMAILAREA", 14) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CHOOSEMAILAREA;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEMAILAREA;
|
||||||
} else if (strncasecmp(&buffer[8], "SENDEMAIL", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "SENDEMAIL", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SENDEMAIL;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDEMAIL;
|
||||||
} else if (strncasecmp(&buffer[8], "LISTEMAIL", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "LISTEMAIL", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LISTEMAIL;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTEMAIL;
|
||||||
} else if (strncasecmp(&buffer[8], "NEXTMAILCONF", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "NEXTMAILCONF", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_NEXTMAILCONF;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTMAILCONF;
|
||||||
} else if (strncasecmp(&buffer[8], "PREVMAILCONF", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "PREVMAILCONF", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_PREVMAILCONF;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMAILCONF;
|
||||||
} else if (strncasecmp(&buffer[8], "NEXTMAILAREA", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "NEXTMAILAREA", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_NEXTMAILAREA;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTMAILAREA;
|
||||||
} else if (strncasecmp(&buffer[8], "PREVMAILAREA", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "PREVMAILAREA", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_PREVMAILAREA;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMAILAREA;
|
||||||
} else if (strncasecmp(&buffer[8], "BLUEWAVEDOWNLOAD", 16) == 0) {
|
} else if (strncasecmp(&buffer[8], "BLUEWAVEDOWNLOAD", 16) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BLUEWAVEDOWN;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLUEWAVEDOWN;
|
||||||
} else if (strncasecmp(&buffer[8], "BLUEWAVEUPLOAD", 14) == 0) {
|
} else if (strncasecmp(&buffer[8], "BLUEWAVEUPLOAD", 14) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BLUEWAVEUP;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLUEWAVEUP;
|
||||||
} else if (strncasecmp(&buffer[8], "CHOOSEFILEDIR", 13) == 0) {
|
} else if (strncasecmp(&buffer[8], "CHOOSEFILEDIR", 13) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CHOOSEFILEDIR;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEFILEDIR;
|
||||||
} else if (strncasecmp(&buffer[8], "CHOOSEFILESUB", 13) == 0) {
|
} else if (strncasecmp(&buffer[8], "CHOOSEFILESUB", 13) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CHOOSEFILESUB;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEFILESUB;
|
||||||
} else if (strncasecmp(&buffer[8], "LISTFILES", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "LISTFILES", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LISTFILES;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTFILES;
|
||||||
} else if (strncasecmp(&buffer[8], "UPLOAD", 6) == 0) {
|
} else if (strncasecmp(&buffer[8], "UPLOAD", 6) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_UPLOAD;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_UPLOAD;
|
||||||
} else if (strncasecmp(&buffer[8], "DOWNLOAD", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "DOWNLOAD", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_DOWNLOAD;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOWNLOAD;
|
||||||
} else if (strncasecmp(&buffer[8], "CLEARTAGGED", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "CLEARTAGGED", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_CLEARTAGGEDFILES;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CLEARTAGGEDFILES;
|
||||||
} else if (strncasecmp(&buffer[8], "NEXTFILEDIR", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "NEXTFILEDIR", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_NEXTFILEDIR;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTFILEDIR;
|
||||||
} else if (strncasecmp(&buffer[8], "PREVFILEDIR", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "PREVFILEDIR", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_PREVFILEDIR;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVFILEDIR;
|
||||||
} else if (strncasecmp(&buffer[8], "NEXTFILESUB", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "NEXTFILESUB", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_NEXTFILESUB;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTFILESUB;
|
||||||
} else if (strncasecmp(&buffer[8], "PREVFILESUB", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "PREVFILESUB", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_PREVFILESUB;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVFILESUB;
|
||||||
} else if (strncasecmp(&buffer[8], "LISTMESSAGES", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "LISTMESSAGES", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_LISTMESSAGES;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTMESSAGES;
|
||||||
} else if (strncasecmp(&buffer[8], "DOSCRIPT", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "DOSCRIPT", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_DOSCRIPT;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOSCRIPT;
|
||||||
} else if (strncasecmp(&buffer[8], "SENDNODEMSG", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "SENDNODEMSG", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SENDNODEMSG;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDNODEMSG;
|
||||||
} else if (strncasecmp(&buffer[8], "SUBUNSUBCONF", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "SUBUNSUBCONF", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SUBUNSUBCONF;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SUBUNSUBCONF;
|
||||||
} else if (strncasecmp(&buffer[8], "RESETMSGPTRS", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "RESETMSGPTRS", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_RESETPOINTERS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_RESETPOINTERS;
|
||||||
} else if (strncasecmp(&buffer[8], "RESETALLMSGPTRS", 15) == 0) {
|
} else if (strncasecmp(&buffer[8], "RESETALLMSGPTRS", 15) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_RESETALLPOINTERS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_RESETALLPOINTERS;
|
||||||
} else if (strncasecmp(&buffer[8], "FILESCAN", 8) == 0) {
|
} else if (strncasecmp(&buffer[8], "FILESCAN", 8) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_FILESCAN;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FILESCAN;
|
||||||
} else if (strncasecmp(&buffer[8], "FULLMAILSCAN", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "FULLMAILSCAN", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_FULLMAILSCAN;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FULLMAILSCAN;
|
||||||
} else if (strncasecmp(&buffer[8], "FILESEARCH", 10) == 0) {
|
} else if (strncasecmp(&buffer[8], "FILESEARCH", 10) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_FILESEARCH;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FILESEARCH;
|
||||||
} else if (strncasecmp(&buffer[8], "DISPLAYTXTFILE", 14) == 0) {
|
} else if (strncasecmp(&buffer[8], "DISPLAYTXTFILE", 14) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_DISPTXTFILE;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DISPTXTFILE;
|
||||||
} else if (strncasecmp(&buffer[8], "DISPLAYTXTPAUSE", 15) == 0) {
|
} else if (strncasecmp(&buffer[8], "DISPLAYTXTPAUSE", 15) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_DISPTXTFILEPAUSE;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DISPTXTFILEPAUSE;
|
||||||
} else if (strncasecmp(&buffer[8], "GENWWWURLS", 10) == 0) {
|
} else if (strncasecmp(&buffer[8], "GENWWWURLS", 10) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_GENWWWURLS;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_GENWWWURLS;
|
||||||
} else if (strncasecmp(&buffer[8], "NLBROWSER", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "NLBROWSER", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_NLBROWSER;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NLBROWSER;
|
||||||
} else if (strncasecmp(&buffer[8], "SENDFEEDBACK", 12) == 0) {
|
} else if (strncasecmp(&buffer[8], "SENDFEEDBACK", 12) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_SENDFEEDBACK;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDFEEDBACK;
|
||||||
} else if (strncasecmp(&buffer[8], "BLOGDISPLAY", 11) == 0) {
|
} else if (strncasecmp(&buffer[8], "BLOGDISPLAY", 11) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BLOGDISPLAY;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLOGDISPLAY;
|
||||||
} else if (strncasecmp(&buffer[8], "BLOGWRITE", 9) == 0) {
|
} else if (strncasecmp(&buffer[8], "BLOGWRITE", 9) == 0) {
|
||||||
menu[menu_items-1]->command = MENU_BLOGWRITE;
|
menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLOGWRITE;
|
||||||
}
|
}
|
||||||
} else if (strncasecmp(buffer, "SECLEVEL", 8) == 0) {
|
} else if (strncasecmp(buffer, "SECLEVEL", 8) == 0) {
|
||||||
menu[menu_items-1]->seclevel = atoi(&buffer[9]);
|
menu[menu_items-1]->seclevel = atoi(&buffer[9]);
|
||||||
} else if (strncasecmp(buffer, "DATA", 4) == 0) {
|
} else if (strncasecmp(buffer, "DATA", 4) == 0) {
|
||||||
menu[menu_items-1]->data = strdup(&buffer[5]);
|
if (menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] != NULL) {
|
||||||
|
free(menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1]);
|
||||||
|
}
|
||||||
|
menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] = strdup(&buffer[5]);
|
||||||
} else if (strncasecmp(buffer, "LUASCRIPT", 9) == 0) {
|
} else if (strncasecmp(buffer, "LUASCRIPT", 9) == 0) {
|
||||||
if (lua_script != NULL) {
|
if (lua_script != NULL) {
|
||||||
free(lua_script);
|
free(lua_script);
|
||||||
@ -334,14 +350,39 @@ int menu_system(char *menufile) {
|
|||||||
for (i=0;i<menu_items;i++) {
|
for (i=0;i<menu_items;i++) {
|
||||||
if (tolower(menu[i]->hotkey) == tolower(c)) {
|
if (tolower(menu[i]->hotkey) == tolower(c)) {
|
||||||
if (menu[i]->seclevel <= gUser->sec_level) {
|
if (menu[i]->seclevel <= gUser->sec_level) {
|
||||||
switch(menu[i]->command) {
|
for (j=0; j<menu[i]->command_count;j++) {
|
||||||
case MENU_SUBMENU:
|
switch(menu[i]->command[j]) {
|
||||||
doquit = menu_system(menu[i]->data);
|
case MENU_SUBMENU:
|
||||||
if (doquit == 1) {
|
doquit = menu_system(menu[i]->data[j]);
|
||||||
// free menus
|
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++) {
|
||||||
|
for (j=0;j<menu[i]->command_count;j++) {
|
||||||
|
if (menu[i]->data[j] != NULL) {
|
||||||
|
free(menu[i]->data[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(menu[i]->data);
|
||||||
|
free(menu[i]->command);
|
||||||
|
free(menu[i]);
|
||||||
|
}
|
||||||
|
free(menu);
|
||||||
|
return doquit;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MENU_LOGOFF:
|
||||||
if (do_lua_menu) {
|
if (do_lua_menu) {
|
||||||
lua_close(L);
|
lua_close(L);
|
||||||
}
|
}
|
||||||
if (lua_script != NULL) {
|
if (lua_script != NULL) {
|
||||||
free(lua_script);
|
free(lua_script);
|
||||||
}
|
}
|
||||||
@ -349,259 +390,248 @@ int menu_system(char *menufile) {
|
|||||||
free(ansi_file);
|
free(ansi_file);
|
||||||
}
|
}
|
||||||
for (i=0;i<menu_items;i++) {
|
for (i=0;i<menu_items;i++) {
|
||||||
if (menu[i]->data != NULL) {
|
for (j=0;j<menu[i]->command_count;j++) {
|
||||||
free(menu[i]->data);
|
if (menu[i]->data[j] != NULL) {
|
||||||
|
free(menu[i]->data[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
free(menu[i]->data);
|
||||||
|
free(menu[i]->command);
|
||||||
free(menu[i]);
|
free(menu[i]);
|
||||||
}
|
}
|
||||||
free(menu);
|
free(menu);
|
||||||
return doquit;
|
return 1;
|
||||||
}
|
case MENU_PREVMENU:
|
||||||
break;
|
if (do_lua_menu) {
|
||||||
case MENU_LOGOFF:
|
lua_close(L);
|
||||||
if (do_lua_menu) {
|
}
|
||||||
lua_close(L);
|
if (lua_script != NULL) {
|
||||||
}
|
free(lua_script);
|
||||||
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]);
|
if (ansi_file != NULL) {
|
||||||
}
|
free(ansi_file);
|
||||||
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]);
|
for (i=0;i<menu_items;i++) {
|
||||||
}
|
for (j=0;j<menu[i]->command_count;j++) {
|
||||||
free(menu);
|
if (menu[i]->data[j] != NULL) {
|
||||||
return 0;
|
free(menu[i]->data[j]);
|
||||||
case MENU_AUTOMESSAGE:
|
}
|
||||||
automessage();
|
}
|
||||||
break;
|
free(menu[i]->data);
|
||||||
case MENU_TEXTFILES:
|
free(menu[i]->command);
|
||||||
display_textfiles();
|
free(menu[i]);
|
||||||
break;
|
}
|
||||||
case MENU_CHATSYSTEM:
|
free(menu);
|
||||||
chat_system(gUser);
|
return 0;
|
||||||
break;
|
case MENU_AUTOMESSAGE:
|
||||||
case MENU_BBSLIST:
|
automessage();
|
||||||
bbs_list(gUser);
|
break;
|
||||||
break;
|
case MENU_TEXTFILES:
|
||||||
case MENU_LISTUSERS:
|
display_textfiles();
|
||||||
list_users(gUser);
|
break;
|
||||||
break;
|
case MENU_CHATSYSTEM:
|
||||||
case MENU_BULLETINS:
|
chat_system(gUser);
|
||||||
display_bulletins();
|
break;
|
||||||
break;
|
case MENU_BBSLIST:
|
||||||
case MENU_LAST10:
|
bbs_list(gUser);
|
||||||
display_last10_callers(gUser);
|
break;
|
||||||
break;
|
case MENU_LISTUSERS:
|
||||||
case MENU_SETTINGS:
|
list_users(gUser);
|
||||||
settings_menu(gUser);
|
break;
|
||||||
break;
|
case MENU_BULLETINS:
|
||||||
case MENU_DOOR:
|
display_bulletins();
|
||||||
{
|
break;
|
||||||
for (j=0;j<conf.door_count;j++) {
|
case MENU_LAST10:
|
||||||
if (strcasecmp(menu[i]->data, conf.doors[j]->name) == 0) {
|
display_last10_callers(gUser);
|
||||||
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[j]->name, mynode);
|
break;
|
||||||
rundoor(gUser, conf.doors[j]->command, conf.doors[j]->stdio, conf.doors[j]->codepage);
|
case MENU_SETTINGS:
|
||||||
dolog("%s returned from door %s, on node %d", gUser->loginname, conf.doors[j]->name, mynode);
|
settings_menu(gUser);
|
||||||
break;
|
break;
|
||||||
|
case MENU_DOOR:
|
||||||
|
{
|
||||||
|
for (m=0;m<conf.door_count;m++) {
|
||||||
|
if (strcasecmp(menu[i]->data[j], conf.doors[m]->name) == 0) {
|
||||||
|
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[m]->name, mynode);
|
||||||
|
rundoor(gUser, conf.doors[m]->command, conf.doors[m]->stdio, conf.doors[m]->codepage);
|
||||||
|
dolog("%s returned from door %s, on node %d", gUser->loginname, conf.doors[m]->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();
|
|
||||||
break;
|
|
||||||
case MENU_CHOOSEMAILAREA:
|
|
||||||
choose_area();
|
|
||||||
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();
|
|
||||||
break;
|
|
||||||
case MENU_CHOOSEFILESUB:
|
|
||||||
choose_subdir();
|
|
||||||
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;
|
|
||||||
case MENU_DOSCRIPT:
|
|
||||||
do_lua_script(menu[i]->data);
|
|
||||||
break;
|
|
||||||
case MENU_SENDNODEMSG:
|
|
||||||
send_node_msg();
|
|
||||||
break;
|
|
||||||
case MENU_SUBUNSUBCONF:
|
|
||||||
msg_conf_sub_bases();
|
|
||||||
break;
|
|
||||||
case MENU_RESETPOINTERS:
|
|
||||||
s_printf(get_string(229));
|
|
||||||
s_readstring(buffer, 10);
|
|
||||||
if (tolower(buffer[0]) == 'r') {
|
|
||||||
k = -1;
|
|
||||||
j = 1;
|
|
||||||
} else if (tolower(buffer[0]) == 'u') {
|
|
||||||
k = -1;
|
|
||||||
j = 0;
|
|
||||||
} else if (buffer[0] < '0' || buffer[0] > '9') {
|
|
||||||
s_printf(get_string(39));
|
|
||||||
break;
|
break;
|
||||||
} else {
|
case MENU_MAILSCAN:
|
||||||
k = atoi(buffer) - 1;
|
mail_scan(gUser);
|
||||||
}
|
|
||||||
|
|
||||||
msgbase_reset_pointers(gUser->cur_mail_conf, gUser->cur_mail_area, j, k);
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MENU_RESETALLPOINTERS:
|
|
||||||
s_printf(get_string(230));
|
|
||||||
confirm = s_getc();
|
|
||||||
if (confirm == 'r' || confirm == 'R') {
|
|
||||||
j = 1;
|
|
||||||
} else if (confirm == 'u' || confirm == 'U') {
|
|
||||||
j = 0;
|
|
||||||
} else {
|
|
||||||
s_printf(get_string(39));
|
|
||||||
break;
|
break;
|
||||||
}
|
case MENU_READMAIL:
|
||||||
msgbase_reset_all_pointers(j);
|
read_mail(gUser);
|
||||||
break;
|
break;
|
||||||
case MENU_FILESCAN:
|
case MENU_POSTMESSAGE:
|
||||||
file_scan();
|
post_message(gUser);
|
||||||
break;
|
break;
|
||||||
case MENU_FULLMAILSCAN:
|
case MENU_CHOOSEMAILCONF:
|
||||||
if (menu[i]->data != NULL) {
|
choose_conference();
|
||||||
if (strcasecmp(menu[i]->data, "PERSONAL") == 0) {
|
break;
|
||||||
full_mail_scan_personal(gUser);
|
case MENU_CHOOSEMAILAREA:
|
||||||
|
choose_area();
|
||||||
|
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();
|
||||||
|
break;
|
||||||
|
case MENU_CHOOSEFILESUB:
|
||||||
|
choose_subdir();
|
||||||
|
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;
|
||||||
|
case MENU_DOSCRIPT:
|
||||||
|
do_lua_script(menu[i]->data);
|
||||||
|
break;
|
||||||
|
case MENU_SENDNODEMSG:
|
||||||
|
send_node_msg();
|
||||||
|
break;
|
||||||
|
case MENU_SUBUNSUBCONF:
|
||||||
|
msg_conf_sub_bases();
|
||||||
|
break;
|
||||||
|
case MENU_RESETPOINTERS:
|
||||||
|
s_printf(get_string(229));
|
||||||
|
s_readstring(buffer, 10);
|
||||||
|
if (tolower(buffer[0]) == 'r') {
|
||||||
|
k = -1;
|
||||||
|
m = 1;
|
||||||
|
} else if (tolower(buffer[0]) == 'u') {
|
||||||
|
k = -1;
|
||||||
|
m = 0;
|
||||||
|
} else if (buffer[0] < '0' || buffer[0] > '9') {
|
||||||
|
s_printf(get_string(39));
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
k = atoi(buffer) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
msgbase_reset_pointers(gUser->cur_mail_conf, gUser->cur_mail_area, m, k);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MENU_RESETALLPOINTERS:
|
||||||
|
s_printf(get_string(230));
|
||||||
|
confirm = s_getc();
|
||||||
|
if (confirm == 'r' || confirm == 'R') {
|
||||||
|
m = 1;
|
||||||
|
} else if (confirm == 'u' || confirm == 'U') {
|
||||||
|
m = 0;
|
||||||
|
} else {
|
||||||
|
s_printf(get_string(39));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
msgbase_reset_all_pointers(m);
|
||||||
|
break;
|
||||||
|
case MENU_FILESCAN:
|
||||||
|
file_scan();
|
||||||
|
break;
|
||||||
|
case MENU_FULLMAILSCAN:
|
||||||
|
if (menu[i]->data[j] != NULL) {
|
||||||
|
if (strcasecmp(menu[i]->data[j], "PERSONAL") == 0) {
|
||||||
|
full_mail_scan_personal(gUser);
|
||||||
|
} else {
|
||||||
|
full_mail_scan(gUser);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
full_mail_scan(gUser);
|
full_mail_scan(gUser);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
full_mail_scan(gUser);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MENU_FILESEARCH:
|
|
||||||
file_search();
|
|
||||||
break;
|
|
||||||
case MENU_DISPTXTFILE:
|
|
||||||
if (menu[i]->data != NULL) {
|
|
||||||
s_displayansi_pause(menu[i]->data, 0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MENU_DISPTXTFILEPAUSE:
|
|
||||||
if (menu[i]->data != NULL) {
|
|
||||||
s_displayansi_pause(menu[i]->data, 1);
|
|
||||||
}
|
|
||||||
s_printf(get_string(6));
|
|
||||||
s_getc();
|
|
||||||
break;
|
|
||||||
case MENU_GENWWWURLS:
|
|
||||||
genurls();
|
|
||||||
break;
|
|
||||||
case MENU_NLBROWSER:
|
|
||||||
nl_browser();
|
|
||||||
break;
|
|
||||||
case MENU_SENDFEEDBACK:
|
|
||||||
if (check_user(conf.sysop_name)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
case MENU_FILESEARCH:
|
||||||
msg = external_editor(gUser, conf.sysop_name, gUser->loginname, NULL, 0, NULL, "Feedback", 1, 0);
|
file_search();
|
||||||
if (msg != NULL) {
|
break;
|
||||||
commit_email(conf.sysop_name, "Feedback", msg);
|
case MENU_DISPTXTFILE:
|
||||||
free(msg);
|
if (menu[i]->data[j] != NULL) {
|
||||||
}
|
s_displayansi_pause(menu[i]->data[j], 0);
|
||||||
break;
|
}
|
||||||
case MENU_BLOGDISPLAY:
|
break;
|
||||||
blog_display();
|
case MENU_DISPTXTFILEPAUSE:
|
||||||
break;
|
if (menu[i]->data[j] != NULL) {
|
||||||
case MENU_BLOGWRITE:
|
s_displayansi_pause(menu[i]->data[j], 1);
|
||||||
blog_write();
|
}
|
||||||
break;
|
s_printf(get_string(6));
|
||||||
default:
|
s_getc();
|
||||||
break;
|
break;
|
||||||
|
case MENU_GENWWWURLS:
|
||||||
|
genurls();
|
||||||
|
break;
|
||||||
|
case MENU_NLBROWSER:
|
||||||
|
nl_browser();
|
||||||
|
break;
|
||||||
|
case MENU_SENDFEEDBACK:
|
||||||
|
if (check_user(conf.sysop_name)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
msg = external_editor(gUser, conf.sysop_name, gUser->loginname, NULL, 0, NULL, "Feedback", 1, 0);
|
||||||
|
if (msg != NULL) {
|
||||||
|
commit_email(conf.sysop_name, "Feedback", msg);
|
||||||
|
free(msg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MENU_BLOGDISPLAY:
|
||||||
|
blog_display();
|
||||||
|
break;
|
||||||
|
case MENU_BLOGWRITE:
|
||||||
|
blog_write();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user