Fixed deleting messages, added menu item 206

This commit is contained in:
Michiel Broek 2003-02-20 21:06:46 +00:00
parent 6aacdea786
commit 827cbede63
12 changed files with 270 additions and 197 deletions

View File

@ -44,6 +44,7 @@ v0.37.01 14-Jan-2003.
Removed charset conversion/translation. Removed charset conversion/translation.
Added integer endian byteorder swapper, usefull for non-Intel Added integer endian byteorder swapper, usefull for non-Intel
hardware. hardware.
The poutCR function for the bbs never did send a newline.
mbtask: mbtask:
Arcmail for non-CM nodes and Txx nodes is now sent during the Arcmail for non-CM nodes and Txx nodes is now sent during the
@ -113,6 +114,10 @@ v0.37.01 14-Jan-2003.
Maybe removed a bug where the bbs sometimes crashed during Maybe removed a bug where the bbs sometimes crashed during
mail reading. mail reading.
Fixed some minor things to the door.sys file. Fixed some minor things to the door.sys file.
Normal users were allowed to delete messages of other users,
now only the writer or those with sysop access to the area are
allowed to delete messages.
Finally wrote Delete Message from the menu (menu 206).
examples: examples:
The English and Dutch templates are updated to show the new The English and Dutch templates are updated to show the new
@ -121,7 +126,8 @@ v0.37.01 14-Jan-2003.
functions. functions.
lang: lang:
Changed english and dutch language prompts 11, 12, 13 and 107. Changed english and dutch language prompts 11, 12, 13, 14 and
107.
Changed in other languages as well, but in English. Changed in other languages as well, but in English.

4
TODO
View File

@ -41,10 +41,6 @@ mbsebbs:
L: ChangeHandle, allow own unix name as handle. L: ChangeHandle, allow own unix name as handle.
N: Delete messages from the menu.
N: With delete message during reading there is no check.
newuser: newuser:
L: Allow handles to be the same as the unixname. L: Allow handles to be the same as the unixname.

View File

@ -12,7 +12,7 @@
</HEAD> </HEAD>
<BODY> <BODY>
<BLOCKQUOTE> <BLOCKQUOTE>
<DIV align=right><h5>Last update 08-Feb-2003</h5></DIV> <DIV align=right><h5>Last update 20-Feb-2003</h5></DIV>
<DIV align=center><h1>MBSE BBS Message Area Menus</h1></DIV> <DIV align=center><h1>MBSE BBS Message Area Menus</h1></DIV>
<hr> <hr>
@ -53,7 +53,7 @@
<P> <P>
<LI value="206"><strong>Delete a Message:</strong> This option will let the <LI value="206"><strong>Delete a Message:</strong> This option will let the
user delete a specific message. He must the the owner or recipient of that user delete a specific message. He must the the owner of that
message or have sysop rights in that area to be able to delete a message.<br> message or have sysop rights in that area to be able to delete a message.<br>
<strong>Optional data:</strong> None.<br> <strong>Optional data:</strong> None.<br>
<P> <P>

View File

@ -12,7 +12,7 @@
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 dispfile.c |No rules found for this area 13 dispfile.c |No rules found for this area
14 .c | 14 mail.c |You are not allowed to delete that message
15 .c | 15 .c |
16 .c | 16 .c |
17 .c | 17 .c |
@ -329,7 +329,7 @@
328 bbslist.c | Date of Entry : 328 bbslist.c | Date of Entry :
329 bbslist.c | Entry Name : 329 bbslist.c | Entry Name :
330 bbslist.c |Delete BBS 330 bbslist.c |Delete BBS
331 bbslist.c oneline.c |Please enter number to delete: 331 bbslist.c oneline.c mail.c |Please enter number to delete:
332 bbslist.c oneline.c |Record 332 bbslist.c oneline.c |Record
333 bbslist.c oneline.c |does not belong to you. 333 bbslist.c oneline.c |does not belong to you.
334 bbslist.c oneline.c |already marked for deletion 334 bbslist.c oneline.c |already marked for deletion

View File

@ -12,7 +12,7 @@ JN|Is Uw naam juist gespeld? [J/n]
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
|Geen regels gevonden voor dit gebied |Geen regels gevonden voor dit gebied
|Bytes op de rekening |Je mag dit bericht niet verwijderen
|Tijd gestort vandaag |Tijd gestort vandaag
|Bytes gestort vandaag |Bytes gestort vandaag
|Tijd opgenomen vandaag |Tijd opgenomen vandaag

View File

@ -12,7 +12,7 @@ YN|Did you spell your name correctly? [Y/n]
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
|No rules found for this area |No rules found for this area
|Bytes in account |You are not allowed to delete that message
|Time deposited today |Time deposited today
|Bytes deposited today |Bytes deposited today
|Time withdrawn today |Time withdrawn today

View File

@ -12,7 +12,7 @@ SN|
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
|No rules found for this area |No rules found for this area
|Bytes na cuenta : |You are not allowed to delete that message
|Tempo depositado hoxe : |Tempo depositado hoxe :
|Bytes depositados hoxe : |Bytes depositados hoxe :
|Tempo retirado hoxe : |Tempo retirado hoxe :

View File

@ -12,7 +12,7 @@ JN|Haben Sie Ihren Namen korrekt eingegeben? [J/n]
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
|No rules found for this area |No rules found for this area
|Kontostand Daten (KBytes) . . . . : |You are not allowed to delete that message
|Heute gesparte Zeit . . . . . . . : |Heute gesparte Zeit . . . . . . . :
|Heute gesparte KBytes . . . . . . : |Heute gesparte KBytes . . . . . . :
|Heute abgehobene Zeit . . . . . . : |Heute abgehobene Zeit . . . . . . :

View File

@ -12,7 +12,7 @@ SN|Hai scritto il tuo nome e cognome correttamente? [S/n]
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
|No rules found for this area |No rules found for this area
|Byte disponibili : |You are not allowed to delete that message
|Tempo depositato oggi: |Tempo depositato oggi:
|Byte depositati oggi : |Byte depositati oggi :
|Tempo prelevato oggi : |Tempo prelevato oggi :

View File

@ -12,7 +12,7 @@ SN|
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
|No rules found for this area |No rules found for this area
|Bytes en la cuenta : |You are not allowed to delete that message
|Tiempo depositado hoy : |Tiempo depositado hoy :
|Bytes depositados hoy : |Bytes depositados hoy :
|Tiempo retirado hoy : |Tiempo retirado hoy :

View File

@ -87,6 +87,7 @@ void poutCR(int fg, int bg, char *Str)
{ {
colour(fg, bg); colour(fg, bg);
fputs(Str, stdout); fputs(Str, stdout);
fprintf(stdout, "\n");
fflush(stdout); fflush(stdout);
} }

View File

