Added bbs menu 221, display area rules

This commit is contained in:
Michiel Broek 2003-02-07 20:49:01 +00:00
parent c481073937
commit b968d11074
18 changed files with 258 additions and 134 deletions

View File

@ -66,6 +66,7 @@ v0.37.01 14-Jan-2003.
anymore. anymore.
Added new menu item 319, removed menu items 22 and 23. Added new menu item 319, removed menu items 22 and 23.
Added setup for rules directory. Added setup for rules directory.
Added setup for menu 221. Changed description of menu 103.
mbsebbs: mbsebbs:
It will now refuse to up/download OLR packets when the system 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 have the filename of the area tag. Normal users can only export
to their private directory. Sysops: now you can start to their private directory. Sysops: now you can start
collecting area rules! 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: examples:
The English and Dutch templates are updated to show the new The English and Dutch templates are updated to show the new
nodes flow counters (html.nodes). nodes flow counters (html.nodes).
English textfiles and menus are updated to show the new menu
functions.
lang: 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 v0.37.00 26-Dec-2002 - 14-Jan-2003

2
TODO
View File

@ -28,8 +28,6 @@ mbsebbs:
N: Display textfiles and archives. N: Display textfiles and archives.
N: Check for tagged files before logoff
L: Better word wrapping or paragraph justification in editor. L: Better word wrapping or paragraph justification in editor.
L: E-mail downloads with e-mail verification. L: E-mail downloads with e-mail verification.

Binary file not shown.

Binary file not shown.

View File

@ -11,7 +11,7 @@
10 user.c |Either your NAME or PASSWORD is incorrect 10 user.c |Either your NAME or PASSWORD is incorrect
11 mail.c email.c HR|Export to (H)ome or (R)ules directory: 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 12 mail.c email.c |Message exported to rules directory as
13 .c | 13 dispfile.c |No rules found for this area
14 .c | 14 .c |
15 .c | 15 .c |
16 .c | 16 .c |

View File

@ -11,7 +11,7 @@ JN|Is Uw naam juist gespeld? [J/n]
|Of Uw NAAM of Uw WACHTWOORD is fout |Of Uw NAAM of Uw WACHTWOORD is fout
HR|Exporteer naar (H)ome of (R)egels directory: HR|Exporteer naar (H)ome of (R)egels directory:
|Bericht geexporteerd naar rules directory als |Bericht geexporteerd naar rules directory als
|Tijd op de rekening |Geen regels gevonden voor dit gebied
|Bytes op de rekening |Bytes op de rekening
|Tijd gestort vandaag |Tijd gestort vandaag
|Bytes gestort vandaag |Bytes gestort vandaag

View File

@ -11,7 +11,7 @@ YN|Did you spell your name correctly? [Y/n]
|Either your NAME or PASSWORD is incorrect |Either your NAME or PASSWORD is incorrect
HR|Export to (H)ome or (R)ules directory: HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as |Message exported to rules directory as
|Time in account |No rules found for this area
|Bytes in account |Bytes in account
|Time deposited today |Time deposited today
|Bytes deposited today |Bytes deposited today

View File

@ -11,7 +11,7 @@ SN|
|O teu nome ou a tua PASSWORD son incorrectos |O teu nome ou a tua PASSWORD son incorrectos
HR|Export to (H)ome or (R)ules directory: HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as |Message exported to rules directory as
|Tempo na conta : |No rules found for this area
|Bytes na cuenta : |Bytes na cuenta :
|Tempo depositado hoxe : |Tempo depositado hoxe :
|Bytes depositados hoxe : |Bytes depositados hoxe :

View File

@ -11,7 +11,7 @@ JN|Haben Sie Ihren Namen korrekt eingegeben? [J/n]
|Entweder Ihr NAME oder Ihr PASSWORT wurden falsch eingegeben |Entweder Ihr NAME oder Ihr PASSWORT wurden falsch eingegeben
HR|Export to (H)ome or (R)ules directory: HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as |Message exported to rules directory as
|Kontostand Zeit (min) . . . . . . : |No rules found for this area
|Kontostand Daten (KBytes) . . . . : |Kontostand Daten (KBytes) . . . . :
|Heute gesparte Zeit . . . . . . . : |Heute gesparte Zeit . . . . . . . :
|Heute gesparte KBytes . . . . . . : |Heute gesparte KBytes . . . . . . :

View File

@ -11,7 +11,7 @@ SN|Hai scritto il tuo nome e cognome correttamente? [S/n]
|Hai inserito un NOME o una PASSWORD errata |Hai inserito un NOME o una PASSWORD errata
HR|Export to (H)ome or (R)ules directory: HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as |Message exported to rules directory as
|Tempo disponibile : |No rules found for this area
|Byte disponibili : |Byte disponibili :
|Tempo depositato oggi: |Tempo depositato oggi:
|Byte depositati oggi : |Byte depositati oggi :

View File

@ -11,7 +11,7 @@ SN|
|Tu nombre o tu PASSWORD son incorrectos |Tu nombre o tu PASSWORD son incorrectos
HR|Export to (H)ome or (R)ules directory: HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as |Message exported to rules directory as
|Tiempo en la cuenta : |No rules found for this area
|Bytes en la cuenta : |Bytes en la cuenta :
|Tiempo depositado hoy : |Tiempo depositado hoy :
|Bytes depositados hoy : |Bytes depositados hoy :

View File

@ -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 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 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 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 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 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 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

View File

@ -48,6 +48,7 @@
#include "exitinfo.h" #include "exitinfo.h"
#include "mail.h" #include "mail.h"
#include "email.h" #include "email.h"
#include "input.h"
#include "dispfile.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 * Function will display textfile in either ansi or ascii and
* display control codes if they exist. * display control codes if they exist.

View File

@ -1,8 +1,11 @@
/* $Id$ */
#ifndef _DISPLAYFILE_H #ifndef _DISPLAYFILE_H
#define _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 DisplayFile(char *); /* Display .ans/.asc textfile */
int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */ int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */
void ControlCodeF(int); /* Check Control Codes in File */ void ControlCodeF(int); /* Check Control Codes in File */

View File

@ -2213,7 +2213,7 @@ void EditTaglist()
/* /*
* View a file in the current area. * View a file in the current area, menu 103.
*/ */
void ViewFile() void ViewFile()
{ {

View File

@ -253,12 +253,8 @@ void menu()
void DoMenu(int Type) void DoMenu(int Type)
{ {
int Strlen, i, x; int Strlen, i, x;
char *DisplayF; char *sPrompt, *sPromptBak, *temp;
char *sPrompt;
char *sPromptBak;
char *temp;
DisplayF = calloc(81, sizeof(char));
sPrompt = calloc(81, sizeof(char)); sPrompt = calloc(81, sizeof(char));
sPromptBak = calloc(81, sizeof(char)); sPromptBak = calloc(81, sizeof(char));
temp = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char));
@ -302,8 +298,8 @@ void DoMenu(int Type)
case 6: case 6:
/* Show menu prompt */ /* Show menu prompt */
Strlen = strlen(menus.OptionalData); Strlen = strlen(menus.OptionalData);
for(x = 0; x < Strlen; x++) { for (x = 0; x < Strlen; x++) {
if( menus.OptionalData[x] == '~') { if (menus.OptionalData[x] == '~') {
strcat(sPrompt, sUserTimeleft); strcat(sPrompt, sUserTimeleft);
} else { } else {
sprintf(temp, "%c", menus.OptionalData[x]); sprintf(temp, "%c", menus.OptionalData[x]);
@ -313,16 +309,13 @@ void DoMenu(int Type)
strcpy(sPromptBak, sPrompt); strcpy(sPromptBak, sPrompt);
strcpy(sPrompt, ""); strcpy(sPrompt, "");
Strlen = strlen(sPromptBak); Strlen = strlen(sPromptBak);
for(x = 0; x < Strlen; x++) { for (x = 0; x < Strlen; x++) {
if( *(sPromptBak + x) == '@') if (*(sPromptBak + x) == '@')
strcat(sPrompt, sAreaDesc); strcat(sPrompt, sAreaDesc);
else else if (*(sPromptBak + x) == '^')
if ( *(sPromptBak + x) == '^')
strcat(sPrompt, sMsgAreaDesc); strcat(sPrompt, sMsgAreaDesc);
else else if (*(sPromptBak + x) == '#')
if ( *(sPromptBak + x) == '#')
sprintf(sPrompt, "%s%s", sPrompt, (char *) GetLocalHM()); sprintf(sPrompt, "%s%s", sPrompt, (char *) GetLocalHM());
else { else {
sprintf(temp, "%c", *(sPromptBak + x)); sprintf(temp, "%c", *(sPromptBak + x));
strcat(sPrompt, temp); strcat(sPrompt, temp);
@ -331,7 +324,7 @@ void DoMenu(int Type)
if (menus.ForeGnd || menus.BackGnd) if (menus.ForeGnd || menus.BackGnd)
pout(menus.ForeGnd, menus.BackGnd, sPrompt); pout(menus.ForeGnd, menus.BackGnd, sPrompt);
else else
pout(15, 0, sPrompt); pout(WHITE, BLACK, sPrompt);
break; break;
case 7: case 7:
@ -366,7 +359,6 @@ void DoMenu(int Type)
case 13: case 13:
/* terminate call */ /* terminate call */
free(DisplayF);
free(sPrompt); free(sPrompt);
free(sPromptBak); free(sPromptBak);
free(temp); free(temp);
@ -381,8 +373,8 @@ void DoMenu(int Type)
case 15: case 15:
/* print text to screen */ /* print text to screen */
if (exitinfo.Security.level >= menus.MenuSecurity.level) { if (exitinfo.Security.level >= menus.MenuSecurity.level) {
for(i = 0; i < strlen(menus.OptionalData); i++) for (i = 0; i < strlen(menus.OptionalData); i++)
if(*(menus.OptionalData + i) == '@') if (*(menus.OptionalData + i) == '@')
*(menus.OptionalData + i) = '\n'; *(menus.OptionalData + i) = '\n';
printf("%s\n", menus.OptionalData); printf("%s\n", menus.OptionalData);
} }
@ -576,6 +568,10 @@ void DoMenu(int Type)
QuickScan_Email(); QuickScan_Email();
break; break;
case 221:
DisplayRules();
break;
case 301: case 301:
Chg_Protocol(); Chg_Protocol();
break; break;
@ -700,25 +696,21 @@ void DoMenu(int Type)
Pause(); Pause();
} }
free(DisplayF);
free(sPrompt); free(sPrompt);
free(sPromptBak); free(sPromptBak);
free(temp); free(temp);
} }
void DisplayMenu ( void ) {
/*
/*
* Display the Menu Display Text to the User, * Display the Menu Display Text to the User,
* if the sysop puts a ';' (semicolon) at the end of the menu prompt, * if the sysop puts a ';' (semicolon) at the end of the menu prompt,
* the CR/LR combination will not be sent * the CR/LR combination will not be sent
*/ */
void DisplayMenu(void)
int maxdpos; {
int dpos; int maxdpos, dpos, escaped, skipCRLF, highlight;
int escaped ;
int skipCRLF ;
int highlight ;
/* Anything to process, if not; save CPU time, return */ /* Anything to process, if not; save CPU time, return */
if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) { if (( strlen( menus.Display ) == 0 ) && (menus.MenuType != 21)) {
@ -735,9 +727,7 @@ void DisplayMenu ( void ) {
colour( menus.ForeGnd, menus.BackGnd ); colour( menus.ForeGnd, menus.BackGnd );
for ( dpos = 0; dpos < maxdpos ; dpos++ ){ for ( dpos = 0; dpos < maxdpos ; dpos++ ){
switch ( menus.Display[ dpos ] ) { switch ( menus.Display[ dpos ] ) {
case ';': /* Semicolon, if not escaped and last char, not CRLF at end of line */ case ';': /* Semicolon, if not escaped and last char, not CRLF at end of line */
if ( ( dpos + 1 ) == maxdpos ) { if ( ( dpos + 1 ) == maxdpos ) {
skipCRLF=1; skipCRLF=1;
@ -773,11 +763,12 @@ void DisplayMenu ( void ) {
default: /* all other characters */ default: /* all other characters */
printf("%c",menus.Display[ dpos ]); printf("%c",menus.Display[ dpos ]);
} }
} }
if ( !skipCRLF ) { if ( !skipCRLF ) {
printf("\n"); printf("\n");
} }
} }

View File

@ -2091,7 +2091,7 @@ char *getmenutype(int val)
case 101: return (char *)"Select new file area"; case 101: return (char *)"Select new file area";
case 102: return (char *)"List files in current 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 104: return (char *)"Download tagged files";
case 105: return (char *)"Raw directory listing"; case 105: return (char *)"Raw directory listing";
case 106: return (char *)"Search file on keyword"; case 106: return (char *)"Search file on keyword";
@ -2129,6 +2129,7 @@ char *getmenutype(int val)
case 218: return (char *)"Trash email"; case 218: return (char *)"Trash email";
case 219: return (char *)"Choose mailbox"; case 219: return (char *)"Choose mailbox";
case 220: return (char *)"Quick-scan email's"; case 220: return (char *)"Quick-scan email's";
case 221: return (char *)"Show area rules";
case 301: return (char *)"Change transfer protocol"; case 301: return (char *)"Change transfer protocol";
case 302: return (char *)"Change password"; case 302: return (char *)"Change password";

View File

@ -200,7 +200,7 @@ int GetMenuType(void)
switch (select_menu(6)) { switch (select_menu(6)) {
case 1: return GetSubmenu(1, 25); case 1: return GetSubmenu(1, 25);
case 2: return GetSubmenu(101, 19); 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 4: return GetSubmenu(301, 19);
case 5: return GetSubmenu(401, 5); case 5: return GetSubmenu(401, 5);
case 6: return GetSubmenu(501, 6); case 6: return GetSubmenu(501, 6);