Implemented export of area rules in the bbs

This commit is contained in:
Michiel Broek 2003-02-03 20:20:23 +00:00
parent 0ff5071414
commit 17c46104de
11 changed files with 155 additions and 96 deletions

View File

@ -6,7 +6,8 @@ v0.37.01 14-Jan-2003.
upgrade: upgrade:
After installing the binaries, start mbsetup, enter menu 1 and After installing the binaries, start mbsetup, enter menu 1 and
leave that and save it. This will set the default rules leave that and save it. This will set the default rules
directory, will be used later. directory, here we will store the area rules of all echomail
areas.
After upgrade you may remove ~/etc/maptabs and it's contents. After upgrade you may remove ~/etc/maptabs and it's contents.
After upgrade you may remove ~/etc/bank.data. After upgrade you may remove ~/etc/bank.data.
@ -58,7 +59,7 @@ v0.37.01 14-Jan-2003.
global settings. global settings.
When moving a message area to area zero mbsetup doesn't crash When moving a message area to area zero mbsetup doesn't crash
anymore. anymore.
Added new menu item 319, remove 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.
mbsebbs: mbsebbs:
@ -71,13 +72,19 @@ v0.37.01 14-Jan-2003.
as from name. as from name.
Removed timebank and nextuser doors. Removed timebank and nextuser doors.
Added editing of user's signature file. New menu item 319. Added editing of user's signature file. New menu item 319.
If the sysop is exporting a echomail message he will have the
option to save to his private directory or to the rules
directory. If saved to the rules directory the message will
have the filename of the area tag. Normal users can only export
to their private directory. Sysops: now you can start
collecting area rules!
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).
lang: lang:
Changed english and dutch language prompts 107. Changed english and dutch language prompts 11, 12 and 107.
v0.37.00 26-Dec-2002 - 14-Jan-2003 v0.37.00 26-Dec-2002 - 14-Jan-2003

View File

@ -151,8 +151,8 @@ install:
@if [ ! -d ${PREFIX}/var/rules ]; then \ @if [ ! -d ${PREFIX}/var/rules ]; then \
mkdir ${PREFIX}/var/rules ; \ mkdir ${PREFIX}/var/rules ; \
${CHOWN} ${OWNER}:${GROUP} ${PREFIX}/var/rules ; \ ${CHOWN} ${OWNER}:${GROUP} ${PREFIX}/var/rules ; \
chmod 0750 ${PREFIX}/var/rules ; \
fi fi
chmod 0770 ${PREFIX}/var/rules
@if [ ! -d ${PREFIX}/var/unknown ] ; then \ @if [ ! -d ${PREFIX}/var/unknown ] ; then \
mkdir ${PREFIX}/var/unknown ; \ mkdir ${PREFIX}/var/unknown ; \
mkdir ${PREFIX}/var/inbound ; \ mkdir ${PREFIX}/var/inbound ; \

2
TODO
View File

@ -111,6 +111,8 @@ mbfile:
N: Override timeout during virus scan when files are imported. N: Override timeout during virus scan when files are imported.
N: Add area sorting
mbmsg: mbmsg:
N: With the post command if a netmail area is used the netmail area N: With the post command if a netmail area is used the netmail area
will cause trouble later, should be blocked to be used on netmail will cause trouble later, should be blocked to be used on netmail

View File

@ -9,8 +9,8 @@
8 user.c filesub.c |Password: 8 user.c filesub.c |Password:
9 user.c |Maximum login attempts have been exceeded ... 9 user.c |Maximum login attempts have been exceeded ...
10 user.c |Either your NAME or PASSWORD is incorrect 10 user.c |Either your NAME or PASSWORD is incorrect
11 .c | 11 mail.c email.c HR|Export to (H)ome or (R)ules directory:
12 .c | 12 mail.c email.c |Message exported to rules directory as
13 .c | 13 .c |
14 .c | 14 .c |
15 .c | 15 .c |

View File

@ -9,8 +9,8 @@ JN|Is Uw naam juist gespeld? [J/n]
|Wachtwoord: |Wachtwoord:
|Maximum aantal inlog pogingen overschreden ... |Maximum aantal inlog pogingen overschreden ...
|Of Uw NAAM of Uw WACHTWOORD is fout |Of Uw NAAM of Uw WACHTWOORD is fout
| MBSE BBS Systeem Bank HR|Exporteer naar (H)ome of (R)egels directory:
|Bank Rekening: |Bericht geexporteerd naar rules directory als
|Tijd op de rekening |Tijd op de rekening
|Bytes op de rekening |Bytes op de rekening
|Tijd gestort vandaag |Tijd gestort vandaag

View File

@ -9,8 +9,8 @@ YN|Did you spell your name correctly? [Y/n]
|Password: |Password:
|Maximum login attempts have been exceeded ... |Maximum login attempts have been exceeded ...
|Either your NAME or PASSWORD is incorrect |Either your NAME or PASSWORD is incorrect
| MBSE BBS System Bank HR|Export to (H)ome or (R)ules directory:
|Bank Account: |Message exported to rules directory as
|Time in account |Time in account
|Bytes in account |Bytes in account
|Time deposited today |Time deposited today