@ -101,30 +101,30 @@ int IsMe(char *); /* Test if this is my userrecord */
*/ */
int LC(int Lines) int LC(int Lines)
{ {
int z; int z;
iLineCount += Lines; iLineCount += Lines;
if (iLineCount >= exitinfo.iScreenLen && iLineCount < 1000) { if (iLineCount >= exitinfo.iScreenLen && iLineCount < 1000) {
iLineCount = 1; iLineCount = 1;
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61)); pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
fflush(stdout); fflush(stdout);
alarm_on(); alarm_on();
z = toupper(Getone()); z = toupper(Getone());
if (z == Keystroke(61, 1)) { if (z == Keystroke(61, 1)) {
printf("\n"); printf("\n");
return(1); return(1);
}
if (z == Keystroke(61, 2))
iLineCount = 50000;
Blanker(strlen(Language(61)));
} }
return(0); if (z == Keystroke(61, 2))
iLineCount = 50000;
Blanker(strlen(Language(61)));
}
return(0);
} }
@ -135,14 +135,14 @@ int LC(int Lines)
int Post_Allowed(void); int Post_Allowed(void);
int Post_Allowed(void) int Post_Allowed(void)
{ {
if (msgs.MsgKinds == RONLY) { if (msgs.MsgKinds == RONLY) {
/* Message area is Readonly */ /* Message area is Readonly */
pout(LIGHTRED, BLACK, (char *) Language(437)); pout(LIGHTRED, BLACK, (char *) Language(437));
fflush(stdout); fflush(stdout);
sleep(3); sleep(3);
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
} }
@ -240,30 +240,30 @@ int Crash_Option(faddr *Dest)
int IsPrivate(void); int IsPrivate(void);
int IsPrivate(void) int IsPrivate(void)
{ {
int rc = FALSE; int rc = FALSE;
if (msgs.MsgKinds == BOTH) { if (msgs.MsgKinds == BOTH) {
Enter(1); Enter(1);
/* Private [y/N]: */ /* Private [y/N]: */
pout(CYAN, BLACK, (char *) Language(163)); pout(CYAN, BLACK, (char *) Language(163));
fflush(stdout); fflush(stdout);
alarm_on(); alarm_on();
if (toupper(Getone()) == Keystroke(163, 0)) { if (toupper(Getone()) == Keystroke(163, 0)) {
rc = TRUE; rc = TRUE;
printf("%c", Keystroke(163, 0)); printf("%c", Keystroke(163, 0));
} else { } else {
printf("%c", Keystroke(163, 1)); printf("%c", Keystroke(163, 1));
} }
fflush(stdout); fflush(stdout);
} }
/* /*
* Allways set the private flag in Private areas. * Allways set the private flag in Private areas.
*/ */
if (msgs.MsgKinds == PRIVATE) if (msgs.MsgKinds == PRIVATE)
rc = TRUE; rc = TRUE;
return rc; return rc;
} }
@ -1175,88 +1175,100 @@ void Read_Msgs()
*/ */
int ReadPanel() int ReadPanel()
{ {
int input; int input;
WhosDoingWhat(READ_POST); WhosDoingWhat(READ_POST);
colour(WHITE, RED); colour(WHITE, RED);
if (msgs.UsrDelete || exitinfo.Security.level >= CFG.sysop_access) { /*
/* (A)gain, (N)ext, (L)ast, (R)eply, (E)nter, (D)elete, (Q)uit, e(X)port */ * The writer of the message, sysops, and who has sysop rights to the message area
printf("%s", (char *) Language(214)); * are allowed to delete messages.
} else { */
/* (A)gain, (N)ext, (L)ast, (R)eply, (E)nter, (Q)uit, e(X)port */ if ((msgs.UsrDelete && IsMe(Msg.From)) || (exitinfo.Security.level >= CFG.sysop_access) ||
printf("%s", (char *) Language(215)); Access(exitinfo.Security, msgs.SYSec)) {
/* (A)gain, (N)ext, (L)ast, (R)eply, (E)nter, (D)elete, (Q)uit, e(X)port */
printf("%s", (char *) Language(214));
} else {
/* (A)gain, (N)ext, (L)ast, (R)eply, (E)nter, (Q)uit, e(X)port */
printf("%s", (char *) Language(215));
}
if ((exitinfo.Security.level >= CFG.sysop_access) || Access(exitinfo.Security, msgs.SYSec))
printf(", (!)");
printf(": ");
fflush(stdout);
alarm_on();
input = toupper(Getone());
if (input == '!') { /* ! Toggle kludges display */
if ((exitinfo.Security.level >= CFG.sysop_access) || Access(exitinfo.Security, msgs.SYSec)) {
if (Kludges)
Kludges = FALSE;
else
Kludges = TRUE;
} }
if (exitinfo.Security.level >= CFG.sysop_access) Read_a_Msg(LastNum, TRUE);
printf(", (!)");
printf(": "); } else if (input == Keystroke(214, 0)) { /* (A)gain */
Read_a_Msg(LastNum, TRUE);
fflush(stdout); } else if (input == Keystroke(214, 4)) { /* (P)ost */
alarm_on(); Post_Msg();
input = toupper(Getone()); Read_a_Msg(LastNum, TRUE);
if (input == '!') { } else if (input == Keystroke(214, 2)) { /* (L)ast */
if (exitinfo.Security.level >= CFG.sysop_access) { if (LastNum > MsgBase.Lowest)
if (Kludges) LastNum--;
Kludges = FALSE; Read_a_Msg(LastNum, TRUE);
else
Kludges = TRUE; } else if (input == Keystroke(214, 3)) { /* (R)eply */
} Reply_Msg(TRUE);
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 5)) { /* (Q)uit */
/* Quit */
printf("%s\n", (char *) Language(189));
return FALSE;
} else if (input == Keystroke(214, 7)) { /* e(X)port */
Export_a_Msg(LastNum);
Read_a_Msg(LastNum, TRUE);
} else if (input == '+') {
if (Msg.Reply)
LastNum = Msg.Reply;
Read_a_Msg(LastNum, TRUE);
} else if (input == '-') {
if (Msg.Original)
LastNum = Msg.Original;
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 6)) { /* (D)elete */
if ((msgs.UsrDelete && IsMe(Msg.From)) || (exitinfo.Security.level >= CFG.sysop_access) ||
Access(exitinfo.Security, msgs.SYSec)) {
Delete_MsgNum(LastNum);
if (LastNum < MsgBase.Highest) {
LastNum++;
Read_a_Msg(LastNum, TRUE); Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 0)) { /* (A)gain */ } else {
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 4)) { /* (P)ost */
Post_Msg();
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 2)) { /* (L)ast */
if (LastNum > MsgBase.Lowest)
LastNum--;
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 3)) { /* (R)eply */
Reply_Msg(TRUE);
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 5)) { /* (Q)uit */
/* Quit */
printf("%s\n", (char *) Language(189));
return FALSE; return FALSE;
}
} else if (input == Keystroke(214, 7)) { /* e(X)port */
Export_a_Msg(LastNum);
Read_a_Msg(LastNum, TRUE);
} else if (input == '+') {
if (Msg.Reply)
LastNum = Msg.Reply;
Read_a_Msg(LastNum, TRUE);
} else if (input == '-') {
if (Msg.Original)
LastNum = Msg.Original;
Read_a_Msg(LastNum, TRUE);
} else if (input == Keystroke(214, 6)) { /* (D)elete */
Delete_MsgNum(LastNum);
if (LastNum < MsgBase.Highest) {
LastNum++;
Read_a_Msg(LastNum, TRUE);
} else {
return FALSE;
}
} else { } else {
/* Next */ Read_a_Msg(LastNum, TRUE);
pout(WHITE, BLACK, (char *) Language(216));
if (LastNum < MsgBase.Highest)
LastNum++;
else
return FALSE;
Read_a_Msg(LastNum, TRUE);
} }
return TRUE;
} else {
/* Next */
pout(WHITE, BLACK, (char *) Language(216));
if (LastNum < MsgBase.Highest)
LastNum++;
else
return FALSE;
Read_a_Msg(LastNum, TRUE);
}
return TRUE;
} }
@ -1476,64 +1488,64 @@ int IsMe(char *Name)
void QuickScan_Msgs() void QuickScan_Msgs()
{ {
int FoundMsg = FALSE; int FoundMsg = FALSE;
long i; long i;
iLineCount = 2; iLineCount = 2;
WhosDoingWhat(READ_POST); WhosDoingWhat(READ_POST);
if (MsgBase.Total == 0) { if (MsgBase.Total == 0) {
Enter(1); Enter(1);
/* There are no messages in this area. */ /* There are no messages in this area. */
pout(WHITE, BLACK, (char *) Language(205)); pout(WHITE, BLACK, (char *) Language(205));
Enter(3); Enter(3);
sleep(3); sleep(3);
return; return;
} }
clear(); clear();
/* # From To Subject */ /* # From To Subject */
poutCR(YELLOW, BLUE, (char *) Language(220)); poutCR(YELLOW, BLUE, (char *) Language(220));
if (Msg_Open(sMsgAreaBase)) { if (Msg_Open(sMsgAreaBase)) {
for (i = MsgBase.Lowest; i <= MsgBase.Highest; i++) { for (i = MsgBase.Lowest; i <= MsgBase.Highest; i++) {
if (Msg_ReadHeader(i) && ((msgs.Type != NETMAIL) || if (Msg_ReadHeader(i) && ((msgs.Type != NETMAIL) ||
((msgs.Type == NETMAIL) && ((IsMe(Msg.From)) || (IsMe(Msg.To)))))) { ((msgs.Type == NETMAIL) && ((IsMe(Msg.From)) || (IsMe(Msg.To)))))) {
colour(WHITE, BLACK); colour(WHITE, BLACK);
printf("%-6lu", Msg.Id); printf("%-6lu", Msg.Id);
if (IsMe(Msg.From)) if (IsMe(Msg.From))
colour(LIGHTCYAN, BLACK); colour(LIGHTCYAN, BLACK);
else else
colour(CYAN, BLACK); colour(CYAN, BLACK);
printf("%s ", padleft(Msg.From, 20, ' ')); printf("%s ", padleft(Msg.From, 20, ' '));
if (IsMe(Msg.To)) if (IsMe(Msg.To))
colour(LIGHTGREEN, BLACK); colour(LIGHTGREEN, BLACK);
else else
colour(GREEN, BLACK); colour(GREEN, BLACK);
printf("%s ", padleft(Msg.To, 20, ' ')); printf("%s ", padleft(Msg.To, 20, ' '));
colour(MAGENTA, BLACK); colour(MAGENTA, BLACK);
printf("%s", padleft(Msg.Subject, 31, ' ')); printf("%s", padleft(Msg.Subject, 31, ' '));
printf("\n"); printf("\n");
FoundMsg = TRUE; FoundMsg = TRUE;
if (LC(1)) if (LC(1))
break; break;
} }
}
Msg_Close();
} }
Msg_Close();
}
if(!FoundMsg) { if (!FoundMsg) {
Enter(1); Enter(1);
/* There are no messages in this area. */ /* There are no messages in this area. */
pout(LIGHTGREEN, BLACK, (char *) Language(205)); pout(LIGHTGREEN, BLACK, (char *) Language(205));
Enter(2); Enter(2);
sleep(3); sleep(3);
} }
iLineCount = 2; iLineCount = 2;
Pause(); Pause();
} }
@ -1543,7 +1555,67 @@ void QuickScan_Msgs()
*/ */
void Delete_Msg() void Delete_Msg()
{ {
char *temp;
unsigned long Msgnum = 0L;
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; return;
}
colour(CFG.TextColourF, CFG.TextColourB);
/* Message area \"%s\" contains %lu messages. */
printf("\n%s\"%s\" %s%lu %s", (char *) Language(221), sMsgAreaDesc,
(char *) Language(222), MsgBase.Total, (char *) Language(223));
colour(WHITE, BLACK);
/* Please enter a message between */
printf("\n%s(%lu - %lu): ", (char *) Language(224), MsgBase.Lowest, MsgBase.Highest);
temp = calloc(81, sizeof(char));
colour(CFG.InputColourF, CFG.InputColourB);
GetstrC(temp, 10);
if ((strcmp(temp, "")) != 0)
Msgnum = atoi(temp);
free(temp);
if (!Msg_Open(sMsgAreaBase)) {
WriteError("Error open JAM base %s", sMsgAreaBase);
return;
}
if (!Msg_ReadHeader(Msgnum)) {
perror("");
colour(WHITE, BLACK);
/* Message doesn't exist */
printf("\n%s\n\n", (char *)Language(77));
Msg_Close();
sleep(3);
return;
}
Msg_Close();
/*
* Message does exist and a valid number is suplied, check and finally mark the message deleted.
*/
if ((msgs.UsrDelete && IsMe(Msg.From)) || (exitinfo.Security.level >= CFG.sysop_access) ||
Access(exitinfo.Security, msgs.SYSec)) {
Delete_MsgNum(Msgnum);
} else {
colour(LIGHTRED, BLACK);
printf("\n%s\n\n", (char *)Language(14));
}
sleep(3);
return;
} }
@ -1933,27 +2005,25 @@ void MsgArea_List(char *Option)
/*
* Function deletes a specified message.
*/
void Delete_MsgNum(unsigned long MsgNum) void Delete_MsgNum(unsigned long MsgNum)
{ {
int Result = FALSE; int Result = FALSE;
pout(LIGHTRED, BLACK, (char *) Language(230)); /* Deleting message */
pout(LIGHTRED, BLACK, (char *) Language(230));
if (Msg_Open(sMsgAreaBase)) { if (Msg_Open(sMsgAreaBase)) {
if (Msg_Lock(15L)) { if (Msg_Lock(15L)) {
Result = Msg_Delete(MsgNum); Result = Msg_Delete(MsgNum);
Msg_UnLock(); Msg_UnLock();
}
Msg_Close();
} }
Msg_Close();
}
if (Result) if (Result)
Syslog('+', "Deleted msg #%lu in Area #%d (%s)", MsgNum, iMsgAreaNumber, sMsgAreaDesc); Syslog('+', "Deleted msg #%lu in Area #%d (%s)", MsgNum, iMsgAreaNumber, sMsgAreaDesc);
else else
WriteError("ERROR delete msg #%lu in Area #%d (%s)", MsgNum, iMsgAreaNumber, sMsgAreaDesc); WriteError("ERROR delete msg #%lu in Area #%d (%s)", MsgNum, iMsgAreaNumber, sMsgAreaDesc);
} }