From 1215de5b4f6c586136497b6b8712f9ed810bbdd1 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 27 Sep 2001 20:35:25 +0000 Subject: [PATCH] Changes to make bright and normal colors is display menus. --- AUTHORS | 2 +- ChangeLog | 5 ++ TODO | 3 ++ html/menus/index.htm | 28 +++++++---- html/menus/menu0.html | 9 ++-- lib/structs.h | 10 ++-- mbsebbs/menu.c | 29 +++++++++--- mbsebbs/pop3.c | 14 +++--- mbsebbs/safe.c | 88 +++++++++++++++++------------------ mbsebbs/timeout.c | 6 +-- mbsetup/Makefile.in | 4 +- mbsetup/ledit.c | 37 +++++++++++---- mbsetup/ledit.h | 1 + mbsetup/m_global.c | 30 +++++------- mbsetup/m_menu.c | 106 +++++++++++++++++++++--------------------- 15 files changed, 212 insertions(+), 160 deletions(-) diff --git a/AUTHORS b/AUTHORS index 140309df..a1e71acd 100644 --- a/AUTHORS +++ b/AUTHORS @@ -3,7 +3,7 @@ All following people have contributed to the MBSE BBS project. I'm sure that people are missing from this list. The list is not in any special order. -Michiel Broek mbse@users.sourceforge.net 2:280/2802 +Michiel Broek mbroek@users.sourceforge.net 2:280/2802 Joaquim Homrighausen joho@abs.lu Andrew Milner andrew@fido.lu Mats Wallin mw@fido.lu diff --git a/ChangeLog b/ChangeLog index a80a50bf..f015b29b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4126,6 +4126,9 @@ v0.33.18 27-Jul-2001 Shows the OS name in the info screen. Creates default tty records with tty names for the right OS (I hope). + Fixed a bug in the menu editor, deleted menus were not really + deleted. + Added setup items for the menu Display colors. mbcico: Renamed sendfile function in zmsend.c to sendzfile to prevent a @@ -4136,6 +4139,8 @@ v0.33.18 27-Jul-2001 mbsebbs: Removed some compiler warnings on some systems. + Added menu Display lines. + Added menu item 21, display text only. mbuseradd: Ported to work on FreeBSD. diff --git a/TODO b/TODO index 59f94341..3666898b 100644 --- a/TODO +++ b/TODO @@ -12,6 +12,9 @@ L = Cosmetic or nice to have. +SETUP.sh: + N: Better way to grep for excisting usernames and groupnames. + mbsebbs: L: Reading of function keys over modem lines, or worse PPP connections, must be fixed. Timing problems together with modem buffering? diff --git a/html/menus/index.htm b/html/menus/index.htm index e9cf81d5..c0042d98 100644 --- a/html/menus/index.htm +++ b/html/menus/index.htm @@ -11,7 +11,7 @@
-
Last update 02-Feb-2001
+
Last update 26-Sep-2001

 

MBSE BBS Menu System

@@ -37,7 +37,7 @@ according to criteria such as security levels.

ANSI Screens.

-For the menus to work properly you must also draw ANSI screens, this +For the menus to work properly you can draw ANSI screens, this is what the users will see. For Linux there is "Duh DRAW" written by Ben Fowler, see sunsite.unc.edu /pub/Lunux/docs. If you can't find it or have no internet access, you can also use @@ -48,6 +48,18 @@ menu, the include screen may for example show the keys that you have available in every menu. See the list of control codes.

 

+

Display lines.

+

+It is also possible to display menu lines with the buildin display option. +The used colors are selectable, a normal color and a bright color. +The normal color is the default, you can toggle bright on and of using +the ^ in the display line. If you end a menu display line with a ; then +no newline is send after that line. If you want to output teh ^ or ; characters +you need to escape them with a backslash like this: \; or \^. The order of menu +entries is important. Also note that the display line does nothing in +autoexec menus. +

 

+

Automatic commands.

A menu function is usually executed when a user presses the hot-key @@ -75,7 +87,7 @@ For each language you can define a set of menus. Only for the default language all menus must exist. It makes sense to make the filenames of your menus for each language the same and not to translate them. If a menu is missing for a non default language, the menu from the default language -path is used. +path is used instead.

 

Editing a menu.

