diff --git a/ChangeLog b/ChangeLog index aa643a01..68fa0bcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ v0.81.0 07-Oct-2005 There is no check anymore for a valid tty with network calls, instead a fake ttyinfo record is created. Modem/ISDN and console still need a valid configured tty. + Fixed a bug in the email menu that would let the current + mailbox disappear. mbnewusr: There is no check anymore for a valid tty with network calls, diff --git a/mbsebbs/dispfile.c b/mbsebbs/dispfile.c index aeb15d19..8334c09a 100644 --- a/mbsebbs/dispfile.c +++ b/mbsebbs/dispfile.c @@ -654,9 +654,9 @@ void ControlCodeK(int ch) break; case 'P': - snprintf(sDataFile, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox); + SetEmailArea(sMailbox); LR.UserID = grecno; - if (Msg_Open(sDataFile)) { + if (Msg_Open(sMailpath)) { if (Msg_GetLastRead(&LR) == TRUE) { if (LR.HighReadMsg > EmailBase.Highest) LR.HighReadMsg = EmailBase.Highest; diff --git a/mbsebbs/email.c b/mbsebbs/email.c index ead930bd..35bcb53d 100644 --- a/mbsebbs/email.c +++ b/mbsebbs/email.c @@ -1040,22 +1040,29 @@ void Choose_Mailbox(char *Option) void SetEmailArea(char *box) { - if (!exitinfo.Email) - return; + char *p; - snprintf(sMailpath, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, box); - snprintf(sMailbox, 21, "%s", box); + if (!exitinfo.Email) + return; - /* - * Get information from the message base - */ - if (Msg_Open(sMailpath)) { - EmailBase.Lowest = Msg_Lowest(); - EmailBase.Highest = Msg_Highest(); - EmailBase.Total = Msg_Number(); - Msg_Close(); - } else - WriteError("Error open JAM %s", sMailpath); + /* + * Use a temp variable because this function can be called line SetEmailArea(sMailbox) + */ + p = xstrcpy(box); + snprintf(sMailpath, PATH_MAX, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, p); + snprintf(sMailbox, 21, "%s", p); + free(p); + + /* + * Get information from the message base + */ + if (Msg_Open(sMailpath)) { + EmailBase.Lowest = Msg_Lowest(); + EmailBase.Highest = Msg_Highest(); + EmailBase.Total = Msg_Number(); + Msg_Close(); + } else + WriteError("Error open JAM %s", sMailpath); }