Commit a7a7b50a authored by rswindell's avatar rswindell
Browse files

Added a loadmail() mode flag: LM_REVERSE which, if used, will reverse the

normal (chronological) order of the returned mail indexes.
parent 02348512
......@@ -168,6 +168,17 @@ mail_t* DLLCALL loadmail(smb_t* smb, uint32_t* msgs, uint usernumber
}
smb_unlocksmbhdr(smb);
*msgs=l;
if(l && (mode&LM_REVERSE)) {
mail_t* reversed = malloc(sizeof(mail_t) * l);
if(reversed == NULL) {
free(mail);
return NULL;
}
for(ulong n = 0; n < l; n++)
reversed[n] = mail[l - (n + 1)];
free(mail);
mail = reversed;
}
return(mail);
}
......
......@@ -793,6 +793,7 @@ typedef enum { /* Values for xtrn_t.event */
#define LM_INCDEL (1<<1) /* Include deleted mail */
#define LM_NOSPAM (1<<2) /* Exclude SPAM */
#define LM_SPAMONLY (1<<3) /* Load SPAM only */
#define LM_REVERSE (1<<4) /* Reverse the index order (newest-first) */
enum { /* readmail and delmailidx which types */
MAIL_YOUR /* mail sent to you */
......
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