From b968d1107470b53014aa6c4f1435eca52fee6fed Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 7 Feb 2003 20:49:01 +0000 Subject: [PATCH] Added bbs menu 221, display area rules --- ChangeLog | 9 +- TODO | 2 - examples/menus-le.tar | Bin 61440 -> 61440 bytes examples/txtfiles-en.tar | Bin 92160 -> 92160 bytes lang/Language.xref | 2 +- lang/dutch.txt | 2 +- lang/english.txt | 2 +- lang/galego.txt | 2 +- lang/german.txt | 2 +- lang/italian.txt | 2 +- lang/spanish.txt | 2 +- mbsebbs/Makefile | 2 +- mbsebbs/dispfile.c | 124 +++++++++++++++++++++ mbsebbs/dispfile.h | 7 +- mbsebbs/file.c | 2 +- mbsebbs/menu.c | 227 +++++++++++++++++++-------------------- mbsetup/ledit.c | 3 +- mbsetup/m_menu.c | 2 +- 18 files changed, 258 insertions(+), 134 deletions(-) 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 8c81b377acfc33e9736eb970fbd28f7164fb202e..278282c9a0eda2703ffe4b1bc36268c57d8d2982 100644 GIT binary patch delta 439 zcmZp8z})bFc|sAV5rY8`7@C+(td?UjXHYPh{E<6lGb3XmFG6Z^HJ==d30#gJRZd2h z)yNnwDO<>itWiyt)es@6UMPqxX@P8`WuYjtoSz(vDcn&1LVjeqI9XO>grV`M&dHHw zH9<(`7P2GjEJ5~1X`!Gt-232Q00xAiu`y80+|0<(z`)qp*qi|=oF2!%U5F(k!Haom@Q&7(xbc&&);*gf&3V U7{Mji7D^+#_XKh%ocyl>0NKKJssI20 delta 417 zcmZp8z})bFc|sAVF@pgR7#kW*td?UjW>7Gg{E<6lGb3XmFG6Z^HJ==d0bGtBRZd2h z)zBO+DO<>itWiyt)c_%>UMPqxX@P8`WuYjtoSz(vA>2^^LVjeqI9XOBgrV`M&dHHw zHAYD07P2GjEJ5~1X`!Gt-232QFfcGQFgG?~FfcbW0eqeS109=V}&Hw-a diff --git a/examples/txtfiles-en.tar b/examples/txtfiles-en.tar index f6ab85880ceeeabeb63b3ae07e401a00f8e1e8f9..78c2068f1adcae2d2b0502c0a563f2dc89b71955 100644 GIT binary patch delta 1651 zcmZvcPe@cz6vpQ=@6I%qGdO}7_y!jl)okvaKkqI|(Aw3mHVO$1%s@dH@8PW8MrxM` z>Qe@4lTZsc1!+7eh=SVGW`f+96x60R1qB6#*;SZ(&nLd^kMFzZeD9ny-R9G6J{M$4 z386n(@#e#VQ%MYpX!%fml`)@N6oo05m&yjF{Un85F88E?2N7neYYthy;CM#Yi!b)O zTv^j2C>(IPEE%Qir)fDyHMGhhv^`mHszz8uCMc80Jm^s&JnizbFs{Q0&lDVG*jX&~ z95i_z;RRaGMKm3wY#hV6MA-zg%Q_odX$@grS7TuV;T77(Rjg)`{^RS&rgS!Ta+-cO z{Z%(~ITqf;{%`4-v;T1hZRY^aW37ucfh82)rtA)~yAZ%Kn%<+r`+l-$HfMK(c9uwa zA|aGll0uYaRVIX#g2cV@%!y`C4W)ucEofegYEIw6gJ2(0t^yAAI#_W1;2e~R!q%;XCU;Ux{>6$)QNdT$W6sqihDzH_+_ zt8;nQQMlpqiXD;nsQf?&?<2BL^tgOR(=U{LMfMHa_>QJO=ob7$_6v6FH^M*k#lOh@ zQPXWdV>hG~9$>^ZW*NB4tuV`M0x`=mYTOF*T5QgC%zF3WJ~oi5icaz|JIwqZ`u1@x f_c~`bW+xb3-d5=8w>wiAGsUp*5vXjGZ6Es&8AY9O delta 1626 zcmZvcPe@cz6vjQwyXyEC9heGygJ6Y!Hut_a^WG*QYgao%NGM29$W8G?S8pS>%gyL0 z1GY)Xg_~MvJTMT0+SFzQ-BcLpMmGfs3I*9kn0wC`&gwBgzVCkL+;i@9MNC&jaU$*4 zNd5DbHy7s|S<@*?%T1$eM3Jzl6xX^!g$C9|DGnQ4Q79PLh_HpbwjyiKIiAsF@Wjim z2(0N96n3~m21e;dbv({h4XyGT+Vw{nhe*lmn@ z2a3FlaFEBjho<*A8^-25;Orr?N4hsQ=?KD6oyNj3gpYX{jz%zM-+a7CVfU&;lgb+-El?UX5B^M7gzXp6278xkI&b4 zWc&OLIY84x&W@1%fHHof=`TL)$H-1#g-#Lv<|qC^_LrNUMQOVT<+z@hYeH#we#>zS z*$yPsO5C^{w`;L^ofFFZhqKgCn-8md_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);