@@ -97,8 +109,8 @@ of all available types see below.
  • Optional data. Some menus need optional data, for example the function goto another menu needs the name of that menu file here.
  • -
  • Display. What is to be displayed to the user. This field has -no meaning yet. What you want to diplay must be done with ANSI screens. +
  • Display. What is to be displayed to the user. You can use this instead +of ANSI screens.
  • Security. This is the minimum security level to execute this @@ -120,13 +132,13 @@ If this field is empty, no password check is done.
  • Credit. How much credit a user must have to execute this menu selection. This field is not in use yet.
  • -
  • Colors. The display color for the display line, not in use yet. +
  • Lo-colors. The normal display color for the display line.
  • +
  • Hi-colors. The bright display color for the display line.
  • +
  • AutoExec. If this is an automatic executed selection.
  • -
  • Menu open. Will be implemented later, you will be able to set -opening hours for this menu selection.
  • No door.sys Suppress writing of a door.sys file in the users home directory. This item is only visible with menu type 7.
  • Y2K style Writes the dates in the door.sys file in the new style, diff --git a/html/menus/menu0.html b/html/menus/menu0.html index b7cb38a2..fa681138 100644 --- a/html/menus/menu0.html +++ b/html/menus/menu0.html @@ -11,7 +11,7 @@
    -
    Last update 02-Feb-2001
    +
    Last update 26-Sep-2001

     

    MBSE BBS Global Menus

    @@ -145,10 +145,9 @@ file to display.

    -

  • Expert mode .a?? Not of any use anymore. - This one will be removed.
    - Optional data: The name of the file without extension - to display.
    +
  • Display line This entry does nothing except + that it displays the text on the display line.
    + Optional data: None.

  • Nextuser door: This runs the message to next diff --git a/lib/structs.h b/lib/structs.h index a80083bd..392b80ae 100644 --- a/lib/structs.h +++ b/lib/structs.h @@ -2,7 +2,7 @@ * * File ..................: structs.h * Purpose ...............: MBSE BBS Global structure - * Last modification date : 06-Jul-2001 + * Last modification date : 26-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -903,10 +903,10 @@ struct menufile { unsigned Y2Kdoorsys : 1; /* Write Y2K style door.sys */ unsigned Comport : 1; /* Vmodem compart mode */ long Credit; /* Credit needed */ - int OpenFrom; /* Open From */ - int OpenTo; /* Open To */ - int ForeGnd; /* ForeGround color */ - int BackGnd; /* BackGround color */ + int HiForeGnd; /* High ForeGround color */ + int HiBackGnd; /* High ForeGround color */ + int ForeGnd; /* Normal ForeGround color */ + int BackGnd; /* Normal BackGround color */ }; diff --git a/mbsebbs/menu.c b/mbsebbs/menu.c index 8a37ab9b..7f62fea5 100644 --- a/mbsebbs/menu.c +++ b/mbsebbs/menu.c @@ -2,7 +2,7 @@ * * File ..................: bbs/menu.c * Purpose ...............: Display and handle the menus. - * Last modification date : 10-Jul-2001 + * Last modification date : 27-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -83,7 +83,7 @@ void InitMenu() void menu() { FILE *pMenuFile; - int iFoundKey = FALSE, Key; + int iFoundKey = FALSE, Key, IsANSI; char *Input, *Semfile; char *sMenuPathFileName; @@ -133,15 +133,26 @@ void menu() strcpy(Menus[0], CFG.default_menu); } else { /* - * Display Menu Text Fields and Perform all autoexec menus in order of menu file + * Display Menu Text Fields and Perform all autoexec menus in order of menu file. + * First check if there are any ANSI menus, if not, send a clearscreen first. */ + IsANSI = FALSE; + while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) { + if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){ + if ((menus.MenuType == 5) || (menus.MenuType == 19) || (menus.MenuType == 20)) + IsANSI = TRUE; + } + } + fseek(pMenuFile, 0, SEEK_SET); + if (! IsANSI) + clear(); + while (fread(&menus, sizeof(menus), 1, pMenuFile) == 1) { if ( Access(exitinfo.Security, menus.MenuSecurity) && (UserAge >= menus.Age)){ if ( menus.AutoExec ) { DoMenu( menus.MenuType ); - } else { - DisplayMenu( ); } + DisplayMenu( ); } } @@ -390,6 +401,10 @@ void DoMenu(int Type) DisplayFileEnter(menus.OptionalData); break; + case 21: + /* display menuline only */ + break; + case 22: /* nextuser door */ nextuser(); @@ -693,7 +708,7 @@ void DisplayMenu ( void ) { int highlight ; /* Anything to process, if not; save CPU time, return */ - if ( strlen( menus.Display ) == 0 ) { + if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) { return; } @@ -731,7 +746,7 @@ void DisplayMenu ( void ) { if ( !escaped ) { if ( highlight == 0 ) { highlight = 1; - colour( CFG.HiliteF, CFG.HiliteB ); + colour( menus.HiForeGnd, menus.HiBackGnd); } else { highlight = 0 ; colour( menus.ForeGnd, menus.BackGnd ); diff --git a/mbsebbs/pop3.c b/mbsebbs/pop3.c index a98e8481..ee0aad79 100644 --- a/mbsebbs/pop3.c +++ b/mbsebbs/pop3.c @@ -2,7 +2,7 @@ * * File ..................: bbs/pop3.c * Purpose ...............: POP3 client - * Last modification date : 13-May-2001 + * Last modification date : 26-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -51,7 +51,7 @@ void error_popmail(char *umsg) pop3_send((char *)"QUIT\r\n"); p = pop3_receive(); pop3_close(); - colour(12, 0); + colour(LIGHTRED, BLACK); printf("%s\r\n", umsg); fflush(stdout); } @@ -131,7 +131,7 @@ void retr_msg(int msgnum) void check_popmail(char *user, char *pass) { char *p, *q, temp[128]; - int tmsgs = 0, size, msgnum, color = 9; + int tmsgs = 0, size, msgnum, color = LIGHTBLUE; FILE *tp; /* @@ -183,13 +183,13 @@ void check_popmail(char *user, char *pass) /* * Show progress */ - colour(color, 0); + colour(color, BLACK); printf("\rFetching message %02d/%02d, total %d bytes", msgnum, tmsgs, size); fflush(stdout); - if (color < 15) + if (color < WHITE) color++; else - color = 9; + color = LIGHTBLUE; retr_msg(msgnum); } fclose(tp); @@ -202,7 +202,7 @@ void check_popmail(char *user, char *pass) pop3_close(); if (tmsgs) { - colour(13, 0); + colour(LIGHTMAGENTA, BLACK); printf("\r \r"); fflush(stdout); } diff --git a/mbsebbs/safe.c b/mbsebbs/safe.c index 86d38e67..18f63383 100644 --- a/mbsebbs/safe.c +++ b/mbsebbs/safe.c @@ -2,7 +2,7 @@ * * File ..................: bbs/safe.c * Purpose ...............: Safe Door - * Last modification date : 28-Jun-2001 + * Last modification date : 26-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -70,7 +70,7 @@ void Safe(void) Enter(1); /* Safe Cracker Door */ - pout(15, 0, (char *) Language(86)); + pout(WHITE, BLACK, (char *) Language(86)); Enter(1); clear(); @@ -81,7 +81,7 @@ void Safe(void) return; /* In the safe lies */ - pout(15, 0, (char *) Language(87)); + pout(WHITE, BLACK, (char *) Language(87)); fflush(stdout); alarm_on(); @@ -90,15 +90,15 @@ void Safe(void) clear(); Enter(2); - pout(10, 0, (char *) Language(88)); + pout(LIGHTGREEN, BLACK, (char *) Language(88)); Enter(2); - colour(13, 0); + colour(LIGHTMAGENTA, BLACK); printf("%s", CFG.sSafePrize); Enter(2); /* Do you want to open the safe ? [Y/n]: */ - pout(15, 0, (char *) Language(102)); + pout(WHITE, BLACK, (char *) Language(102)); fflush(stdout); alarm_on(); @@ -120,7 +120,7 @@ void Safe(void) Enter(1); /* Do you want to try again ? [Y/n]: */ - pout(12, 0, (char *) Language(101)); + pout(LIGHTRED, BLACK, (char *) Language(101)); fflush(stdout); alarm_on(); @@ -145,7 +145,7 @@ int getdigits(void) int i; char temp[81]; - colour(15, 0); + colour(WHITE, BLACK); /* Please enter three numbers consisting from 1 to */ printf("\n\n%s%d\n", (char *) Language(89), CFG.iSafeMaxNumber); /* Please enter three combinations. */ @@ -154,8 +154,8 @@ int getdigits(void) while (TRUE) { Enter(2); /* 1st Digit */ - pout(12, 0, (char *) Language(91)); - colour(9, 0); + pout(LIGHTRED, BLACK, (char *) Language(91)); + colour(LIGHTBLUE, BLACK); fflush(stdout); Getnum(sFirst, 2); sprintf(temp, "1st: %s", sFirst); @@ -165,7 +165,7 @@ int getdigits(void) } if((iFirst > CFG.iSafeMaxNumber) || (iFirst <= 0) || (strcmp(sFirst, "") == 0)) { - colour(15,1); + colour(WHITE, BLUE); /* Please try again! You must input a number greater than Zero and less than */ printf("\n%s%d.", (char *) Language(92), CFG.iSafeMaxNumber); Syslog('-', "Value out of range!"); @@ -176,8 +176,8 @@ int getdigits(void) while (TRUE) { Enter(1); /* 2nd digit: */ - pout(12, 0, (char *) Language(93)); - colour(9, 0); + pout(LIGHTRED, BLACK, (char *) Language(93)); + colour(LIGHTBLUE, BLACK); fflush(stdout); Getnum(sSecond, 2); sprintf(temp, "2nd: %s", sSecond); @@ -187,7 +187,7 @@ int getdigits(void) } if((iSecond > CFG.iSafeMaxNumber) || (iSecond <= 0) || (strcmp(sSecond, "") == 0)) { - colour(15,1); + colour(WHITE, BLUE); /* Please try again! You must input a number greater than Zero and less than */ printf("\n%s%d.\n", (char *) Language(92), CFG.iSafeMaxNumber); Syslog('-', "Value out of range!"); @@ -197,8 +197,8 @@ int getdigits(void) while (TRUE) { Enter(1); - pout(12, 0, (char *) Language(94)); - colour(9, 0); + pout(LIGHTRED, BLACK, (char *) Language(94)); + colour(LIGHTBLUE, BLACK); fflush(stdout); Getnum(sThird, 2); if((strcmp(sThird, "")) != 0) { @@ -216,7 +216,7 @@ int getdigits(void) break; if((iThird > CFG.iSafeMaxNumber) || (iThird <= 0)) { - colour(15,1); + colour(WHITE, BLUE); /* Please try again! You must input a number greater than Zero and less than */ printf("\n%s%d.\n", (char *) Language(92), CFG.iSafeMaxNumber); Syslog('-', "Value out of range!"); @@ -226,20 +226,20 @@ int getdigits(void) /* Left: */ Enter(1); - pout(12, 0, (char *) Language(95)); - poutCR(9, 0, sFirst); + pout(LIGHTRED, BLACK, (char *) Language(95)); + poutCR(LIGHTBLUE, BLACK, sFirst); /* Right: */ - pout(12, 0, (char *) Language(96)); - poutCR(9, 0, sSecond); + pout(LIGHTRED, BLACK, (char *) Language(96)); + poutCR(LIGHTBLUE, BLACK, sSecond); /* Left: */ - pout(12, 0, (char *) Language(95)); - poutCR(9, 0, sThird); + pout(LIGHTRED, BLACK, (char *) Language(95)); + poutCR(LIGHTBLUE, BLACK, sThird); Enter(1); /* Attempt to open safe with this combination [Y/n]: */ - pout(12, 0, (char *) Language(97)); + pout(LIGHTRED, BLACK, (char *) Language(97)); fflush(stdout); alarm_on(); i = toupper(Getone()); @@ -249,22 +249,22 @@ int getdigits(void) printf("\n\n"); /* Left: */ - pout(12, 0, (char *) Language(95)); + pout(LIGHTRED, BLACK, (char *) Language(95)); for (iLoop = 0; iLoop < iFirst; iLoop++) - pout(14, 0, (char *)"."); - poutCR(9, 0, sFirst); + pout(YELLOW, BLACK, (char *)"."); + poutCR(LIGHTBLUE, BLACK, sFirst); /* Right: */ - pout(12, 0, (char *) Language(96)); + pout(LIGHTRED, BLACK, (char *) Language(96)); for (iLoop = 0; iLoop < iSecond; iLoop++) - pout(14, 0, (char *)"."); - poutCR(9, 0, sSecond); + pout(YELLOW, BLACK, (char *)"."); + poutCR(LIGHTBLUE, BLACK, sSecond); /* Left: */ - pout(12, 0, (char *) Language(95)); + pout(LIGHTRED, BLACK, (char *) Language(95)); for (iLoop = 0; iLoop < iThird; iLoop++) - pout(14, 0, (char *)"."); - poutCR(9, 0, sThird); + pout(YELLOW, BLACK, (char *)"."); + poutCR(LIGHTBLUE, BLACK, sThird); if(CFG.iSafeNumGen) { CFG.iSafeFirstDigit = (rand() % CFG.iSafeMaxNumber) + 1; @@ -280,9 +280,9 @@ int getdigits(void) Enter(1); /* You have won the following... */ - pout(12, 0, (char *) Language(98)); + pout(LIGHTRED, BLACK, (char *) Language(98)); Enter(2); - poutCR(13, 0, CFG.sSafePrize); + poutCR(LIGHTMAGENTA, BLACK, CFG.sSafePrize); Enter(1); sprintf(temp, "%s/etc/safe.data", getenv("MBSE_ROOT")); @@ -311,15 +311,15 @@ int getdigits(void) } Enter(1); - pout(10, 0, (char *) Language(99)); + pout(LIGHTGREEN, BLACK, (char *) Language(99)); Enter(1); if(CFG.iSafeNumGen) { Enter(1); /* The safe code was: */ - pout(12, 0, (char *) Language(100)); + pout(LIGHTRED, BLACK, (char *) Language(100)); Enter(2); - colour(12, 0); + colour(LIGHTRED, BLACK); /* Left: */ printf("%s%d\n", (char *) Language(95), CFG.iSafeFirstDigit); @@ -335,13 +335,13 @@ int getdigits(void) CFG.iSafeNumGen = FALSE; if(iThird == 747) { - colour(9, 0); + colour(LIGHTBLUE, BLACK); printf("Code: %d %d %d\n", CFG.iSafeFirstDigit, CFG.iSafeSecondDigit, CFG.iSafeThirdDigit); } Enter(1); /* Please press key to continue */ - pout(10, 0, (char *) Language(87)); + pout(LIGHTGREEN, BLACK, (char *) Language(87)); alarm_on(); getchar(); } @@ -382,15 +382,15 @@ int SafeCheckUser(void) Syslog('+', "Safe is currently LOCKED - exiting door."); /* THE SAFE IS CURRENTLY LOCKED */ - poutCR(15, 4, (char *) Language(103)); + poutCR(WHITE, RED, (char *) Language(103)); Enter(1); - colour(12, 0); + colour(LIGHTRED, BLACK); /* has cracked the safe. */ printf("%s, %s\n", safe.Name, (char *) Language(104)); /* The safe will remain locked until the sysop rewards the user. */ - pout(10, 0, (char *) Language(105)); + pout(LIGHTGREEN, BLACK, (char *) Language(105)); Enter(2); Pause(); fclose(pSafe); @@ -424,7 +424,7 @@ int SafeCheckUser(void) if(Counter >= CFG.iSafeMaxTrys - 1) { Enter(2); /* Maximum trys per day exceeded */ - pout(15, 0, (char *) Language(106)); + pout(WHITE, BLACK, (char *) Language(106)); Enter(1); sleep(3); fclose(pSafe); diff --git a/mbsebbs/timeout.c b/mbsebbs/timeout.c index 77ce64e1..50e214c0 100644 --- a/mbsebbs/timeout.c +++ b/mbsebbs/timeout.c @@ -2,10 +2,10 @@ * * File ..................: bbs/timeout.c * Purpose ...............: Inactivity timeout functions - * Last modification date : 24-Dec-2000 + * Last modification date : 26-Sep-2001 * ***************************************************************************** - * Copyright (C) 1997-2000 + * Copyright (C) 1997-2001 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -105,7 +105,7 @@ void die(int onsig) void alarm_sig() { - colour(12, 0); + colour(LIGHTRED, BLACK); /* Autologout: idletime reached.*/ printf("\r\n%s\r\n", (char *) Language(410)); diff --git a/mbsetup/Makefile.in b/mbsetup/Makefile.in index 377818b9..23fd5b20 100644 --- a/mbsetup/Makefile.in +++ b/mbsetup/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am +# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am # Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation @@ -109,7 +109,7 @@ DIST_COMMON = Makefile.am Makefile.in DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) -TAR = gtar +TAR = tar GZIP_ENV = --best DEP_FILES = .deps/grlist.P .deps/ledit.P .deps/m_archive.P \ .deps/m_bbs.P .deps/m_domain.P .deps/m_farea.P .deps/m_fdb.P \ diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index 5266d66a..1a98af5b 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -2,7 +2,7 @@ * * File ..................: ledit.c * Purpose ...............: Line Editor - * Last modification date : 27-May-2001 + * Last modification date : 27-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -1449,9 +1449,8 @@ void edit_color(int *fg, int *bg, char *help) clr_index(); set_color(WHITE, BLACK); mvprintw(5, 6, "1.7 EDIT COLORS"); - - sprintf(temp, "Change ^%s^ color with arrow keys, press whene done", help); - showhelp(help); + sprintf(temp, "Change the ^%s^ color with arrow keys, press whene done", help); + showhelp(temp); for (f = 0; f < 16; f++) for (b = 0; b < 8; b++) { @@ -1466,7 +1465,7 @@ void edit_color(int *fg, int *bg, char *help) mvprintw(7, 6, "This is an example..."); fflush(stdout); mvprintw(b + 9, f + 33, "*"); - ch = readkey(10,10,f,b); + ch = readkey(7,28,f,b); mvprintw(b + 9, f + 33, "."); switch(ch) { case KEY_LINEFEED: @@ -1491,6 +1490,30 @@ void edit_color(int *fg, int *bg, char *help) +char *get_color(int c) +{ + switch (c) { + case BLACK: return (char *)"black"; + case BLUE: return (char *)"blue"; + case GREEN: return (char *)"green"; + case CYAN: return (char *)"cyan"; + case RED: return (char *)"red"; + case MAGENTA: return (char *)"magenta"; + case BROWN: return (char *)"brown"; + case LIGHTGRAY: return (char *)"lightgray"; + case DARKGRAY: return (char *)"darkgray"; + case LIGHTBLUE: return (char *)"lightblue"; + case LIGHTGREEN: return (char *)"lightgreen"; + case LIGHTCYAN: return (char *)"lightcyan"; + case LIGHTRED: return (char *)"lightred"; + case LIGHTMAGENTA: return (char *)"lightmagenta"; + case YELLOW: return (char *)"yellow"; + case WHITE: return (char *)"white"; + } +} + + + char *getmenutype(int val) { switch (val) { @@ -1514,7 +1537,7 @@ char *getmenutype(int val) case 18: return (char *)"Send an on-line message"; case 19: return (char *)"Display textfile with more"; case 20: return (char *)"Display .A?? file with Enter"; - + case 21: return (char *)"Display Text Only"; case 22: return (char *)"Message to nextuser door"; case 23: return (char *)"Time banking system"; @@ -1590,8 +1613,6 @@ char *getmenutype(int val) case 505: return (char *)"Print a BBS"; case 506: return (char *)"Search for a BBS"; - case 999: return (char *)"Display Text Only"; - default: return (char *)"Unknown menu"; } } diff --git a/mbsetup/ledit.h b/mbsetup/ledit.h index c86a1e4b..9ac33693 100644 --- a/mbsetup/ledit.h +++ b/mbsetup/ledit.h @@ -59,6 +59,7 @@ void show_magictype(int, int, int); int edit_magictype(int, int, int); void show_aka(int, int, fidoaddr); void edit_color(int *, int *, char *); +char *get_color(int); char *getmenutype(int); diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index e8f80247..35b0c5da 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -2,7 +2,7 @@ * * File ..................: m_global.c * Purpose ...............: Global Setup Program - * Last modification date : 11-Aug-2001 + * Last modification date : 27-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -1633,12 +1633,6 @@ int PickAka(char *msg, int openit) } -char Co[16][16] = { - "Black", "Blue", "Green", "Cyan", - "Red", "Magenta", "Brown", "Lightgray", - "Darkgary", "Lightblue", "Lightgreen", "Lightcyan", - "Lightred", "Lightmagenta", "Yellow", "White" }; - int global_doc(FILE *fp, FILE *toc, int page) { @@ -1758,17 +1752,17 @@ int global_doc(FILE *fp, FILE *toc, int page) addtoc(fp, toc, 1, 7, page, (char *)"Text colors"); - fprintf(fp, " Normal text %s on %s\n", Co[CFG.TextColourF], Co[CFG.TextColourB]); - fprintf(fp, " Underline text %s on %s\n", Co[CFG.UnderlineColourF], Co[CFG.UnderlineColourB]); - fprintf(fp, " Input text %s on %s\n", Co[CFG.InputColourF], Co[CFG.InputColourB]); - fprintf(fp, " CR text %s on %s\n", Co[CFG.CRColourF], Co[CFG.CRColourB]); - fprintf(fp, " More prompt %s on %s\n", Co[CFG.MoreF], Co[CFG.MoreB]); - fprintf(fp, " Hilite text %s on %s\n", Co[CFG.HiliteF], Co[CFG.HiliteB]); - fprintf(fp, " File name %s on %s\n", Co[CFG.FilenameF], Co[CFG.FilenameB]); - fprintf(fp, " File size %s on %s\n", Co[CFG.FilesizeF], Co[CFG.FilesizeB]); - fprintf(fp, " File date %s on %s\n", Co[CFG.FiledateF], Co[CFG.FiledateB]); - fprintf(fp, " File description %s on %s\n", Co[CFG.FiledescF], Co[CFG.FiledescB]); - fprintf(fp, " Message input %s on %s\n", Co[CFG.MsgInputColourF], Co[CFG.MsgInputColourB]); + fprintf(fp, " Normal text %s on %s\n", get_color(CFG.TextColourF), get_color(CFG.TextColourB)); + fprintf(fp, " Underline text %s on %s\n", get_color(CFG.UnderlineColourF), get_color(CFG.UnderlineColourB)); + fprintf(fp, " Input text %s on %s\n", get_color(CFG.InputColourF), get_color(CFG.InputColourB)); + fprintf(fp, " CR text %s on %s\n", get_color(CFG.CRColourF), get_color(CFG.CRColourB)); + fprintf(fp, " More prompt %s on %s\n", get_color(CFG.MoreF), get_color(CFG.MoreB)); + fprintf(fp, " Hilite text %s on %s\n", get_color(CFG.HiliteF), get_color(CFG.HiliteB)); + fprintf(fp, " File name %s on %s\n", get_color(CFG.FilenameF), get_color(CFG.FilenameB)); + fprintf(fp, " File size %s on %s\n", get_color(CFG.FilesizeF), get_color(CFG.FilesizeB)); + fprintf(fp, " File date %s on %s\n", get_color(CFG.FiledateF), get_color(CFG.FiledateB)); + fprintf(fp, " File description %s on %s\n", get_color(CFG.FiledescF), get_color(CFG.FiledescB)); + fprintf(fp, " Message input %s on %s\n", get_color(CFG.MsgInputColourF), get_color(CFG.MsgInputColourB)); page = newpage(fp, page); addtoc(fp, toc, 1, 8, page, (char *)"Next user door"); diff --git a/mbsetup/m_menu.c b/mbsetup/m_menu.c index 41881592..79917f19 100644 --- a/mbsetup/m_menu.c +++ b/mbsetup/m_menu.c @@ -2,7 +2,7 @@ * * File ..................: mbsetup/m_menu.c * Purpose ...............: Edit BBS menus - * Last modification date : 27-May-2001 + * Last modification date : 26-Sep-2001 * ***************************************************************************** * Copyright (C) 1997-2001 @@ -96,8 +96,6 @@ char *select_menurec(int max) void Show_A_Menu(void); void Show_A_Menu(void) { - char *p; - clr_index(); set_color(WHITE, BLACK); mvprintw( 5, 2, "8.3. EDIT MENU ITEM"); @@ -105,50 +103,44 @@ void Show_A_Menu(void) mvprintw( 7, 2, "1. Sel. key"); mvprintw( 8, 2, "2. Type nr."); mvprintw( 9, 2, "3. Opt. data"); - mvprintw(10, 2, "4. Display"); - mvprintw(11, 2, "5. Security"); - mvprintw(12, 2, "6. Min. age"); - mvprintw(13, 2, "7. Max. lvl"); - mvprintw(14, 2, "8. Password"); - mvprintw(15, 2, "9. Credit"); - mvprintw(16, 2, "10. Colors"); - mvprintw(12,42, "11. Autoexec"); - mvprintw(13,42, "12. Menu open"); + mvprintw(11, 2, "4. Display"); + mvprintw(12, 2, "5. Security"); + mvprintw(13, 2, "6. Min. age"); + mvprintw(14, 2, "7. Max. lvl"); + mvprintw(15, 2, "8. Password"); + mvprintw(16, 2, "9. Credit"); + mvprintw(17, 2, "10. Lo-colors"); + mvprintw(18, 2, "11. Hi-colors"); + mvprintw(15,42, "12. Autoexec"); if (menus.MenuType == 7) { - mvprintw(14,42, "13. No door.sys"); - mvprintw(15,42, "14. Y2K style"); - mvprintw(16,42, "15. Use Comport"); + mvprintw(16,42, "13. No door.sys"); + mvprintw(17,42, "14. Y2K style"); + mvprintw(18,42, "15. Use Comport"); } set_color(WHITE, BLACK); show_str( 7,16, 1, menus.MenuKey); show_int( 8,16, menus.MenuType); show_str( 8, 26,29, menus.TypeDesc); show_str( 9,16,64, menus.OptionalData); - show_str(10,16,64, menus.Display); - show_sec(11,16, menus.MenuSecurity); - show_int(12,16, menus.Age); - show_int(13,16, menus.MaxSecurity); + show_str(10,16,64,(char *)"1234567890123456789012345678901234567890123456789012345678901234"); + show_str(11,16,64, menus.Display); + show_sec(12,16, menus.MenuSecurity); + show_int(13,16, menus.Age); + show_int(14,16, menus.MaxSecurity); if (strlen(menus.Password)) - show_str(14,16,14, (char *)"**************"); + show_str(15,16,14, (char *)"**************"); else - show_str(14,16,14, (char *)""); - show_int(15,16, menus.Credit); - S_COL(16,16, "Display color", menus.ForeGnd, menus.BackGnd) + show_str(15,16,14, (char *)""); + show_int(16,16, menus.Credit); + S_COL(17,16, "Normal display color", menus.ForeGnd, menus.BackGnd) + S_COL(18,16, "Bright display color", menus.HiForeGnd, menus.HiBackGnd) + set_color(WHITE, BLACK); - show_bool(12,58, menus.AutoExec); - if ((menus.OpenFrom == 0) && (menus.OpenTo == 0)) - show_str(13,58, 6, (char *)"Always"); - else { - p = calloc(40, sizeof(char)); - sprintf(p, "%02d:%02d - %02d:%02d", menus.OpenFrom / 60, menus.OpenFrom % 60, - menus.OpenTo / 60, menus.OpenTo % 60); - show_str(13, 58, 13, p); - free(p); - } + show_bool(15,58, menus.AutoExec); if (menus.MenuType == 7) { - show_bool(14,58, menus.NoDoorsys); - show_bool(15,58, menus.Y2Kdoorsys); - show_bool(16,58, menus.Comport); + show_bool(16,58, menus.NoDoorsys); + show_bool(17,58, menus.Y2Kdoorsys); + show_bool(18,58, menus.Comport); } } @@ -222,38 +214,41 @@ void Edit_A_Menu(void) for (;;) { switch(select_menu(15)) { - case 0: - return; + case 0: return; break; - case 1: E_UPS( 7,16, 1, menus.MenuKey, "The ^key^ to select this menu item") case 2: menus.MenuType = GetMenuType(); memset(&menus.TypeDesc, 0, sizeof(menus.TypeDesc)); if (menus.MenuType) strcpy(menus.TypeDesc, getmenutype(menus.MenuType)); + if (menus.MenuType == 21) + menus.AutoExec = TRUE; Show_A_Menu(); break; case 3: E_STR( 9,16,64, menus.OptionalData, "The ^optional data^ for this menu item") - case 4: E_STR(10,16,64, menus.Display, "The text to ^display^ for this menu") - case 5: E_SEC(11,16, menus.MenuSecurity, "7.3.5 MENU ACCESS SECURITY", Show_A_Menu) - case 6: E_INT(12,16, menus.Age, "The minimum ^Age^ to select this menu, 0 is don't care") - case 7: E_INT(13,16, menus.MaxSecurity, "The maximum ^Security level^ to access this menu") - case 8: E_STR(14,16,14, menus.Password, "The ^password^ to access this menu item") - case 9: E_INT(15,16, menus.Credit, "The ^credit cost^ for this menu item") - case 10:edit_color(&menus.ForeGnd, &menus.BackGnd, (char *)"Display color"); + case 4: E_STR(11,16,64, menus.Display, "The text to ^display^ for this menu") + case 5: E_SEC(12,16, menus.MenuSecurity, "7.3.5 MENU ACCESS SECURITY", Show_A_Menu) + case 6: E_INT(13,16, menus.Age, "The minimum ^Age^ to select this menu, 0 is don't care") + case 7: E_INT(14,16, menus.MaxSecurity, "The maximum ^Security level^ to access this menu") + case 8: E_STR(15,16,14, menus.Password, "The ^password^ to access this menu item") + case 9: E_INT(16,16, menus.Credit, "The ^credit cost^ for this menu item") + case 10:edit_color(&menus.ForeGnd, &menus.BackGnd, (char *)"normal"); Show_A_Menu(); break; - case 11:E_BOOL(12,58, menus.AutoExec, "Is this an ^Autoexecute^ menu item") + case 11:edit_color(&menus.HiForeGnd, &menus.HiBackGnd, (char *)"bright"); + Show_A_Menu(); + break; + case 12:E_BOOL(15,58, menus.AutoExec, "Is this an ^Autoexecute^ menu item") case 13:if (menus.MenuType == 7) { - E_BOOL(14,58, menus.NoDoorsys, "Suppress writing ^door.sys^ dropfile") + E_BOOL(16,58, menus.NoDoorsys, "Suppress writing ^door.sys^ dropfile") } else break; case 14:if (menus.MenuType == 7) { - E_BOOL(15,58, menus.Y2Kdoorsys, "Create ^door.sys^ with 4 digit yearnumbers") + E_BOOL(17,58, menus.Y2Kdoorsys, "Create ^door.sys^ with 4 digit yearnumbers") } else break; case 15:if (menus.MenuType == 7) { - E_BOOL(16,58, menus.Comport, "Write real ^COM port^ in door.sys for Vmodem patch") + E_BOOL(18,58, menus.Comport, "Write real ^COM port^ in door.sys for Vmodem patch") } else break; } @@ -306,7 +301,7 @@ void EditMenu(char *Name) offset = ((o + i) - 1) * sizeof(menus); fseek(tmp, offset, SEEK_SET); fread(&menus, sizeof(menus), 1, tmp); - if (menus.MenuType || menus.AutoExec) { + if (menus.MenuKey[0] || menus.AutoExec) { set_color(CYAN, BLACK); mvprintw(y, 5, "%3d. ", o + i); if (menus.AutoExec) { @@ -341,9 +336,10 @@ void EditMenu(char *Name) if ((fil = fopen(temp, "w+")) == NULL) { working(2, 0, 0); } else { + Syslog('+', "Updated menu %s", temp); fseek(tmp, 0, SEEK_SET); while (fread(&menus, sizeof(menus), 1, tmp) == 1) { - if (menus.MenuType || menus.AutoExec) + if (menus.MenuKey[0] || menus.AutoExec) fwrite(&menus, sizeof(menus), 1, fil); } fclose(fil); @@ -359,6 +355,8 @@ void EditMenu(char *Name) if (strncmp(pick, "A", 1) == 0) { working(1, 0, 0); memset(&menus, 0, sizeof(menus)); + menus.ForeGnd = LIGHTGRAY; + menus.HiForeGnd = WHITE; fseek(tmp, 0, SEEK_END); fwrite(&menus, sizeof(menus), 1, tmp); records++; @@ -573,6 +571,10 @@ int bbs_menu_doc(FILE *fp, FILE *toc, int page) fprintf(fp, " Maximum level %d\n", menus.MaxSecurity); fprintf(fp, " Password %s\n", menus.Password); fprintf(fp, " Credits %ld\n", menus.Credit); + fprintf(fp, " Lo-colors %s on %s\n", + get_color(menus.ForeGnd), get_color(menus.BackGnd)); + fprintf(fp, " Hi-colors %s on %s\n", + get_color(menus.HiForeGnd), get_color(menus.HiBackGnd)); if (menus.MenuType == 7) { fprintf(fp, " No door.sys %s\n", getboolean(menus.NoDoorsys)); fprintf(fp, " Y2K door.sys %s\n", getboolean(menus.Y2Kdoorsys));