Commit a42b1476 authored by rswindell's avatar rswindell
Browse files

Pass the sort order ("newest" or "oldest" first) as an arg when printing the

Mail.*LstHdr text strings.
parent 58d50222
......@@ -131,11 +131,12 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
else
act=NODE_RMAL;
action=act;
char* order = (lm_mode&LM_REVERSE) ? "newest" : "oldest";
if(smb.msgs>1 && which!=MAIL_ALL) {
if(which==MAIL_SENT)
bputs(text[MailSentLstHdr]);
bprintf(text[MailSentLstHdr], order);
else
bputs(text[MailWaitingLstHdr]);
bprintf(text[MailWaitingLstHdr], order);
for(smb.curmsg=0;smb.curmsg<smb.msgs && !msgabort();smb.curmsg++) {
if(msg.total_hfields)
......@@ -219,6 +220,7 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
if(smb.status.last_msg!=last || lm_mode != last_mode) { /* New messages */
last=smb.status.last_msg;
free(mail);
order = (lm_mode&LM_REVERSE) ? "newest" : "oldest";
mail=loadmail(&smb,&smb.msgs,usernumber,which,lm_mode); /* So re-load */
if(!smb.msgs)
break;
......@@ -582,11 +584,11 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
else
i=smb.curmsg;
if(which==MAIL_SENT)
bputs(text[MailSentLstHdr]);
bprintf(text[MailSentLstHdr], order);
else if(which==MAIL_ALL)
bputs(text[MailOnSystemLstHdr]);
bprintf(text[MailOnSystemLstHdr], order);
else
bputs(text[MailWaitingLstHdr]);
bprintf(text[MailWaitingLstHdr], order);
for(u=i;u<smb.msgs && !msgabort();u++) {
if(msg.total_hfields)
smb_freemsgmem(&msg);
......@@ -753,11 +755,11 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
v=smb.msgs;
if(which==MAIL_SENT)
bputs(text[MailSentLstHdr]);
bprintf(text[MailSentLstHdr], order);
else if(which==MAIL_ALL)
bputs(text[MailOnSystemLstHdr]);
bprintf(text[MailOnSystemLstHdr], order);
else
bputs(text[MailWaitingLstHdr]);
bprintf(text[MailWaitingLstHdr], order);
for(;u<v;u++) {
if(msg.total_hfields)
smb_freemsgmem(&msg);
......@@ -867,7 +869,7 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
bputs(text[SearchStringPrompt]);
if(!getstr(search_str,40,K_LINE|K_UPPER|K_EDIT|K_AUTODEL))
break;
searchmail(mail, (long)i64, smb.msgs, which, search_str);
searchmail(mail, (long)i64, smb.msgs, which, search_str, order);
break;
case '?':
menu(menu_file);
......@@ -903,7 +905,7 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
current_msg=NULL;
}
long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const char *search)
long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const char *search, const char* order)
{
char* buf;
char subj[128];
......@@ -928,11 +930,11 @@ long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const ch
if(strstr(buf,search) || strstr(subj,search)) {
if(!found) {
if(which==MAIL_SENT)
bputs(text[MailSentLstHdr]);
bprintf(text[MailSentLstHdr], order);
else if(which==MAIL_ALL)
bputs(text[MailOnSystemLstHdr]);
bprintf(text[MailOnSystemLstHdr], order);
else
bputs(text[MailWaitingLstHdr]);
bprintf(text[MailWaitingLstHdr], order);
}
if(which==MAIL_ALL)
bprintf(text[MailOnSystemLstFmt]
......
......@@ -683,7 +683,7 @@ public:
/* readmail.cpp */
void readmail(uint usernumber, int which, long lm_mode = 0);
bool readmail_inside;
long searchmail(mail_t*, long start, long msgss, int which, const char *search);
long searchmail(mail_t*, long start, long msgss, int which, const char *search, const char* order);
/* bulkmail.cpp */
bool bulkmail(uchar *ar);
......
......@@ -24,7 +24,7 @@ const char * const text_defaults[TOTAL_TEXT]={
"\xc4\xc4\xc4\xc4\xc4\xfa\xfa\xfa\xfa\xfa\xfa\x01\x6e" // 009 MsgDate
,"\x01\x5f\x0d\x0a\x01\x62\x01\x68\x45\x2d\x6d\x61\x69\x6c\x20\x28\x55\x73\x65\x72\x20\x6e\x61\x6d\x65\x20\x6f\x72\x20\x6e\x75\x6d"
"\x62\x65\x72\x29\x3a\x20\x01\x77" // 010 Email
,"\x0d\x0a\x50\x6f\x73\x74\x20\x6f\x6e\x20\x25\x73\x20\x25\x73" // 011 Post
,"\x0d\x0a\x50\x6f\x73\x74\x20\x6f\x6e\x20\x25\x73\x01\x5c\x20\x25\x73" // 011 Post
,"\x01\x72\x01\x68\x0d\x0a\x07\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x73\x65\x6e\x74\x20\x74\x6f\x6f\x20\x6d\x61\x6e\x79\x20\x45\x2d"
"\x6d\x61\x69\x6c\x73\x20\x74\x6f\x64\x61\x79\x2e\x0d\x0a" // 012 TooManyEmailsToday
,"\x01\x72\x01\x68\x0d\x0a\x07\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x70\x6f\x73\x74\x65\x64\x20\x74\x6f\x6f\x20\x6d\x61\x6e\x79\x20"
......@@ -78,7 +78,8 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x63\x61\x6e\x27\x74\x20\x77\x72\x69\x74\x65\x20\x74\x6f\x20\x74\x68\x65\x20\x61\x75\x74\x6f\x2d"
"\x6d\x65\x73\x73\x61\x67\x65\x2e\x0d\x0a" // 044 R_AutoMsg
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x6e\x6f\x20\x25\x73\x2e\x0d\x0a" // 045 NoMailWaiting
,"\x01\x5f\x0d\x0a\x01\x71\x01\x67\x01\x68\x4d\x61\x69\x6c\x20\x57\x61\x69\x74\x69\x6e\x67\x3a\x0d\x0a\x0d\x0a" // 046 MailWaitingLstHdr
,"\x01\x5f\x0d\x0a\x01\x71\x01\x67\x01\x68\x4d\x61\x69\x6c\x20\x57\x61\x69\x74\x69\x6e\x67\x20\x28\x25\x73\x20\x66\x69\x72\x73\x74"
"\x29\x3a\x0d\x0a\x0d\x0a" // 046 MailWaitingLstHdr
,"\x01\x67\x01\x68\x25\x34\x64\x20\x01\x6e\x01\x67\x25\x2d\x32\x35\x2e\x32\x35\x73\x20\x01\x68\x25\x63\x01\x6e\x01\x67\x20\x25\x2e"
"\x34\x36\x73\x0d\x0a" // 047 MailWaitingLstFmt
,"\x01\x5f\x0d\x0a\x01\x79\x01\x68\x53\x74\x61\x72\x74\x20\x77\x69\x74\x68\x20\x6e\x75\x6d\x62\x65\x72\x20\x5b\x01\x77\x25\x75\x01"
......@@ -104,7 +105,7 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x01\x6e\x0d\x0a\x59\x6f\x75\x20\x68\x61\x76\x65\x20\x6e\x6f\x20\x73\x65\x6e\x74\x20\x6d\x65\x73\x73\x61\x67\x65\x73\x20\x70\x65"
"\x6e\x64\x69\x6e\x67\x2e\x0d\x0a" // 059 NoMailSent
,"\x0d\x0a\x01\x71\x01\x67\x01\x68\x4d\x61\x69\x6c\x20\x74\x68\x61\x74\x20\x79\x6f\x75\x27\x76\x65\x20\x73\x65\x6e\x74\x20\x73\x74"
"\x69\x6c\x6c\x20\x70\x65\x6e\x64\x69\x6e\x67\x3a\x0d\x0a\x0d\x0a\x01\x6e" // 060 MailSentLstHdr
"\x69\x6c\x6c\x20\x70\x65\x6e\x64\x69\x6e\x67\x20\x28\x25\x73\x20\x66\x69\x72\x73\x74\x29\x3a\x0d\x0a\x0d\x0a\x01\x6e" // 060 MailSentLstHdr
,"\x01\x6e\x0d\x0a\x01\x63\xfe\x20\x01\x68\x01\x62\x52\x65\x61\x64\x69\x6e\x67\x20\x53\x65\x6e\x74\x20\x45\x2d\x6d\x61\x69\x6c\x20"
"\x01\x6e\x01\x63\xfe\x20\x01\x68\x01\x62\x28\x01\x77\x3f\x01\x62\x3d\x4d\x65\x6e\x75\x29\x20\x28\x01\x77\x25\x75\x01\x62\x20\x6f"
"\x66\x20\x01\x77\x25\x75\x01\x62\x29\x3a\x20\x01\x6e" // 061 ReadingSentMail
......@@ -331,11 +332,11 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x0d\x0a\x01\x72\x01\x68\x42\x61\x64\x20\x66\x69\x6c\x65\x6e\x61\x6d\x65\x2e\x0d\x0a" // 203 BadFilename
,"\x55\x70\x6c\x6f\x61\x64\x20\x27\x25\x73\x27\x20\x74\x6f\x20\x53\x79\x73\x6f\x70\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79" // 204 UploadToSysopDirQ
,"\x55\x70\x6c\x6f\x61\x64\x20\x27\x25\x73\x27\x20\x74\x6f\x20\x55\x73\x65\x72\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79" // 205 UploadToUserDirQ
,"\x55\x70\x6c\x6f\x61\x64\x20\x27\x25\x73\x27\x20\x74\x6f\x20\x25\x73\x20\x25\x73" // 206 UploadToCurDirQ
,"\x55\x70\x6c\x6f\x61\x64\x20\x27\x25\x73\x27\x20\x74\x6f\x20\x25\x73\x01\x5c\x20\x25\x73" // 206 UploadToCurDirQ
,"\x0d\x0a\x01\x72\x01\x68\x01\x69\x54\x68\x61\x74\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x74\x68\x65"
"\x72\x65\x21\x01\x6e\x0d\x0a" // 207 FileAlreadyThere
,"\x54\x68\x61\x74\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x6f\x6e\x20\x64\x69\x73\x6b\x2e\x20\x41\x64"
"\x64\x20\x74\x6f\x20\x64\x61\x74\x61\x20\x62\x61\x73\x65" // 208 FileOnDiskAddQ
,"\x54\x68\x61\x74\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x61\x6c\x72\x65\x61\x64\x79\x20\x6f\x6e\x20\x64\x69\x73\x6b\x2e\x01\x5c\x20"
"\x41\x64\x64\x20\x74\x6f\x20\x64\x61\x74\x61\x20\x62\x61\x73\x65" // 208 FileOnDiskAddQ
,"\x0d\x0a\x01\x72\x01\x68\x01\x69\x54\x68\x61\x74\x20\x66\x69\x6c\x65\x20\x69\x73\x20\x6e\x6f\x74\x20\x6f\x6e\x20\x64\x69\x73\x6b"
"\x21\x01\x6e\x0d\x0a" // 209 FileNotOnDisk
,"\x0d\x0a\x01\x72\x01\x68\x01\x69\x50\x6c\x65\x61\x73\x65\x20\x75\x70\x6c\x6f\x61\x64\x20\x66\x69\x6c\x65\x73\x20\x77\x69\x74\x68"
......@@ -358,8 +359,8 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x74\x20\x6f\x66\x20\x74\x68\x69\x73\x20\x66\x69\x6c\x65\x20\x28\x01\x68\x01\x77\x47\x01\x6e\x01\x67\x2c\x20\x01\x68\x01\x77\x52"
"\x01\x6e\x01\x67\x2c\x20\x6f\x72\x20\x01\x68\x01\x77\x58\x01\x6e\x01\x67\x29\x3a\x20\x01\x6e" // 218 RateThisFile
,"\x5b\x25\x63\x5d\x20" // 219 Rated
,"\x49\x73\x20\x74\x68\x69\x73\x20\x75\x70\x6c\x6f\x61\x64\x20\x70\x61\x72\x74\x20\x6f\x66\x20\x61\x20\x73\x65\x74\x20\x28\x6d\x75"
"\x6c\x74\x69\x70\x6c\x65\x20\x66\x69\x6c\x65\x73\x29" // 220 MultipleDiskQ
,"\x49\x73\x20\x74\x68\x69\x73\x20\x75\x70\x6c\x6f\x61\x64\x20\x70\x61\x72\x74\x20\x6f\x66\x20\x61\x20\x73\x65\x74\x01\x5c\x20\x28"
"\x6d\x75\x6c\x74\x69\x70\x6c\x65\x20\x66\x69\x6c\x65\x73\x29" // 220 MultipleDiskQ
,"\x01\x5f\x01\x79\x01\x68\x48\x6f\x77\x20\x6d\x61\x6e\x79\x20\x66\x69\x6c\x65\x73\x20\x74\x6f\x74\x61\x6c\x3a\x20\x01\x6e" // 221 HowManyDisksTotal
,"\x01\x5f\x01\x79\x01\x68\x57\x68\x69\x63\x68\x20\x66\x69\x6c\x65\x20\x6e\x75\x6d\x62\x65\x72\x20\x69\x73\x20\x79\x6f\x75\x72\x20"
"\x75\x70\x6c\x6f\x61\x64\x3a\x20\x01\x6e" // 222 NumberOfFile
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment