diff --git a/ChangeLog b/ChangeLog index 033d4a34..d92a24fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -66,6 +66,7 @@ v0.37.01 14-Jan-2003. anymore. Added new menu item 319, removed menu items 22 and 23. Added setup for rules directory. + Added setup for menu 221. Changed description of menu 103. mbsebbs: It will now refuse to up/download OLR packets when the system @@ -83,13 +84,19 @@ v0.37.01 14-Jan-2003. have the filename of the area tag. Normal users can only export to their private directory. Sysops: now you can start collecting area rules! + New menu 221, display arearules. This function tries to find + the arearules in the rules directory and if found displays + this to the user. examples: The English and Dutch templates are updated to show the new nodes flow counters (html.nodes). + English textfiles and menus are updated to show the new menu + functions. lang: - Changed english and dutch language prompts 11, 12 and 107. + Changed english and dutch language prompts 11, 12, 13 and 107. + Changed in other languages as well, but in English. v0.37.00 26-Dec-2002 - 14-Jan-2003 diff --git a/TODO b/TODO index f396cf17..4d92d559 100644 --- a/TODO +++ b/TODO @@ -28,8 +28,6 @@ mbsebbs: N: Display textfiles and archives. - N: Check for tagged files before logoff - L: Better word wrapping or paragraph justification in editor. L: E-mail downloads with e-mail verification. diff --git a/examples/menus-le.tar b/examples/menus-le.tar index 8c81b377..278282c9 100644 Binary files a/examples/menus-le.tar and b/examples/menus-le.tar differ diff --git a/examples/txtfiles-en.tar b/examples/txtfiles-en.tar index f6ab8588..78c2068f 100644 Binary files a/examples/txtfiles-en.tar and b/examples/txtfiles-en.tar differ diff --git a/lang/Language.xref b/lang/Language.xref index e42289a9..c8f446cb 100644 --- a/lang/Language.xref +++ b/lang/Language.xref @@ -11,7 +11,7 @@ 10 user.c |Either your NAME or PASSWORD is incorrect 11 mail.c email.c HR|Export to (H)ome or (R)ules directory: 12 mail.c email.c |Message exported to rules directory as -13 .c | +13 dispfile.c |No rules found for this area 14 .c | 15 .c | 16 .c | diff --git a/lang/dutch.txt b/lang/dutch.txt index 9ee95d7e..434259ec 100644 --- a/lang/dutch.txt +++ b/lang/dutch.txt @@ -11,7 +11,7 @@ JN|Is Uw naam juist gespeld? [J/n] |Of Uw NAAM of Uw WACHTWOORD is fout HR|Exporteer naar (H)ome of (R)egels directory: |Bericht geexporteerd naar rules directory als -|Tijd op de rekening +|Geen regels gevonden voor dit gebied |Bytes op de rekening |Tijd gestort vandaag |Bytes gestort vandaag diff --git a/lang/english.txt b/lang/english.txt index f32d8168..4aeb717d 100644 --- a/lang/english.txt +++ b/lang/english.txt @@ -11,7 +11,7 @@ YN|Did you spell your name correctly? [Y/n] |Either your NAME or PASSWORD is incorrect HR|Export to (H)ome or (R)ules directory: |Message exported to rules directory as -|Time in account +|No rules found for this area |Bytes in account |Time deposited today |Bytes deposited today diff --git a/lang/galego.txt b/lang/galego.txt index cb6e4a64..37bf221b 100644 --- a/lang/galego.txt +++ b/lang/galego.txt @@ -11,7 +11,7 @@ SN| |O teu nome ou a tua PASSWORD son incorrectos HR|Export to (H)ome or (R)ules directory: |Message exported to rules directory as -|Tempo na conta : +|No rules found for this area |Bytes na cuenta : |Tempo depositado hoxe : |Bytes depositados hoxe : diff --git a/lang/german.txt b/lang/german.txt index ed19a74f..5ced16b4 100644 --- a/lang/german.txt +++ b/lang/german.txt @@ -11,7 +11,7 @@ JN|Haben Sie Ihren Namen korrekt eingegeben? [J/n] |Entweder Ihr NAME oder Ihr PASSWORT wurden falsch eingegeben HR|Export to (H)ome or (R)ules directory: |Message exported to rules directory as -|Kontostand Zeit (min) . . . . . . : +|No rules found for this area |Kontostand Daten (KBytes) . . . . : |Heute gesparte Zeit . . . . . . . : |Heute gesparte KBytes . . . . . . : diff --git a/lang/italian.txt b/lang/italian.txt index 169cda79..24bf4764 100644 --- a/lang/italian.txt +++ b/lang/italian.txt @@ -11,7 +11,7 @@ SN|Hai scritto il tuo nome e cognome correttamente? [S/n] |Hai inserito un NOME o una PASSWORD errata HR|Export to (H)ome or (R)ules directory: |Message exported to rules directory as -|Tempo disponibile : +|No rules found for this area |Byte disponibili : |Tempo depositato oggi: |Byte depositati oggi : diff --git a/lang/spanish.txt b/lang/spanish.txt index 8f24bc93..96ebc6ff 100644 --- a/lang/spanish.txt +++ b/lang/spanish.txt @@ -11,7 +11,7 @@ SN| |Tu nombre o tu PASSWORD son incorrectos HR|Export to (H)ome or (R)ules directory: |Message exported to rules directory as -|Tiempo en la cuenta : +|No rules found for this area |Bytes en la cuenta : |Tiempo depositado hoy : |Bytes depositados hoy : diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index 7963c894..2d06a32d 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -174,7 +174,7 @@ mbnewusr.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/str input.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h input.h timeout.h language.h whoson.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h exitinfo.h whoson.h door.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mberrors.h input.h timeout.h exitinfo.h whoson.h door.h -dispfile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h +dispfile.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h input.h dispfile.h userlist.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h userlist.h language.h input.h timeout.h timestats.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h logentry.o: ../config.h ../lib/libs.h ../lib/memwatch.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h logentry.h diff --git a/mbsebbs/dispfile.c b/mbsebbs/dispfile.c index 52732f29..54ef80b1 100644 --- a/mbsebbs/dispfile.c +++ b/mbsebbs/dispfile.c @@ -48,6 +48,7 @@ #include "exitinfo.h" #include "mail.h" #include "email.h" +#include "input.h" #include "dispfile.h" @@ -85,6 +86,129 @@ int TotalUsers(void) +/* + * Function will display a aras rulefile to the user. + * Searches in rules directory first for a file with + * the full name of the area, then the fule name of the + * area with a .rul suffix, and finally for the first + * 8 characters of the areaname with a .rul suffix. + * The search is case insensitive. + * + * Menu 221. + */ +void DisplayRules(void) +{ + DIR *dp; + struct dirent *de; + int Found = FALSE; + char temp[128]; + + if ((dp = opendir(CFG.rulesdir)) == NULL) { + WriteError("$Can't open directory %s", CFG.rulesdir); + /* Can't open directory for listing: */ + printf("\n%s\n\n", (char *) Language(290)); + Pause(); + return; + } + + while ((de = readdir(dp))) { + if (de->d_name[0] != '.') { + strcpy(temp, msgs.Tag); + if (strcasecmp(de->d_name, temp) == 0) { + Found = TRUE; + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + break; + } + sprintf(temp, "%s.rul", temp); + if (strcasecmp(de->d_name, temp) == 0) { + Found = TRUE; + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + break; + } + memset(&temp, 0, sizeof(temp)); + strncpy(temp, msgs.Tag, 8); + sprintf(temp, "%s.rul", temp); + if (strcasecmp(de->d_name, temp) == 0) { + Found = TRUE; + sprintf(temp, "%s/%s", CFG.rulesdir, de->d_name); + break; + } + } + } + closedir(dp); + + if (Found) { + Syslog('+', "Display rules: %s", temp); + DisplayTextFile(temp); + } else { + Syslog('+', "Display rules for %s failed, not found", msgs.Tag); + Enter(1); + colour(LIGHTRED, BLACK); + /* No rules found for this area */ + printf("\n%s\n\n", (char *) Language(13)); + Pause(); + } +} + + + +/* + * Function will display a flat ascii textfile to the + * user without control codes. This is used to display + * area rules, but is also called from the menu function + * that will display a textfile or the contents of a archive. + */ +int DisplayTextFile(char *filename) +{ + FILE *fp; + char *buf; + int i, x, c, lc = 0; + + if ((fp = fopen(filename, "r")) == NULL) { + WriteError("$DisplayTextFile(%s) failed"); + return FALSE; + } + + buf = calloc(81, sizeof(char)); + clear(); + colour(CFG.TextColourF, CFG.TextColourB); + + while (fgets(buf, 79, fp)) { + i = strlen(buf); + + for (x = 0; x < i; x++) { + c = (*(buf + x)); + if (isprint(c)) + printf("%c", c); + } + + printf("\n"); + fflush(stdout); + lc++; + + if (lc == exitinfo.iScreenLen) { + Pause(); + lc = 0; + colour(CFG.TextColourF, CFG.TextColourB); + } + } + + fclose(fp); + free(buf); + + Enter(1); + /* Press ENTER to continue */ + language(LIGHTMAGENTA, BLACK, 436); + fflush(stdout); + fflush(stdin); + alarm_on(); + Getone(); + + return TRUE; +} + + + /* * Function will display textfile in either ansi or ascii and * display control codes if they exist. diff --git a/mbsebbs/dispfile.h b/mbsebbs/dispfile.h index 6f985282..6c04018f 100644 --- a/mbsebbs/dispfile.h +++ b/mbsebbs/dispfile.h @@ -1,8 +1,11 @@ -/* $Id$ */ - #ifndef _DISPLAYFILE_H #define _DISPLAYFILE_H +/* $Id$ */ + + +void DisplayRules(void); /* Display area rules */ +int DisplayTextFile(char *); /* Display a flat textfile */ int DisplayFile(char *); /* Display .ans/.asc textfile */ int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */ void ControlCodeF(int); /* Check Control Codes in File */ diff --git a/mbsebbs/file.c b/mbsebbs/file.c index 3d12226b..681fedda 100644 --- a/mbsebbs/file.c +++ b/mbsebbs/file.c @@ -2213,7 +2213,7 @@ void EditTaglist() /* - * View a file in the current area. + * View a file in the current area, menu 103. */ void ViewFile() { diff --git a/mbsebbs/menu.c b/mbsebbs/menu.c index 6d212967..648fb152 100644 --- a/mbsebbs/menu.c +++ b/mbsebbs/menu.c @@ -79,13 +79,13 @@ int MenuError; void InitMenu() { - int i; + int i; - for (i = 0; i < 50; i++) - memset(Menus[i], 0, 51); - MenuLevel = 0; - MenuError = 0; - sprintf(Menus[0], "%s", CFG.default_menu); + for (i = 0; i < 50; i++) + memset(Menus[i], 0, 51); + MenuLevel = 0; + MenuError = 0; + sprintf(Menus[0], "%s", CFG.default_menu); } @@ -252,20 +252,16 @@ void menu() void DoMenu(int Type) { - int Strlen, i, x; - char *DisplayF; - char *sPrompt; - char *sPromptBak; - char *temp; + int Strlen, i, x; + char *sPrompt, *sPromptBak, *temp; - DisplayF = calloc(81, sizeof(char)); - sPrompt = calloc(81, sizeof(char)); - sPromptBak = calloc(81, sizeof(char)); - temp = calloc(81, sizeof(char)); + sPrompt = calloc(81, sizeof(char)); + sPromptBak = calloc(81, sizeof(char)); + temp = calloc(81, sizeof(char)); - TimeCheck(); + TimeCheck(); - switch(Type) { + switch(Type) { case 0: /* Display Prompt Line Only */ break; @@ -277,16 +273,16 @@ void DoMenu(int Type) case 2: /* Gosub another menu */ if (MenuLevel < 49) { - MenuLevel++; - strncpy(Menus[MenuLevel], menus.OptionalData, 14); + MenuLevel++; + strncpy(Menus[MenuLevel], menus.OptionalData, 14); } else - Syslog('?', "More than 50 menu levels"); + Syslog('?', "More than 50 menu levels"); break; case 3: /* Return from gosub */ if (MenuLevel > 0) - MenuLevel--; + MenuLevel--; break; case 4: @@ -302,36 +298,33 @@ void DoMenu(int Type) case 6: /* Show menu prompt */ Strlen = strlen(menus.OptionalData); - for(x = 0; x < Strlen; x++) { - if( menus.OptionalData[x] == '~') { - strcat(sPrompt, sUserTimeleft); - } else { - sprintf(temp, "%c", menus.OptionalData[x]); - strcat(sPrompt, temp); - } + for (x = 0; x < Strlen; x++) { + if (menus.OptionalData[x] == '~') { + strcat(sPrompt, sUserTimeleft); + } else { + sprintf(temp, "%c", menus.OptionalData[x]); + strcat(sPrompt, temp); + } } strcpy(sPromptBak, sPrompt); strcpy(sPrompt, ""); Strlen = strlen(sPromptBak); - for(x = 0; x < Strlen; x++) { - if( *(sPromptBak + x) == '@') - strcat(sPrompt, sAreaDesc); - else - if ( *(sPromptBak + x) == '^') - strcat(sPrompt, sMsgAreaDesc); - else - if ( *(sPromptBak + x) == '#') - sprintf(sPrompt, "%s%s", sPrompt, (char *) GetLocalHM()); - - else { - sprintf(temp, "%c", *(sPromptBak + x)); - strcat(sPrompt, temp); - } + for (x = 0; x < Strlen; x++) { + if (*(sPromptBak + x) == '@') + strcat(sPrompt, sAreaDesc); + else if (*(sPromptBak + x) == '^') + strcat(sPrompt, sMsgAreaDesc); + else if (*(sPromptBak + x) == '#') + sprintf(sPrompt, "%s%s", sPrompt, (char *) GetLocalHM()); + else { + sprintf(temp, "%c", *(sPromptBak + x)); + strcat(sPrompt, temp); + } } if (menus.ForeGnd || menus.BackGnd) pout(menus.ForeGnd, menus.BackGnd, sPrompt); else - pout(15, 0, sPrompt); + pout(WHITE, BLACK, sPrompt); break; case 7: @@ -366,7 +359,6 @@ void DoMenu(int Type) case 13: /* terminate call */ - free(DisplayF); free(sPrompt); free(sPromptBak); free(temp); @@ -381,10 +373,10 @@ void DoMenu(int Type) case 15: /* print text to screen */ if (exitinfo.Security.level >= menus.MenuSecurity.level) { - for(i = 0; i < strlen(menus.OptionalData); i++) - if(*(menus.OptionalData + i) == '@') - *(menus.OptionalData + i) = '\n'; - printf("%s\n", menus.OptionalData); + for (i = 0; i < strlen(menus.OptionalData); i++) + if (*(menus.OptionalData + i) == '@') + *(menus.OptionalData + i) = '\n'; + printf("%s\n", menus.OptionalData); } break; @@ -576,6 +568,10 @@ void DoMenu(int Type) QuickScan_Email(); break; + case 221: + DisplayRules(); + break; + case 301: Chg_Protocol(); break; @@ -700,84 +696,79 @@ void DoMenu(int Type) Pause(); } - free(DisplayF); free(sPrompt); free(sPromptBak); free(temp); } -void DisplayMenu ( void ) { + - /* - * Display the Menu Display Text to the User, - * if the sysop puts a ';' (semicolon) at the end of the menu prompt, - * the CR/LR combination will not be sent - */ +/* + * Display the Menu Display Text to the User, + * if the sysop puts a ';' (semicolon) at the end of the menu prompt, + * the CR/LR combination will not be sent + */ +void DisplayMenu(void) +{ + int maxdpos, dpos, escaped, skipCRLF, highlight; - int maxdpos; - int dpos; - int escaped ; - int skipCRLF ; - int highlight ; + /* Anything to process, if not; save CPU time, return */ + if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) { + return; + } - /* Anything to process, if not; save CPU time, return */ - if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) { - return; - } - - /* Send Display string, formated with ANSI codes as required */ - /* --- basically this with brains: printf("%s\n", menus.Display); */ - maxdpos = strlen(menus.Display); - escaped = 0; - skipCRLF = 0; - highlight = 0; - - colour( menus.ForeGnd, menus.BackGnd ); - - for ( dpos = 0; dpos < maxdpos ; dpos++ ){ - - switch ( menus.Display[ dpos ] ) { - - case ';': /* Semicolon, if not escaped and last char, not CRLF at end of line */ - if ( ( dpos + 1 ) == maxdpos ) { - skipCRLF=1; - } else { - printf("%c",menus.Display[ dpos ]); - } - break; - - case '\\': if ( !escaped ) { - escaped = 1; - } else { - escaped = 0; - printf("%c",menus.Display[ dpos ]); - } - break; - - case '^': /* Highlight Toggle */ - - if ( !escaped ) { - if ( highlight == 0 ) { - highlight = 1; - colour( menus.HiForeGnd, menus.HiBackGnd); - } else { - highlight = 0 ; - colour( menus.ForeGnd, menus.BackGnd ); - } - } else { - escaped=0; - printf("%c",menus.Display[ dpos ]); - } - break; - - default: /* all other characters */ - printf("%c",menus.Display[ dpos ]); - } - - } - - if ( !skipCRLF ) { - printf("\n"); + /* Send Display string, formated with ANSI codes as required */ + /* --- basically this with brains: printf("%s\n", menus.Display); */ + maxdpos = strlen(menus.Display); + escaped = 0; + skipCRLF = 0; + highlight = 0; + + colour( menus.ForeGnd, menus.BackGnd ); + + for ( dpos = 0; dpos < maxdpos ; dpos++ ){ + switch ( menus.Display[ dpos ] ) { + case ';': /* Semicolon, if not escaped and last char, not CRLF at end of line */ + if ( ( dpos + 1 ) == maxdpos ) { + skipCRLF=1; + } else { + printf("%c",menus.Display[ dpos ]); + } + break; + + case '\\': if ( !escaped ) { + escaped = 1; + } else { + escaped = 0; + printf("%c",menus.Display[ dpos ]); + } + break; + + case '^': /* Highlight Toggle */ + + if ( !escaped ) { + if ( highlight == 0 ) { + highlight = 1; + colour( menus.HiForeGnd, menus.HiBackGnd); + } else { + highlight = 0 ; + colour( menus.ForeGnd, menus.BackGnd ); + } + } else { + escaped=0; + printf("%c",menus.Display[ dpos ]); + } + break; + + default: /* all other characters */ + printf("%c",menus.Display[ dpos ]); } + } + if ( !skipCRLF ) { + printf("\n"); + } } + + + diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index fb211805..3318ebf9 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -2091,7 +2091,7 @@ char *getmenutype(int val) case 101: return (char *)"Select new file area"; case 102: return (char *)"List files in current area"; - case 103: return (char *)"View a textfile"; + case 103: return (char *)"View file contents"; case 104: return (char *)"Download tagged files"; case 105: return (char *)"Raw directory listing"; case 106: return (char *)"Search file on keyword"; @@ -2129,6 +2129,7 @@ char *getmenutype(int val) case 218: return (char *)"Trash email"; case 219: return (char *)"Choose mailbox"; case 220: return (char *)"Quick-scan email's"; + case 221: return (char *)"Show area rules"; case 301: return (char *)"Change transfer protocol"; case 302: return (char *)"Change password"; diff --git a/mbsetup/m_menu.c b/mbsetup/m_menu.c index 7635f7fe..b27e9ac5 100644 --- a/mbsetup/m_menu.c +++ b/mbsetup/m_menu.c @@ -200,7 +200,7 @@ int GetMenuType(void) switch (select_menu(6)) { case 1: return GetSubmenu(1, 25); case 2: return GetSubmenu(101, 19); - case 3: return GetSubmenu(201, 20); + case 3: return GetSubmenu(201, 21); case 4: return GetSubmenu(301, 19); case 5: return GetSubmenu(401, 5); case 6: return GetSubmenu(501, 6);