64 const struct Email *ea = *(
struct Email const *
const *) a;
65 const struct Email *eb = *(
struct Email const *
const *) b;
76 return reverse ? -result : result;
85 return reverse ? -result : result;
94 return reverse ? -result : result;
119 return reverse ? -rc : rc;
155 char fa[128] = { 0 };
160 return reverse ? -result : result;
168 char fa[128] = { 0 };
173 return reverse ? -result : result;
182 return reverse ? -result : result;
191 return reverse ? -result : result;
199 char *aptr = NULL, *bptr = NULL;
211 return reverse ? -1 : 1;
213 return reverse ? 1 : -1;
225 result = ((difference < 0.0) ? -1 : (difference > 0.0) ? 1 : 0);
232 return reverse ? -result : result;
240 return reverse ? -result : result;
248 int ahas, bhas, result = 0;
258 return reverse ? 1 : -1;
260 return reverse ? -1 : 1;
268 return reverse ? -result : result;
305 mutt_error(
_(
"Could not find sorting function [report this bug]"));
338 rc = func(a, b,
false);
const char * mutt_addr_for_display(const struct Address *a)
Convert an Address for display purposes.
struct Address * alias_reverse_lookup(const struct Address *addr)
Does the user have an alias for the given address.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
Structs that make up an email.
bool OptNeedRescore
(pseudo) set when the 'score' command is used
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
bool OptNeedResort
(pseudo) used to force a re-sort
#define mutt_message(...)
static int compare_email_shim(const void *a, const void *b, void *sdata)
Helper to sort emails - Implements sort_t -.
int mutt_compare_emails(const struct Email *a, const struct Email *b, enum MailboxType type, short sort, short sort_aux)
Compare two emails using up to two sort methods -.
static int compare_to(const struct Email *a, const struct Email *b, bool reverse)
Compare the 'to' fields of two emails - Implements sort_mail_t -.
int nntp_compare_order(const struct Email *a, const struct Email *b, bool reverse)
Restore the 'unsorted' order of emails - Implements sort_mail_t -.
static int compare_label(const struct Email *a, const struct Email *b, bool reverse)
Compare the labels of two emails - Implements sort_mail_t -.
static int compare_spam(const struct Email *a, const struct Email *b, bool reverse)
Compare the spam values of two emails - Implements sort_mail_t -.
static int compare_order(const struct Email *a, const struct Email *b, bool reverse)
Restore the 'unsorted' order of emails - Implements sort_mail_t -.
static int compare_date_sent(const struct Email *a, const struct Email *b, bool reverse)
Compare the sent date of two emails - Implements sort_mail_t -.
static int compare_subject(const struct Email *a, const struct Email *b, bool reverse)
Compare the subject of two emails - Implements sort_mail_t -.
static int compare_score(const struct Email *a, const struct Email *b, bool reverse)
Compare two emails using their scores - Implements sort_mail_t -.
static int compare_from(const struct Email *a, const struct Email *b, bool reverse)
Compare the 'from' fields of two emails - Implements sort_mail_t -.
static int compare_size(const struct Email *a, const struct Email *b, bool reverse)
Compare the size of two emails - Implements sort_mail_t -.
static int compare_date_received(const struct Email *a, const struct Email *b, bool reverse)
Compare the date received of two emails - Implements sort_mail_t -.
MailboxType
Supported mailbox formats.
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Convenience wrapper for the library headers.
int mutt_str_cmp(const char *a, const char *b)
Compare two strings, safely.
int mutt_istrn_cmp(const char *a, const char *b, size_t num)
Compare two strings ignoring case (to a maximum), safely.
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void mutt_clear_threads(struct ThreadsContext *tctx)
Clear the threading of message in a mailbox.
void mutt_thread_collapse_collapsed(struct ThreadsContext *tctx)
Re-collapse threads marked as collapsed.
void mutt_sort_threads(struct ThreadsContext *tctx, bool init)
Sort email threads.
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Create/manipulate threading in emails.
#define mutt_using_threads()
enum MailboxType mx_type(struct Mailbox *m)
Return the type of the Mailbox.
Usenet network mailbox type; talk to an NNTP server.
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
#define TAILQ_FIRST(head)
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Routines for adding user scores to emails.
#define SORT_MASK
Mask for the sort id.
SortType
Methods for sorting.
@ SORT_SUBJECT
Sort by the email's subject.
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
@ SORT_SPAM
Sort by the email's spam score.
@ SORT_LABEL
Sort by the emails label.
@ SORT_FROM
Sort by the email's From field.
@ SORT_SIZE
Sort by the size of the email.
@ SORT_RECEIVED
Sort by when the message were delivered locally.
@ SORT_TO
Sort by the email's To field.
@ SORT_DATE
Sort by the date the email was sent.
@ SORT_SCORE
Sort by the email's score.
#define SORT_REVERSE
Reverse the order of the sort.
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
static sort_mail_t get_sort_func(enum SortType method, enum MailboxType type)
Get the sort function for a given sort id.
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Assorted sorting methods.
int(* sort_mail_t)(const struct Email *a, const struct Email *b, bool reverse)
#define mutt_numeric_cmp(a, b)
struct Buffer * personal
Real name of address.
struct Buffer * mailbox
Mailbox and host address.
LOFF_T length
length (in bytes) of attachment
char * data
Pointer to data.
Context for compare_email_shim()
short sort_aux
Secondary sort.
enum MailboxType type
Current mailbox type.
The envelope/body of an email.
bool visible
Is this message part of the view?
struct Envelope * env
Envelope information.
bool collapsed
Is this message part of a collapsed thread?
struct Body * body
List of MIME parts.
bool threaded
Used for threading.
time_t date_sent
Time when the message was sent (UTC)
int vnum
Virtual message number.
int msgno
Number displayed to the user.
int index
The absolute (unsorted) message number.
time_t received
Time when the message was placed in the mailbox.
struct AddressList to
Email's 'To' list.
struct Buffer spam
Spam header.
char * real_subj
Offset of the real subject.
struct AddressList from
Email's 'From' list.
off_t vsize
Size (in bytes) of the messages shown.
struct ThreadsContext * threads
Threads context.
struct Mailbox * mailbox
Current Mailbox.
int vcount
The number of virtual messages.
int * v2r
Mapping from virtual to real msgno.
int msg_count
Total number of messages.
struct Email ** emails
Array of Emails.
bool verbose
Display status messages?
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.