View File

@ -9,8 +9,8 @@ SN|
|Password: |Password:
|Sobrepasouse o n£mero m ximo de erros permitido... |Sobrepasouse o n£mero m ximo de erros permitido...
|O teu nome ou a tua PASSWORD son incorrectos |O teu nome ou a tua PASSWORD son incorrectos
| Banco de MBSE BBS HR|Export to (H)ome or (R)ules directory:
|Conta: |Message exported to rules directory as
|Tempo na conta : |Tempo na conta :
|Bytes na cuenta : |Bytes na cuenta :
|Tempo depositado hoxe : |Tempo depositado hoxe :

View File

@ -9,8 +9,8 @@ JN|Haben Sie Ihren Namen korrekt eingegeben? [J/n]
|Passwort: |Passwort:
|Die maximale Anzahl von Login-Versuchen wurde ueberschritten ... |Die maximale Anzahl von Login-Versuchen wurde ueberschritten ...
|Entweder Ihr NAME oder Ihr PASSWORT wurden falsch eingegeben |Entweder Ihr NAME oder Ihr PASSWORT wurden falsch eingegeben
| MBSE BBS System Bank HR|Export to (H)ome or (R)ules directory:
|Zeitbank Konto fuer: |Message exported to rules directory as
|Kontostand Zeit (min) . . . . . . : |Kontostand Zeit (min) . . . . . . :
|Kontostand Daten (KBytes) . . . . : |Kontostand Daten (KBytes) . . . . :
|Heute gesparte Zeit . . . . . . . : |Heute gesparte Zeit . . . . . . . :

View File

@ -9,8 +9,8 @@ SN|Hai scritto il tuo nome e cognome correttamente? [S/n]
|Password: |Password:
|Numero massimo di tentativi per il login raggiunto ... |Numero massimo di tentativi per il login raggiunto ...
|Hai inserito un NOME o una PASSWORD errata |Hai inserito un NOME o una PASSWORD errata
| MBSE BBS Banca di Sistema HR|Export to (H)ome or (R)ules directory:
|Account bancario di : |Message exported to rules directory as
|Tempo disponibile : |Tempo disponibile :
|Byte disponibili : |Byte disponibili :
|Tempo depositato oggi: |Tempo depositato oggi:

View File

@ -9,8 +9,8 @@ SN|
|Password: |Password:
|El n£mero de errores permitidos se ha sobrepasado ... |El n£mero de errores permitidos se ha sobrepasado ...
|Tu nombre o tu PASSWORD son incorrectos |Tu nombre o tu PASSWORD son incorrectos
| Banco de mbsebbs HR|Export to (H)ome or (R)ules directory:
|Cuenta: |Message exported to rules directory as
|Tiempo en la cuenta : |Tiempo en la cuenta :
|Bytes en la cuenta : |Bytes en la cuenta :
|Tiempo depositado hoy : |Tiempo depositado hoy :

View File

