Add Option to list new mail areas to menu option 201

This commit is contained in:
Scott Street 2002-12-12 05:05:02 +00:00
parent 78a226ef01
commit 01f7d384f4

View File

@ -1531,8 +1531,10 @@ void MsgArea_List(char *Option)
int iAreaCount = 6, Recno = 0; int iAreaCount = 6, Recno = 0;
int iOldArea = 0, iAreaNum = 0; int iOldArea = 0, iAreaNum = 0;
int iGotArea = FALSE; /* Flag to check if user typed in area */ int iGotArea = FALSE; /* Flag to check if user typed in area */
int iCheckNew = FALSE; /* Flag to check for new mail in area */
long offset; long offset;
char *temp; char *temp;
lastread LR;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
@ -1558,48 +1560,57 @@ void MsgArea_List(char *Option)
iAreaNum = (ftell(pAreas) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize); iAreaNum = (ftell(pAreas) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize);
/* /*
* If there are menu options, select area direct. * If there are menu options, parse them first
* 1. Check for New Messages in Area (only option that will continue to display list)
* 2. Increment Area, return
* 3. Decrement Area, return
* 4. Select area direct (via area number), return
*/ */
if (strlen(Option) != 0) { if (strlen(Option) != 0) {
if (strcmp(Option, "N") == 0) {
if (strcmp(Option, "M+") == 0) iCheckNew = TRUE;
while(TRUE) { } else {
iMsgAreaNumber++; if (strcmp(Option, "M+") == 0)
if (iMsgAreaNumber >= iAreaNum) while(TRUE) {
iMsgAreaNumber = 0; iMsgAreaNumber++;
if (iMsgAreaNumber >= iAreaNum)
offset = msgshdr.hdrsize + (iMsgAreaNumber * (msgshdr.recsize + msgshdr.syssize)); iMsgAreaNumber = 0;
if(fseek(pAreas, offset, 0) != 0) {
printf("Can't move pointer there."); offset = msgshdr.hdrsize + (iMsgAreaNumber * (msgshdr.recsize + msgshdr.syssize));
if(fseek(pAreas, offset, 0) != 0) {
printf("Can't move pointer there.");
}
fread(&msgs, msgshdr.recsize, 1, pAreas);
if ((Access(exitinfo.Security, msgs.RDSec)) && (msgs.Active) && (strlen(msgs.Password) == 0))
break;
} }
fread(&msgs, msgshdr.recsize, 1, pAreas); if (strcmp(Option, "M-") == 0)
if ((Access(exitinfo.Security, msgs.RDSec)) && (msgs.Active) && (strlen(msgs.Password) == 0)) while(TRUE) {
break; iMsgAreaNumber--;
} if (iMsgAreaNumber < 0)
iMsgAreaNumber = iAreaNum -1;
if (strcmp(Option, "M-") == 0)
while(TRUE) { offset = msgshdr.hdrsize + (iMsgAreaNumber * (msgshdr.recsize + msgshdr.syssize));
iMsgAreaNumber--; if(fseek(pAreas, offset, 0) != 0) {
if (iMsgAreaNumber < 0) printf("Can't move pointer there.");
iMsgAreaNumber = iAreaNum -1; }
offset = msgshdr.hdrsize + (iMsgAreaNumber * (msgshdr.recsize + msgshdr.syssize)); fread(&msgs, msgshdr.recsize, 1, pAreas);
if(fseek(pAreas, offset, 0) != 0) { if ((Access(exitinfo.Security, msgs.RDSec)) && (msgs.Active) && (strlen(msgs.Password) == 0))
printf("Can't move pointer there."); break;
} }
fread(&msgs, msgshdr.recsize, 1, pAreas);
if ((Access(exitinfo.Security, msgs.RDSec)) && (msgs.Active) && (strlen(msgs.Password) == 0)) SetMsgArea(iMsgAreaNumber);
break; Syslog('+', "Msg area %lu %s", iMsgAreaNumber, sMsgAreaDesc);
} free(temp);
SetMsgArea(iMsgAreaNumber); fclose(pAreas);
Syslog('+', "Msg area %lu %s", iMsgAreaNumber, sMsgAreaDesc); return;
free(temp); }
fclose(pAreas);
return;
} }
clear(); clear();
Enter(1); Enter(1);
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(231)); pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(231));
@ -1619,7 +1630,26 @@ void MsgArea_List(char *Option)
printf("%5d", Recno + 1); printf("%5d", Recno + 1);
colour(LIGHTBLUE, BLACK); colour(LIGHTBLUE, BLACK);
printf(" %c ", 46); /* Check for New Mail if N was put on option data */
if ( iCheckNew ) {
if(Msg_Open(msgs.Base)){
MsgBase.Highest = Msg_Highest();
LR.UserID = grecno;
if ( Msg_GetLastRead(&LR) != TRUE ){
LR.HighReadMsg = 0;
}
if (MsgBase.Highest > LR.HighReadMsg ) {
colour(YELLOW, BLACK);
printf(" %c ", 42 );
} else {
printf(" %c ", 46 );
}
} else {
printf(" %c ", 46 );
}
} else {
printf(" %c ", 46);
}
colour(CYAN, BLACK); colour(CYAN, BLACK);
printf("%-31s", msgs.Name); printf("%-31s", msgs.Name);