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:
After installing the binaries, start mbsetup, enter menu 1 and
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/bank.data.
@ -58,7 +59,7 @@ v0.37.01 14-Jan-2003.
global settings.
When moving a message area to area zero mbsetup doesn't crash
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.
mbsebbs:
@ -71,13 +72,19 @@ v0.37.01 14-Jan-2003.
as from name.
Removed timebank and nextuser doors.
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:
The English and Dutch templates are updated to show the new
nodes flow counters (html.nodes).
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

View File

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

2
TODO
View File

@ -111,6 +111,8 @@ mbfile:
N: Override timeout during virus scan when files are imported.
N: Add area sorting
mbmsg:
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

View File

@ -9,8 +9,8 @@
8 user.c filesub.c |Password:
9 user.c |Maximum login attempts have been exceeded ...
10 user.c |Either your NAME or PASSWORD is incorrect
11 .c |
12 .c |
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 |
14 .c |
15 .c |

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,8 +9,8 @@ SN|
|Password:
|El n£mero de errores permitidos se ha sobrepasado ...
|Tu nombre o tu PASSWORD son incorrectos
| Banco de mbsebbs
|Cuenta:
HR|Export to (H)ome or (R)ules directory:
|Message exported to rules directory as
|Tiempo en la cuenta :
|Bytes en la cuenta :
|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)
{
char *p;
int ShowMsg = TRUE;
char *p;
int ShowMsg = TRUE, z, homedir = TRUE;
LastNum = Num;
iLineCount = 7;
WhosDoingWhat(READ_POST);
Syslog('+', "Export msg %d in area #%d (%s)", Num, iMsgAreaNumber + 1, sMsgAreaDesc);
LastNum = Num;
iLineCount = 7;
WhosDoingWhat(READ_POST);
/*
* The area data is already set, so we can do the next things
*/
if (MsgBase.Total == 0) {
colour(WHITE, BLACK);
/* There are no messages in this area */
printf("\n%s\n\n", (char *) Language(205));
sleep(3);
return FALSE;
/*
* The sysop has a choice to export to the rules directory.
*/
if ((exitinfo.Security.level >= CFG.sysop_access) && strlen(msgs.Tag)) {
while (TRUE) {
Enter(2);
/* Export to (H)ome or (R)ules directory: */
pout(WHITE, RED, (char *) Language(11));
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;
}
}
}
if (!Msg_Open(sMsgAreaBase)) {
WriteError("Error open JAM base %s", sMsgAreaBase);
return FALSE;
}
Syslog('+', "Export msg %d in area #%d (%s) to %s directory", Num, iMsgAreaNumber + 1, sMsgAreaDesc, homedir?"Home":"Rules");
if (!Msg_ReadHeader(Num)) {
perror("");
colour(WHITE, BLACK);
printf("\n%s\n\n", (char *)Language(77));
Msg_Close();
sleep(3);
return FALSE;
}
/*
* The area data is already set, so we can do the next things
*/
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.Private) {
ShowMsg = FALSE;
if ((strcasecmp(exitinfo.sUserName, Msg.From) == 0) || (strcasecmp(exitinfo.sUserName, Msg.To) == 0))
ShowMsg = TRUE;
if (exitinfo.Security.level >= msgs.SYSec.level)
ShowMsg = TRUE;
}
if (!Msg_Open(sMsgAreaBase)) {
WriteError("Error open JAM base %s", sMsgAreaBase);
return FALSE;
}
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);
}
if (!Msg_ReadHeader(Num)) {
perror("");
colour(WHITE, BLACK);
/* Message doesn't exist */
printf("\n%s\n\n", (char *)Language(77));
Msg_Close();
sleep(3);
return FALSE;
}
/*
* Report the result.
*/
colour(CFG.TextColourF, CFG.TextColourB);
if (Msg.Private) {
ShowMsg = FALSE;
if ((strcasecmp(exitinfo.sUserName, Msg.From) == 0) || (strcasecmp(exitinfo.sUserName, Msg.To) == 0))
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));
colour(CFG.HiliteF, CFG.HiliteB);
printf("%d_%lu.msg\n\n", iMsgAreaNumber + 1, Num);
Pause();
return TRUE;
} else {
/* 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;
}