@ -807,98 +807,148 @@ void ShowMsgHdr()
/* /*
* Export a message to file in the users home directory. * Export a message to file in the users home directory or to the rules directory.
*/ */
int Export_a_Msg(unsigned long Num) int Export_a_Msg(unsigned long Num)
{ {
char *p; char *p;
int ShowMsg = TRUE; int ShowMsg = TRUE, z, homedir = TRUE;
LastNum = Num; LastNum = Num;
iLineCount = 7; iLineCount = 7;
WhosDoingWhat(READ_POST); WhosDoingWhat(READ_POST);
Syslog('+', "Export msg %d in area #%d (%s)", Num, iMsgAreaNumber + 1, sMsgAreaDesc);
/* /*
* The area data is already set, so we can do the next things * The sysop has a choice to export to the rules directory.
*/ */
if (MsgBase.Total == 0) { if ((exitinfo.Security.level >= CFG.sysop_access) && strlen(msgs.Tag)) {
colour(WHITE, BLACK); while (TRUE) {
/* There are no messages in this area */ Enter(2);
printf("\n%s\n\n", (char *) Language(205)); /* Export to (H)ome or (R)ules directory: */
sleep(3); pout(WHITE, RED, (char *) Language(11));
return FALSE; colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
fflush(stdout);
alarm_on();
z = toupper(Getone());
if (z == Keystroke(11, 0)) {
printf("%c", Keystroke(478, 0));
break;
}
if (z == Keystroke(11, 1)) {
printf("%c", Keystroke(478, 1));
homedir = FALSE;
break;
}
} }
}
Syslog('+', "Export msg %d in area #%d (%s) to %s directory", Num, iMsgAreaNumber + 1, sMsgAreaDesc, homedir?"Home":"Rules");
if (!Msg_Open(sMsgAreaBase)) { /*
WriteError("Error open JAM base %s", sMsgAreaBase); * The area data is already set, so we can do the next things
return FALSE; */
} if (MsgBase.Total == 0) {
colour(WHITE, BLACK);
/* There are no messages in this area */
printf("\n%s\n\n", (char *) Language(205));
Syslog('+', "No messages in area");
sleep(3);
return FALSE;
}
if (!Msg_ReadHeader(Num)) { if (!Msg_Open(sMsgAreaBase)) {
perror(""); WriteError("Error open JAM base %s", sMsgAreaBase);
colour(WHITE, BLACK); return FALSE;
printf("\n%s\n\n", (char *)Language(77)); }
Msg_Close();
sleep(3);
return FALSE;
}
if (Msg.Private) { if (!Msg_ReadHeader(Num)) {
ShowMsg = FALSE; perror("");
if ((strcasecmp(exitinfo.sUserName, Msg.From) == 0) || (strcasecmp(exitinfo.sUserName, Msg.To) == 0)) colour(WHITE, BLACK);
ShowMsg = TRUE; /* Message doesn't exist */
if (exitinfo.Security.level >= msgs.SYSec.level) printf("\n%s\n\n", (char *)Language(77));
ShowMsg = TRUE;
}
if (!ShowMsg) {
printf("\n%s\n\n", (char *) Language(82));
Msg_Close();
sleep(3);
return FALSE;
}
/*
* Export the message text to the file in the users home/wrk directory.
* Create the filename as <areanum>_<msgnum>.msg The message is
* written in M$DOS <cr/lf> format.
*/
p = calloc(128, sizeof(char));
sprintf(p, "%s/%s/wrk/%d_%lu.msg", CFG.bbs_usersdir, exitinfo.Name, iMsgAreaNumber + 1, Num);
if ((qf = fopen(p, "w")) != NULL) {
free(p);
p = NULL;
if (Msg_Read(Num, 80)) {
if ((p = (char *)MsgText_First()) != NULL)
do {
if ((p[0] == '\001') || (!strncmp(p, "SEEN-BY:", 8)) || (!strncmp(p, "AREA:", 5))) {
if (Kludges) {
if (p[0] == '\001') {
p[0] = 'a';
fprintf(qf, "^%s\r\n", p);
} else
fprintf(qf, "%s\r\n", p);
}
} else
fprintf(qf, "%s\r\n", p);
} while ((p = (char *)MsgText_Next()) != NULL);
}
fclose(qf);
} else {
WriteError("$Can't open %s", p);
}
Msg_Close(); Msg_Close();
sleep(3);
return FALSE;
}
/* if (Msg.Private) {
* Report the result. ShowMsg = FALSE;
*/ if ((strcasecmp(exitinfo.sUserName, Msg.From) == 0) || (strcasecmp(exitinfo.sUserName, Msg.To) == 0))
colour(CFG.TextColourF, CFG.TextColourB); ShowMsg = TRUE;
if (exitinfo.Security.level >= msgs.SYSec.level)
ShowMsg = TRUE;
}
if (!ShowMsg) {
/* Private message, not owner */
printf("\n%s\n\n", (char *) Language(82));
Msg_Close();
sleep(3);
return FALSE;
}
/*
* Export the message text to the file in the users home/wrk directory
* or to the rules directory.
* Create the filename as <areanum>_<msgnum>.msg if exported to the
* home directory, if exported to a rule directory the name is the area tag.
* The message is written in M$DOS <cr/lf> format.
*/
p = calloc(PATH_MAX, sizeof(char));
if (homedir)
sprintf(p, "%s/%s/wrk/%d_%lu.msg", CFG.bbs_usersdir, exitinfo.Name, iMsgAreaNumber + 1, Num);
else
sprintf(p, "%s/%s", CFG.rulesdir, msgs.Tag);
if ((qf = fopen(p, "w")) != NULL) {
free(p);
p = NULL;
if (Msg_Read(Num, 80)) {
if ((p = (char *)MsgText_First()) != NULL) {
do {
if ((p[0] == '\001') || (!strncmp(p, "SEEN-BY:", 8)) || (!strncmp(p, "AREA:", 5))) {
if (Kludges && homedir) {
if (p[0] == '\001') {
p[0] = 'a';
fprintf(qf, "^%s\r\n", p);
} else {
fprintf(qf, "%s\r\n", p);
}
}
} else {
if (homedir || (strncmp(p, "--- ", 4) && strncmp(p, " * Origin", 9))) {
/*
* In rules directory, don't write tearline and Origin line.
*/
fprintf(qf, "%s\r\n", p);
}
}
} while ((p = (char *)MsgText_Next()) != NULL);
}
}
fclose(qf);
} else {
WriteError("$Can't open %s", p);
}
Msg_Close();
/*
* Report the result.
*/
colour(CFG.TextColourF, CFG.TextColourB);
if (homedir) {
/* Message exported to your private directory as: */
printf("\n\n%s", (char *) Language(46)); printf("\n\n%s", (char *) Language(46));
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
printf("%d_%lu.msg\n\n", iMsgAreaNumber + 1, Num); printf("%d_%lu.msg\n\n", iMsgAreaNumber + 1, Num);
Pause(); } else {
return TRUE; /* Message exported to rules directory as */
printf("\n\n%s", (char *) Language(12));
colour(CFG.HiliteF, CFG.HiliteB);
printf("%s\n\n", msgs.Tag);
}
Pause();
return TRUE;
} }